From 9ee6558d5865608f7e89869ebc43425cc3088875 Mon Sep 17 00:00:00 2001 From: Jean Cvllr <31145285+CJ42@users.noreply.github.com> Date: Wed, 29 Nov 2023 14:56:59 +0000 Subject: [PATCH] feat!: set `LSP4TokenType` on deployment of LSP7/8 Digital Assets (#806) * refactor!: set `LSP4TokenType` on deployment of digital asset * test: add tests for LSP4 for `LSP4TokenType` data key not editable * test: update LSP7 test suite with extra deployment param * test: update LSP8 test with extra deployment param * docs: update auto-generated docs * test: fix remaining tests that deploy tokens * test: update tokens deployments on foundry tests * refactor: put `lsp4TokenType` param before `lsp8TokenIdType` on deployment * refactor: rename LSP8TokenIdType to LSP8TokenIdSchema * chore: resolve merge conflicts * test: fix foundry tesst * docs: add autogenerated docs --------- Co-authored-by: YamenMerhi --- README.md | 2 +- constants.ts | 36 ++++++++++--- .../LSP4Constants.sol | 9 ++++ .../LSP4DigitalAssetMetadata.sol | 14 +++-- .../LSP4DigitalAssetMetadataCore.sol | 9 +++- .../LSP4DigitalAssetMetadataInitAbstract.sol | 8 ++- .../LSP4DigitalAssetMetadata/LSP4Errors.sol | 19 ++++--- .../LSP7DigitalAsset/LSP7DigitalAsset.sol | 12 +++-- .../LSP7DigitalAssetInitAbstract.sol | 7 ++- .../extensions/LSP7CompatibleERC20.sol | 6 ++- .../LSP7CompatibleERC20InitAbstract.sol | 11 ++-- .../presets/LSP7CompatibleERC20Mintable.sol | 6 ++- .../LSP7CompatibleERC20MintableInit.sol | 7 ++- ...SP7CompatibleERC20MintableInitAbstract.sol | 10 +++- .../LSP7DigitalAsset/presets/LSP7Mintable.sol | 13 ++++- .../presets/LSP7MintableInit.sol | 4 ++ .../presets/LSP7MintableInitAbstract.sol | 4 ++ .../LSP8Constants.sol | 25 +++++---- .../LSP8Errors.sol | 6 +-- .../LSP8IdentifiableDigitalAsset.sol | 29 +++++----- ...P8IdentifiableDigitalAssetInitAbstract.sol | 28 +++++----- .../extensions/LSP8CompatibleERC721.sol | 15 +++++- .../LSP8CompatibleERC721InitAbstract.sol | 8 ++- .../presets/LSP8CompatibleERC721Mintable.sol | 15 +++++- .../LSP8CompatibleERC721MintableInit.sol | 8 ++- ...P8CompatibleERC721MintableInitAbstract.sol | 6 ++- .../presets/LSP8Mintable.sol | 15 +++++- .../presets/LSP8MintableInit.sol | 8 ++- .../presets/LSP8MintableInitAbstract.sol | 8 ++- .../Tokens/LSP7CappedSupplyInitTester.sol | 19 ++++--- .../Mocks/Tokens/LSP7CappedSupplyTester.sol | 13 ++--- .../Tokens/LSP7CompatibleERC20InitTester.sol | 10 +++- .../Tokens/LSP7CompatibleERC20Tester.sol | 5 +- contracts/Mocks/Tokens/LSP7InitTester.sol | 2 + .../Mocks/Tokens/LSP7MintWhenDeployed.sol | 11 ++-- contracts/Mocks/Tokens/LSP7Tester.sol | 9 ++-- .../Mocks/Tokens/LSP8BurnableInitTester.sol | 6 ++- contracts/Mocks/Tokens/LSP8BurnableTester.sol | 13 ++++- .../Tokens/LSP8CappedSupplyInitTester.sol | 6 ++- .../Mocks/Tokens/LSP8CappedSupplyTester.sol | 11 +++- .../Tokens/LSP8CompatibleERC721Tester.sol | 13 ++++- .../Tokens/LSP8CompatibleERC721TesterInit.sol | 6 ++- .../Mocks/Tokens/LSP8EnumerableInitTester.sol | 18 ++++--- .../Mocks/Tokens/LSP8EnumerableTester.sol | 19 +++++-- contracts/Mocks/Tokens/LSP8InitTester.sol | 18 ++++--- contracts/Mocks/Tokens/LSP8Tester.sol | 19 +++++-- .../LSP4DigitalAssetMetadata.md | 23 +++++++- .../LSP7DigitalAsset/LSP7DigitalAsset.md | 23 +++++++- .../extensions/LSP7Burnable.md | 23 +++++++- .../extensions/LSP7CappedSupply.md | 23 +++++++- .../extensions/LSP7CompatibleERC20.md | 23 +++++++- .../presets/LSP7CompatibleERC20Mintable.md | 41 +++++++++++--- .../LSP7DigitalAsset/presets/LSP7Mintable.md | 37 ++++++++++--- .../LSP8IdentifiableDigitalAsset.md | 37 +++++++++---- .../extensions/LSP8Burnable.md | 37 +++++++++---- .../extensions/LSP8CappedSupply.md | 37 +++++++++---- .../extensions/LSP8CompatibleERC721.md | 37 +++++++++---- .../extensions/LSP8Enumerable.md | 37 +++++++++---- .../presets/LSP8CompatibleERC721Mintable.md | 53 +++++++++++++------ .../presets/LSP8Mintable.md | 53 +++++++++++++------ tests/Benchmark.test.ts | 23 +++++--- ...P1UniversalReceiverDelegateUP.behaviour.ts | 22 ++++++-- ...niversalReceiverDelegateVault.behaviour.ts | 21 ++++++-- .../Interactions/AllowedFunctions.test.ts | 7 ++- .../Interactions/AllowedStandards.test.ts | 4 ++ .../Interactions/ERC725XExecuteBatch.test.ts | 16 ++++-- .../PermissionTransferValue.test.ts | 5 ++ .../LSP4DigitalAssetMetadata.behaviour.ts | 12 ++++- .../Interactions/AllowedFunctions.test.ts | 7 ++- .../Interactions/AllowedStandards.test.ts | 4 ++ .../Interactions/BatchExecute.test.ts | 21 ++++++-- .../PermissionTransferValue.test.ts | 5 ++ .../LSP6ControlledToken.test.ts | 10 +++- .../Relay/ExecuteRelayCall.test.ts | 2 + .../LSP7CappedSupply.behaviour.ts | 1 + .../LSP7CompatibleERC20.behaviour.ts | 11 ++++ .../LSP7DigitalAsset.behaviour.ts | 11 ++++ .../LSP7Mintable.behaviour.ts | 1 + .../proxy/LSP7CappedSupplyInit.test.ts | 5 +- .../proxy/LSP7CompatibleERC20Init.test.ts | 11 ++-- .../proxy/LSP7DigitalAssetInit.test.ts | 12 +++-- .../proxy/LSP7MintableInit.test.ts | 10 ++-- .../standard/LSP7CappedSupply.test.ts | 4 ++ .../standard/LSP7CompatibleERC20.test.ts | 3 ++ .../standard/LSP7DigitalAsset.test.ts | 14 ++++- .../standard/LSP7Mintable.test.ts | 3 ++ .../LSP8CappedSupply.behaviour.ts | 3 +- .../LSP8CompatibleERC721.behaviour.ts | 28 +++++++--- .../LSP8Enumerable.behaviour.ts | 3 +- .../LSP8IdentifiableDigitalAsset.behaviour.ts | 35 ++++++++---- .../LSP8Mintable.behaviour.ts | 3 +- .../proxy/LSP8BurnableInit.test.ts | 11 ++-- .../proxy/LSP8CappedSupplyInit.test.ts | 10 ++-- .../proxy/LSP8CompatibleERC721Init.test.ts | 23 +++++--- .../proxy/LSP8EnumerableInit.test.ts | 10 ++-- .../LSP8IdentifiableDigitalAssetInit.test.ts | 16 ++++-- .../proxy/LSP8MintableInit.test.ts | 16 +++--- .../standard/LSP8Burnable.test.ts | 11 ++-- .../standard/LSP8CappedSupply.test.ts | 8 +-- .../standard/LSP8CompatibleERC721.test.ts | 8 +-- .../standard/LSP8Enumerable.test.ts | 8 +-- .../LSP8IdentifiableDigitalAsset.test.ts | 21 +++++--- .../standard/LSP8Mintable.test.ts | 8 +-- .../GasTests/execute/RestrictedController.sol | 12 +++-- .../execute/UnrestrictedController.sol | 12 +++-- 105 files changed, 1135 insertions(+), 386 deletions(-) diff --git a/README.md b/README.md index f2f20a33e..939a59421 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ import { ERC725YDataKeys, PERMISSIONS, ALL_PERMISSIONS, - LSP8_TOKEN_ID_TYPES, + LSP8_TOKEN_ID_SCHEMA, LSP25_VERSION, ErrorSelectors, EventSigHashes, diff --git a/constants.ts b/constants.ts index 4990132d1..a7e679bc7 100644 --- a/constants.ts +++ b/constants.ts @@ -192,6 +192,9 @@ export const ERC725YDataKeys = { // keccak256('LSP4TokenSymbol') LSP4TokenSymbol: '0x2f0a68ab07768e01943a599e73362a0e17a63a72e94dd2e384d2c1d4db932756', + // keccak256('LSP4TokenType) + LSP4TokenType: '0xe0261fa95db2eb3b5439bd033cda66d56b96f92f243a8228fd87550ed7bdfdb3', + // keccak256('LSP4Metadata') LSP4Metadata: '0x9afb95cacc9f95858ec44aa8c3b685511002e30ae54415823f406128b85b238e', @@ -233,8 +236,7 @@ export const ERC725YDataKeys = { 'AddressPermissions:AllowedCalls': '0x4b80742de2bf393a64c70000', }, LSP8: { - LSP8TokenIdType: '0x715f248956de7ce65e94d9d836bfead479f7e70d69b718d47bfe7b00e05b4fe4', - LSP8MetadataTokenURI: '0x1339e76a390b7b9ec9010000', + LSP8TokenIdSchema: '0x341bc44e55234544c70af9d37b2cb8cc7ba74685b58526221de2cc977f469924', LSP8TokenMetadataBaseURI: '0x1a7628600c3bac7101f53697f48df381ddc36b9015e7d7c9c5633d1252aa2843', LSP8ReferenceContract: '0x708e7b881795f2e6b6c2752108c177ec89248458de3bf69d0d43480b3e5034e6', }, @@ -390,19 +392,37 @@ export const LSP1_TYPE_IDS = { '0xe32c7debcb817925ba4883fdbfc52797187f28f73f860641dab1a68d9b32902c', }; +// LSP4 +// ---------- + +/** + * @dev list of LSP4 Token types to describe the type of token a digital asset contract represents. + * @see for details see: https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-4-DigitalAsset-Metadata.md#lsp4tokentype + */ +export const LSP4_TOKEN_TYPES = { + TOKEN: 0, + NFT: 1, + COLLECTION: 2, +}; + // LSP8 // ---------- /** - * @dev list of LSP8 Token ID types that can be used to create different types of NFTs. - * @see for details see: https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidtype + * @dev list of LSP8 Token ID Schemas that can be used to create different types of NFTs and represent each NFT identifiers differently. + * @see for details see: https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidschema */ -export const LSP8_TOKEN_ID_TYPES = { +export const LSP8_TOKEN_ID_SCHEMA = { NUMBER: 0, STRING: 1, - UNIQUE_ID: 2, - HASH: 3, - ADDRESS: 4, + ADDRESS: 2, + UNIQUE_ID: 3, + HASH: 4, + MIXED_DEFAULT_NUMBER: 100, + MIXED_DEFAULT_STRING: 101, + MIXED_DEFAULT_ADDRESS: 102, + MIXED_DEFAULT_UNIQUE_ID: 103, + MIXED_DEFAULT_HASH: 104, }; // LSP25 diff --git a/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol b/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol index 09547e37a..fa9edc516 100644 --- a/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol +++ b/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol @@ -1,6 +1,12 @@ // SPDX-License-Identifier: Apache-2.0 pragma solidity ^0.8.4; +// Token types + +uint256 constant _LSP4_TOKEN_TYPE_TOKEN = 0; +uint256 constant _LSP4_TOKEN_TYPE_NFT = 1; +uint256 constant _LSP4_TOKEN_TYPE_COLLECTION = 2; + // --- ERC725Y entries // bytes10(keccak256('SupportedStandards')) + bytes2(0) + bytes20(keccak256('LSP4DigitalAsset')) @@ -15,6 +21,9 @@ bytes32 constant _LSP4_TOKEN_NAME_KEY = 0xdeba1e292f8ba88238e10ab3c7f88bd4be4fac // keccak256('LSP4TokenSymbol') bytes32 constant _LSP4_TOKEN_SYMBOL_KEY = 0x2f0a68ab07768e01943a599e73362a0e17a63a72e94dd2e384d2c1d4db932756; +// keccak256('LSP4TokenType') +bytes32 constant _LSP4_TOKEN_TYPE_KEY = 0xe0261fa95db2eb3b5439bd033cda66d56b96f92f243a8228fd87550ed7bdfdb3; + // keccak256('LSP4Creators[]') bytes32 constant _LSP4_CREATORS_ARRAY_KEY = 0x114bd03b3a46d48759680d81ebb2b414fda7d030a7105a851867accf1c2352e7; diff --git a/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol b/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol index fd7772fc9..db7ce4fd7 100644 --- a/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol +++ b/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol @@ -11,7 +11,8 @@ import { _LSP4_SUPPORTED_STANDARDS_KEY, _LSP4_SUPPORTED_STANDARDS_VALUE, _LSP4_TOKEN_NAME_KEY, - _LSP4_TOKEN_SYMBOL_KEY + _LSP4_TOKEN_SYMBOL_KEY, + _LSP4_TOKEN_TYPE_KEY } from "./LSP4Constants.sol"; /** @@ -26,14 +27,16 @@ abstract contract LSP4DigitalAssetMetadata is /** * @notice Deploying a digital asset `name_` with the `symbol_` symbol. * - * @param name_ The name of the token - * @param symbol_ The symbol of the token - * @param initialOwner_ The owner of the token contract + * @param name_ The name of the token. + * @param symbol_ The symbol of the token. + * @param initialOwner_ The owner of the token contract. + * @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection). */ constructor( string memory name_, string memory symbol_, - address initialOwner_ + address initialOwner_, + uint256 lsp4TokenType_ ) ERC725Y(initialOwner_) { // set data key SupportedStandards:LSP4DigitalAsset ERC725YCore._setData( @@ -43,6 +46,7 @@ abstract contract LSP4DigitalAssetMetadata is ERC725YCore._setData(_LSP4_TOKEN_NAME_KEY, bytes(name_)); ERC725YCore._setData(_LSP4_TOKEN_SYMBOL_KEY, bytes(symbol_)); + ERC725YCore._setData(_LSP4_TOKEN_TYPE_KEY, abi.encode(lsp4TokenType_)); } /** diff --git a/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataCore.sol b/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataCore.sol index 8846aba51..a1ed4a24d 100644 --- a/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataCore.sol +++ b/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataCore.sol @@ -10,13 +10,15 @@ import {BytesLib} from "solidity-bytes-utils/contracts/BytesLib.sol"; // constants import { _LSP4_TOKEN_NAME_KEY, - _LSP4_TOKEN_SYMBOL_KEY + _LSP4_TOKEN_SYMBOL_KEY, + _LSP4_TOKEN_TYPE_KEY } from "./LSP4Constants.sol"; // errors import { LSP4TokenNameNotEditable, - LSP4TokenSymbolNotEditable + LSP4TokenSymbolNotEditable, + LSP4TokenTypeNotEditable } from "./LSP4Errors.sol"; /** @@ -39,8 +41,11 @@ abstract contract LSP4DigitalAssetMetadataCore is ERC725YCore { revert LSP4TokenNameNotEditable(); } else if (dataKey == _LSP4_TOKEN_SYMBOL_KEY) { revert LSP4TokenSymbolNotEditable(); + } else if (dataKey == _LSP4_TOKEN_TYPE_KEY) { + revert LSP4TokenTypeNotEditable(); } else { _store[dataKey] = dataValue; + emit DataChanged( dataKey, dataValue.length <= 256 diff --git a/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol b/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol index 78be37cb7..8035e4dce 100644 --- a/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol +++ b/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol @@ -15,7 +15,8 @@ import { _LSP4_SUPPORTED_STANDARDS_KEY, _LSP4_SUPPORTED_STANDARDS_VALUE, _LSP4_TOKEN_NAME_KEY, - _LSP4_TOKEN_SYMBOL_KEY + _LSP4_TOKEN_SYMBOL_KEY, + _LSP4_TOKEN_TYPE_KEY } from "./LSP4Constants.sol"; /** @@ -33,11 +34,13 @@ abstract contract LSP4DigitalAssetMetadataInitAbstract is * @param name_ The name of the token * @param symbol_ The symbol of the token * @param initialOwner_ The owner of the token contract + * @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection) */ function _initialize( string memory name_, string memory symbol_, - address initialOwner_ + address initialOwner_, + uint256 lsp4TokenType_ ) internal virtual onlyInitializing { ERC725YInitAbstract._initialize(initialOwner_); @@ -49,6 +52,7 @@ abstract contract LSP4DigitalAssetMetadataInitAbstract is ERC725YCore._setData(_LSP4_TOKEN_NAME_KEY, bytes(name_)); ERC725YCore._setData(_LSP4_TOKEN_SYMBOL_KEY, bytes(symbol_)); + ERC725YCore._setData(_LSP4_TOKEN_TYPE_KEY, abi.encode(lsp4TokenType_)); } /** diff --git a/contracts/LSP4DigitalAssetMetadata/LSP4Errors.sol b/contracts/LSP4DigitalAssetMetadata/LSP4Errors.sol index 44e28f370..9ecaa3e93 100644 --- a/contracts/LSP4DigitalAssetMetadata/LSP4Errors.sol +++ b/contracts/LSP4DigitalAssetMetadata/LSP4Errors.sol @@ -2,15 +2,22 @@ pragma solidity ^0.8.4; /** - * @dev Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. - * The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. - * It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. + * @dev Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed / initialized. + * The `LSP4TokenName` data key is located inside the ERC725Y data key-value store of the digital asset contract. + * It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized. */ error LSP4TokenNameNotEditable(); /** - * @dev Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. - * The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. - * It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. + * @dev Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed / initialized. + * The `LSP4TokenSymbol` data key is located inside the ERC725Y data key-value store of the digital asset contract. + * It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized. */ error LSP4TokenSymbolNotEditable(); + +/** + * @dev Reverts when trying to edit the data key `LSP4TokenType` after the digital asset contract has been deployed / initialized. + * The `LSP4TokenType` data key is located inside the ERC725Y data key-value store of the digital asset contract. + * It can be set only once inside the constructor / initializer when the digital asset contract is being deployed / initialized. + */ +error LSP4TokenTypeNotEditable(); diff --git a/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol b/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol index 42638fa88..e58f38915 100644 --- a/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol +++ b/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol @@ -47,17 +47,19 @@ abstract contract LSP7DigitalAsset is { /** * @notice Sets the token-Metadata - * @param name_ The name of the token - * @param symbol_ The symbol of the token - * @param newOwner_ The owner of the the token-Metadata - * @param isNonDivisible_ Specify if the LSP7 token is a fungible or non-fungible token + * @param name_ The name of the token. + * @param symbol_ The symbol of the token. + * @param newOwner_ The owner of the the token-Metadata. + * @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection). + * @param isNonDivisible_ Specify if the LSP7 token is a fungible or non-fungible token. */ constructor( string memory name_, string memory symbol_, address newOwner_, + uint256 lsp4TokenType_, bool isNonDivisible_ - ) LSP4DigitalAssetMetadata(name_, symbol_, newOwner_) { + ) LSP4DigitalAssetMetadata(name_, symbol_, newOwner_, lsp4TokenType_) { _isNonDivisible = isNonDivisible_; } diff --git a/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol b/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol index 29bbc55c6..80169e687 100644 --- a/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol +++ b/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol @@ -46,14 +46,17 @@ abstract contract LSP7DigitalAssetInitAbstract is string memory name_, string memory symbol_, address newOwner_, + uint256 lsp4TokenType_, bool isNonDivisible_ ) internal virtual onlyInitializing { - _isNonDivisible = isNonDivisible_; LSP4DigitalAssetMetadataInitAbstract._initialize( name_, symbol_, - newOwner_ + newOwner_, + lsp4TokenType_ ); + + _isNonDivisible = isNonDivisible_; } // fallback function diff --git a/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol b/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol index b8326007b..525584001 100644 --- a/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol +++ b/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol @@ -27,12 +27,14 @@ abstract contract LSP7CompatibleERC20 is IERC20Metadata, LSP7DigitalAsset { * @param name_ The name of the token. * @param symbol_ The symbol of the token. * @param newOwner_ The owner of the token contract. + * @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection). */ constructor( string memory name_, string memory symbol_, - address newOwner_ - ) LSP7DigitalAsset(name_, symbol_, newOwner_, false) {} + address newOwner_, + uint256 lsp4TokenType_ + ) LSP7DigitalAsset(name_, symbol_, newOwner_, lsp4TokenType_, false) {} /** * @inheritdoc IERC20Metadata diff --git a/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20InitAbstract.sol b/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20InitAbstract.sol index 8f0d9dec0..d2176e60f 100644 --- a/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20InitAbstract.sol +++ b/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20InitAbstract.sol @@ -30,19 +30,22 @@ abstract contract LSP7CompatibleERC20InitAbstract is * @notice Initializing a `LSP7CompatibleERC20` token contract with: token name = `name_`, token symbol = `symbol_`, and * address `newOwner_` as the token contract owner. * - * @param name_ The name of the token - * @param symbol_ The symbol of the token - * @param newOwner_ The owner of the token + * @param name_ The name of the token. + * @param symbol_ The symbol of the token. + * @param newOwner_ The owner of the token. + * @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection). */ function _initialize( string memory name_, string memory symbol_, - address newOwner_ + address newOwner_, + uint256 lsp4TokenType_ ) internal virtual override onlyInitializing { LSP7DigitalAssetInitAbstract._initialize( name_, symbol_, newOwner_, + lsp4TokenType_, false ); } diff --git a/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol b/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol index c3833e16e..6fa892b16 100644 --- a/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol +++ b/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol @@ -14,12 +14,14 @@ contract LSP7CompatibleERC20Mintable is LSP7CompatibleERC20 { * @param name_ The name of the token. * @param symbol_ The symbol of the token. * @param newOwner_ The owner of the token contract. + * @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection). */ constructor( string memory name_, string memory symbol_, - address newOwner_ - ) LSP7CompatibleERC20(name_, symbol_, newOwner_) {} + address newOwner_, + uint256 lsp4TokenType_ + ) LSP7CompatibleERC20(name_, symbol_, newOwner_, lsp4TokenType_) {} /** * @dev Public {_mint} function only callable by the {owner}. diff --git a/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInit.sol b/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInit.sol index 83ace62b5..8a649e765 100644 --- a/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInit.sol +++ b/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInit.sol @@ -26,16 +26,19 @@ contract LSP7CompatibleERC20MintableInit is * @param name_ The name of the token. * @param symbol_ The symbol of the token. * @param newOwner_ The owner of the token contract. + * @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection). */ function initialize( string memory name_, string memory symbol_, - address newOwner_ + address newOwner_, + uint256 lsp4TokenType_ ) external virtual initializer { LSP7CompatibleERC20MintableInitAbstract._initialize( name_, symbol_, - newOwner_ + newOwner_, + lsp4TokenType_ ); } } diff --git a/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInitAbstract.sol b/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInitAbstract.sol index 9b831d11a..ca390db9a 100644 --- a/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInitAbstract.sol +++ b/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInitAbstract.sol @@ -18,9 +18,15 @@ abstract contract LSP7CompatibleERC20MintableInitAbstract is function _initialize( string memory name_, string memory symbol_, - address newOwner_ + address newOwner_, + uint256 lsp4TokenType_ ) internal virtual override onlyInitializing { - LSP7CompatibleERC20InitAbstract._initialize(name_, symbol_, newOwner_); + LSP7CompatibleERC20InitAbstract._initialize( + name_, + symbol_, + newOwner_, + lsp4TokenType_ + ); } /** diff --git a/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol b/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol index 5091862cf..397059e8c 100644 --- a/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol +++ b/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol @@ -20,13 +20,24 @@ contract LSP7Mintable is LSP7DigitalAsset, ILSP7Mintable { * @param name_ The name of the token. * @param symbol_ The symbol of the token. * @param newOwner_ The owner of the token contract. + * @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection). + * @param isNonDivisible_ Specify if the LSP7 token is a fungible or non-fungible token. */ constructor( string memory name_, string memory symbol_, address newOwner_, + uint256 lsp4TokenType_, bool isNonDivisible_ - ) LSP7DigitalAsset(name_, symbol_, newOwner_, isNonDivisible_) {} + ) + LSP7DigitalAsset( + name_, + symbol_, + newOwner_, + lsp4TokenType_, + isNonDivisible_ + ) + {} /** * @dev Public {_mint} function only callable by the {owner}. diff --git a/contracts/LSP7DigitalAsset/presets/LSP7MintableInit.sol b/contracts/LSP7DigitalAsset/presets/LSP7MintableInit.sol index d3e395f26..0f2dc1f62 100644 --- a/contracts/LSP7DigitalAsset/presets/LSP7MintableInit.sol +++ b/contracts/LSP7DigitalAsset/presets/LSP7MintableInit.sol @@ -23,17 +23,21 @@ contract LSP7MintableInit is LSP7MintableInitAbstract { * @param name_ The name of the token. * @param symbol_ The symbol of the token. * @param newOwner_ The owner of the token contract. + * @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection). + * @param isNonDivisible_ Specify if the LSP7 token is a fungible or non-fungible token. */ function initialize( string memory name_, string memory symbol_, address newOwner_, + uint256 lsp4TokenType_, bool isNonDivisible_ ) external virtual initializer { LSP7MintableInitAbstract._initialize( name_, symbol_, newOwner_, + lsp4TokenType_, isNonDivisible_ ); } diff --git a/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol b/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol index a32716124..81708365a 100644 --- a/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol +++ b/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol @@ -24,17 +24,21 @@ abstract contract LSP7MintableInitAbstract is * @param name_ The name of the token. * @param symbol_ The symbol of the token. * @param newOwner_ The owner of the token contract. + * @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection). + * @param isNonDivisible_ Specify if the LSP7 token is a fungible or non-fungible token. */ function _initialize( string memory name_, string memory symbol_, address newOwner_, + uint256 lsp4TokenType_, bool isNonDivisible_ ) internal virtual override onlyInitializing { LSP7DigitalAssetInitAbstract._initialize( name_, symbol_, newOwner_, + lsp4TokenType_, isNonDivisible_ ); } diff --git a/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol b/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol index b7b97bc60..d20ba7375 100644 --- a/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol +++ b/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol @@ -6,11 +6,8 @@ bytes4 constant _INTERFACEID_LSP8 = 0xecad9f75; // --- ERC725Y Data Keys -// keccak256('LSP8TokenIdType') -bytes32 constant _LSP8_TOKENID_TYPE_KEY = 0x715f248956de7ce65e94d9d836bfead479f7e70d69b718d47bfe7b00e05b4fe4; - -// bytes10(keccak256('LSP8MetadataTokenURI')) + bytes2(0) -bytes12 constant _LSP8_METADATA_TOKEN_URI_PREFIX = 0x1339e76a390b7b9ec9010000; +// keccak256('LSP8TokenIdSchema') +bytes32 constant _LSP8_TOKENID_SCHEMA_KEY = 0x341bc44e55234544c70af9d37b2cb8cc7ba74685b58526221de2cc977f469924; // keccak256('LSP8TokenMetadataBaseURI') bytes32 constant _LSP8_TOKEN_METADATA_BASE_URI = 0x1a7628600c3bac7101f53697f48df381ddc36b9015e7d7c9c5633d1252aa2843; @@ -29,10 +26,16 @@ bytes32 constant _TYPEID_LSP8_TOKENSRECIPIENT = 0x0b084a55ebf70fd3c06fd755269dac // keccak256('LSP8Tokens_OperatorNotification') bytes32 constant _TYPEID_LSP8_TOKENOPERATOR = 0x8a1c15a8799f71b547e08e2bcb2e85257e81b0a07eee2ce6712549eef1f00970; -// --- Types of token IDs +// --- Token IDs Schema + +uint256 constant _LSP8_TOKENID_SCHEMA_NUMBER = 0; +uint256 constant _LSP8_TOKENID_SCHEMA_STRING = 1; +uint256 constant _LSP8_TOKENID_SCHEMA_ADDRESS = 2; +uint256 constant _LSP8_TOKENID_SCHEMA_UNIQUE_ID = 3; +uint256 constant _LSP8_TOKENID_SCHEMA_HASH = 4; -uint256 constant _LSP8_TOKENID_TYPE_NUMBER = 0; -uint256 constant _LSP8_TOKENID_TYPE_STRING = 1; -uint256 constant _LSP8_TOKENID_TYPE_UNIQUE_ID = 2; -uint256 constant _LSP8_TOKENID_TYPE_HASH = 3; -uint256 constant _LSP8_TOKENID_TYPE_ADDRESS = 4; +uint256 constant _LSP8_TOKENID_SCHEMA_MIXED_DEFAULT_NUMBER = 100; +uint256 constant _LSP8_TOKENID_SCHEMA_MIXED_DEFAULT_STRING = 101; +uint256 constant _LSP8_TOKENID_SCHEMA_MIXED_DEFAULT_ADDRESS = 102; +uint256 constant _LSP8_TOKENID_SCHEMA_MIXED_DEFAULT_UNIQUE_ID = 103; +uint256 constant _LSP8_TOKENID_SCHEMA_MIXED_DEFAULT_HASH = 104; diff --git a/contracts/LSP8IdentifiableDigitalAsset/LSP8Errors.sol b/contracts/LSP8IdentifiableDigitalAsset/LSP8Errors.sol index 7976fa27f..97d1d3c2e 100644 --- a/contracts/LSP8IdentifiableDigitalAsset/LSP8Errors.sol +++ b/contracts/LSP8IdentifiableDigitalAsset/LSP8Errors.sol @@ -82,11 +82,11 @@ error LSP8TokenOwnerCannotBeOperator(); error LSP8TokenContractCannotHoldValue(); /** - * @dev Reverts when trying to edit the data key `LSP8TokenIdType` after the identifiable digital asset contract has been deployed. - * The `LSP8TokenIdType` data key is located inside the ERC725Y Data key-value store of the identifiable digital asset contract. + * @dev Reverts when trying to edit the data key `LSP8TokenIdSchema` after the identifiable digital asset contract has been deployed. + * The `LSP8TokenIdSchema` data key is located inside the ERC725Y Data key-value store of the identifiable digital asset contract. * It can be set only once inside the constructor/initializer when the identifiable digital asset contract is being deployed. */ -error LSP8TokenIdTypeNotEditable(); +error LSP8TokenIdSchemaNotEditable(); /** * @dev Reverts when the length of the token IDs data arrays is not equal diff --git a/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol b/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol index ee7f353d6..67970cb17 100644 --- a/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol +++ b/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol @@ -23,12 +23,12 @@ import {LSP17Extendable} from "../LSP17ContractExtension/LSP17Extendable.sol"; import {LSP2Utils} from "../LSP2ERC725YJSONSchema/LSP2Utils.sol"; // constants -import {_INTERFACEID_LSP8, _LSP8_TOKENID_TYPE_KEY} from "./LSP8Constants.sol"; +import {_INTERFACEID_LSP8, _LSP8_TOKENID_SCHEMA_KEY} from "./LSP8Constants.sol"; // errors import { LSP8TokenContractCannotHoldValue, - LSP8TokenIdTypeNotEditable + LSP8TokenIdSchemaNotEditable } from "./LSP8Errors.sol"; import { @@ -61,29 +61,30 @@ abstract contract LSP8IdentifiableDigitalAsset is { /** * @notice Deploying a LSP8IdentifiableDigitalAsset with name `name_`, symbol `symbol_`, owned by address `newOwner_` - * with tokenId type `tokenIdType_`. + * with tokenId schema `lsp8TokenIdSchema_`. * - * @dev Deploy a `LSP8IdentifiableDigitalAsset` contract and set the tokenId type inside the ERC725Y storage of the contract. + * @dev Deploy a `LSP8IdentifiableDigitalAsset` contract and set the tokenId schema inside the ERC725Y storage of the contract. * This will also set the token `name_` and `symbol_` under the ERC725Y data keys `LSP4TokenName` and `LSP4TokenSymbol`. * * @param name_ The name of the token * @param symbol_ The symbol of the token * @param newOwner_ The owner of the the token-Metadata - * @param tokenIdType_ The type of tokenIds (= NFTs) that this contract will create. - * Available options are: NUMBER = `0`; STRING = `1`; UNIQUE_ID = `2`; HASH = `3`; ADDRESS = `4`. + * @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection). + * @param lsp8TokenIdSchema_ The schema of tokenIds (= NFTs) that this contract will create. * - * @custom:warning Make sure the tokenId type provided on deployment is correct, as it can only be set once + * @custom:warning Make sure the tokenId schema provided on deployment is correct, as it can only be set once * and cannot be changed in the ERC725Y storage after the contract has been deployed. */ constructor( string memory name_, string memory symbol_, address newOwner_, - uint256 tokenIdType_ - ) LSP4DigitalAssetMetadata(name_, symbol_, newOwner_) { + uint256 lsp4TokenType_, + uint256 lsp8TokenIdSchema_ + ) LSP4DigitalAssetMetadata(name_, symbol_, newOwner_, lsp4TokenType_) { LSP4DigitalAssetMetadata._setData( - _LSP8_TOKENID_TYPE_KEY, - abi.encode(tokenIdType_) + _LSP8_TOKENID_SCHEMA_KEY, + abi.encode(lsp8TokenIdSchema_) ); } @@ -219,7 +220,7 @@ abstract contract LSP8IdentifiableDigitalAsset is /** * @inheritdoc LSP4DigitalAssetMetadata - * @dev The ERC725Y data key `_LSP8_TOKENID_TYPE_KEY` cannot be changed + * @dev The ERC725Y data key `_LSP8_TOKENID_SCHEMA_KEY` cannot be changed * once the identifiable digital asset contract has been deployed. */ function _setData( @@ -230,8 +231,8 @@ abstract contract LSP8IdentifiableDigitalAsset is virtual override(LSP4DigitalAssetMetadata, LSP4DigitalAssetMetadataCore) { - if (dataKey == _LSP8_TOKENID_TYPE_KEY) { - revert LSP8TokenIdTypeNotEditable(); + if (dataKey == _LSP8_TOKENID_SCHEMA_KEY) { + revert LSP8TokenIdSchemaNotEditable(); } LSP4DigitalAssetMetadata._setData(dataKey, dataValue); } diff --git a/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol b/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol index 431071e19..46e9d1629 100644 --- a/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol +++ b/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol @@ -23,12 +23,12 @@ import {LSP17Extendable} from "../LSP17ContractExtension/LSP17Extendable.sol"; import {LSP2Utils} from "../LSP2ERC725YJSONSchema/LSP2Utils.sol"; // constants -import {_INTERFACEID_LSP8, _LSP8_TOKENID_TYPE_KEY} from "./LSP8Constants.sol"; +import {_INTERFACEID_LSP8, _LSP8_TOKENID_SCHEMA_KEY} from "./LSP8Constants.sol"; // errors import { LSP8TokenContractCannotHoldValue, - LSP8TokenIdTypeNotEditable + LSP8TokenIdSchemaNotEditable } from "./LSP8Errors.sol"; import { @@ -60,33 +60,35 @@ abstract contract LSP8IdentifiableDigitalAssetInitAbstract is LSP17Extendable { /** - * @dev Initialize a `LSP8IdentifiableDigitalAsset` contract and set the tokenId type inside the ERC725Y storage of the contract. + * @dev Initialize a `LSP8IdentifiableDigitalAsset` contract and set the tokenId schema inside the ERC725Y storage of the contract. * This will also set the token `name_` and `symbol_` under the ERC725Y data keys `LSP4TokenName` and `LSP4TokenSymbol`. * * @param name_ The name of the token * @param symbol_ The symbol of the token * @param newOwner_ The owner of the the token-Metadata - * @param tokenIdType_ The type of tokenIds (= NFTs) that this contract will create. - * Available options are: NUMBER = `0`; STRING = `1`; UNIQUE_ID = `2`; HASH = `3`; ADDRESS = `4`. + * @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection). + * @param lsp8TokenIdSchema_ The schema of tokenIds (= NFTs) that this contract will create. * - * @custom:warning Make sure the tokenId type provided on deployment is correct, as it can only be set once + * @custom:warning Make sure the tokenId schema provided on deployment is correct, as it can only be set once * and cannot be changed in the ERC725Y storage after the contract has been initialized. */ function _initialize( string memory name_, string memory symbol_, address newOwner_, - uint256 tokenIdType_ + uint256 lsp4TokenType_, + uint256 lsp8TokenIdSchema_ ) internal virtual onlyInitializing { LSP4DigitalAssetMetadataInitAbstract._initialize( name_, symbol_, - newOwner_ + newOwner_, + lsp4TokenType_ ); LSP4DigitalAssetMetadataInitAbstract._setData( - _LSP8_TOKENID_TYPE_KEY, - abi.encode(tokenIdType_) + _LSP8_TOKENID_SCHEMA_KEY, + abi.encode(lsp8TokenIdSchema_) ); } @@ -222,7 +224,7 @@ abstract contract LSP8IdentifiableDigitalAssetInitAbstract is /** * @inheritdoc LSP4DigitalAssetMetadataInitAbstract - * @dev The ERC725Y data key `_LSP8_TOKENID_TYPE_KEY` cannot be changed + * @dev The ERC725Y data key `_LSP8_TOKENID_SCHEMA_KEY` cannot be changed * once the identifiable digital asset contract has been deployed. */ function _setData( @@ -236,8 +238,8 @@ abstract contract LSP8IdentifiableDigitalAssetInitAbstract is LSP4DigitalAssetMetadataCore ) { - if (dataKey == _LSP8_TOKENID_TYPE_KEY) { - revert LSP8TokenIdTypeNotEditable(); + if (dataKey == _LSP8_TOKENID_SCHEMA_KEY) { + revert LSP8TokenIdSchemaNotEditable(); } LSP4DigitalAssetMetadataInitAbstract._setData(dataKey, dataValue); } diff --git a/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol b/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol index 926c31c7f..f270ea199 100644 --- a/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol +++ b/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol @@ -64,13 +64,24 @@ abstract contract LSP8CompatibleERC721 is * @param name_ The name of the token. * @param symbol_ The symbol of the token. * @param newOwner_ The owner of the token contract. + * @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection). + * @param lsp8TokenIdSchema_ The schema of tokenIds (= NFTs) that this contract will create. */ constructor( string memory name_, string memory symbol_, address newOwner_, - uint256 tokenIdType_ - ) LSP8IdentifiableDigitalAsset(name_, symbol_, newOwner_, tokenIdType_) {} + uint256 lsp4TokenType_, + uint256 lsp8TokenIdSchema_ + ) + LSP8IdentifiableDigitalAsset( + name_, + symbol_, + newOwner_, + lsp4TokenType_, + lsp8TokenIdSchema_ + ) + {} /** * @inheritdoc IERC721Metadata diff --git a/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol b/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol index fa17a9514..f04260d37 100644 --- a/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol +++ b/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol @@ -64,19 +64,23 @@ abstract contract LSP8CompatibleERC721InitAbstract is * @param name_ The name of the token. * @param symbol_ The symbol of the token. * @param newOwner_ The owner of the token contract. + * @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection). + * @param lsp8TokenIdSchema_ The schema of tokenIds (= NFTs) that this contract will create. */ function _initialize( string memory name_, string memory symbol_, address newOwner_, - uint256 tokenIdType_ + uint256 lsp4TokenType_, + uint256 lsp8TokenIdSchema_ ) internal virtual override onlyInitializing { LSP8IdentifiableDigitalAssetInitAbstract._initialize( name_, symbol_, newOwner_, - tokenIdType_ + lsp4TokenType_, + lsp8TokenIdSchema_ ); } diff --git a/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol b/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol index cec967433..66c2f3659 100644 --- a/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol +++ b/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol @@ -14,13 +14,24 @@ contract LSP8CompatibleERC721Mintable is LSP8CompatibleERC721 { * @param name_ The name of the token. * @param symbol_ The symbol of the token. * @param newOwner_ The owner of the token contract. + * @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection). + * @param lsp8TokenIdSchema_ The schema of tokenIds (= NFTs) that this contract will create. */ constructor( string memory name_, string memory symbol_, address newOwner_, - uint256 tokenIdType_ - ) LSP8CompatibleERC721(name_, symbol_, newOwner_, tokenIdType_) {} + uint256 lsp4TokenType_, + uint256 lsp8TokenIdSchema_ + ) + LSP8CompatibleERC721( + name_, + symbol_, + newOwner_, + lsp4TokenType_, + lsp8TokenIdSchema_ + ) + {} /** * @notice Minting tokenId `tokenId` for address `to` with the additional data `data` (Note: allow non-LSP1 recipient is set to `force`). diff --git a/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol b/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol index 7558bc368..9fb6d9011 100644 --- a/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol +++ b/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol @@ -26,18 +26,22 @@ contract LSP8CompatibleERC721MintableInit is * @param name_ The name of the token. * @param symbol_ The symbol of the token. * @param newOwner_ The owner of the token contract. + * @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection). + * @param lsp8TokenIdSchema_ The schema of tokenIds (= NFTs) that this contract will create. */ function initialize( string memory name_, string memory symbol_, address newOwner_, - uint256 tokenIdType_ + uint256 lsp4TokenType_, + uint256 lsp8TokenIdSchema_ ) external virtual initializer { LSP8CompatibleERC721MintableInitAbstract._initialize( name_, symbol_, newOwner_, - tokenIdType_ + lsp4TokenType_, + lsp8TokenIdSchema_ ); } } diff --git a/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.sol b/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.sol index 58e7d31aa..67838e84c 100644 --- a/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.sol +++ b/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.sol @@ -19,13 +19,15 @@ contract LSP8CompatibleERC721MintableInitAbstract is string memory name_, string memory symbol_, address newOwner_, - uint256 tokenIdType_ + uint256 lsp4TokenType_, + uint256 lsp8TokenIdSchema_ ) internal virtual override onlyInitializing { LSP8CompatibleERC721InitAbstract._initialize( name_, symbol_, newOwner_, - tokenIdType_ + lsp4TokenType_, + lsp8TokenIdSchema_ ); } diff --git a/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol b/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol index 66bc01675..ca9a9ea9c 100644 --- a/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol +++ b/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol @@ -21,13 +21,24 @@ contract LSP8Mintable is LSP8IdentifiableDigitalAsset, ILSP8Mintable { * @param name_ The name of the token. * @param symbol_ The symbol of the token. * @param newOwner_ The owner of the token contract. + * @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection). + * @param lsp8TokenIdSchema_ The schema of tokenIds (= NFTs) that this contract will create. */ constructor( string memory name_, string memory symbol_, address newOwner_, - uint256 tokenIdType_ - ) LSP8IdentifiableDigitalAsset(name_, symbol_, newOwner_, tokenIdType_) {} + uint256 lsp4TokenType_, + uint256 lsp8TokenIdSchema_ + ) + LSP8IdentifiableDigitalAsset( + name_, + symbol_, + newOwner_, + lsp4TokenType_, + lsp8TokenIdSchema_ + ) + {} /** * @notice Minting tokenId `tokenId` for address `to` with the additional data `data` (Note: allow non-LSP1 recipient is set to `force`). diff --git a/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInit.sol b/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInit.sol index 72532187e..b3d986feb 100644 --- a/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInit.sol +++ b/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInit.sol @@ -23,18 +23,22 @@ contract LSP8MintableInit is LSP8MintableInitAbstract { * @param name_ The name of the token. * @param symbol_ The symbol of the token. * @param newOwner_ The owner of the token contract. + * @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection). + * @param lsp8TokenIdSchema_ The schema of tokenIds (= NFTs) that this contract will create. */ function initialize( string memory name_, string memory symbol_, address newOwner_, - uint256 tokenIdType_ + uint256 lsp4TokenType_, + uint256 lsp8TokenIdSchema_ ) external virtual initializer { LSP8MintableInitAbstract._initialize( name_, symbol_, newOwner_, - tokenIdType_ + lsp4TokenType_, + lsp8TokenIdSchema_ ); } } diff --git a/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol b/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol index b59f023ab..5fd5dff0b 100644 --- a/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol +++ b/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol @@ -23,18 +23,22 @@ abstract contract LSP8MintableInitAbstract is * @param name_ The name of the token. * @param symbol_ The symbol of the token. * @param newOwner_ The owner of the token contract. + * @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection). + * @param lsp8TokenIdSchema_ The schema of tokenIds (= NFTs) that this contract will create. */ function _initialize( string memory name_, string memory symbol_, address newOwner_, - uint256 tokenIdType_ + uint256 lsp4TokenType_, + uint256 lsp8TokenIdSchema_ ) internal virtual override onlyInitializing { LSP8IdentifiableDigitalAssetInitAbstract._initialize( name_, symbol_, newOwner_, - tokenIdType_ + lsp4TokenType_, + lsp8TokenIdSchema_ ); } diff --git a/contracts/Mocks/Tokens/LSP7CappedSupplyInitTester.sol b/contracts/Mocks/Tokens/LSP7CappedSupplyInitTester.sol index 286d08d22..0e9c44e1b 100644 --- a/contracts/Mocks/Tokens/LSP7CappedSupplyInitTester.sol +++ b/contracts/Mocks/Tokens/LSP7CappedSupplyInitTester.sol @@ -12,13 +12,20 @@ import { contract LSP7CappedSupplyInitTester is LSP7CappedSupplyInitAbstract { function initialize( - string memory name, - string memory symbol, - address newOwner, - uint256 tokenSupplyCap + string memory name_, + string memory symbol_, + address newOwner_, + uint256 lsp4TokenType_, + uint256 tokenSupplyCap_ ) public virtual initializer { - LSP7DigitalAssetInitAbstract._initialize(name, symbol, newOwner, true); - LSP7CappedSupplyInitAbstract._initialize(tokenSupplyCap); + LSP7DigitalAssetInitAbstract._initialize( + name_, + symbol_, + newOwner_, + lsp4TokenType_, + true + ); + LSP7CappedSupplyInitAbstract._initialize(tokenSupplyCap_); } function mint(address to, uint256 amount) public { diff --git a/contracts/Mocks/Tokens/LSP7CappedSupplyTester.sol b/contracts/Mocks/Tokens/LSP7CappedSupplyTester.sol index 252d985ce..de76f80d2 100644 --- a/contracts/Mocks/Tokens/LSP7CappedSupplyTester.sol +++ b/contracts/Mocks/Tokens/LSP7CappedSupplyTester.sol @@ -10,13 +10,14 @@ import { contract LSP7CappedSupplyTester is LSP7CappedSupply { constructor( - string memory name, - string memory symbol, - address newOwner, - uint256 tokenSupplyCap + string memory name_, + string memory symbol_, + address newOwner_, + uint256 lsp4TokenType_, + uint256 tokenSupplyCap_ ) - LSP7DigitalAsset(name, symbol, newOwner, true) - LSP7CappedSupply(tokenSupplyCap) + LSP7DigitalAsset(name_, symbol_, newOwner_, lsp4TokenType_, true) + LSP7CappedSupply(tokenSupplyCap_) {} function mint(address to, uint256 amount) public { diff --git a/contracts/Mocks/Tokens/LSP7CompatibleERC20InitTester.sol b/contracts/Mocks/Tokens/LSP7CompatibleERC20InitTester.sol index 996b173a9..bf5b86e7e 100644 --- a/contracts/Mocks/Tokens/LSP7CompatibleERC20InitTester.sol +++ b/contracts/Mocks/Tokens/LSP7CompatibleERC20InitTester.sol @@ -18,9 +18,15 @@ contract LSP7CompatibleERC20InitTester is LSP7CompatibleERC20InitAbstract { function initialize( string memory name_, string memory symbol_, - address newOwner_ + address newOwner_, + uint256 lsp4TokenType_ ) public initializer { - LSP7CompatibleERC20InitAbstract._initialize(name_, symbol_, newOwner_); + LSP7CompatibleERC20InitAbstract._initialize( + name_, + symbol_, + newOwner_, + lsp4TokenType_ + ); } function mint(address to, uint256 amount, bytes calldata data) public { diff --git a/contracts/Mocks/Tokens/LSP7CompatibleERC20Tester.sol b/contracts/Mocks/Tokens/LSP7CompatibleERC20Tester.sol index 21b1e4891..7a2bd280b 100644 --- a/contracts/Mocks/Tokens/LSP7CompatibleERC20Tester.sol +++ b/contracts/Mocks/Tokens/LSP7CompatibleERC20Tester.sol @@ -11,8 +11,9 @@ contract LSP7CompatibleERC20Tester is LSP7CompatibleERC20 { constructor( string memory name_, string memory symbol_, - address newOwner_ - ) LSP7CompatibleERC20(name_, symbol_, newOwner_) {} + address newOwner_, + uint256 lsp4TokenType_ + ) LSP7CompatibleERC20(name_, symbol_, newOwner_, lsp4TokenType_) {} function mint(address to, uint256 amount, bytes calldata data) public { // using force=true so we can send to EOA in test diff --git a/contracts/Mocks/Tokens/LSP7InitTester.sol b/contracts/Mocks/Tokens/LSP7InitTester.sol index 5759191f6..731591bd1 100644 --- a/contracts/Mocks/Tokens/LSP7InitTester.sol +++ b/contracts/Mocks/Tokens/LSP7InitTester.sol @@ -18,12 +18,14 @@ contract LSP7InitTester is string memory tokenName_, string memory tokenSymbol_, address newOwner_, + uint256 lsp4TokenType_, bool isNonDivisible_ ) public initializer { LSP7DigitalAssetInitAbstract._initialize( tokenName_, tokenSymbol_, newOwner_, + lsp4TokenType_, isNonDivisible_ ); } diff --git a/contracts/Mocks/Tokens/LSP7MintWhenDeployed.sol b/contracts/Mocks/Tokens/LSP7MintWhenDeployed.sol index 7c4e15a5f..f90f5daf8 100644 --- a/contracts/Mocks/Tokens/LSP7MintWhenDeployed.sol +++ b/contracts/Mocks/Tokens/LSP7MintWhenDeployed.sol @@ -5,10 +5,11 @@ import {LSP7DigitalAsset} from "../../LSP7DigitalAsset/LSP7DigitalAsset.sol"; contract LSP7MintWhenDeployed is LSP7DigitalAsset { constructor( - string memory name, - string memory symbol, - address newOwner - ) LSP7DigitalAsset(name, symbol, newOwner, false) { - _mint(newOwner, 1_000, true, ""); + string memory name_, + string memory symbol_, + address newOwner_, + uint256 lsp4TokenType_ + ) LSP7DigitalAsset(name_, symbol_, newOwner_, lsp4TokenType_, false) { + _mint(newOwner_, 1_000, true, ""); } } diff --git a/contracts/Mocks/Tokens/LSP7Tester.sol b/contracts/Mocks/Tokens/LSP7Tester.sol index ca0744ec8..76a1a4404 100644 --- a/contracts/Mocks/Tokens/LSP7Tester.sol +++ b/contracts/Mocks/Tokens/LSP7Tester.sol @@ -7,10 +7,11 @@ import {LSP7Burnable} from "../../LSP7DigitalAsset/extensions/LSP7Burnable.sol"; contract LSP7Tester is LSP7DigitalAsset, LSP7Burnable { constructor( - string memory name, - string memory symbol, - address newOwner - ) LSP7DigitalAsset(name, symbol, newOwner, false) {} + string memory name_, + string memory symbol_, + address newOwner_, + uint256 lsp4TokenType_ + ) LSP7DigitalAsset(name_, symbol_, newOwner_, lsp4TokenType_, false) {} function mint( address to, diff --git a/contracts/Mocks/Tokens/LSP8BurnableInitTester.sol b/contracts/Mocks/Tokens/LSP8BurnableInitTester.sol index 0b63ce67b..137bbdfb0 100644 --- a/contracts/Mocks/Tokens/LSP8BurnableInitTester.sol +++ b/contracts/Mocks/Tokens/LSP8BurnableInitTester.sol @@ -15,13 +15,15 @@ contract LSP8BurnableInitTester is LSP8BurnableInitAbstract { string memory name_, string memory symbol_, address newOwner_, - uint256 tokenIdType_ + uint256 lsp4TokenType_, + uint256 lsp8TokenIdSchema_ ) public virtual initializer { LSP8IdentifiableDigitalAssetInitAbstract._initialize( name_, symbol_, newOwner_, - tokenIdType_ + lsp4TokenType_, + lsp8TokenIdSchema_ ); } } diff --git a/contracts/Mocks/Tokens/LSP8BurnableTester.sol b/contracts/Mocks/Tokens/LSP8BurnableTester.sol index 02c38dbb4..728338172 100644 --- a/contracts/Mocks/Tokens/LSP8BurnableTester.sol +++ b/contracts/Mocks/Tokens/LSP8BurnableTester.sol @@ -15,6 +15,15 @@ contract LSP8BurnableTester is LSP8Burnable { string memory name_, string memory symbol_, address newOwner_, - uint256 tokenIdType_ - ) LSP8IdentifiableDigitalAsset(name_, symbol_, newOwner_, tokenIdType_) {} + uint256 lsp4TokenType_, + uint256 lsp8TokenIdSchema_ + ) + LSP8IdentifiableDigitalAsset( + name_, + symbol_, + newOwner_, + lsp4TokenType_, + lsp8TokenIdSchema_ + ) + {} } diff --git a/contracts/Mocks/Tokens/LSP8CappedSupplyInitTester.sol b/contracts/Mocks/Tokens/LSP8CappedSupplyInitTester.sol index ece6a3b52..217b5cf99 100644 --- a/contracts/Mocks/Tokens/LSP8CappedSupplyInitTester.sol +++ b/contracts/Mocks/Tokens/LSP8CappedSupplyInitTester.sol @@ -15,14 +15,16 @@ contract LSP8CappedSupplyInitTester is LSP8CappedSupplyInitAbstract { string memory name_, string memory symbol_, address newOwner_, - uint256 tokenIdType_, + uint256 lsp4TokenType_, + uint256 lsp8TokenIdSchema_, uint256 tokenSupplyCap_ ) public virtual initializer { LSP8IdentifiableDigitalAssetInitAbstract._initialize( name_, symbol_, newOwner_, - tokenIdType_ + lsp4TokenType_, + lsp8TokenIdSchema_ ); LSP8CappedSupplyInitAbstract._initialize(tokenSupplyCap_); } diff --git a/contracts/Mocks/Tokens/LSP8CappedSupplyTester.sol b/contracts/Mocks/Tokens/LSP8CappedSupplyTester.sol index 5ee6bea0c..02d51fefe 100644 --- a/contracts/Mocks/Tokens/LSP8CappedSupplyTester.sol +++ b/contracts/Mocks/Tokens/LSP8CappedSupplyTester.sol @@ -15,10 +15,17 @@ contract LSP8CappedSupplyTester is LSP8CappedSupply { string memory name_, string memory symbol_, address newOwner_, - uint256 tokenIdType_, + uint256 lsp4TokenType_, + uint256 lsp8TokenIdSchema_, uint256 tokenSupplyCap_ ) - LSP8IdentifiableDigitalAsset(name_, symbol_, newOwner_, tokenIdType_) + LSP8IdentifiableDigitalAsset( + name_, + symbol_, + newOwner_, + lsp4TokenType_, + lsp8TokenIdSchema_ + ) LSP8CappedSupply(tokenSupplyCap_) {} diff --git a/contracts/Mocks/Tokens/LSP8CompatibleERC721Tester.sol b/contracts/Mocks/Tokens/LSP8CompatibleERC721Tester.sol index e713ebe63..61112dfee 100644 --- a/contracts/Mocks/Tokens/LSP8CompatibleERC721Tester.sol +++ b/contracts/Mocks/Tokens/LSP8CompatibleERC721Tester.sol @@ -17,9 +17,18 @@ contract LSP8CompatibleERC721Tester is LSP8CompatibleERC721 { string memory name_, string memory symbol_, address newOwner_, - uint256 tokenIdType_, + uint256 lsp4TokenType_, + uint256 lsp8TokenIdSchema_, bytes memory tokenURIValue_ - ) LSP8CompatibleERC721(name_, symbol_, newOwner_, tokenIdType_) { + ) + LSP8CompatibleERC721( + name_, + symbol_, + newOwner_, + lsp4TokenType_, + lsp8TokenIdSchema_ + ) + { _setData(_LSP4_METADATA_KEY, tokenURIValue_); } diff --git a/contracts/Mocks/Tokens/LSP8CompatibleERC721TesterInit.sol b/contracts/Mocks/Tokens/LSP8CompatibleERC721TesterInit.sol index 51689eb2e..7e62b9fe4 100644 --- a/contracts/Mocks/Tokens/LSP8CompatibleERC721TesterInit.sol +++ b/contracts/Mocks/Tokens/LSP8CompatibleERC721TesterInit.sol @@ -24,14 +24,16 @@ contract LSP8CompatibleERC721InitTester is LSP8CompatibleERC721InitAbstract { string memory name_, string memory symbol_, address newOwner_, - uint256 tokenIdType_, + uint256 lsp4TokenType_, + uint256 lsp8TokenIdSchema_, bytes memory tokenURIValue_ ) public virtual initializer { LSP8CompatibleERC721InitAbstract._initialize( name_, symbol_, newOwner_, - tokenIdType_ + lsp4TokenType_, + lsp8TokenIdSchema_ ); _setData(_LSP4_METADATA_KEY, tokenURIValue_); diff --git a/contracts/Mocks/Tokens/LSP8EnumerableInitTester.sol b/contracts/Mocks/Tokens/LSP8EnumerableInitTester.sol index 50aa38f66..33ab82d75 100644 --- a/contracts/Mocks/Tokens/LSP8EnumerableInitTester.sol +++ b/contracts/Mocks/Tokens/LSP8EnumerableInitTester.sol @@ -12,16 +12,18 @@ import { contract LSP8EnumerableInitTester is LSP8EnumerableInitAbstract { function initialize( - string memory name, - string memory symbol, - address newOwner, - uint256 tokenIdType + string memory name_, + string memory symbol_, + address newOwner_, + uint256 lsp4TokenType_, + uint256 lsp8TokenIdSchema_ ) public virtual initializer { LSP8IdentifiableDigitalAssetInitAbstract._initialize( - name, - symbol, - newOwner, - tokenIdType + name_, + symbol_, + newOwner_, + lsp4TokenType_, + lsp8TokenIdSchema_ ); } diff --git a/contracts/Mocks/Tokens/LSP8EnumerableTester.sol b/contracts/Mocks/Tokens/LSP8EnumerableTester.sol index ef7d25858..4abcb8059 100644 --- a/contracts/Mocks/Tokens/LSP8EnumerableTester.sol +++ b/contracts/Mocks/Tokens/LSP8EnumerableTester.sol @@ -12,11 +12,20 @@ import { contract LSP8EnumerableTester is LSP8Enumerable { constructor( - string memory name, - string memory symbol, - address newOwner, - uint256 tokenIdType - ) LSP8IdentifiableDigitalAsset(name, symbol, newOwner, tokenIdType) {} + string memory name_, + string memory symbol_, + address newOwner_, + uint256 lsp4TokenType_, + uint256 lsp8TokenIdSchema_ + ) + LSP8IdentifiableDigitalAsset( + name_, + symbol_, + newOwner_, + lsp4TokenType_, + lsp8TokenIdSchema_ + ) + {} function mint(address to, bytes32 tokenId) public { _mint(to, tokenId, true, "token printer go brrr"); diff --git a/contracts/Mocks/Tokens/LSP8InitTester.sol b/contracts/Mocks/Tokens/LSP8InitTester.sol index 9f8e3245d..137d770ed 100644 --- a/contracts/Mocks/Tokens/LSP8InitTester.sol +++ b/contracts/Mocks/Tokens/LSP8InitTester.sol @@ -15,16 +15,18 @@ contract LSP8InitTester is LSP8BurnableInitAbstract { function initialize( - string memory name, - string memory symbol, - address newOwner, - uint256 tokenIdType + string memory name_, + string memory symbol_, + address newOwner_, + uint256 lsp4TokenType_, + uint256 lsp8TokenIdSchema_ ) public initializer { LSP8IdentifiableDigitalAssetInitAbstract._initialize( - name, - symbol, - newOwner, - tokenIdType + name_, + symbol_, + newOwner_, + lsp4TokenType_, + lsp8TokenIdSchema_ ); } diff --git a/contracts/Mocks/Tokens/LSP8Tester.sol b/contracts/Mocks/Tokens/LSP8Tester.sol index 337cdc2b9..0127b9a3c 100644 --- a/contracts/Mocks/Tokens/LSP8Tester.sol +++ b/contracts/Mocks/Tokens/LSP8Tester.sol @@ -12,11 +12,20 @@ import { contract LSP8Tester is LSP8IdentifiableDigitalAsset, LSP8Burnable { constructor( - string memory name, - string memory symbol, - address newOwner, - uint256 tokenIdType - ) LSP8IdentifiableDigitalAsset(name, symbol, newOwner, tokenIdType) {} + string memory name_, + string memory symbol_, + address newOwner_, + uint256 lsp4TokenType_, + uint256 lsp8TokenIdSchema_ + ) + LSP8IdentifiableDigitalAsset( + name_, + symbol_, + newOwner_, + lsp4TokenType_, + lsp8TokenIdSchema_ + ) + {} function mint( address to, diff --git a/docs/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.md b/docs/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.md index 15121dc6b..d2aa87b1d 100644 --- a/docs/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.md +++ b/docs/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.md @@ -483,7 +483,7 @@ Reverts when sending value to the [`setData`](#setdata) or [`setDataBatch`](#set error LSP4TokenNameNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed / initialized. The `LSP4TokenName` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized.
@@ -502,7 +502,26 @@ Reverts when trying to edit the data key `LSP4TokenName` after the digital asset error LSP4TokenSymbolNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed / initialized. The `LSP4TokenSymbol` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized. + +
+ +### LSP4TokenTypeNotEditable + +:::note References + +- Specification details: [**LSP-4-DigitalAssetMetadata**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-4-DigitalAssetMetadata.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP4DigitalAssetMetadata.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol) +- Error signature: `LSP4TokenTypeNotEditable()` +- Error hash: `0x4ef6d7fb` + +::: + +```solidity +error LSP4TokenTypeNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenType` after the digital asset contract has been deployed / initialized. The `LSP4TokenType` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor / initializer when the digital asset contract is being deployed / initialized.
diff --git a/docs/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md b/docs/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md index d70bf684e..9ec8c569d 100644 --- a/docs/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md +++ b/docs/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md @@ -1427,7 +1427,7 @@ reverts when the contract is called with a function selector not valid (less tha error LSP4TokenNameNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed / initialized. The `LSP4TokenName` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized.
@@ -1446,7 +1446,26 @@ Reverts when trying to edit the data key `LSP4TokenName` after the digital asset error LSP4TokenSymbolNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed / initialized. The `LSP4TokenSymbol` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized. + +
+ +### LSP4TokenTypeNotEditable + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol) +- Error signature: `LSP4TokenTypeNotEditable()` +- Error hash: `0x4ef6d7fb` + +::: + +```solidity +error LSP4TokenTypeNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenType` after the digital asset contract has been deployed / initialized. The `LSP4TokenType` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor / initializer when the digital asset contract is being deployed / initialized.
diff --git a/docs/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.md b/docs/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.md index 709ddb05e..46fd6e6d2 100644 --- a/docs/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.md +++ b/docs/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.md @@ -1452,7 +1452,7 @@ reverts when the contract is called with a function selector not valid (less tha error LSP4TokenNameNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed / initialized. The `LSP4TokenName` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized.
@@ -1471,7 +1471,26 @@ Reverts when trying to edit the data key `LSP4TokenName` after the digital asset error LSP4TokenSymbolNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed / initialized. The `LSP4TokenSymbol` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized. + +
+ +### LSP4TokenTypeNotEditable + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol) +- Error signature: `LSP4TokenTypeNotEditable()` +- Error hash: `0x4ef6d7fb` + +::: + +```solidity +error LSP4TokenTypeNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenType` after the digital asset contract has been deployed / initialized. The `LSP4TokenType` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor / initializer when the digital asset contract is being deployed / initialized.
diff --git a/docs/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.md b/docs/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.md index 7c81403ce..64660a180 100644 --- a/docs/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.md +++ b/docs/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.md @@ -1426,7 +1426,7 @@ reverts when the contract is called with a function selector not valid (less tha error LSP4TokenNameNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed / initialized. The `LSP4TokenName` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized.
@@ -1445,7 +1445,26 @@ Reverts when trying to edit the data key `LSP4TokenName` after the digital asset error LSP4TokenSymbolNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed / initialized. The `LSP4TokenSymbol` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized. + +
+ +### LSP4TokenTypeNotEditable + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol) +- Error signature: `LSP4TokenTypeNotEditable()` +- Error hash: `0x4ef6d7fb` + +::: + +```solidity +error LSP4TokenTypeNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenType` after the digital asset contract has been deployed / initialized. The `LSP4TokenType` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor / initializer when the digital asset contract is being deployed / initialized.
diff --git a/docs/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.md b/docs/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.md index a69c7f031..c2c34a450 100644 --- a/docs/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.md +++ b/docs/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.md @@ -1569,7 +1569,7 @@ reverts when the contract is called with a function selector not valid (less tha error LSP4TokenNameNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed / initialized. The `LSP4TokenName` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized.
@@ -1588,7 +1588,26 @@ Reverts when trying to edit the data key `LSP4TokenName` after the digital asset error LSP4TokenSymbolNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed / initialized. The `LSP4TokenSymbol` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized. + +
+ +### LSP4TokenTypeNotEditable + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP7CompatibleERC20.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol) +- Error signature: `LSP4TokenTypeNotEditable()` +- Error hash: `0x4ef6d7fb` + +::: + +```solidity +error LSP4TokenTypeNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenType` after the digital asset contract has been deployed / initialized. The `LSP4TokenType` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor / initializer when the digital asset contract is being deployed / initialized.
diff --git a/docs/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.md b/docs/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.md index d765412dc..af99e3fa0 100644 --- a/docs/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.md +++ b/docs/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.md @@ -31,18 +31,24 @@ When marked as 'public', a method can be called both externally and internally, ::: ```solidity -constructor(string name_, string symbol_, address newOwner_); +constructor( + string name_, + string symbol_, + address newOwner_, + uint256 lsp4TokenType_ +); ``` _Deploying a `LSP7CompatibleERC20Mintable` token contract with: token name = `name_`, token symbol = `symbol_`, and address `newOwner_` as the token contract owner._ #### Parameters -| Name | Type | Description | -| ----------- | :-------: | -------------------------------- | -| `name_` | `string` | The name of the token. | -| `symbol_` | `string` | The symbol of the token. | -| `newOwner_` | `address` | The owner of the token contract. | +| Name | Type | Description | +| ---------------- | :-------: | ---------------------------------------------------------------------------------------------------- | +| `name_` | `string` | The name of the token. | +| `symbol_` | `string` | The symbol of the token. | +| `newOwner_` | `address` | The owner of the token contract. | +| `lsp4TokenType_` | `uint256` | The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection). |
@@ -1603,7 +1609,7 @@ reverts when the contract is called with a function selector not valid (less tha error LSP4TokenNameNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed / initialized. The `LSP4TokenName` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized.
@@ -1622,7 +1628,26 @@ Reverts when trying to edit the data key `LSP4TokenName` after the digital asset error LSP4TokenSymbolNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed / initialized. The `LSP4TokenSymbol` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized. + +
+ +### LSP4TokenTypeNotEditable + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP7CompatibleERC20Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol) +- Error signature: `LSP4TokenTypeNotEditable()` +- Error hash: `0x4ef6d7fb` + +::: + +```solidity +error LSP4TokenTypeNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenType` after the digital asset contract has been deployed / initialized. The `LSP4TokenType` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor / initializer when the digital asset contract is being deployed / initialized.
diff --git a/docs/contracts/LSP7DigitalAsset/presets/LSP7Mintable.md b/docs/contracts/LSP7DigitalAsset/presets/LSP7Mintable.md index 1605f8df5..576072a73 100644 --- a/docs/contracts/LSP7DigitalAsset/presets/LSP7Mintable.md +++ b/docs/contracts/LSP7DigitalAsset/presets/LSP7Mintable.md @@ -35,6 +35,7 @@ constructor( string name_, string symbol_, address newOwner_, + uint256 lsp4TokenType_, bool isNonDivisible_ ); ``` @@ -43,12 +44,13 @@ _Deploying a `LSP7Mintable` token contract with: token name = `name_`, token sym #### Parameters -| Name | Type | Description | -| ----------------- | :-------: | -------------------------------- | -| `name_` | `string` | The name of the token. | -| `symbol_` | `string` | The symbol of the token. | -| `newOwner_` | `address` | The owner of the token contract. | -| `isNonDivisible_` | `bool` | - | +| Name | Type | Description | +| ----------------- | :-------: | ---------------------------------------------------------------------------------------------------- | +| `name_` | `string` | The name of the token. | +| `symbol_` | `string` | The symbol of the token. | +| `newOwner_` | `address` | The owner of the token contract. | +| `lsp4TokenType_` | `uint256` | The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection). | +| `isNonDivisible_` | `bool` | Specify if the LSP7 token is a fungible or non-fungible token. |
@@ -1489,7 +1491,7 @@ reverts when the contract is called with a function selector not valid (less tha error LSP4TokenNameNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed / initialized. The `LSP4TokenName` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized.
@@ -1508,7 +1510,26 @@ Reverts when trying to edit the data key `LSP4TokenName` after the digital asset error LSP4TokenSymbolNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed / initialized. The `LSP4TokenSymbol` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized. + +
+ +### LSP4TokenTypeNotEditable + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol) +- Error signature: `LSP4TokenTypeNotEditable()` +- Error hash: `0x4ef6d7fb` + +::: + +```solidity +error LSP4TokenTypeNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenType` after the digital asset contract has been deployed / initialized. The `LSP4TokenType` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor / initializer when the digital asset contract is being deployed / initialized.
diff --git a/docs/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md b/docs/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md index a1ee52083..a3f7b321f 100644 --- a/docs/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md +++ b/docs/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md @@ -894,7 +894,7 @@ mapping(bytes32 => bytes) _store function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; ``` -The ERC725Y data key `_LSP8_TOKENID_TYPE_KEY` cannot be changed +The ERC725Y data key `_LSP8_TOKENID_SCHEMA_KEY` cannot be changed once the identifiable digital asset contract has been deployed.
@@ -1642,7 +1642,7 @@ reverts when the contract is called with a function selector not valid (less tha error LSP4TokenNameNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed / initialized. The `LSP4TokenName` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized.
@@ -1661,7 +1661,26 @@ Reverts when trying to edit the data key `LSP4TokenName` after the digital asset error LSP4TokenSymbolNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed / initialized. The `LSP4TokenSymbol` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized. + +
+ +### LSP4TokenTypeNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP4TokenTypeNotEditable()` +- Error hash: `0x4ef6d7fb` + +::: + +```solidity +error LSP4TokenTypeNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenType` after the digital asset contract has been deployed / initialized. The `LSP4TokenType` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor / initializer when the digital asset contract is being deployed / initialized.
@@ -1971,22 +1990,22 @@ Error occurs when sending native tokens to the LSP8 contract without sending any
-### LSP8TokenIdTypeNotEditable +### LSP8TokenIdSchemaNotEditable :::note References -- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidtypenoteditable) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidschemanoteditable) - Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol) -- Error signature: `LSP8TokenIdTypeNotEditable()` -- Error hash: `0x53bc1122` +- Error signature: `LSP8TokenIdSchemaNotEditable()` +- Error hash: `0xce0c7552` ::: ```solidity -error LSP8TokenIdTypeNotEditable(); +error LSP8TokenIdSchemaNotEditable(); ``` -Reverts when trying to edit the data key `LSP8TokenIdType` after the identifiable digital asset contract has been deployed. The `LSP8TokenIdType` data key is located inside the ERC725Y Data key-value store of the identifiable digital asset contract. It can be set only once inside the constructor/initializer when the identifiable digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP8TokenIdSchema` after the identifiable digital asset contract has been deployed. The `LSP8TokenIdSchema` data key is located inside the ERC725Y Data key-value store of the identifiable digital asset contract. It can be set only once inside the constructor/initializer when the identifiable digital asset contract is being deployed.
diff --git a/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.md b/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.md index 334163ea8..d03071673 100644 --- a/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.md +++ b/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.md @@ -920,7 +920,7 @@ mapping(bytes32 => bytes) _store function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; ``` -The ERC725Y data key `_LSP8_TOKENID_TYPE_KEY` cannot be changed +The ERC725Y data key `_LSP8_TOKENID_SCHEMA_KEY` cannot be changed once the identifiable digital asset contract has been deployed.
@@ -1668,7 +1668,7 @@ reverts when the contract is called with a function selector not valid (less tha error LSP4TokenNameNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed / initialized. The `LSP4TokenName` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized.
@@ -1687,7 +1687,26 @@ Reverts when trying to edit the data key `LSP4TokenName` after the digital asset error LSP4TokenSymbolNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed / initialized. The `LSP4TokenSymbol` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized. + +
+ +### LSP4TokenTypeNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Error signature: `LSP4TokenTypeNotEditable()` +- Error hash: `0x4ef6d7fb` + +::: + +```solidity +error LSP4TokenTypeNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenType` after the digital asset contract has been deployed / initialized. The `LSP4TokenType` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor / initializer when the digital asset contract is being deployed / initialized.
@@ -1997,22 +2016,22 @@ Error occurs when sending native tokens to the LSP8 contract without sending any
-### LSP8TokenIdTypeNotEditable +### LSP8TokenIdSchemaNotEditable :::note References -- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidtypenoteditable) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidschemanoteditable) - Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) -- Error signature: `LSP8TokenIdTypeNotEditable()` -- Error hash: `0x53bc1122` +- Error signature: `LSP8TokenIdSchemaNotEditable()` +- Error hash: `0xce0c7552` ::: ```solidity -error LSP8TokenIdTypeNotEditable(); +error LSP8TokenIdSchemaNotEditable(); ``` -Reverts when trying to edit the data key `LSP8TokenIdType` after the identifiable digital asset contract has been deployed. The `LSP8TokenIdType` data key is located inside the ERC725Y Data key-value store of the identifiable digital asset contract. It can be set only once inside the constructor/initializer when the identifiable digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP8TokenIdSchema` after the identifiable digital asset contract has been deployed. The `LSP8TokenIdSchema` data key is located inside the ERC725Y Data key-value store of the identifiable digital asset contract. It can be set only once inside the constructor/initializer when the identifiable digital asset contract is being deployed.
diff --git a/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.md b/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.md index cc6f8d6a2..1ec07dc80 100644 --- a/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.md +++ b/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.md @@ -919,7 +919,7 @@ mapping(bytes32 => bytes) _store function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; ``` -The ERC725Y data key `_LSP8_TOKENID_TYPE_KEY` cannot be changed +The ERC725Y data key `_LSP8_TOKENID_SCHEMA_KEY` cannot be changed once the identifiable digital asset contract has been deployed.
@@ -1642,7 +1642,7 @@ reverts when the contract is called with a function selector not valid (less tha error LSP4TokenNameNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed / initialized. The `LSP4TokenName` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized.
@@ -1661,7 +1661,26 @@ Reverts when trying to edit the data key `LSP4TokenName` after the digital asset error LSP4TokenSymbolNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed / initialized. The `LSP4TokenSymbol` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized. + +
+ +### LSP4TokenTypeNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Error signature: `LSP4TokenTypeNotEditable()` +- Error hash: `0x4ef6d7fb` + +::: + +```solidity +error LSP4TokenTypeNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenType` after the digital asset contract has been deployed / initialized. The `LSP4TokenType` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor / initializer when the digital asset contract is being deployed / initialized.
@@ -2013,22 +2032,22 @@ Error occurs when sending native tokens to the LSP8 contract without sending any
-### LSP8TokenIdTypeNotEditable +### LSP8TokenIdSchemaNotEditable :::note References -- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidtypenoteditable) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidschemanoteditable) - Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) -- Error signature: `LSP8TokenIdTypeNotEditable()` -- Error hash: `0x53bc1122` +- Error signature: `LSP8TokenIdSchemaNotEditable()` +- Error hash: `0xce0c7552` ::: ```solidity -error LSP8TokenIdTypeNotEditable(); +error LSP8TokenIdSchemaNotEditable(); ``` -Reverts when trying to edit the data key `LSP8TokenIdType` after the identifiable digital asset contract has been deployed. The `LSP8TokenIdType` data key is located inside the ERC725Y Data key-value store of the identifiable digital asset contract. It can be set only once inside the constructor/initializer when the identifiable digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP8TokenIdSchema` after the identifiable digital asset contract has been deployed. The `LSP8TokenIdSchema` data key is located inside the ERC725Y Data key-value store of the identifiable digital asset contract. It can be set only once inside the constructor/initializer when the identifiable digital asset contract is being deployed.
diff --git a/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.md b/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.md index d44fd5c13..ea71513be 100644 --- a/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.md +++ b/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.md @@ -1270,7 +1270,7 @@ mapping(bytes32 => bytes) _store function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; ``` -The ERC725Y data key `_LSP8_TOKENID_TYPE_KEY` cannot be changed +The ERC725Y data key `_LSP8_TOKENID_SCHEMA_KEY` cannot be changed once the identifiable digital asset contract has been deployed.
@@ -2033,7 +2033,7 @@ reverts when the contract is called with a function selector not valid (less tha error LSP4TokenNameNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed / initialized. The `LSP4TokenName` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized.
@@ -2052,7 +2052,26 @@ Reverts when trying to edit the data key `LSP4TokenName` after the digital asset error LSP4TokenSymbolNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed / initialized. The `LSP4TokenSymbol` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized. + +
+ +### LSP4TokenTypeNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Error signature: `LSP4TokenTypeNotEditable()` +- Error hash: `0x4ef6d7fb` + +::: + +```solidity +error LSP4TokenTypeNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenType` after the digital asset contract has been deployed / initialized. The `LSP4TokenType` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor / initializer when the digital asset contract is being deployed / initialized.
@@ -2362,22 +2381,22 @@ Error occurs when sending native tokens to the LSP8 contract without sending any
-### LSP8TokenIdTypeNotEditable +### LSP8TokenIdSchemaNotEditable :::note References -- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidtypenoteditable) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidschemanoteditable) - Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) -- Error signature: `LSP8TokenIdTypeNotEditable()` -- Error hash: `0x53bc1122` +- Error signature: `LSP8TokenIdSchemaNotEditable()` +- Error hash: `0xce0c7552` ::: ```solidity -error LSP8TokenIdTypeNotEditable(); +error LSP8TokenIdSchemaNotEditable(); ``` -Reverts when trying to edit the data key `LSP8TokenIdType` after the identifiable digital asset contract has been deployed. The `LSP8TokenIdType` data key is located inside the ERC725Y Data key-value store of the identifiable digital asset contract. It can be set only once inside the constructor/initializer when the identifiable digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP8TokenIdSchema` after the identifiable digital asset contract has been deployed. The `LSP8TokenIdSchema` data key is located inside the ERC725Y Data key-value store of the identifiable digital asset contract. It can be set only once inside the constructor/initializer when the identifiable digital asset contract is being deployed.
diff --git a/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.md b/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.md index 13409310d..50956a00b 100644 --- a/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.md +++ b/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.md @@ -925,7 +925,7 @@ mapping(bytes32 => bytes) _store function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; ``` -The ERC725Y data key `_LSP8_TOKENID_TYPE_KEY` cannot be changed +The ERC725Y data key `_LSP8_TOKENID_SCHEMA_KEY` cannot be changed once the identifiable digital asset contract has been deployed.
@@ -1670,7 +1670,7 @@ reverts when the contract is called with a function selector not valid (less tha error LSP4TokenNameNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed / initialized. The `LSP4TokenName` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized.
@@ -1689,7 +1689,26 @@ Reverts when trying to edit the data key `LSP4TokenName` after the digital asset error LSP4TokenSymbolNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed / initialized. The `LSP4TokenSymbol` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized. + +
+ +### LSP4TokenTypeNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Error signature: `LSP4TokenTypeNotEditable()` +- Error hash: `0x4ef6d7fb` + +::: + +```solidity +error LSP4TokenTypeNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenType` after the digital asset contract has been deployed / initialized. The `LSP4TokenType` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor / initializer when the digital asset contract is being deployed / initialized.
@@ -1999,22 +2018,22 @@ Error occurs when sending native tokens to the LSP8 contract without sending any
-### LSP8TokenIdTypeNotEditable +### LSP8TokenIdSchemaNotEditable :::note References -- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidtypenoteditable) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidschemanoteditable) - Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) -- Error signature: `LSP8TokenIdTypeNotEditable()` -- Error hash: `0x53bc1122` +- Error signature: `LSP8TokenIdSchemaNotEditable()` +- Error hash: `0xce0c7552` ::: ```solidity -error LSP8TokenIdTypeNotEditable(); +error LSP8TokenIdSchemaNotEditable(); ``` -Reverts when trying to edit the data key `LSP8TokenIdType` after the identifiable digital asset contract has been deployed. The `LSP8TokenIdType` data key is located inside the ERC725Y Data key-value store of the identifiable digital asset contract. It can be set only once inside the constructor/initializer when the identifiable digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP8TokenIdSchema` after the identifiable digital asset contract has been deployed. The `LSP8TokenIdSchema` data key is located inside the ERC725Y Data key-value store of the identifiable digital asset contract. It can be set only once inside the constructor/initializer when the identifiable digital asset contract is being deployed.
diff --git a/docs/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.md b/docs/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.md index 1c62bac59..f65035b57 100644 --- a/docs/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.md +++ b/docs/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.md @@ -35,7 +35,8 @@ constructor( string name_, string symbol_, address newOwner_, - uint256 tokenIdType_ + uint256 lsp4TokenType_, + uint256 lsp8TokenIdSchema_ ); ``` @@ -43,12 +44,13 @@ _Deploying a `LSP8CompatibleERC721Mintable` token contract with: token name = `n #### Parameters -| Name | Type | Description | -| -------------- | :-------: | -------------------------------- | -| `name_` | `string` | The name of the token. | -| `symbol_` | `string` | The symbol of the token. | -| `newOwner_` | `address` | The owner of the token contract. | -| `tokenIdType_` | `uint256` | - | +| Name | Type | Description | +| -------------------- | :-------: | ---------------------------------------------------------------------------------------------------- | +| `name_` | `string` | The name of the token. | +| `symbol_` | `string` | The symbol of the token. | +| `newOwner_` | `address` | The owner of the token contract. | +| `lsp4TokenType_` | `uint256` | The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection). | +| `lsp8TokenIdSchema_` | `uint256` | The schema of tokenIds (= NFTs) that this contract will create. |
@@ -1312,7 +1314,7 @@ mapping(bytes32 => bytes) _store function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; ``` -The ERC725Y data key `_LSP8_TOKENID_TYPE_KEY` cannot be changed +The ERC725Y data key `_LSP8_TOKENID_SCHEMA_KEY` cannot be changed once the identifiable digital asset contract has been deployed.
@@ -2075,7 +2077,7 @@ reverts when the contract is called with a function selector not valid (less tha error LSP4TokenNameNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed / initialized. The `LSP4TokenName` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized.
@@ -2094,7 +2096,26 @@ Reverts when trying to edit the data key `LSP4TokenName` after the digital asset error LSP4TokenSymbolNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed / initialized. The `LSP4TokenSymbol` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized. + +
+ +### LSP4TokenTypeNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Error signature: `LSP4TokenTypeNotEditable()` +- Error hash: `0x4ef6d7fb` + +::: + +```solidity +error LSP4TokenTypeNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenType` after the digital asset contract has been deployed / initialized. The `LSP4TokenType` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor / initializer when the digital asset contract is being deployed / initialized.
@@ -2429,22 +2450,22 @@ Reverts when `tokenId` has already been minted.
-### LSP8TokenIdTypeNotEditable +### LSP8TokenIdSchemaNotEditable :::note References -- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidtypenoteditable) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidschemanoteditable) - Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) -- Error signature: `LSP8TokenIdTypeNotEditable()` -- Error hash: `0x53bc1122` +- Error signature: `LSP8TokenIdSchemaNotEditable()` +- Error hash: `0xce0c7552` ::: ```solidity -error LSP8TokenIdTypeNotEditable(); +error LSP8TokenIdSchemaNotEditable(); ``` -Reverts when trying to edit the data key `LSP8TokenIdType` after the identifiable digital asset contract has been deployed. The `LSP8TokenIdType` data key is located inside the ERC725Y Data key-value store of the identifiable digital asset contract. It can be set only once inside the constructor/initializer when the identifiable digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP8TokenIdSchema` after the identifiable digital asset contract has been deployed. The `LSP8TokenIdSchema` data key is located inside the ERC725Y Data key-value store of the identifiable digital asset contract. It can be set only once inside the constructor/initializer when the identifiable digital asset contract is being deployed.
diff --git a/docs/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.md b/docs/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.md index b21a3c124..33ee04b44 100644 --- a/docs/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.md +++ b/docs/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.md @@ -35,7 +35,8 @@ constructor( string name_, string symbol_, address newOwner_, - uint256 tokenIdType_ + uint256 lsp4TokenType_, + uint256 lsp8TokenIdSchema_ ); ``` @@ -43,12 +44,13 @@ _Deploying a `LSP8Mintable` token contract with: token name = `name_`, token sym #### Parameters -| Name | Type | Description | -| -------------- | :-------: | -------------------------------- | -| `name_` | `string` | The name of the token. | -| `symbol_` | `string` | The symbol of the token. | -| `newOwner_` | `address` | The owner of the token contract. | -| `tokenIdType_` | `uint256` | - | +| Name | Type | Description | +| -------------------- | :-------: | ---------------------------------------------------------------------------------------------------- | +| `name_` | `string` | The name of the token. | +| `symbol_` | `string` | The symbol of the token. | +| `newOwner_` | `address` | The owner of the token contract. | +| `lsp4TokenType_` | `uint256` | The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection). | +| `lsp8TokenIdSchema_` | `uint256` | The schema of tokenIds (= NFTs) that this contract will create. |
@@ -958,7 +960,7 @@ mapping(bytes32 => bytes) _store function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; ``` -The ERC725Y data key `_LSP8_TOKENID_TYPE_KEY` cannot be changed +The ERC725Y data key `_LSP8_TOKENID_SCHEMA_KEY` cannot be changed once the identifiable digital asset contract has been deployed.
@@ -1706,7 +1708,7 @@ reverts when the contract is called with a function selector not valid (less tha error LSP4TokenNameNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed / initialized. The `LSP4TokenName` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized.
@@ -1725,7 +1727,26 @@ Reverts when trying to edit the data key `LSP4TokenName` after the digital asset error LSP4TokenSymbolNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed / initialized. The `LSP4TokenSymbol` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed / initialized. + +
+ +### LSP4TokenTypeNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Error signature: `LSP4TokenTypeNotEditable()` +- Error hash: `0x4ef6d7fb` + +::: + +```solidity +error LSP4TokenTypeNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenType` after the digital asset contract has been deployed / initialized. The `LSP4TokenType` data key is located inside the ERC725Y data key-value store of the digital asset contract. It can be set only once inside the constructor / initializer when the digital asset contract is being deployed / initialized.
@@ -2060,22 +2081,22 @@ Reverts when `tokenId` has already been minted.
-### LSP8TokenIdTypeNotEditable +### LSP8TokenIdSchemaNotEditable :::note References -- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidtypenoteditable) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidschemanoteditable) - Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) -- Error signature: `LSP8TokenIdTypeNotEditable()` -- Error hash: `0x53bc1122` +- Error signature: `LSP8TokenIdSchemaNotEditable()` +- Error hash: `0xce0c7552` ::: ```solidity -error LSP8TokenIdTypeNotEditable(); +error LSP8TokenIdSchemaNotEditable(); ``` -Reverts when trying to edit the data key `LSP8TokenIdType` after the identifiable digital asset contract has been deployed. The `LSP8TokenIdType` data key is located inside the ERC725Y Data key-value store of the identifiable digital asset contract. It can be set only once inside the constructor/initializer when the identifiable digital asset contract is being deployed. +Reverts when trying to edit the data key `LSP8TokenIdSchema` after the identifiable digital asset contract has been deployed. The `LSP8TokenIdSchema` data key is located inside the ERC725Y Data key-value store of the identifiable digital asset contract. It can be set only once inside the constructor/initializer when the identifiable digital asset contract is being deployed.
diff --git a/tests/Benchmark.test.ts b/tests/Benchmark.test.ts index 302f0a722..bf8c45335 100644 --- a/tests/Benchmark.test.ts +++ b/tests/Benchmark.test.ts @@ -21,7 +21,8 @@ import { OPERATION_TYPES, PERMISSIONS, CALLTYPE, - LSP8_TOKEN_ID_TYPES, + LSP8_TOKEN_ID_SCHEMA, + LSP4_TOKEN_TYPES, } from '../constants'; import { LSP6TestContext } from './utils/context'; import { setupKeyManager, setupProfileWithKeyManagerWithURD } from './utils/fixtures'; @@ -128,6 +129,7 @@ describe('⛽📊 Gas Benchmark', () => { 'Token', 'MTKN', accounts[0].address, + LSP4_TOKEN_TYPES.TOKEN, false, ); @@ -141,7 +143,8 @@ describe('⛽📊 Gas Benchmark', () => { 'My NFT', 'MNFT', accounts[0].address, - LSP8_TOKEN_ID_TYPES.NUMBER, + LSP4_TOKEN_TYPES.NFT, + LSP8_TOKEN_ID_SCHEMA.NUMBER, ); const lsp8DeployTransaction = lsp8Mintable.deployTransaction; @@ -551,6 +554,7 @@ describe('⛽📊 Gas Benchmark', () => { 'Token', 'MTKN', context.mainController.address, + LSP4_TOKEN_TYPES.TOKEN, false, ); @@ -559,7 +563,8 @@ describe('⛽📊 Gas Benchmark', () => { 'My NFT', 'MNFT', context.mainController.address, - LSP8_TOKEN_ID_TYPES.UNIQUE_ID, + LSP4_TOKEN_TYPES.NFT, + LSP8_TOKEN_ID_SCHEMA.UNIQUE_ID, ); universalProfile1 = await new UniversalProfile__factory(context.mainController).deploy( @@ -703,6 +708,7 @@ describe('⛽📊 Gas Benchmark', () => { 'MetaCoin', 'MTC', context.mainController.address, + LSP4_TOKEN_TYPES.TOKEN, false, ); @@ -711,7 +717,8 @@ describe('⛽📊 Gas Benchmark', () => { 'MetaNFT', 'MNF', context.mainController.address, - LSP8_TOKEN_ID_TYPES.UNIQUE_ID, + LSP4_TOKEN_TYPES.NFT, + LSP8_TOKEN_ID_SCHEMA.UNIQUE_ID, ); // mint some tokens to the UP @@ -890,6 +897,7 @@ describe('⛽📊 Gas Benchmark', () => { 'MetaCoin', 'MTC', context.mainController.address, + LSP4_TOKEN_TYPES.TOKEN, false, ); @@ -897,6 +905,7 @@ describe('⛽📊 Gas Benchmark', () => { 'LyxDai', 'LDAI', context.mainController.address, + LSP4_TOKEN_TYPES.TOKEN, false, ); @@ -911,14 +920,16 @@ describe('⛽📊 Gas Benchmark', () => { 'MetaNFT', 'MNF', context.mainController.address, - LSP8_TOKEN_ID_TYPES.UNIQUE_ID, + LSP4_TOKEN_TYPES.NFT, + LSP8_TOKEN_ID_SCHEMA.UNIQUE_ID, ); lsp8LyxPunks = await new LSP8Mintable__factory(context.mainController).deploy( 'LyxPunks', 'LPK', context.mainController.address, - LSP8_TOKEN_ID_TYPES.UNIQUE_ID, + LSP4_TOKEN_TYPES.NFT, + LSP8_TOKEN_ID_SCHEMA.UNIQUE_ID, ); [ diff --git a/tests/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP.behaviour.ts b/tests/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP.behaviour.ts index ed506e914..e9759c0e7 100644 --- a/tests/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP.behaviour.ts +++ b/tests/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP.behaviour.ts @@ -35,7 +35,8 @@ import { INTERFACE_IDS, OPERATION_TYPES, LSP1_TYPE_IDS, - LSP8_TOKEN_ID_TYPES, + LSP8_TOKEN_ID_SCHEMA, + LSP4_TOKEN_TYPES, } from '../../constants'; // fixtures @@ -245,18 +246,21 @@ export const shouldBehaveLikeLSP1Delegate = ( 'TokenAlpha', 'TA', context.accounts.random.address, + LSP4_TOKEN_TYPES.TOKEN, ); lsp7TokenB = await new LSP7Tester__factory(context.accounts.random).deploy( 'TokenBeta', 'TB', context.accounts.random.address, + LSP4_TOKEN_TYPES.TOKEN, ); lsp7TokenC = await new LSP7Tester__factory(context.accounts.random).deploy( 'TokenGamma', 'TA', context.accounts.random.address, + LSP4_TOKEN_TYPES.TOKEN, ); }); @@ -269,6 +273,7 @@ export const shouldBehaveLikeLSP1Delegate = ( 'LSP7 Token', 'TKN', context.universalProfile1.address, + LSP4_TOKEN_TYPES.TOKEN, ); }); @@ -931,6 +936,7 @@ export const shouldBehaveLikeLSP1Delegate = ( 'Example LSP7 token', 'EL7T', context.accounts.random.address, + LSP4_TOKEN_TYPES.TOKEN, ); }); @@ -1124,6 +1130,7 @@ export const shouldBehaveLikeLSP1Delegate = ( 'Example LSP7 token', 'EL7T', context.accounts.random.address, + LSP4_TOKEN_TYPES.TOKEN, ); arrayKey = ERC725YDataKeys.LSP5['LSP5ReceivedAssets[]'].length; @@ -1781,21 +1788,24 @@ export const shouldBehaveLikeLSP1Delegate = ( 'TokenAlpha', 'TA', context.accounts.random.address, - LSP8_TOKEN_ID_TYPES.UNIQUE_ID, + LSP4_TOKEN_TYPES.NFT, + LSP8_TOKEN_ID_SCHEMA.UNIQUE_ID, ); lsp8TokenB = await new LSP8Tester__factory(context.accounts.random).deploy( 'TokenBeta', 'TB', context.accounts.random.address, - LSP8_TOKEN_ID_TYPES.UNIQUE_ID, + LSP4_TOKEN_TYPES.NFT, + LSP8_TOKEN_ID_SCHEMA.UNIQUE_ID, ); lsp8TokenC = await new LSP8Tester__factory(context.accounts.random).deploy( 'TokenGamma', 'TA', context.accounts.random.address, - LSP8_TOKEN_ID_TYPES.UNIQUE_ID, + LSP4_TOKEN_TYPES.NFT, + LSP8_TOKEN_ID_SCHEMA.UNIQUE_ID, ); }); @@ -3087,6 +3097,7 @@ export const shouldBehaveLikeLSP1Delegate = ( 'MyToken', 'MTK', context.universalProfile1.address, + LSP4_TOKEN_TYPES.TOKEN, ); expect(await LSP7.balanceOf(context.universalProfile1.address)).to.equal(1000); @@ -3118,7 +3129,8 @@ export const shouldBehaveLikeLSP1Delegate = ( 'MyToken', 'MTK', context.universalProfile1.address, - LSP8_TOKEN_ID_TYPES.NUMBER, + LSP4_TOKEN_TYPES.NFT, + LSP8_TOKEN_ID_SCHEMA.NUMBER, ); // Mint token for UP1 await LSP8.mint(context.universalProfile1.address, '0x' + '0'.repeat(64), true, '0x'); diff --git a/tests/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault.behaviour.ts b/tests/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault.behaviour.ts index 6ec9222ab..cd9a1cd62 100644 --- a/tests/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault.behaviour.ts +++ b/tests/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault.behaviour.ts @@ -24,7 +24,8 @@ import { INTERFACE_IDS, OPERATION_TYPES, LSP1_TYPE_IDS, - LSP8_TOKEN_ID_TYPES, + LSP8_TOKEN_ID_SCHEMA, + LSP4_TOKEN_TYPES, } from '../../constants'; import { callPayload, getLSP5MapAndArrayKeysValue } from '../utils/fixtures'; import { BigNumber, BytesLike, Transaction } from 'ethers'; @@ -209,18 +210,21 @@ export const shouldBehaveLikeLSP1Delegate = (buildContext: () => Promise Promise Promise Promise Promise Promise Promise Promise Promise Promise Promise { // step 1 - deploy token contract const lsp7ConstructorArguments = abiCoder.encode( - ['string', 'string', 'address', 'bool'], - ['My UP LSP7 Token', 'UPLSP7', context.universalProfile.address, false], + ['string', 'string', 'address', 'uint256', 'bool'], + [ + 'My UP LSP7 Token', + 'UPLSP7', + context.universalProfile.address, + LSP4_TOKEN_TYPES.TOKEN, + false, + ], ); // we simulate deploying the token contract to know the future address of the LSP7 Token contract, diff --git a/tests/LSP20CallVerification/LSP6/Interactions/PermissionTransferValue.test.ts b/tests/LSP20CallVerification/LSP6/Interactions/PermissionTransferValue.test.ts index e1b455d0a..5ddbef075 100644 --- a/tests/LSP20CallVerification/LSP6/Interactions/PermissionTransferValue.test.ts +++ b/tests/LSP20CallVerification/LSP6/Interactions/PermissionTransferValue.test.ts @@ -25,6 +25,7 @@ import { PERMISSIONS, OPERATION_TYPES, CALLTYPE, + LSP4_TOKEN_TYPES, } from '../../../../constants'; // setup @@ -599,6 +600,7 @@ export const shouldBehaveLikePermissionTransferValue = ( 'LSP7 Token', 'LSP7', context.accounts[0].address, + LSP4_TOKEN_TYPES.TOKEN, false, ); @@ -755,6 +757,7 @@ export const shouldBehaveLikePermissionTransferValue = ( 'New LSP7 Token', 'LSP7TKN', context.accounts[0].address, + LSP4_TOKEN_TYPES.TOKEN, false, ); @@ -994,6 +997,7 @@ export const shouldBehaveLikePermissionTransferValue = ( 'LSP7 Token', 'LSP7', context.accounts[0].address, + LSP4_TOKEN_TYPES.TOKEN, false, ); @@ -1156,6 +1160,7 @@ export const shouldBehaveLikePermissionTransferValue = ( 'LSP7 Token', 'LSP7', context.accounts[0].address, + LSP4_TOKEN_TYPES.TOKEN, false, ); diff --git a/tests/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.behaviour.ts b/tests/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.behaviour.ts index dd552e53b..d6de9e019 100644 --- a/tests/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.behaviour.ts +++ b/tests/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.behaviour.ts @@ -7,11 +7,12 @@ import { LSP7DigitalAsset, LSP8IdentifiableDigitalAsset, LSP9Vault } from '../.. // constants import { ERC725YDataKeys } from '../../constants'; +import { abiCoder } from '../utils/helpers'; export type LS4DigitalAssetMetadataTestContext = { accounts: SignerWithAddress[]; contract: LSP7DigitalAsset | LSP8IdentifiableDigitalAsset | LSP9Vault; - deployParams: { owner: SignerWithAddress }; + deployParams: { owner: SignerWithAddress; lsp4TokenType: number }; }; export const shouldBehaveLikeLSP4DigitalAssetMetadata = ( @@ -68,6 +69,15 @@ export const shouldBehaveLikeLSP4DigitalAssetMetadata = ( ).to.be.revertedWithCustomError(context.contract, 'LSP4TokenSymbolNotEditable'); }); + it('should revert when trying to edit Token Type', async () => { + const key = ERC725YDataKeys.LSP4['LSP4TokenType']; + const value = abiCoder.encode(['uint256'], [12345]); + + expect( + context.contract.connect(context.deployParams.owner).setData(key, value), + ).to.be.revertedWithCustomError(context.contract, 'LSP4TokenTypeNotEditable'); + }); + describe('when setting a data key with a value less than 256 bytes', () => { it('should emit DataChanged event with the whole data value', async () => { const key = ethers.utils.keccak256(ethers.utils.toUtf8Bytes('My Key')); diff --git a/tests/LSP6KeyManager/Interactions/AllowedFunctions.test.ts b/tests/LSP6KeyManager/Interactions/AllowedFunctions.test.ts index f9273d5be..d109492d7 100644 --- a/tests/LSP6KeyManager/Interactions/AllowedFunctions.test.ts +++ b/tests/LSP6KeyManager/Interactions/AllowedFunctions.test.ts @@ -20,7 +20,8 @@ import { PERMISSIONS, INTERFACE_IDS, CALLTYPE, - LSP8_TOKEN_ID_TYPES, + LSP8_TOKEN_ID_SCHEMA, + LSP4_TOKEN_TYPES, } from '../../../constants'; // setup @@ -334,6 +335,7 @@ export const shouldBehaveLikeAllowedFunctions = (buildContext: () => Promise Promise Promise Promise Promise { // step 1 - deploy token contract const lsp7ConstructorArguments = abiCoder.encode( - ['string', 'string', 'address', 'bool'], - ['My UP LSP7 Token', 'UPLSP7', context.universalProfile.address, false], + ['string', 'string', 'address', 'uint256', 'bool'], + [ + 'My UP LSP7 Token', + 'UPLSP7', + context.universalProfile.address, + LSP4_TOKEN_TYPES.TOKEN, + false, + ], ); const lsp7DeploymentPayload = context.universalProfile.interface.encodeFunctionData( diff --git a/tests/LSP6KeyManager/Interactions/PermissionTransferValue.test.ts b/tests/LSP6KeyManager/Interactions/PermissionTransferValue.test.ts index 4a0e2d0e6..1d3626f4d 100644 --- a/tests/LSP6KeyManager/Interactions/PermissionTransferValue.test.ts +++ b/tests/LSP6KeyManager/Interactions/PermissionTransferValue.test.ts @@ -27,6 +27,7 @@ import { PERMISSIONS, OPERATION_TYPES, CALLTYPE, + LSP4_TOKEN_TYPES, } from '../../../constants'; // setup @@ -882,6 +883,7 @@ export const shouldBehaveLikePermissionTransferValue = ( 'LSP7 Token', 'LSP7', context.accounts[0].address, + LSP4_TOKEN_TYPES.TOKEN, false, ); @@ -1064,6 +1066,7 @@ export const shouldBehaveLikePermissionTransferValue = ( 'New LSP7 Token', 'LSP7TKN', context.accounts[0].address, + LSP4_TOKEN_TYPES.TOKEN, false, ); @@ -1332,6 +1335,7 @@ export const shouldBehaveLikePermissionTransferValue = ( 'LSP7 Token', 'LSP7', context.accounts[0].address, + LSP4_TOKEN_TYPES.TOKEN, false, ); @@ -1512,6 +1516,7 @@ export const shouldBehaveLikePermissionTransferValue = ( 'LSP7 Token', 'LSP7', context.accounts[0].address, + LSP4_TOKEN_TYPES.TOKEN, false, ); diff --git a/tests/LSP6KeyManager/LSP6ControlledToken.test.ts b/tests/LSP6KeyManager/LSP6ControlledToken.test.ts index 19b98fa31..ccd5e6eeb 100644 --- a/tests/LSP6KeyManager/LSP6ControlledToken.test.ts +++ b/tests/LSP6KeyManager/LSP6ControlledToken.test.ts @@ -13,7 +13,13 @@ import { LSP0ERC725Account__factory, } from '../../types'; -import { ERC725YDataKeys, ALL_PERMISSIONS, PERMISSIONS, ERC1271_VALUES } from '../../constants'; +import { + ERC725YDataKeys, + ALL_PERMISSIONS, + PERMISSIONS, + ERC1271_VALUES, + LSP4_TOKEN_TYPES, +} from '../../constants'; import { ARRAY_LENGTH, encodeCompactBytesArray } from '../utils/helpers'; export type LSP6ControlledToken = { @@ -30,6 +36,7 @@ const buildContext = async () => { 'name', 'symbol', accounts[0].address, + LSP4_TOKEN_TYPES.TOKEN, true, ); @@ -597,6 +604,7 @@ describe('When deploying LSP7 with LSP6 as owner', () => { 'NewTokenName', 'NewTokenSymbol', context.mainController.address, + LSP4_TOKEN_TYPES.TOKEN, ); // creating a payload to mint tokens in the new contract const mintPayload = newTokenContract.interface.encodeFunctionData('mint', [ diff --git a/tests/LSP6KeyManager/Relay/ExecuteRelayCall.test.ts b/tests/LSP6KeyManager/Relay/ExecuteRelayCall.test.ts index 97bcc5ff1..34d7cc193 100644 --- a/tests/LSP6KeyManager/Relay/ExecuteRelayCall.test.ts +++ b/tests/LSP6KeyManager/Relay/ExecuteRelayCall.test.ts @@ -21,6 +21,7 @@ import { PERMISSIONS, CALLTYPE, INTERFACE_IDS, + LSP4_TOKEN_TYPES, } from '../../../constants'; // helpers @@ -1378,6 +1379,7 @@ export const shouldBehaveLikeExecuteRelayCall = ( 'My LSP7 Token', 'LSP7', context.universalProfile.address, + LSP4_TOKEN_TYPES.TOKEN, false, ); diff --git a/tests/LSP7DigitalAsset/LSP7CappedSupply.behaviour.ts b/tests/LSP7DigitalAsset/LSP7CappedSupply.behaviour.ts index 25687e214..e36a7a9d0 100644 --- a/tests/LSP7DigitalAsset/LSP7CappedSupply.behaviour.ts +++ b/tests/LSP7DigitalAsset/LSP7CappedSupply.behaviour.ts @@ -23,6 +23,7 @@ export type LSP7CappedSupplyTestContext = { symbol: string; newOwner: string; tokenSupplyCap: BigNumber; + lsp4TokenType: number; }; }; diff --git a/tests/LSP7DigitalAsset/LSP7CompatibleERC20.behaviour.ts b/tests/LSP7DigitalAsset/LSP7CompatibleERC20.behaviour.ts index df9df8bbd..1f9df0e9d 100644 --- a/tests/LSP7DigitalAsset/LSP7CompatibleERC20.behaviour.ts +++ b/tests/LSP7DigitalAsset/LSP7CompatibleERC20.behaviour.ts @@ -18,6 +18,7 @@ import { UniversalReceiverDelegateRevert__factory, } from '../../types'; import { ERC725YDataKeys } from '../../constants'; +import { abiCoder } from '../utils/helpers'; type LSP7CompatibleERC20TestAccounts = { owner: SignerWithAddress; @@ -36,6 +37,7 @@ export type LSP7CompatibleERC20DeployParams = { name: string; symbol: string; newOwner: string; + lsp4TokenType: number; }; export type LSP7CompatibleERC20TestContext = { @@ -1286,6 +1288,15 @@ export const shouldInitializeLikeLSP7CompatibleERC20 = ( .to.emit(context.lsp7CompatibleERC20, 'DataChanged') .withArgs(symbolKey, expectedSymbolValue); expect(await context.lsp7CompatibleERC20.getData(symbolKey)).to.equal(expectedSymbolValue); + + const tokenTypeKey = ERC725YDataKeys.LSP4['LSP4TokenType']; + const expectedTokenTypeValue = abiCoder.encode( + ['uint256'], + [context.deployParams.lsp4TokenType], + ); + expect(await context.lsp7CompatibleERC20.getData(tokenTypeKey)).to.equal( + expectedTokenTypeValue, + ); }); describe('when using the functions from IERC20Metadata', () => { diff --git a/tests/LSP7DigitalAsset/LSP7DigitalAsset.behaviour.ts b/tests/LSP7DigitalAsset/LSP7DigitalAsset.behaviour.ts index 956ba7359..4761dfc0f 100644 --- a/tests/LSP7DigitalAsset/LSP7DigitalAsset.behaviour.ts +++ b/tests/LSP7DigitalAsset/LSP7DigitalAsset.behaviour.ts @@ -57,6 +57,7 @@ export type LSP7DeployParams = { name: string; symbol: string; newOwner: string; + lsp4TokenType?: number; }; export type LSP7TestContext = { @@ -2572,6 +2573,16 @@ export const shouldInitializeLikeLSP7 = ( .to.emit(context.lsp7, 'DataChanged') .withArgs(symbolKey, expectedSymbolValue); expect(await context.lsp7.getData(symbolKey)).to.equal(expectedSymbolValue); + + const tokenTypeKey = ERC725YDataKeys.LSP4['LSP4TokenType']; + const expectedTokenTypeValue = abiCoder.encode( + ['uint256'], + [context.deployParams.lsp4TokenType], + ); + await expect(context.initializeTransaction) + .to.emit(context.lsp7, 'DataChanged') + .withArgs(tokenTypeKey, expectedTokenTypeValue); + expect(await context.lsp7.getData(tokenTypeKey)).to.equal(expectedTokenTypeValue); }); }); }; diff --git a/tests/LSP7DigitalAsset/LSP7Mintable.behaviour.ts b/tests/LSP7DigitalAsset/LSP7Mintable.behaviour.ts index c1e94a27e..3ff145a02 100644 --- a/tests/LSP7DigitalAsset/LSP7Mintable.behaviour.ts +++ b/tests/LSP7DigitalAsset/LSP7Mintable.behaviour.ts @@ -29,6 +29,7 @@ export type LSP7MintableDeployParams = { symbol: string; newOwner: string; isNFT: boolean; + lsp4TokenType: number; }; export type LSP7MintableTestContext = { diff --git a/tests/LSP7DigitalAsset/proxy/LSP7CappedSupplyInit.test.ts b/tests/LSP7DigitalAsset/proxy/LSP7CappedSupplyInit.test.ts index 317b3c537..d4209cef6 100644 --- a/tests/LSP7DigitalAsset/proxy/LSP7CappedSupplyInit.test.ts +++ b/tests/LSP7DigitalAsset/proxy/LSP7CappedSupplyInit.test.ts @@ -11,6 +11,7 @@ import { } from '../LSP7CappedSupply.behaviour'; import { deployProxy } from '../../utils/fixtures'; +import { LSP4_TOKEN_TYPES } from '../../../constants'; describe('LSP7CappedSupplyInit with proxy', () => { const buildTestContext = async () => { @@ -19,6 +20,7 @@ describe('LSP7CappedSupplyInit with proxy', () => { name: 'LSP7 capped supply - deployed with proxy', symbol: 'CAP', newOwner: accounts.owner.address, + lsp4TokenType: LSP4_TOKEN_TYPES.TOKEN, tokenSupplyCap: ethers.BigNumber.from('2'), }; const lsp7CappedSupplyInit = await new LSP7CappedSupplyInitTester__factory( @@ -31,10 +33,11 @@ describe('LSP7CappedSupplyInit with proxy', () => { }; const initializeProxy = async (context: LSP7CappedSupplyTestContext) => { - return context.lsp7CappedSupply['initialize(string,string,address,uint256)']( + return context.lsp7CappedSupply['initialize(string,string,address,uint256,uint256)']( context.deployParams.name, context.deployParams.symbol, context.deployParams.newOwner, + context.deployParams.lsp4TokenType, context.deployParams.tokenSupplyCap, ); }; diff --git a/tests/LSP7DigitalAsset/proxy/LSP7CompatibleERC20Init.test.ts b/tests/LSP7DigitalAsset/proxy/LSP7CompatibleERC20Init.test.ts index 9c05ba3d9..c98a47f2c 100644 --- a/tests/LSP7DigitalAsset/proxy/LSP7CompatibleERC20Init.test.ts +++ b/tests/LSP7DigitalAsset/proxy/LSP7CompatibleERC20Init.test.ts @@ -14,6 +14,7 @@ import { } from '../LSP7CompatibleERC20.behaviour'; import { deployProxy } from '../../utils/fixtures'; +import { LSP4_TOKEN_TYPES } from '../../../constants'; describe('LSP7CompatibleERC20Init with proxy', () => { const buildTestContext = async (): Promise => { @@ -23,6 +24,7 @@ describe('LSP7CompatibleERC20Init with proxy', () => { name: 'LSP7 - deployed with constructor', symbol: 'NFT', newOwner: accounts.owner.address, + lsp4TokenType: LSP4_TOKEN_TYPES.TOKEN, }; const lsp7CompatibilityForERC20TesterInit = await new LSP7CompatibleERC20InitTester__factory( @@ -45,10 +47,11 @@ describe('LSP7CompatibleERC20Init with proxy', () => { }; const initializeProxy = async (context: LSP7CompatibleERC20TestContext) => { - return context.lsp7CompatibleERC20['initialize(string,string,address)']( + return context.lsp7CompatibleERC20['initialize(string,string,address,uint256)']( context.deployParams.name, context.deployParams.symbol, context.deployParams.newOwner, + context.deployParams.lsp4TokenType, ); }; @@ -63,10 +66,11 @@ describe('LSP7CompatibleERC20Init with proxy', () => { const randomCaller = accounts[1]; await expect( - lsp7CompatibilityForERC20TesterInit['initialize(string,string,address)']( + lsp7CompatibilityForERC20TesterInit['initialize(string,string,address,uint256)']( 'XXXXXXXXXXX', 'XXX', randomCaller.address, + 12345, ), ).to.be.revertedWith('Initializable: contract is already initialized'); }); @@ -81,10 +85,11 @@ describe('LSP7CompatibleERC20Init with proxy', () => { const randomCaller = accounts[1]; await expect( - lsp7CompatibleERC20MintableInit['initialize(string,string,address)']( + lsp7CompatibleERC20MintableInit['initialize(string,string,address,uint256)']( 'XXXXXXXXXXX', 'XXX', randomCaller.address, + 12345, ), ).to.be.revertedWith('Initializable: contract is already initialized'); }); diff --git a/tests/LSP7DigitalAsset/proxy/LSP7DigitalAssetInit.test.ts b/tests/LSP7DigitalAsset/proxy/LSP7DigitalAssetInit.test.ts index fc3c599d4..fbf2b4107 100644 --- a/tests/LSP7DigitalAsset/proxy/LSP7DigitalAssetInit.test.ts +++ b/tests/LSP7DigitalAsset/proxy/LSP7DigitalAssetInit.test.ts @@ -16,6 +16,7 @@ import { } from '../../LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.behaviour'; import { deployProxy } from '../../utils/fixtures'; +import { LSP4_TOKEN_TYPES } from '../../../constants'; describe('LSP7DigitalAssetInit with proxy', () => { const buildTestContext = async (): Promise => { @@ -25,6 +26,7 @@ describe('LSP7DigitalAssetInit with proxy', () => { name: 'LSP7 - deployed with proxy', symbol: 'TKN', newOwner: accounts.owner.address, + lsp4TokenType: LSP4_TOKEN_TYPES.TOKEN, }; const lsp7TesterInit = await new LSP7InitTester__factory(accounts.owner).deploy(); @@ -46,6 +48,7 @@ describe('LSP7DigitalAssetInit with proxy', () => { const deployParams = { owner: accounts[0], + lsp4TokenType: LSP4_TOKEN_TYPES.TOKEN, }; return { @@ -56,10 +59,11 @@ describe('LSP7DigitalAssetInit with proxy', () => { }; const initializeProxy = async (context: LSP7TestContext) => { - return context.lsp7['initialize(string,string,address,bool)']( + return context.lsp7['initialize(string,string,address,uint256,bool)']( context.deployParams.name, context.deployParams.symbol, context.deployParams.newOwner, + context.deployParams.lsp4TokenType, false, ); }; @@ -73,10 +77,11 @@ describe('LSP7DigitalAssetInit with proxy', () => { it('should revert when initializing with address(0) as owner', async () => { await expect( - context.lsp7['initialize(string,string,address,bool)']( + context.lsp7['initialize(string,string,address,uint256,bool)']( context.deployParams.name, context.deployParams.symbol, ethers.constants.AddressZero, + 12345, false, ), ).to.be.revertedWithCustomError(context.lsp7, 'OwnableCannotSetZeroAddressAsOwner'); @@ -108,10 +113,11 @@ describe('LSP7DigitalAssetInit with proxy', () => { shouldBehaveLikeLSP4DigitalAssetMetadata(async () => { const lsp4Context = await buildLSP4DigitalAssetMetadataTestContext(); - await lsp4Context.contract['initialize(string,string,address,bool)']( + await lsp4Context.contract['initialize(string,string,address,uint256,bool)']( 'LSP7 - deployed with proxy', 'TKN', lsp4Context.deployParams.owner.address, + lsp4Context.deployParams.lsp4TokenType, false, ); diff --git a/tests/LSP7DigitalAsset/proxy/LSP7MintableInit.test.ts b/tests/LSP7DigitalAsset/proxy/LSP7MintableInit.test.ts index 3593d07e7..0ee2d4782 100644 --- a/tests/LSP7DigitalAsset/proxy/LSP7MintableInit.test.ts +++ b/tests/LSP7DigitalAsset/proxy/LSP7MintableInit.test.ts @@ -11,7 +11,7 @@ import { } from '../LSP7Mintable.behaviour'; import { deployProxy } from '../../utils/fixtures'; -import { ERC725YDataKeys } from '../../../constants'; +import { ERC725YDataKeys, LSP4_TOKEN_TYPES } from '../../../constants'; describe('LSP7MintableInit with proxy', () => { const buildTestContext = async () => { @@ -22,6 +22,7 @@ describe('LSP7MintableInit with proxy', () => { symbol: 'LSP7 MNTBL', newOwner: accounts.owner.address, isNFT: false, + lsp4TokenType: LSP4_TOKEN_TYPES.TOKEN, }; const LSP7MintableInit: LSP7MintableInit = await new LSP7MintableInit__factory( @@ -35,10 +36,11 @@ describe('LSP7MintableInit with proxy', () => { }; const initializeProxy = async (context: LSP7MintableTestContext) => { - return context.lsp7Mintable['initialize(string,string,address,bool)']( + return context.lsp7Mintable['initialize(string,string,address,uint256,bool)']( context.deployParams.name, context.deployParams.symbol, context.deployParams.newOwner, + context.deployParams.lsp4TokenType, context.deployParams.isNFT, ); }; @@ -52,6 +54,7 @@ describe('LSP7MintableInit with proxy', () => { expect(await lsp7MintableInit.getData(ERC725YDataKeys.LSP4.LSP4TokenName)).to.equal('0x'); expect(await lsp7MintableInit.getData(ERC725YDataKeys.LSP4.LSP4TokenSymbol)).to.equal('0x'); expect(await lsp7MintableInit.getData(ERC725YDataKeys.LSP4.LSP4Metadata)).to.equal('0x'); + expect(await lsp7MintableInit.getData(ERC725YDataKeys.LSP4.LSP4TokenType)).to.equal('0x'); expect(await lsp7MintableInit.owner()).to.equal(ethers.constants.AddressZero); }); @@ -64,10 +67,11 @@ describe('LSP7MintableInit with proxy', () => { const randomCaller = accounts[1]; await expect( - lsp7MintableInit['initialize(string,string,address,bool)']( + lsp7MintableInit['initialize(string,string,address,uint256,bool)']( 'XXXXXXXXXXX', 'XXX', randomCaller.address, + 12345, false, ), ).to.be.revertedWith('Initializable: contract is already initialized'); diff --git a/tests/LSP7DigitalAsset/standard/LSP7CappedSupply.test.ts b/tests/LSP7DigitalAsset/standard/LSP7CappedSupply.test.ts index fe8491784..1c9e546b6 100644 --- a/tests/LSP7DigitalAsset/standard/LSP7CappedSupply.test.ts +++ b/tests/LSP7DigitalAsset/standard/LSP7CappedSupply.test.ts @@ -8,6 +8,7 @@ import { LSP7CappedSupplyTestContext, getNamedAccounts, } from '../LSP7CappedSupply.behaviour'; +import { LSP4_TOKEN_TYPES } from '../../../constants'; describe('LSP7CappedSupply with constructor', () => { const buildTestContext = async () => { @@ -16,12 +17,15 @@ describe('LSP7CappedSupply with constructor', () => { name: 'LSP7 capped supply - deployed with constructor', symbol: 'CAP', newOwner: accounts.owner.address, + lsp4TokenType: LSP4_TOKEN_TYPES.TOKEN, tokenSupplyCap: ethers.BigNumber.from('2'), }; + const lsp7CappedSupply = await new LSP7CappedSupplyTester__factory(accounts.owner).deploy( deployParams.name, deployParams.symbol, deployParams.newOwner, + deployParams.lsp4TokenType, deployParams.tokenSupplyCap, ); diff --git a/tests/LSP7DigitalAsset/standard/LSP7CompatibleERC20.test.ts b/tests/LSP7DigitalAsset/standard/LSP7CompatibleERC20.test.ts index 1e033ce1d..0c37f48ea 100644 --- a/tests/LSP7DigitalAsset/standard/LSP7CompatibleERC20.test.ts +++ b/tests/LSP7DigitalAsset/standard/LSP7CompatibleERC20.test.ts @@ -8,6 +8,7 @@ import { shouldInitializeLikeLSP7CompatibleERC20, shouldBehaveLikeLSP7CompatibleERC20, } from '../LSP7CompatibleERC20.behaviour'; +import { LSP4_TOKEN_TYPES } from '../../../constants'; describe('LSP7CompatibleERC20 with constructor', () => { const buildTestContext = async (): Promise => { @@ -17,12 +18,14 @@ describe('LSP7CompatibleERC20 with constructor', () => { name: 'Compat for ERC20', symbol: 'NFT', newOwner: accounts.owner.address, + lsp4TokenType: LSP4_TOKEN_TYPES.TOKEN, }; const lsp7CompatibleERC20 = await new LSP7CompatibleERC20Tester__factory(accounts.owner).deploy( deployParams.name, deployParams.symbol, deployParams.newOwner, + deployParams.lsp4TokenType, ); return { diff --git a/tests/LSP7DigitalAsset/standard/LSP7DigitalAsset.test.ts b/tests/LSP7DigitalAsset/standard/LSP7DigitalAsset.test.ts index 8447ea11b..443d0f39a 100644 --- a/tests/LSP7DigitalAsset/standard/LSP7DigitalAsset.test.ts +++ b/tests/LSP7DigitalAsset/standard/LSP7DigitalAsset.test.ts @@ -19,6 +19,7 @@ import { LS4DigitalAssetMetadataTestContext, shouldBehaveLikeLSP4DigitalAssetMetadata, } from '../../LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.behaviour'; +import { LSP4_TOKEN_TYPES } from '../../../constants'; describe('LSP7DigitalAsset with constructor', () => { const buildTestContext = async (): Promise => { @@ -28,12 +29,14 @@ describe('LSP7DigitalAsset with constructor', () => { name: 'LSP7 - deployed with constructor', symbol: 'Token', newOwner: accounts.owner.address, + lsp4TokenType: LSP4_TOKEN_TYPES.TOKEN, }; const lsp7 = await new LSP7Tester__factory(accounts.owner).deploy( deployParams.name, deployParams.symbol, deployParams.newOwner, + deployParams.lsp4TokenType, ); // mint tokens for the owner @@ -49,6 +52,7 @@ describe('LSP7DigitalAsset with constructor', () => { const deployParams = { owner: accounts[0], + lsp4TokenType: LSP4_TOKEN_TYPES.TOKEN, }; return { @@ -65,12 +69,14 @@ describe('LSP7DigitalAsset with constructor', () => { name: 'LSP8 - deployed with constructor', symbol: 'NFT', owner: accounts[0], + lsp4TokenType: LSP4_TOKEN_TYPES.TOKEN, }; const contract = await new LSP7Tester__factory(accounts[0]).deploy( deployParams.name, deployParams.symbol, deployParams.owner.address, + deployParams.lsp4TokenType, ); return { accounts, contract, deployParams }; @@ -84,12 +90,18 @@ describe('LSP7DigitalAsset with constructor', () => { name: 'LSP7 - deployed with constructor', symbol: 'Token', newOwner: ethers.constants.AddressZero, + lsp4TokenType: LSP4_TOKEN_TYPES.TOKEN, }; const contractToDeploy = new LSP7Tester__factory(accounts[0]); await expect( - contractToDeploy.deploy(deployParams.name, deployParams.symbol, deployParams.newOwner), + contractToDeploy.deploy( + deployParams.name, + deployParams.symbol, + deployParams.newOwner, + deployParams.lsp4TokenType, + ), ).to.be.revertedWithCustomError(contractToDeploy, 'OwnableCannotSetZeroAddressAsOwner'); }); diff --git a/tests/LSP7DigitalAsset/standard/LSP7Mintable.test.ts b/tests/LSP7DigitalAsset/standard/LSP7Mintable.test.ts index 86ff9ee6f..c9afcaf9d 100644 --- a/tests/LSP7DigitalAsset/standard/LSP7Mintable.test.ts +++ b/tests/LSP7DigitalAsset/standard/LSP7Mintable.test.ts @@ -1,3 +1,4 @@ +import { LSP4_TOKEN_TYPES } from '../../../constants'; import { LSP7Mintable, LSP7Mintable__factory } from '../../../types'; import { shouldInitializeLikeLSP7 } from '../LSP7DigitalAsset.behaviour'; @@ -17,12 +18,14 @@ describe('LSP7Mintable with constructor', () => { symbol: 'LSP7MNT', newOwner: accounts.owner.address, isNFT: false, + lsp4TokenType: LSP4_TOKEN_TYPES.TOKEN, }; const lsp7Mintable: LSP7Mintable = await new LSP7Mintable__factory(accounts.owner).deploy( deployParams.name, deployParams.symbol, deployParams.newOwner, + deployParams.lsp4TokenType, deployParams.isNFT, ); diff --git a/tests/LSP8IdentifiableDigitalAsset/LSP8CappedSupply.behaviour.ts b/tests/LSP8IdentifiableDigitalAsset/LSP8CappedSupply.behaviour.ts index 24cb4ceca..6775aa267 100644 --- a/tests/LSP8IdentifiableDigitalAsset/LSP8CappedSupply.behaviour.ts +++ b/tests/LSP8IdentifiableDigitalAsset/LSP8CappedSupply.behaviour.ts @@ -22,7 +22,8 @@ export type LSP8CappedSupplyTestContext = { name: string; symbol: string; newOwner: string; - tokenIdType: number; + lsp4TokenType: number; + lsp8TokenIdSchema: number; tokenSupplyCap: BigNumber; }; }; diff --git a/tests/LSP8IdentifiableDigitalAsset/LSP8CompatibleERC721.behaviour.ts b/tests/LSP8IdentifiableDigitalAsset/LSP8CompatibleERC721.behaviour.ts index 00bb4c36f..bc692a853 100644 --- a/tests/LSP8IdentifiableDigitalAsset/LSP8CompatibleERC721.behaviour.ts +++ b/tests/LSP8IdentifiableDigitalAsset/LSP8CompatibleERC721.behaviour.ts @@ -28,6 +28,7 @@ import { ERC725YDataKeys, INTERFACE_IDS, SupportedStandards } from '../../consta import type { BytesLike } from 'ethers'; import type { TransactionResponse } from '@ethersproject/abstract-provider'; +import { abiCoder } from '../utils/helpers'; export type LSP8CompatibleERC721TestAccounts = { owner: SignerWithAddress; @@ -46,8 +47,9 @@ type LSP8CompatibleERC721DeployParams = { name: string; symbol: string; newOwner: string; + lsp4TokenType: number; + lsp8TokenIdSchema: number; lsp4MetadataValue: string; - tokenIdType: number; }; export type LSP8CompatibleERC721TestContext = { @@ -74,18 +76,18 @@ export const shouldBehaveLikeLSP8CompatibleERC721 = ( }); describe('when setting data', () => { - it('should not allow to update the `LSP8TokenIdType` after deployment', async () => { + it('should not allow to update the `lsp8TokenIdSchema` after deployment', async () => { await expect( - context.lsp8CompatibleERC721.setData(ERC725YDataKeys.LSP8.LSP8TokenIdType, '0xdeadbeef'), - ).to.be.revertedWithCustomError(context.lsp8CompatibleERC721, 'LSP8TokenIdTypeNotEditable'); + context.lsp8CompatibleERC721.setData(ERC725YDataKeys.LSP8.LSP8TokenIdSchema, '0xdeadbeef'), + ).to.be.revertedWithCustomError(context.lsp8CompatibleERC721, 'LSP8TokenIdSchemaNotEditable'); }); }); describe('when setting data', () => { - it('should not allow to update the `LSP8TokenIdType` after deployment', async () => { + it('should not allow to update the `lsp8TokenIdSchema` after deployment', async () => { await expect( - context.lsp8CompatibleERC721.setData(ERC725YDataKeys.LSP8.LSP8TokenIdType, '0xdeadbeef'), - ).to.be.revertedWithCustomError(context.lsp8CompatibleERC721, 'LSP8TokenIdTypeNotEditable'); + context.lsp8CompatibleERC721.setData(ERC725YDataKeys.LSP8.LSP8TokenIdSchema, '0xdeadbeef'), + ).to.be.revertedWithCustomError(context.lsp8CompatibleERC721, 'LSP8TokenIdSchemaNotEditable'); }); }); @@ -1290,6 +1292,18 @@ export const shouldInitializeLikeLSP8CompatibleERC721 = ( .to.emit(context.lsp8CompatibleERC721, 'DataChanged') .withArgs(symbolKey, expectedSymbolValue); expect(await context.lsp8CompatibleERC721.getData(symbolKey)).to.equal(expectedSymbolValue); + + const tokenTypeKey = ERC725YDataKeys.LSP4['LSP4TokenType']; + const expectedTokenTypeValue = abiCoder.encode( + ['uint256'], + [context.deployParams.lsp4TokenType], + ); + await expect(context.initializeTransaction) + .to.emit(context.lsp8CompatibleERC721, 'DataChanged') + .withArgs(tokenTypeKey, expectedTokenTypeValue); + expect(await context.lsp8CompatibleERC721.getData(tokenTypeKey)).to.equal( + expectedTokenTypeValue, + ); }); describe('when using the functions from IERC721Metadata', () => { diff --git a/tests/LSP8IdentifiableDigitalAsset/LSP8Enumerable.behaviour.ts b/tests/LSP8IdentifiableDigitalAsset/LSP8Enumerable.behaviour.ts index 0be64bb05..c7e52c599 100644 --- a/tests/LSP8IdentifiableDigitalAsset/LSP8Enumerable.behaviour.ts +++ b/tests/LSP8IdentifiableDigitalAsset/LSP8Enumerable.behaviour.ts @@ -18,7 +18,8 @@ export type LSP8EnumerableDeployParams = { name: string; symbol: string; newOwner: string; - tokenIdType: number; + lsp4TokenType: number; + lsp8TokenIdSchema: number; }; export type LSP8EnumerableTestContext = { diff --git a/tests/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.behaviour.ts b/tests/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.behaviour.ts index ab3459fd0..dcfca19c7 100644 --- a/tests/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.behaviour.ts +++ b/tests/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.behaviour.ts @@ -44,7 +44,8 @@ export type LSP8DeployParams = { name: string; symbol: string; newOwner: string; - tokenIdType: number; + lsp4TokenType: number; + lsp8TokenIdSchema: number; }; export type LSP8TestContext = { @@ -72,18 +73,18 @@ export const shouldBehaveLikeLSP8 = ( }); describe('when setting data', () => { - it('should not allow to update the `LSP8TokenIdType` after deployment', async () => { + it('should not allow to update the `LSP8TokenIdSchema` after deployment', async () => { await expect( - context.lsp8.setData(ERC725YDataKeys.LSP8.LSP8TokenIdType, '0xdeadbeef'), - ).to.be.revertedWithCustomError(context.lsp8, 'LSP8TokenIdTypeNotEditable'); + context.lsp8.setData(ERC725YDataKeys.LSP8.LSP8TokenIdSchema, '0xdeadbeef'), + ).to.be.revertedWithCustomError(context.lsp8, 'LSP8TokenIdSchemaNotEditable'); }); }); describe('when setting data', () => { - it('should not allow to update the `LSP8TokenIdType` after deployment', async () => { + it('should not allow to update the `LSP8TokenIdSchema` after deployment', async () => { await expect( - context.lsp8.setData(ERC725YDataKeys.LSP8.LSP8TokenIdType, '0xdeadbeef'), - ).to.be.revertedWithCustomError(context.lsp8, 'LSP8TokenIdTypeNotEditable'); + context.lsp8.setData(ERC725YDataKeys.LSP8.LSP8TokenIdSchema, '0xdeadbeef'), + ).to.be.revertedWithCustomError(context.lsp8, 'LSP8TokenIdSchemaNotEditable'); }); }); @@ -2267,15 +2268,27 @@ export const shouldInitializeLikeLSP8 = ( .withArgs(symbolKey, expectedSymbolValue); expect(await context.lsp8.getData(symbolKey)).to.equal(expectedSymbolValue); - const lsp8TokenIdTypeDataKey = ERC725YDataKeys.LSP8['LSP8TokenIdType']; + const lsp4TokenTypeKey = ERC725YDataKeys.LSP4['LSP4TokenType']; + const expectedTokenTypeValue = abiCoder.encode( + ['uint256'], + [context.deployParams.lsp4TokenType], + ); + await expect(context.initializeTransaction) + .to.emit(context.lsp8, 'DataChanged') + .withArgs(lsp4TokenTypeKey, expectedTokenTypeValue); + expect(await context.lsp8.getData(lsp4TokenTypeKey)).to.equal(expectedTokenTypeValue); + + const lsp8TokenIdSchemaDataKey = ERC725YDataKeys.LSP8['LSP8TokenIdSchema']; const expectedTokenIdDataValue = abiCoder.encode( ['uint256'], - [context.deployParams.tokenIdType], + [context.deployParams.lsp8TokenIdSchema], ); await expect(context.initializeTransaction) .to.emit(context.lsp8, 'DataChanged') - .withArgs(lsp8TokenIdTypeDataKey, expectedTokenIdDataValue); - expect(await context.lsp8.getData(lsp8TokenIdTypeDataKey)).to.equal(expectedTokenIdDataValue); + .withArgs(lsp8TokenIdSchemaDataKey, expectedTokenIdDataValue); + expect(await context.lsp8.getData(lsp8TokenIdSchemaDataKey)).to.equal( + expectedTokenIdDataValue, + ); }); }); }; diff --git a/tests/LSP8IdentifiableDigitalAsset/LSP8Mintable.behaviour.ts b/tests/LSP8IdentifiableDigitalAsset/LSP8Mintable.behaviour.ts index da558a2ca..e8af41d58 100644 --- a/tests/LSP8IdentifiableDigitalAsset/LSP8Mintable.behaviour.ts +++ b/tests/LSP8IdentifiableDigitalAsset/LSP8Mintable.behaviour.ts @@ -28,7 +28,8 @@ export type LSP8MintableDeployParams = { name: string; symbol: string; newOwner: string; - tokenIdType: number; + lsp4TokenType: number; + lsp8TokenIdSchema: number; }; export type LSP8MintableTestContext = { diff --git a/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8BurnableInit.test.ts b/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8BurnableInit.test.ts index f6d1cf7db..d7b01b8f6 100644 --- a/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8BurnableInit.test.ts +++ b/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8BurnableInit.test.ts @@ -7,7 +7,7 @@ import { LSP8BurnableInitTester, LSP8BurnableInitTester__factory } from '../../. import { shouldInitializeLikeLSP8 } from '../LSP8IdentifiableDigitalAsset.behaviour'; import { deployProxy } from '../../utils/fixtures'; -import { LSP8_TOKEN_ID_TYPES } from '../../../constants'; +import { LSP4_TOKEN_TYPES, LSP8_TOKEN_ID_SCHEMA } from '../../../constants'; type LSP8BurnableInitTestContext = { accounts: SignerWithAddress[]; @@ -16,7 +16,8 @@ type LSP8BurnableInitTestContext = { name: string; symbol: string; newOwner: string; - tokenIdType: number; + lsp4TokenType: number; + lsp8TokenIdSchema: number; }; }; @@ -27,7 +28,8 @@ describe('LSP8BurnableInit with proxy', () => { name: 'LSP8 Burnable - deployed with constructor', symbol: 'BRN', newOwner: accounts[0].address, - tokenIdType: LSP8_TOKEN_ID_TYPES.NUMBER, + lsp4TokenType: LSP4_TOKEN_TYPES.NFT, + lsp8TokenIdSchema: LSP8_TOKEN_ID_SCHEMA.NUMBER, }; const lsp8BurnableImplementation = await new LSP8BurnableInitTester__factory( @@ -44,7 +46,8 @@ describe('LSP8BurnableInit with proxy', () => { context.deployParams.name, context.deployParams.symbol, context.deployParams.newOwner, - context.deployParams.tokenIdType, + context.deployParams.lsp4TokenType, + context.deployParams.lsp8TokenIdSchema, ); }; diff --git a/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8CappedSupplyInit.test.ts b/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8CappedSupplyInit.test.ts index b1091b1b4..bc74500f6 100644 --- a/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8CappedSupplyInit.test.ts +++ b/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8CappedSupplyInit.test.ts @@ -10,7 +10,7 @@ import { } from '../LSP8CappedSupply.behaviour'; import { deployProxy } from '../../utils/fixtures'; -import { LSP8_TOKEN_ID_TYPES } from '../../../constants'; +import { LSP4_TOKEN_TYPES, LSP8_TOKEN_ID_SCHEMA } from '../../../constants'; describe('LSP8CappedSupplyInit with proxy', () => { const buildTestContext = async () => { @@ -19,7 +19,8 @@ describe('LSP8CappedSupplyInit with proxy', () => { name: 'LSP8 capped supply - deployed with proxy', symbol: 'CAP', newOwner: accounts.owner.address, - tokenIdType: LSP8_TOKEN_ID_TYPES.NUMBER, + lsp4TokenType: LSP4_TOKEN_TYPES.NFT, + lsp8TokenIdSchema: LSP8_TOKEN_ID_SCHEMA.NUMBER, tokenSupplyCap: ethers.BigNumber.from('2'), }; const lsp8CappedSupplyInit = await new LSP8CappedSupplyInitTester__factory( @@ -32,11 +33,12 @@ describe('LSP8CappedSupplyInit with proxy', () => { }; const initializeProxy = async (context: LSP8CappedSupplyTestContext) => { - return context.lsp8CappedSupply['initialize(string,string,address,uint256,uint256)']( + return context.lsp8CappedSupply['initialize(string,string,address,uint256,uint256,uint256)']( context.deployParams.name, context.deployParams.symbol, context.deployParams.newOwner, - context.deployParams.tokenIdType, + context.deployParams.lsp4TokenType, + context.deployParams.lsp8TokenIdSchema, context.deployParams.tokenSupplyCap, ); }; diff --git a/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8CompatibleERC721Init.test.ts b/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8CompatibleERC721Init.test.ts index cf444cca8..9f751f48f 100644 --- a/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8CompatibleERC721Init.test.ts +++ b/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8CompatibleERC721Init.test.ts @@ -14,7 +14,7 @@ import { } from '../LSP8CompatibleERC721.behaviour'; import { deployProxy } from '../../utils/fixtures'; -import { LSP8_TOKEN_ID_TYPES } from '../../../constants'; +import { LSP4_TOKEN_TYPES, LSP8_TOKEN_ID_SCHEMA } from '../../../constants'; describe('LSP8CompatibleERC721Init with proxy', () => { const buildTestContext = async (): Promise => { @@ -32,7 +32,8 @@ describe('LSP8CompatibleERC721Init with proxy', () => { name: 'LSP8 - deployed with constructor', symbol: 'NFT', newOwner: accounts.owner.address, - tokenIdType: LSP8_TOKEN_ID_TYPES.NUMBER, + lsp4TokenType: LSP4_TOKEN_TYPES.NFT, + lsp8TokenIdSchema: LSP8_TOKEN_ID_SCHEMA.NUMBER, lsp4MetadataValue, }; @@ -49,11 +50,12 @@ describe('LSP8CompatibleERC721Init with proxy', () => { }; const initializeProxy = async (context: LSP8CompatibleERC721TestContext) => { - return context.lsp8CompatibleERC721['initialize(string,string,address,uint256,bytes)']( + return context.lsp8CompatibleERC721['initialize(string,string,address,uint256,uint256,bytes)']( context.deployParams.name, context.deployParams.symbol, context.deployParams.newOwner, - context.deployParams.tokenIdType, + context.deployParams.lsp4TokenType, + context.deployParams.lsp8TokenIdSchema, context.deployParams.lsp4MetadataValue, ); }; @@ -68,11 +70,12 @@ describe('LSP8CompatibleERC721Init with proxy', () => { const randomCaller = accounts[1]; await expect( - lsp8CompatibilityForERC721TesterInit['initialize(string,string,address,uint256,bytes)']( + lsp8CompatibilityForERC721TesterInit.initialize( 'XXXXXXXXXXX', 'XXX', randomCaller.address, - 0, + 12345, + 6789, '0x', ), ).to.be.revertedWith('Initializable: contract is already initialized'); @@ -88,7 +91,13 @@ describe('LSP8CompatibleERC721Init with proxy', () => { const randomCaller = accounts[1]; await expect( - lsp8CompatibleERC721MintableInit.initialize('XXXXXXXXXXX', 'XXX', randomCaller.address, 0), + lsp8CompatibleERC721MintableInit.initialize( + 'XXXXXXXXXXX', + 'XXX', + randomCaller.address, + 12345, + 6789, + ), ).to.be.revertedWith('Initializable: contract is already initialized'); }); }); diff --git a/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8EnumerableInit.test.ts b/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8EnumerableInit.test.ts index 7aae65422..0bd2e8c4e 100644 --- a/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8EnumerableInit.test.ts +++ b/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8EnumerableInit.test.ts @@ -9,7 +9,7 @@ import { } from '../LSP8Enumerable.behaviour'; import { deployProxy } from '../../utils/fixtures'; -import { LSP8_TOKEN_ID_TYPES } from '../../../constants'; +import { LSP4_TOKEN_TYPES, LSP8_TOKEN_ID_SCHEMA } from '../../../constants'; describe('LSP8EnumerableInit with proxy', () => { const buildTestContext = async () => { @@ -18,7 +18,8 @@ describe('LSP8EnumerableInit with proxy', () => { name: 'LSP8 Enumerable - deployed with proxy', symbol: 'LSP8 NMRBL', newOwner: accounts.owner.address, - tokenIdType: LSP8_TOKEN_ID_TYPES.NUMBER, + lsp4TokenType: LSP4_TOKEN_TYPES.NFT, + lsp8TokenIdSchema: LSP8_TOKEN_ID_SCHEMA.NUMBER, }; const LSP8EnumerableInit: LSP8EnumerableInitTester = @@ -31,11 +32,12 @@ describe('LSP8EnumerableInit with proxy', () => { }; const initializeProxy = async (context: LSP8EnumerableTestContext) => { - return context.lsp8Enumerable['initialize(string,string,address,uint256)']( + return context.lsp8Enumerable['initialize(string,string,address,uint256,uint256)']( context.deployParams.name, context.deployParams.symbol, context.deployParams.newOwner, - context.deployParams.tokenIdType, + context.deployParams.lsp4TokenType, + context.deployParams.lsp8TokenIdSchema, ); }; diff --git a/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8IdentifiableDigitalAssetInit.test.ts b/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8IdentifiableDigitalAssetInit.test.ts index d016e2167..47170638b 100644 --- a/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8IdentifiableDigitalAssetInit.test.ts +++ b/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8IdentifiableDigitalAssetInit.test.ts @@ -16,6 +16,7 @@ import { } from '../../LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.behaviour'; import { deployProxy } from '../../utils/fixtures'; +import { LSP4_TOKEN_TYPES } from '../../../constants'; describe('LSP8IdentifiableDigitalAssetInit with proxy', () => { const buildTestContext = async (nftType: number): Promise => { @@ -24,7 +25,8 @@ describe('LSP8IdentifiableDigitalAssetInit with proxy', () => { name: 'LSP8 - deployed with constructor', symbol: 'NFT', newOwner: accounts.owner.address, - tokenIdType: nftType, + lsp4TokenType: LSP4_TOKEN_TYPES.NFT, + lsp8TokenIdSchema: nftType, }; const lsp8TesterInit = await new LSP8InitTester__factory(accounts.owner).deploy(); @@ -41,6 +43,7 @@ describe('LSP8IdentifiableDigitalAssetInit with proxy', () => { const deployParams = { owner: accounts[0], + lsp4TokenType: LSP4_TOKEN_TYPES.NFT, }; return { @@ -51,11 +54,12 @@ describe('LSP8IdentifiableDigitalAssetInit with proxy', () => { }; const initializeProxy = async (context: LSP8TestContext) => { - return context.lsp8['initialize(string,string,address,uint256)']( + return context.lsp8['initialize(string,string,address,uint256,uint256)']( context.deployParams.name, context.deployParams.symbol, context.deployParams.newOwner, - context.deployParams.tokenIdType, + context.deployParams.lsp4TokenType, + context.deployParams.lsp8TokenIdSchema, ); }; @@ -68,11 +72,12 @@ describe('LSP8IdentifiableDigitalAssetInit with proxy', () => { it('should revert when initializing with address(0) as owner', async () => { await expect( - context.lsp8['initialize(string,string,address,uint256)']( + context.lsp8['initialize(string,string,address,uint256,uint256)']( context.deployParams.name, context.deployParams.symbol, ethers.constants.AddressZero, 0, + context.deployParams.lsp4TokenType, ), ).to.be.revertedWithCustomError(context.lsp8, 'OwnableCannotSetZeroAddressAsOwner'); }); @@ -103,11 +108,12 @@ describe('LSP8IdentifiableDigitalAssetInit with proxy', () => { shouldBehaveLikeLSP4DigitalAssetMetadata(async () => { const lsp4Context = await buildLSP4DigitalAssetMetadataTestContext(); - await lsp4Context.contract['initialize(string,string,address,uint256)']( + await lsp4Context.contract['initialize(string,string,address,uint256,uint256)']( 'LSP8 - deployed with proxy', 'NFT', lsp4Context.deployParams.owner.address, 0, + lsp4Context.deployParams.lsp4TokenType, ); return lsp4Context; diff --git a/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8MintableInit.test.ts b/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8MintableInit.test.ts index 9843cffcb..41134e3f3 100644 --- a/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8MintableInit.test.ts +++ b/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8MintableInit.test.ts @@ -10,7 +10,7 @@ import { } from '../LSP8Mintable.behaviour'; import { deployProxy } from '../../utils/fixtures'; -import { ERC725YDataKeys, LSP8_TOKEN_ID_TYPES } from '../../../constants'; +import { ERC725YDataKeys, LSP4_TOKEN_TYPES, LSP8_TOKEN_ID_SCHEMA } from '../../../constants'; describe('LSP8MintableInit with proxy', () => { const buildTestContext = async () => { @@ -19,7 +19,8 @@ describe('LSP8MintableInit with proxy', () => { name: 'LSP8 Mintable - deployed with proxy', symbol: 'MNTBL', newOwner: accounts.owner.address, - tokenIdType: LSP8_TOKEN_ID_TYPES.NUMBER, + lsp4TokenType: LSP4_TOKEN_TYPES.NFT, + lsp8TokenIdSchema: LSP8_TOKEN_ID_SCHEMA.NUMBER, }; const LSP8MintableInit: LSP8MintableInit = await new LSP8MintableInit__factory( @@ -33,11 +34,12 @@ describe('LSP8MintableInit with proxy', () => { }; const initializeProxy = async (context: LSP8MintableTestContext) => { - return context.lsp8Mintable['initialize(string,string,address,uint256)']( + return context.lsp8Mintable['initialize(string,string,address,uint256,uint256)']( context.deployParams.name, context.deployParams.symbol, context.deployParams.newOwner, - context.deployParams.tokenIdType, + context.deployParams.lsp4TokenType, + context.deployParams.lsp8TokenIdSchema, ); }; @@ -50,7 +52,8 @@ describe('LSP8MintableInit with proxy', () => { expect(await lsp8MintableInit.getData(ERC725YDataKeys.LSP4.LSP4TokenName)).to.equal('0x'); expect(await lsp8MintableInit.getData(ERC725YDataKeys.LSP4.LSP4TokenSymbol)).to.equal('0x'); expect(await lsp8MintableInit.getData(ERC725YDataKeys.LSP4.LSP4Metadata)).to.equal('0x'); - expect(await lsp8MintableInit.getData(ERC725YDataKeys.LSP8.LSP8TokenIdType)).to.equal('0x'); + expect(await lsp8MintableInit.getData(ERC725YDataKeys.LSP4.LSP4TokenType)).to.equal('0x'); + expect(await lsp8MintableInit.getData(ERC725YDataKeys.LSP8.LSP8TokenIdSchema)).to.equal('0x'); expect(await lsp8MintableInit.owner()).to.equal(ethers.constants.AddressZero); }); @@ -63,11 +66,12 @@ describe('LSP8MintableInit with proxy', () => { const randomCaller = accounts[1]; await expect( - lsp8Mintable['initialize(string,string,address,uint256)']( + lsp8Mintable['initialize(string,string,address,uint256,uint256)']( 'XXXXXXXXXXX', 'XXX', randomCaller.address, 0, + 12345, ), ).to.be.revertedWith('Initializable: contract is already initialized'); }); diff --git a/tests/LSP8IdentifiableDigitalAsset/standard/LSP8Burnable.test.ts b/tests/LSP8IdentifiableDigitalAsset/standard/LSP8Burnable.test.ts index 4170d7959..44304d035 100644 --- a/tests/LSP8IdentifiableDigitalAsset/standard/LSP8Burnable.test.ts +++ b/tests/LSP8IdentifiableDigitalAsset/standard/LSP8Burnable.test.ts @@ -4,7 +4,7 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; import { LSP8BurnableTester, LSP8BurnableTester__factory } from '../../../types'; import { shouldInitializeLikeLSP8 } from '../LSP8IdentifiableDigitalAsset.behaviour'; -import { LSP8_TOKEN_ID_TYPES } from '../../../constants'; +import { LSP4_TOKEN_TYPES, LSP8_TOKEN_ID_SCHEMA } from '../../../constants'; type LSP8BurnableTestContext = { accounts: SignerWithAddress[]; @@ -13,7 +13,8 @@ type LSP8BurnableTestContext = { name: string; symbol: string; newOwner: string; - tokenIdType: number; + lsp4TokenType: number; + lsp8TokenIdSchema: number; }; }; @@ -24,14 +25,16 @@ describe('LSP8Burnable with constructor', () => { name: 'LSP8 Burnable - deployed with constructor', symbol: 'BRN', newOwner: accounts[0].address, - tokenIdType: LSP8_TOKEN_ID_TYPES.NUMBER, + lsp4TokenType: LSP4_TOKEN_TYPES.NFT, + lsp8TokenIdSchema: LSP8_TOKEN_ID_SCHEMA.NUMBER, }; const lsp8Burnable = await new LSP8BurnableTester__factory(accounts[0]).deploy( deployParams.name, deployParams.symbol, deployParams.newOwner, - deployParams.tokenIdType, + deployParams.lsp4TokenType, + deployParams.lsp8TokenIdSchema, ); return { accounts, lsp8Burnable, deployParams }; diff --git a/tests/LSP8IdentifiableDigitalAsset/standard/LSP8CappedSupply.test.ts b/tests/LSP8IdentifiableDigitalAsset/standard/LSP8CappedSupply.test.ts index 9d3c85e41..d269c75eb 100644 --- a/tests/LSP8IdentifiableDigitalAsset/standard/LSP8CappedSupply.test.ts +++ b/tests/LSP8IdentifiableDigitalAsset/standard/LSP8CappedSupply.test.ts @@ -8,7 +8,7 @@ import { LSP8CappedSupplyTestContext, getNamedAccounts, } from '../LSP8CappedSupply.behaviour'; -import { LSP8_TOKEN_ID_TYPES } from '../../../constants'; +import { LSP4_TOKEN_TYPES, LSP8_TOKEN_ID_SCHEMA } from '../../../constants'; describe('LSP8CappedSupply with constructor', () => { const buildTestContext = async () => { @@ -17,14 +17,16 @@ describe('LSP8CappedSupply with constructor', () => { name: 'LSP8 capped supply - deployed with constructor', symbol: 'CAP', newOwner: accounts.owner.address, - tokenIdType: LSP8_TOKEN_ID_TYPES.NUMBER, + lsp4TokenType: LSP4_TOKEN_TYPES.NFT, + lsp8TokenIdSchema: LSP8_TOKEN_ID_SCHEMA.NUMBER, tokenSupplyCap: ethers.BigNumber.from('2'), }; const lsp8CappedSupply = await new LSP8CappedSupplyTester__factory(accounts.owner).deploy( deployParams.name, deployParams.symbol, deployParams.newOwner, - deployParams.tokenIdType, + deployParams.lsp4TokenType, + deployParams.lsp8TokenIdSchema, deployParams.tokenSupplyCap, ); diff --git a/tests/LSP8IdentifiableDigitalAsset/standard/LSP8CompatibleERC721.test.ts b/tests/LSP8IdentifiableDigitalAsset/standard/LSP8CompatibleERC721.test.ts index e55499f8f..b009e0bcc 100644 --- a/tests/LSP8IdentifiableDigitalAsset/standard/LSP8CompatibleERC721.test.ts +++ b/tests/LSP8IdentifiableDigitalAsset/standard/LSP8CompatibleERC721.test.ts @@ -8,7 +8,7 @@ import { shouldInitializeLikeLSP8CompatibleERC721, LSP8CompatibleERC721TestContext, } from '../LSP8CompatibleERC721.behaviour'; -import { LSP8_TOKEN_ID_TYPES } from '../../../constants'; +import { LSP4_TOKEN_TYPES, LSP8_TOKEN_ID_SCHEMA } from '../../../constants'; describe('LSP8CompatibleERC721 with constructor', () => { const buildTestContext = async (): Promise => { @@ -26,7 +26,8 @@ describe('LSP8CompatibleERC721 with constructor', () => { name: 'Compat for ERC721', symbol: 'NFT', newOwner: accounts.owner.address, - tokenIdType: LSP8_TOKEN_ID_TYPES.NUMBER, + lsp4TokenType: LSP4_TOKEN_TYPES.NFT, + lsp8TokenIdSchema: LSP8_TOKEN_ID_SCHEMA.NUMBER, lsp4MetadataValue, }; @@ -36,7 +37,8 @@ describe('LSP8CompatibleERC721 with constructor', () => { deployParams.name, deployParams.symbol, deployParams.newOwner, - deployParams.tokenIdType, + deployParams.lsp4TokenType, + deployParams.lsp8TokenIdSchema, deployParams.lsp4MetadataValue, ); diff --git a/tests/LSP8IdentifiableDigitalAsset/standard/LSP8Enumerable.test.ts b/tests/LSP8IdentifiableDigitalAsset/standard/LSP8Enumerable.test.ts index e78b97336..98e9425fa 100644 --- a/tests/LSP8IdentifiableDigitalAsset/standard/LSP8Enumerable.test.ts +++ b/tests/LSP8IdentifiableDigitalAsset/standard/LSP8Enumerable.test.ts @@ -6,7 +6,7 @@ import { LSP8EnumerableTestContext, getNamedAccounts, } from '../LSP8Enumerable.behaviour'; -import { LSP8_TOKEN_ID_TYPES } from '../../../constants'; +import { LSP4_TOKEN_TYPES, LSP8_TOKEN_ID_SCHEMA } from '../../../constants'; describe('LSP8Enumerable with constructor', () => { const buildTestContext = async () => { @@ -16,7 +16,8 @@ describe('LSP8Enumerable with constructor', () => { name: 'LSP8 Enumerable - deployed with constructor', symbol: 'LSP8 NMRBL', newOwner: accounts.owner.address, - tokenIdType: LSP8_TOKEN_ID_TYPES.NUMBER, + lsp4TokenType: LSP4_TOKEN_TYPES.NFT, + lsp8TokenIdSchema: LSP8_TOKEN_ID_SCHEMA.NUMBER, }; const lsp8Enumerable: LSP8EnumerableTester = await new LSP8EnumerableTester__factory( @@ -25,7 +26,8 @@ describe('LSP8Enumerable with constructor', () => { deployParams.name, deployParams.symbol, deployParams.newOwner, - deployParams.tokenIdType, + deployParams.lsp4TokenType, + deployParams.lsp8TokenIdSchema, ); return { accounts, lsp8Enumerable, deployParams }; diff --git a/tests/LSP8IdentifiableDigitalAsset/standard/LSP8IdentifiableDigitalAsset.test.ts b/tests/LSP8IdentifiableDigitalAsset/standard/LSP8IdentifiableDigitalAsset.test.ts index 3d5d14d07..0b7553e19 100644 --- a/tests/LSP8IdentifiableDigitalAsset/standard/LSP8IdentifiableDigitalAsset.test.ts +++ b/tests/LSP8IdentifiableDigitalAsset/standard/LSP8IdentifiableDigitalAsset.test.ts @@ -19,7 +19,7 @@ import { LS4DigitalAssetMetadataTestContext, shouldBehaveLikeLSP4DigitalAssetMetadata, } from '../../LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.behaviour'; -import { LSP8_TOKEN_ID_TYPES } from '../../../constants'; +import { LSP4_TOKEN_TYPES, LSP8_TOKEN_ID_SCHEMA } from '../../../constants'; describe('LSP8IdentifiableDigitalAsset with constructor', () => { const buildTestContext = async (nftType: number): Promise => { @@ -28,13 +28,15 @@ describe('LSP8IdentifiableDigitalAsset with constructor', () => { name: 'LSP8 - deployed with constructor', symbol: 'NFT', newOwner: accounts.owner.address, - tokenIdType: nftType, + lsp4TokenType: LSP4_TOKEN_TYPES.NFT, + lsp8TokenIdSchema: nftType, }; const lsp8 = await new LSP8Tester__factory(accounts.owner).deploy( deployParams.name, deployParams.symbol, deployParams.newOwner, - deployParams.tokenIdType, + deployParams.lsp4TokenType, + deployParams.lsp8TokenIdSchema, ); return { accounts, lsp8, deployParams }; @@ -42,11 +44,12 @@ describe('LSP8IdentifiableDigitalAsset with constructor', () => { const buildLSP4DigitalAssetMetadataTestContext = async (): Promise => { - const { lsp8 } = await buildTestContext(LSP8_TOKEN_ID_TYPES.NUMBER); + const { lsp8 } = await buildTestContext(LSP8_TOKEN_ID_SCHEMA.NUMBER); const accounts = await ethers.getSigners(); const deployParams = { owner: accounts[0], + lsp4TokenType: LSP4_TOKEN_TYPES.NFT, }; return { @@ -63,13 +66,15 @@ describe('LSP8IdentifiableDigitalAsset with constructor', () => { name: 'LSP8 - deployed with constructor', symbol: 'NFT', owner: accounts[0], - tokenIdType: LSP8_TOKEN_ID_TYPES.NUMBER, + lsp4TokenType: LSP4_TOKEN_TYPES.NFT, + lsp8TokenIdSchema: LSP8_TOKEN_ID_SCHEMA.NUMBER, }; const contract = await new LSP8Tester__factory(accounts[0]).deploy( deployParams.name, deployParams.symbol, deployParams.owner.address, - deployParams.tokenIdType, + deployParams.lsp4TokenType, + deployParams.lsp8TokenIdSchema, ); return { accounts, contract, deployParams }; @@ -83,6 +88,7 @@ describe('LSP8IdentifiableDigitalAsset with constructor', () => { name: 'LSP8 - deployed with constructor', symbol: 'NFT', newOwner: ethers.constants.AddressZero, + lsp4TokenType: LSP4_TOKEN_TYPES.NFT, }; const contractToDeploy = new LSP8Tester__factory(accounts[0]); @@ -92,7 +98,8 @@ describe('LSP8IdentifiableDigitalAsset with constructor', () => { deployParams.name, deployParams.symbol, ethers.constants.AddressZero, - LSP8_TOKEN_ID_TYPES.NUMBER, + deployParams.lsp4TokenType, + LSP8_TOKEN_ID_SCHEMA.NUMBER, ), ).to.be.revertedWithCustomError(contractToDeploy, 'OwnableCannotSetZeroAddressAsOwner'); }); diff --git a/tests/LSP8IdentifiableDigitalAsset/standard/LSP8Mintable.test.ts b/tests/LSP8IdentifiableDigitalAsset/standard/LSP8Mintable.test.ts index 79b77d849..19a12372d 100644 --- a/tests/LSP8IdentifiableDigitalAsset/standard/LSP8Mintable.test.ts +++ b/tests/LSP8IdentifiableDigitalAsset/standard/LSP8Mintable.test.ts @@ -1,4 +1,4 @@ -import { LSP8_TOKEN_ID_TYPES } from '../../../constants'; +import { LSP4_TOKEN_TYPES, LSP8_TOKEN_ID_SCHEMA } from '../../../constants'; import { LSP8Mintable, LSP8Mintable__factory } from '../../../types'; import { shouldInitializeLikeLSP8 } from '../LSP8IdentifiableDigitalAsset.behaviour'; @@ -16,14 +16,16 @@ describe('LSP8Mintable with constructor', () => { name: 'LSP8 Mintable - deployed with constructor', symbol: 'LSP8 MNTBL', newOwner: accounts.owner.address, - tokenIdType: LSP8_TOKEN_ID_TYPES.NUMBER, + lsp4TokenType: LSP4_TOKEN_TYPES.NFT, + lsp8TokenIdSchema: LSP8_TOKEN_ID_SCHEMA.NUMBER, }; const lsp8Mintable: LSP8Mintable = await new LSP8Mintable__factory(accounts.owner).deploy( deployParams.name, deployParams.symbol, deployParams.newOwner, - deployParams.tokenIdType, + deployParams.lsp4TokenType, + deployParams.lsp8TokenIdSchema, ); return { accounts, lsp8Mintable, deployParams }; diff --git a/tests/foundry/GasTests/execute/RestrictedController.sol b/tests/foundry/GasTests/execute/RestrictedController.sol index a7bf58cf0..56b1ffda8 100644 --- a/tests/foundry/GasTests/execute/RestrictedController.sol +++ b/tests/foundry/GasTests/execute/RestrictedController.sol @@ -10,6 +10,10 @@ import "../../../../contracts/Mocks/Tokens/LSP8Tester.sol"; import { _LSP1_UNIVERSAL_RECEIVER_DELEGATE_KEY } from "../../../../contracts/LSP1UniversalReceiver/LSP1Constants.sol"; +import { + _LSP4_TOKEN_TYPE_TOKEN, + _LSP4_TOKEN_TYPE_NFT +} from "../../../../contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol"; import { _LSP6KEY_ADDRESSPERMISSIONS_PERMISSIONS_PREFIX, _PERMISSION_SUPER_SETDATA, @@ -20,7 +24,7 @@ import { _PERMISSION_TRANSFERVALUE } from "../../../../contracts/LSP6KeyManager/LSP6Constants.sol"; import { - _LSP8_TOKENID_TYPE_NUMBER + _LSP8_TOKENID_SCHEMA_NUMBER } from "../../../../contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol"; import "../UniversalProfileTestsHelper.sol"; @@ -442,7 +446,8 @@ contract ExecuteRestrictedController is UniversalProfileTestsHelper { "TestLSP8", "TSTLSP8", digitalAssetsOwner, - _LSP8_TOKENID_TYPE_NUMBER + _LSP4_TOKEN_TYPE_NFT, + _LSP8_TOKENID_SCHEMA_NUMBER ); bytes32 tokenID = bytes32(uint256(1)); @@ -467,7 +472,8 @@ contract ExecuteRestrictedController is UniversalProfileTestsHelper { digitalAsset = new LSP7Tester( "TestLSP7", "TSTLSP7", - digitalAssetsOwner + digitalAssetsOwner, + _LSP4_TOKEN_TYPE_TOKEN ); // mint 100 tokens to UniversalProfile diff --git a/tests/foundry/GasTests/execute/UnrestrictedController.sol b/tests/foundry/GasTests/execute/UnrestrictedController.sol index 49ca3b07a..103719fc0 100644 --- a/tests/foundry/GasTests/execute/UnrestrictedController.sol +++ b/tests/foundry/GasTests/execute/UnrestrictedController.sol @@ -10,6 +10,10 @@ import "../../../../contracts/Mocks/Tokens/LSP8Tester.sol"; import { _LSP1_UNIVERSAL_RECEIVER_DELEGATE_KEY } from "../../../../contracts/LSP1UniversalReceiver/LSP1Constants.sol"; +import { + _LSP4_TOKEN_TYPE_TOKEN, + _LSP4_TOKEN_TYPE_NFT +} from "../../../../contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol"; import { _LSP6KEY_ADDRESSPERMISSIONS_PERMISSIONS_PREFIX, _PERMISSION_SUPER_SETDATA, @@ -18,7 +22,7 @@ import { _PERMISSION_SUPER_TRANSFERVALUE } from "../../../../contracts/LSP6KeyManager/LSP6Constants.sol"; import { - _LSP8_TOKENID_TYPE_NUMBER + _LSP8_TOKENID_SCHEMA_NUMBER } from "../../../../contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol"; import "../UniversalProfileTestsHelper.sol"; @@ -264,7 +268,8 @@ contract ExecuteUnrestrictedController is UniversalProfileTestsHelper { "TestLSP8", "TSTLSP8", digitalAssetsOwner, - _LSP8_TOKENID_TYPE_NUMBER + _LSP4_TOKEN_TYPE_NFT, + _LSP8_TOKENID_SCHEMA_NUMBER ); bytes32 tokenID = bytes32(uint256(1)); @@ -289,7 +294,8 @@ contract ExecuteUnrestrictedController is UniversalProfileTestsHelper { digitalAsset = new LSP7Tester( "TestLSP7", "TSTLSP7", - digitalAssetsOwner + digitalAssetsOwner, + _LSP4_TOKEN_TYPE_TOKEN ); // mint 100 tokens to UniversalProfile