@lukso/lsp-smart-contracts 0.13.0 → 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 +1 -0
- package/artifacts/LSP0ERC725Account.json +2 -2
- package/artifacts/LSP0ERC725AccountInit.json +2 -2
- 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/LSP6KeyManager.json +2 -2
- package/artifacts/LSP6KeyManagerInit.json +2 -2
- package/artifacts/LSP7CompatibleERC20Mintable.json +2 -2
- package/artifacts/LSP7CompatibleERC20MintableInit.json +2 -2
- package/artifacts/LSP7Mintable.json +2 -2
- package/artifacts/LSP7MintableInit.json +2 -2
- package/artifacts/LSP8CappedSupply.json +42 -42
- package/artifacts/LSP8CappedSupplyInitAbstract.json +42 -42
- package/artifacts/LSP8CompatibleERC721.json +42 -42
- package/artifacts/LSP8CompatibleERC721InitAbstract.json +42 -42
- package/artifacts/LSP8CompatibleERC721Mintable.json +45 -45
- package/artifacts/LSP8CompatibleERC721MintableInit.json +45 -45
- package/artifacts/LSP8IdentifiableDigitalAsset.json +42 -42
- package/artifacts/LSP8IdentifiableDigitalAssetInitAbstract.json +42 -42
- package/artifacts/LSP8Mintable.json +45 -45
- package/artifacts/LSP8MintableInit.json +45 -45
- package/artifacts/LSP9Vault.json +2 -2
- package/artifacts/LSP9VaultInit.json +2 -2
- package/artifacts/UniversalProfile.json +2 -2
- package/artifacts/UniversalProfileInit.json +2 -2
- package/contracts/LSP3ProfileMetadata/LSP3Constants.sol +1 -1
- package/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol +2 -3
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol +1 -1
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6SetDataModule.sol +2 -2
- package/contracts/LSP6KeyManager/LSP6Utils.sol +1 -1
- package/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol +1 -1
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol +1 -1
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20InitAbstract.sol +1 -1
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol +1 -1
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInit.sol +1 -1
- package/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol +1 -1
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableInit.sol +1 -1
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol +1 -1
- package/contracts/LSP8IdentifiableDigitalAsset/ILSP8IdentifiableDigitalAsset.sol +30 -31
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol +14 -14
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Errors.sol +3 -3
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol +13 -13
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +37 -37
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol +12 -12
- 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 +4 -4
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol +4 -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 +4 -4
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol +4 -4
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.sol +2 -2
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol +5 -6
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInit.sol +5 -6
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol +5 -6
- package/contracts/Version.sol +1 -1
- package/devdocs/LSP4DigitalAssetMetadata.json +1 -1
- package/devdocs/LSP7CompatibleERC20.json +1 -1
- package/devdocs/LSP7CompatibleERC20Mintable.json +1 -1
- package/devdocs/LSP7CompatibleERC20MintableInit.json +1 -1
- package/devdocs/LSP7DigitalAsset.json +1 -1
- package/devdocs/LSP7Mintable.json +1 -1
- package/devdocs/LSP7MintableInit.json +1 -1
- package/devdocs/LSP8CappedSupply.json +20 -20
- package/devdocs/LSP8CappedSupplyInitAbstract.json +20 -20
- package/devdocs/LSP8CompatibleERC721.json +22 -22
- package/devdocs/LSP8CompatibleERC721InitAbstract.json +20 -20
- package/devdocs/LSP8CompatibleERC721Mintable.json +22 -22
- package/devdocs/LSP8CompatibleERC721MintableInit.json +22 -22
- package/devdocs/LSP8IdentifiableDigitalAsset.json +24 -24
- package/devdocs/LSP8IdentifiableDigitalAssetInitAbstract.json +20 -20
- package/devdocs/LSP8Mintable.json +22 -22
- package/devdocs/LSP8MintableInit.json +22 -22
- package/dist/constants.cjs.js +797 -797
- package/dist/constants.d.ts +399 -399
- package/dist/constants.es.js +797 -797
- package/package.json +1 -1
- package/userdocs/LSP8CappedSupply.json +8 -8
- package/userdocs/LSP8CappedSupplyInitAbstract.json +8 -8
- package/userdocs/LSP8CompatibleERC721.json +8 -8
- package/userdocs/LSP8CompatibleERC721InitAbstract.json +8 -8
- package/userdocs/LSP8CompatibleERC721Mintable.json +8 -8
- package/userdocs/LSP8CompatibleERC721MintableInit.json +8 -8
- package/userdocs/LSP8IdentifiableDigitalAsset.json +9 -9
- package/userdocs/LSP8IdentifiableDigitalAssetInitAbstract.json +8 -8
- package/userdocs/LSP8Mintable.json +8 -8
- package/userdocs/LSP8MintableInit.json +8 -8
|
@@ -30,7 +30,7 @@ abstract contract LSP4DigitalAssetMetadata is
|
|
|
30
30
|
* @param name_ The name of the token.
|
|
31
31
|
* @param symbol_ The symbol of the token.
|
|
32
32
|
* @param initialOwner_ The owner of the token contract.
|
|
33
|
-
* @param lsp4TokenType_ The type of token this digital asset contract represents (`
|
|
33
|
+
* @param lsp4TokenType_ The type of token this digital asset contract represents (`0` = Token, `1` = NFT, `2` = Collection).
|
|
34
34
|
*/
|
|
35
35
|
constructor(
|
|
36
36
|
string memory name_,
|
|
@@ -278,9 +278,9 @@ abstract contract LSP6SetDataModule {
|
|
|
278
278
|
* @dev more permissions types starting with `AddressPermissions:...` can be implemented by overriding this function.
|
|
279
279
|
*
|
|
280
280
|
* // AddressPermissions:MyCustomPermissions:<address>
|
|
281
|
-
*
|
|
281
|
+
* bytes10 CUSTOM_PERMISSION_PREFIX = 0x4b80742de2bf9e659ba4
|
|
282
282
|
*
|
|
283
|
-
* if (
|
|
283
|
+
* if (bytes10(dataKey) == CUSTOM_PERMISSION_PREFIX) {
|
|
284
284
|
* // custom logic
|
|
285
285
|
* }
|
|
286
286
|
*
|
|
@@ -50,7 +50,7 @@ abstract contract LSP7DigitalAsset is
|
|
|
50
50
|
* @param name_ The name of the token.
|
|
51
51
|
* @param symbol_ The symbol of the token.
|
|
52
52
|
* @param newOwner_ The owner of the the token-Metadata.
|
|
53
|
-
* @param lsp4TokenType_ The type of token this digital asset contract represents (`
|
|
53
|
+
* @param lsp4TokenType_ The type of token this digital asset contract represents (`0` = Token, `1` = NFT, `2` = Collection).
|
|
54
54
|
* @param isNonDivisible_ Specify if the LSP7 token is a fungible or non-fungible token.
|
|
55
55
|
*/
|
|
56
56
|
constructor(
|
|
@@ -27,7 +27,7 @@ abstract contract LSP7CompatibleERC20 is IERC20Metadata, LSP7DigitalAsset {
|
|
|
27
27
|
* @param name_ The name of the token.
|
|
28
28
|
* @param symbol_ The symbol of the token.
|
|
29
29
|
* @param newOwner_ The owner of the token contract.
|
|
30
|
-
* @param lsp4TokenType_ The type of token this digital asset contract represents (`
|
|
30
|
+
* @param lsp4TokenType_ The type of token this digital asset contract represents (`0` = Token, `1` = NFT, `2` = Collection).
|
|
31
31
|
*/
|
|
32
32
|
constructor(
|
|
33
33
|
string memory name_,
|
|
@@ -33,7 +33,7 @@ abstract contract LSP7CompatibleERC20InitAbstract is
|
|
|
33
33
|
* @param name_ The name of the token.
|
|
34
34
|
* @param symbol_ The symbol of the token.
|
|
35
35
|
* @param newOwner_ The owner of the token.
|
|
36
|
-
* @param lsp4TokenType_ The type of token this digital asset contract represents (`
|
|
36
|
+
* @param lsp4TokenType_ The type of token this digital asset contract represents (`0` = Token, `1` = NFT, `2` = Collection).
|
|
37
37
|
*/
|
|
38
38
|
function _initialize(
|
|
39
39
|
string memory name_,
|
|
@@ -14,7 +14,7 @@ contract LSP7CompatibleERC20Mintable is LSP7CompatibleERC20 {
|
|
|
14
14
|
* @param name_ The name of the token.
|
|
15
15
|
* @param symbol_ The symbol of the token.
|
|
16
16
|
* @param newOwner_ The owner of the token contract.
|
|
17
|
-
* @param lsp4TokenType_ The type of token this digital asset contract represents (`
|
|
17
|
+
* @param lsp4TokenType_ The type of token this digital asset contract represents (`0` = Token, `1` = NFT, `2` = Collection).
|
|
18
18
|
*/
|
|
19
19
|
constructor(
|
|
20
20
|
string memory name_,
|
|
@@ -26,7 +26,7 @@ contract LSP7CompatibleERC20MintableInit is
|
|
|
26
26
|
* @param name_ The name of the token.
|
|
27
27
|
* @param symbol_ The symbol of the token.
|
|
28
28
|
* @param newOwner_ The owner of the token contract.
|
|
29
|
-
* @param lsp4TokenType_ The type of token this digital asset contract represents (`
|
|
29
|
+
* @param lsp4TokenType_ The type of token this digital asset contract represents (`0` = Token, `1` = NFT, `2` = Collection).
|
|
30
30
|
*/
|
|
31
31
|
function initialize(
|
|
32
32
|
string memory name_,
|
|
@@ -20,7 +20,7 @@ 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 (`
|
|
23
|
+
* @param lsp4TokenType_ The type of token this digital asset contract represents (`0` = Token, `1` = NFT, `2` = Collection).
|
|
24
24
|
* @param isNonDivisible_ Specify if the LSP7 token is a fungible or non-fungible token.
|
|
25
25
|
*/
|
|
26
26
|
constructor(
|
|
@@ -23,7 +23,7 @@ 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 (`
|
|
26
|
+
* @param lsp4TokenType_ The type of token this digital asset contract represents (`0` = Token, `1` = NFT, `2` = Collection).
|
|
27
27
|
* @param isNonDivisible_ Specify if the LSP7 token is a fungible or non-fungible token.
|
|
28
28
|
*/
|
|
29
29
|
function initialize(
|
|
@@ -24,7 +24,7 @@ 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 (`
|
|
27
|
+
* @param lsp4TokenType_ The type of token this digital asset contract represents (`0` = Token, `1` = NFT, `2` = Collection).
|
|
28
28
|
* @param isNonDivisible_ Specify if the LSP7 token is a fungible or non-fungible token.
|
|
29
29
|
*/
|
|
30
30
|
function _initialize(
|
|
@@ -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
|
|
@@ -114,6 +113,28 @@ interface ILSP8IdentifiableDigitalAsset is IERC165, IERC725Y {
|
|
|
114
113
|
|
|
115
114
|
// --- TokenId Metadata functionality
|
|
116
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
|
+
|
|
117
138
|
/**
|
|
118
139
|
* @notice Sets data for a specific `tokenId` and `dataKey`.
|
|
119
140
|
* @param tokenId The unique identifier for a token.
|
|
@@ -121,7 +142,7 @@ interface ILSP8IdentifiableDigitalAsset is IERC165, IERC725Y {
|
|
|
121
142
|
* @param dataValue The value to set for the given data key.
|
|
122
143
|
* @custom:events {TokenIdDataChanged} event.
|
|
123
144
|
*/
|
|
124
|
-
function
|
|
145
|
+
function setDataForTokenId(
|
|
125
146
|
bytes32 tokenId,
|
|
126
147
|
bytes32 dataKey,
|
|
127
148
|
bytes memory dataValue
|
|
@@ -129,39 +150,17 @@ interface ILSP8IdentifiableDigitalAsset is IERC165, IERC725Y {
|
|
|
129
150
|
|
|
130
151
|
/**
|
|
131
152
|
* @notice Sets data in batch for multiple `tokenId` and `dataKey` pairs.
|
|
132
|
-
* @param
|
|
133
|
-
* @param
|
|
134
|
-
* @param
|
|
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.
|
|
135
156
|
* @custom:events {TokenIdDataChanged} event for each pair.
|
|
136
157
|
*/
|
|
137
|
-
function
|
|
138
|
-
bytes32[] memory
|
|
139
|
-
bytes32[] memory
|
|
140
|
-
bytes[] memory
|
|
158
|
+
function setDataBatchForTokenIds(
|
|
159
|
+
bytes32[] memory tokenIds,
|
|
160
|
+
bytes32[] memory dataKeys,
|
|
161
|
+
bytes[] memory dataValues
|
|
141
162
|
) external;
|
|
142
163
|
|
|
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
|
-
|
|
165
164
|
// --- Operator functionality
|
|
166
165
|
|
|
167
166
|
/**
|
|
@@ -2,12 +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
|
|
9
|
+
// keccak256('LSP8TokenIdFormat')
|
|
10
|
+
bytes32 constant _LSP8_TOKENID_FORMAT_KEY = 0xf675e9361af1c1664c1868cfa3eb97672d6b1a513aa5b81dec34c9ee330e818d;
|
|
11
11
|
|
|
12
12
|
// keccak256('LSP8TokenMetadataBaseURI')
|
|
13
13
|
bytes32 constant _LSP8_TOKEN_METADATA_BASE_URI = 0x1a7628600c3bac7101f53697f48df381ddc36b9015e7d7c9c5633d1252aa2843;
|
|
@@ -26,16 +26,16 @@ bytes32 constant _TYPEID_LSP8_TOKENSRECIPIENT = 0x0b084a55ebf70fd3c06fd755269dac
|
|
|
26
26
|
// keccak256('LSP8Tokens_OperatorNotification')
|
|
27
27
|
bytes32 constant _TYPEID_LSP8_TOKENOPERATOR = 0x8a1c15a8799f71b547e08e2bcb2e85257e81b0a07eee2ce6712549eef1f00970;
|
|
28
28
|
|
|
29
|
-
// --- Token IDs
|
|
29
|
+
// --- Token IDs Format
|
|
30
30
|
|
|
31
|
-
uint256 constant
|
|
32
|
-
uint256 constant
|
|
33
|
-
uint256 constant
|
|
34
|
-
uint256 constant
|
|
35
|
-
uint256 constant
|
|
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;
|
|
36
36
|
|
|
37
|
-
uint256 constant
|
|
38
|
-
uint256 constant
|
|
39
|
-
uint256 constant
|
|
40
|
-
uint256 constant
|
|
41
|
-
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,11 +82,11 @@ 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
90
|
|
|
91
91
|
/**
|
|
92
92
|
* @dev Reverts when the length of the token IDs data arrays is not equal
|
|
@@ -23,12 +23,12 @@ import {LSP17Extendable} from "../LSP17ContractExtension/LSP17Extendable.sol";
|
|
|
23
23
|
import {LSP2Utils} from "../LSP2ERC725YJSONSchema/LSP2Utils.sol";
|
|
24
24
|
|
|
25
25
|
// constants
|
|
26
|
-
import {_INTERFACEID_LSP8,
|
|
26
|
+
import {_INTERFACEID_LSP8, _LSP8_TOKENID_FORMAT_KEY} from "./LSP8Constants.sol";
|
|
27
27
|
|
|
28
28
|
// errors
|
|
29
29
|
import {
|
|
30
30
|
LSP8TokenContractCannotHoldValue,
|
|
31
|
-
|
|
31
|
+
LSP8TokenIdFormatNotEditable
|
|
32
32
|
} from "./LSP8Errors.sol";
|
|
33
33
|
|
|
34
34
|
import {
|
|
@@ -61,18 +61,18 @@ abstract contract LSP8IdentifiableDigitalAsset is
|
|
|
61
61
|
{
|
|
62
62
|
/**
|
|
63
63
|
* @notice Deploying a LSP8IdentifiableDigitalAsset with name `name_`, symbol `symbol_`, owned by address `newOwner_`
|
|
64
|
-
* with tokenId
|
|
64
|
+
* with tokenId format `lsp8TokenIdFormat_`.
|
|
65
65
|
*
|
|
66
|
-
* @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.
|
|
67
67
|
* This will also set the token `name_` and `symbol_` under the ERC725Y data keys `LSP4TokenName` and `LSP4TokenSymbol`.
|
|
68
68
|
*
|
|
69
69
|
* @param name_ The name of the token
|
|
70
70
|
* @param symbol_ The symbol of the token
|
|
71
71
|
* @param newOwner_ The owner of the the token-Metadata
|
|
72
|
-
* @param lsp4TokenType_ The type of token this digital asset contract represents (`
|
|
73
|
-
* @param
|
|
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.
|
|
74
74
|
*
|
|
75
|
-
* @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
|
|
76
76
|
* and cannot be changed in the ERC725Y storage after the contract has been deployed.
|
|
77
77
|
*/
|
|
78
78
|
constructor(
|
|
@@ -80,11 +80,11 @@ abstract contract LSP8IdentifiableDigitalAsset is
|
|
|
80
80
|
string memory symbol_,
|
|
81
81
|
address newOwner_,
|
|
82
82
|
uint256 lsp4TokenType_,
|
|
83
|
-
uint256
|
|
83
|
+
uint256 lsp8TokenIdFormat_
|
|
84
84
|
) LSP4DigitalAssetMetadata(name_, symbol_, newOwner_, lsp4TokenType_) {
|
|
85
85
|
LSP4DigitalAssetMetadata._setData(
|
|
86
|
-
|
|
87
|
-
abi.encode(
|
|
86
|
+
_LSP8_TOKENID_FORMAT_KEY,
|
|
87
|
+
abi.encode(lsp8TokenIdFormat_)
|
|
88
88
|
);
|
|
89
89
|
}
|
|
90
90
|
|
|
@@ -220,7 +220,7 @@ abstract contract LSP8IdentifiableDigitalAsset is
|
|
|
220
220
|
|
|
221
221
|
/**
|
|
222
222
|
* @inheritdoc LSP4DigitalAssetMetadata
|
|
223
|
-
* @dev The ERC725Y data key `
|
|
223
|
+
* @dev The ERC725Y data key `_LSP8_TOKENID_FORMAT_KEY` cannot be changed
|
|
224
224
|
* once the identifiable digital asset contract has been deployed.
|
|
225
225
|
*/
|
|
226
226
|
function _setData(
|
|
@@ -231,8 +231,8 @@ abstract contract LSP8IdentifiableDigitalAsset is
|
|
|
231
231
|
virtual
|
|
232
232
|
override(LSP4DigitalAssetMetadata, LSP4DigitalAssetMetadataCore)
|
|
233
233
|
{
|
|
234
|
-
if (dataKey ==
|
|
235
|
-
revert
|
|
234
|
+
if (dataKey == _LSP8_TOKENID_FORMAT_KEY) {
|
|
235
|
+
revert LSP8TokenIdFormatNotEditable();
|
|
236
236
|
}
|
|
237
237
|
LSP4DigitalAssetMetadata._setData(dataKey, dataValue);
|
|
238
238
|
}
|
|
@@ -128,18 +128,49 @@ abstract contract LSP8IdentifiableDigitalAssetCore is
|
|
|
128
128
|
/**
|
|
129
129
|
* @inheritdoc ILSP8IdentifiableDigitalAsset
|
|
130
130
|
*/
|
|
131
|
-
function
|
|
131
|
+
function getDataForTokenId(
|
|
132
|
+
bytes32 tokenId,
|
|
133
|
+
bytes32 dataKey
|
|
134
|
+
) public view virtual override returns (bytes memory dataValue) {
|
|
135
|
+
return _getDataForTokenId(tokenId, dataKey);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* @inheritdoc ILSP8IdentifiableDigitalAsset
|
|
140
|
+
*/
|
|
141
|
+
function getDataBatchForTokenIds(
|
|
142
|
+
bytes32[] memory tokenIds,
|
|
143
|
+
bytes32[] memory dataKeys
|
|
144
|
+
) public view virtual override returns (bytes[] memory dataValues) {
|
|
145
|
+
dataValues = new bytes[](tokenIds.length);
|
|
146
|
+
|
|
147
|
+
for (uint256 i; i < tokenIds.length; ) {
|
|
148
|
+
dataValues[i] = _getDataForTokenId(tokenIds[i], dataKeys[i]);
|
|
149
|
+
|
|
150
|
+
// Increment the iterator in unchecked block to save gas
|
|
151
|
+
unchecked {
|
|
152
|
+
++i;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return dataValues;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* @inheritdoc ILSP8IdentifiableDigitalAsset
|
|
161
|
+
*/
|
|
162
|
+
function setDataForTokenId(
|
|
132
163
|
bytes32 tokenId,
|
|
133
164
|
bytes32 dataKey,
|
|
134
165
|
bytes memory dataValue
|
|
135
166
|
) public virtual override onlyOwner {
|
|
136
|
-
|
|
167
|
+
_setDataForTokenId(tokenId, dataKey, dataValue);
|
|
137
168
|
}
|
|
138
169
|
|
|
139
170
|
/**
|
|
140
171
|
* @inheritdoc ILSP8IdentifiableDigitalAsset
|
|
141
172
|
*/
|
|
142
|
-
function
|
|
173
|
+
function setDataBatchForTokenIds(
|
|
143
174
|
bytes32[] memory tokenIds,
|
|
144
175
|
bytes32[] memory dataKeys,
|
|
145
176
|
bytes[] memory dataValues
|
|
@@ -156,7 +187,7 @@ abstract contract LSP8IdentifiableDigitalAssetCore is
|
|
|
156
187
|
}
|
|
157
188
|
|
|
158
189
|
for (uint256 i; i < tokenIds.length; ) {
|
|
159
|
-
|
|
190
|
+
_setDataForTokenId(tokenIds[i], dataKeys[i], dataValues[i]);
|
|
160
191
|
|
|
161
192
|
// Increment the iterator in unchecked block to save gas
|
|
162
193
|
unchecked {
|
|
@@ -204,37 +235,6 @@ abstract contract LSP8IdentifiableDigitalAssetCore is
|
|
|
204
235
|
}
|
|
205
236
|
}
|
|
206
237
|
|
|
207
|
-
/**
|
|
208
|
-
* @inheritdoc ILSP8IdentifiableDigitalAsset
|
|
209
|
-
*/
|
|
210
|
-
function getTokenIdData(
|
|
211
|
-
bytes32 tokenId,
|
|
212
|
-
bytes32 dataKey
|
|
213
|
-
) public view virtual override returns (bytes memory dataValues) {
|
|
214
|
-
return _getTokenIdData(tokenId, dataKey);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* @inheritdoc ILSP8IdentifiableDigitalAsset
|
|
219
|
-
*/
|
|
220
|
-
function getTokenIdDataBatch(
|
|
221
|
-
bytes32[] memory tokenIds,
|
|
222
|
-
bytes32[] memory dataKeys
|
|
223
|
-
) public view virtual override returns (bytes[] memory dataValues) {
|
|
224
|
-
dataValues = new bytes[](tokenIds.length);
|
|
225
|
-
|
|
226
|
-
for (uint256 i; i < tokenIds.length; ) {
|
|
227
|
-
dataValues[i] = _getTokenIdData(tokenIds[i], dataKeys[i]);
|
|
228
|
-
|
|
229
|
-
// Increment the iterator in unchecked block to save gas
|
|
230
|
-
unchecked {
|
|
231
|
-
++i;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
return dataValues;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
238
|
// --- Operator functionality
|
|
239
239
|
|
|
240
240
|
/**
|
|
@@ -662,7 +662,7 @@ abstract contract LSP8IdentifiableDigitalAssetCore is
|
|
|
662
662
|
* @param dataValue The value to set for the given data key.
|
|
663
663
|
* @custom:events {TokenIdDataChanged} event.
|
|
664
664
|
*/
|
|
665
|
-
function
|
|
665
|
+
function _setDataForTokenId(
|
|
666
666
|
bytes32 tokenId,
|
|
667
667
|
bytes32 dataKey,
|
|
668
668
|
bytes memory dataValue
|
|
@@ -678,7 +678,7 @@ abstract contract LSP8IdentifiableDigitalAssetCore is
|
|
|
678
678
|
* @param dataKey The key for the data to retrieve.
|
|
679
679
|
* @return dataValues The data value associated with the given `tokenId` and `dataKey`.
|
|
680
680
|
*/
|
|
681
|
-
function
|
|
681
|
+
function _getDataForTokenId(
|
|
682
682
|
bytes32 tokenId,
|
|
683
683
|
bytes32 dataKey
|
|
684
684
|
) internal view virtual returns (bytes memory dataValues) {
|
|
@@ -23,12 +23,12 @@ import {LSP17Extendable} from "../LSP17ContractExtension/LSP17Extendable.sol";
|
|
|
23
23
|
import {LSP2Utils} from "../LSP2ERC725YJSONSchema/LSP2Utils.sol";
|
|
24
24
|
|
|
25
25
|
// constants
|
|
26
|
-
import {_INTERFACEID_LSP8,
|
|
26
|
+
import {_INTERFACEID_LSP8, _LSP8_TOKENID_FORMAT_KEY} from "./LSP8Constants.sol";
|
|
27
27
|
|
|
28
28
|
// errors
|
|
29
29
|
import {
|
|
30
30
|
LSP8TokenContractCannotHoldValue,
|
|
31
|
-
|
|
31
|
+
LSP8TokenIdFormatNotEditable
|
|
32
32
|
} from "./LSP8Errors.sol";
|
|
33
33
|
|
|
34
34
|
import {
|
|
@@ -60,16 +60,16 @@ abstract contract LSP8IdentifiableDigitalAssetInitAbstract is
|
|
|
60
60
|
LSP17Extendable
|
|
61
61
|
{
|
|
62
62
|
/**
|
|
63
|
-
* @dev Initialize a `LSP8IdentifiableDigitalAsset` contract and set the tokenId
|
|
63
|
+
* @dev Initialize a `LSP8IdentifiableDigitalAsset` contract and set the tokenId format inside the ERC725Y storage of the contract.
|
|
64
64
|
* This will also set the token `name_` and `symbol_` under the ERC725Y data keys `LSP4TokenName` and `LSP4TokenSymbol`.
|
|
65
65
|
*
|
|
66
66
|
* @param name_ The name of the token
|
|
67
67
|
* @param symbol_ The symbol of the token
|
|
68
68
|
* @param newOwner_ The owner of the the token-Metadata
|
|
69
|
-
* @param lsp4TokenType_ The type of token this digital asset contract represents (`
|
|
70
|
-
* @param
|
|
69
|
+
* @param lsp4TokenType_ The type of token this digital asset contract represents (`0` = Token, `1` = NFT, `2` = Collection).
|
|
70
|
+
* @param lsp8TokenIdFormat_ The format of tokenIds (= NFTs) that this contract will create.
|
|
71
71
|
*
|
|
72
|
-
* @custom:warning Make sure the tokenId
|
|
72
|
+
* @custom:warning Make sure the tokenId format provided on deployment is correct, as it can only be set once
|
|
73
73
|
* and cannot be changed in the ERC725Y storage after the contract has been initialized.
|
|
74
74
|
*/
|
|
75
75
|
function _initialize(
|
|
@@ -77,7 +77,7 @@ abstract contract LSP8IdentifiableDigitalAssetInitAbstract is
|
|
|
77
77
|
string memory symbol_,
|
|
78
78
|
address newOwner_,
|
|
79
79
|
uint256 lsp4TokenType_,
|
|
80
|
-
uint256
|
|
80
|
+
uint256 lsp8TokenIdFormat_
|
|
81
81
|
) internal virtual onlyInitializing {
|
|
82
82
|
LSP4DigitalAssetMetadataInitAbstract._initialize(
|
|
83
83
|
name_,
|
|
@@ -87,8 +87,8 @@ abstract contract LSP8IdentifiableDigitalAssetInitAbstract is
|
|
|
87
87
|
);
|
|
88
88
|
|
|
89
89
|
LSP4DigitalAssetMetadataInitAbstract._setData(
|
|
90
|
-
|
|
91
|
-
abi.encode(
|
|
90
|
+
_LSP8_TOKENID_FORMAT_KEY,
|
|
91
|
+
abi.encode(lsp8TokenIdFormat_)
|
|
92
92
|
);
|
|
93
93
|
}
|
|
94
94
|
|
|
@@ -224,7 +224,7 @@ abstract contract LSP8IdentifiableDigitalAssetInitAbstract is
|
|
|
224
224
|
|
|
225
225
|
/**
|
|
226
226
|
* @inheritdoc LSP4DigitalAssetMetadataInitAbstract
|
|
227
|
-
* @dev The ERC725Y data key `
|
|
227
|
+
* @dev The ERC725Y data key `_LSP8_TOKENID_FORMAT_KEY` cannot be changed
|
|
228
228
|
* once the identifiable digital asset contract has been deployed.
|
|
229
229
|
*/
|
|
230
230
|
function _setData(
|
|
@@ -238,8 +238,8 @@ abstract contract LSP8IdentifiableDigitalAssetInitAbstract is
|
|
|
238
238
|
LSP4DigitalAssetMetadataCore
|
|
239
239
|
)
|
|
240
240
|
{
|
|
241
|
-
if (dataKey ==
|
|
242
|
-
revert
|
|
241
|
+
if (dataKey == _LSP8_TOKENID_FORMAT_KEY) {
|
|
242
|
+
revert LSP8TokenIdFormatNotEditable();
|
|
243
243
|
}
|
|
244
244
|
LSP4DigitalAssetMetadataInitAbstract._setData(dataKey, dataValue);
|
|
245
245
|
}
|
|
@@ -64,22 +64,22 @@ abstract contract LSP8CompatibleERC721 is
|
|
|
64
64
|
* @param name_ The name of the token.
|
|
65
65
|
* @param symbol_ The symbol of the token.
|
|
66
66
|
* @param newOwner_ The owner of the token contract.
|
|
67
|
-
* @param lsp4TokenType_ The type of token this digital asset contract represents (`
|
|
68
|
-
* @param
|
|
67
|
+
* @param lsp4TokenType_ The type of token this digital asset contract represents (`0` = Token, `1` = NFT, `2` = Collection).
|
|
68
|
+
* @param lsp8TokenIdFormat_ The format of tokenIds (= NFTs) that this contract will create.
|
|
69
69
|
*/
|
|
70
70
|
constructor(
|
|
71
71
|
string memory name_,
|
|
72
72
|
string memory symbol_,
|
|
73
73
|
address newOwner_,
|
|
74
74
|
uint256 lsp4TokenType_,
|
|
75
|
-
uint256
|
|
75
|
+
uint256 lsp8TokenIdFormat_
|
|
76
76
|
)
|
|
77
77
|
LSP8IdentifiableDigitalAsset(
|
|
78
78
|
name_,
|
|
79
79
|
symbol_,
|
|
80
80
|
newOwner_,
|
|
81
81
|
lsp4TokenType_,
|
|
82
|
-
|
|
82
|
+
lsp8TokenIdFormat_
|
|
83
83
|
)
|
|
84
84
|
{}
|
|
85
85
|
|
package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol
CHANGED
|
@@ -64,8 +64,8 @@ abstract contract LSP8CompatibleERC721InitAbstract is
|
|
|
64
64
|
* @param name_ The name of the token.
|
|
65
65
|
* @param symbol_ The symbol of the token.
|
|
66
66
|
* @param newOwner_ The owner of the token contract.
|
|
67
|
-
* @param lsp4TokenType_ The type of token this digital asset contract represents (`
|
|
68
|
-
* @param
|
|
67
|
+
* @param lsp4TokenType_ The type of token this digital asset contract represents (`0` = Token, `1` = NFT, `2` = Collection).
|
|
68
|
+
* @param lsp8TokenIdFormat_ The format of tokenIds (= NFTs) that this contract will create.
|
|
69
69
|
*/
|
|
70
70
|
|
|
71
71
|
function _initialize(
|
|
@@ -73,14 +73,14 @@ abstract contract LSP8CompatibleERC721InitAbstract is
|
|
|
73
73
|
string memory symbol_,
|
|
74
74
|
address newOwner_,
|
|
75
75
|
uint256 lsp4TokenType_,
|
|
76
|
-
uint256
|
|
76
|
+
uint256 lsp8TokenIdFormat_
|
|
77
77
|
) internal virtual override onlyInitializing {
|
|
78
78
|
LSP8IdentifiableDigitalAssetInitAbstract._initialize(
|
|
79
79
|
name_,
|
|
80
80
|
symbol_,
|
|
81
81
|
newOwner_,
|
|
82
82
|
lsp4TokenType_,
|
|
83
|
-
|
|
83
|
+
lsp8TokenIdFormat_
|
|
84
84
|
);
|
|
85
85
|
}
|
|
86
86
|
|