diff --git a/constants.ts b/constants.ts index 486deeee0..d7db0ccf0 100644 --- a/constants.ts +++ b/constants.ts @@ -326,6 +326,21 @@ export const LSP1_TYPE_IDS = { '0xe32c7debcb817925ba4883fdbfc52797187f28f73f860641dab1a68d9b32902c', }; +// 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 + */ +export const LSP8_TOKENID_TYPES = { + NUMBER: 0, + STRING: 1, + UNIQUE_ID: 2, + HASH: 3, + ADDRESS: 4, +}; + // LSP25 // ---------- diff --git a/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol b/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol index 43433773f..ff681f4d3 100644 --- a/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol +++ b/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol @@ -25,3 +25,11 @@ bytes32 constant _TYPEID_LSP8_TOKENSRECIPIENT = 0x0b084a55ebf70fd3c06fd755269dac // keccak256('LSP8Tokens_OperatorNotification') bytes32 constant _TYPEID_LSP8_TOKENOPERATOR = 0x8a1c15a8799f71b547e08e2bcb2e85257e81b0a07eee2ce6712549eef1f00970; + +// --- Types of token IDs + +uint256 constant _LSP8_TOKENIDTYPE_NUMBER = 0; +uint256 constant _LSP8_TOKENIDTYPE_STRING = 1; +uint256 constant _LSP8_TOKENIDTYPE_UNIQUE_ID = 2; +uint256 constant _LSP8_TOKENIDTYPE_HASH = 3; +uint256 constant _LSP8_TOKENIDTYPE_ADDRESS = 4; diff --git a/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8BurnableInit.test.ts b/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8BurnableInit.test.ts index 4cafb3b66..5cdd48828 100644 --- a/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8BurnableInit.test.ts +++ b/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8BurnableInit.test.ts @@ -7,6 +7,7 @@ import { LSP8BurnableInitTester, LSP8BurnableInitTester__factory } from '../../. import { shouldInitializeLikeLSP8 } from '../LSP8IdentifiableDigitalAsset.behaviour'; import { deployProxy } from '../../utils/fixtures'; +import { LSP8_TOKENID_TYPES } from '../../../constants'; type LSP8BurnableInitTestContext = { accounts: SignerWithAddress[]; @@ -26,7 +27,7 @@ describe('LSP8BurnableInit with proxy', () => { name: 'LSP8 Burnable - deployed with constructor', symbol: 'BRN', newOwner: accounts[0].address, - tokenIdType: 0, + tokenIdType: LSP8_TOKENID_TYPES.NUMBER, }; const lsp8BurnableImplementation = await new LSP8BurnableInitTester__factory( diff --git a/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8CappedSupplyInit.test.ts b/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8CappedSupplyInit.test.ts index 713d27898..ba1811746 100644 --- a/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8CappedSupplyInit.test.ts +++ b/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8CappedSupplyInit.test.ts @@ -10,6 +10,7 @@ import { } from '../LSP8CappedSupply.behaviour'; import { deployProxy } from '../../utils/fixtures'; +import { LSP8_TOKENID_TYPES } from '../../../constants'; describe('LSP8CappedSupplyInit with proxy', () => { const buildTestContext = async () => { @@ -18,7 +19,7 @@ describe('LSP8CappedSupplyInit with proxy', () => { name: 'LSP8 capped supply - deployed with proxy', symbol: 'CAP', newOwner: accounts.owner.address, - tokenIdType: 0, + tokenIdType: LSP8_TOKENID_TYPES.NUMBER, tokenSupplyCap: ethers.BigNumber.from('2'), }; const lsp8CappedSupplyInit = await new LSP8CappedSupplyInitTester__factory( diff --git a/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8CompatibleERC721Init.test.ts b/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8CompatibleERC721Init.test.ts index 3ff0ea2da..32fc6c61a 100644 --- a/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8CompatibleERC721Init.test.ts +++ b/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8CompatibleERC721Init.test.ts @@ -14,6 +14,7 @@ import { } from '../LSP8CompatibleERC721.behaviour'; import { deployProxy } from '../../utils/fixtures'; +import { LSP8_TOKENID_TYPES } from '../../../constants'; describe('LSP8CompatibleERC721Init with proxy', () => { const buildTestContext = async (): Promise => { @@ -31,7 +32,7 @@ describe('LSP8CompatibleERC721Init with proxy', () => { name: 'LSP8 - deployed with constructor', symbol: 'NFT', newOwner: accounts.owner.address, - tokenIdType: 0, + tokenIdType: LSP8_TOKENID_TYPES.NUMBER, lsp4MetadataValue, }; diff --git a/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8EnumerableInit.test.ts b/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8EnumerableInit.test.ts index fb2f6d583..6c61aae7e 100644 --- a/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8EnumerableInit.test.ts +++ b/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8EnumerableInit.test.ts @@ -9,6 +9,7 @@ import { } from '../LSP8Enumerable.behaviour'; import { deployProxy } from '../../utils/fixtures'; +import { LSP8_TOKENID_TYPES } from '../../../constants'; describe('LSP8EnumerableInit with proxy', () => { const buildTestContext = async () => { @@ -17,7 +18,7 @@ describe('LSP8EnumerableInit with proxy', () => { name: 'LSP8 Enumerable - deployed with proxy', symbol: 'LSP8 NMRBL', newOwner: accounts.owner.address, - tokenIdType: 0, + tokenIdType: LSP8_TOKENID_TYPES.NUMBER, }; const LSP8EnumerableInit: LSP8EnumerableInitTester = diff --git a/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8MintableInit.test.ts b/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8MintableInit.test.ts index aaa91b2ce..5d52a3da7 100644 --- a/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8MintableInit.test.ts +++ b/tests/LSP8IdentifiableDigitalAsset/proxy/LSP8MintableInit.test.ts @@ -10,6 +10,7 @@ import { } from '../LSP8Mintable.behaviour'; import { deployProxy } from '../../utils/fixtures'; +import { LSP8_TOKENID_TYPES } from '../../../constants'; describe('LSP8MintableInit with proxy', () => { const buildTestContext = async () => { @@ -18,7 +19,7 @@ describe('LSP8MintableInit with proxy', () => { name: 'LSP8 Mintable - deployed with proxy', symbol: 'MNTBL', newOwner: accounts.owner.address, - tokenIdType: 0, + tokenIdType: LSP8_TOKENID_TYPES.NUMBER, }; const LSP8MintableInit: LSP8MintableInit = await new LSP8MintableInit__factory( diff --git a/tests/LSP8IdentifiableDigitalAsset/standard/LSP8Burnable.test.ts b/tests/LSP8IdentifiableDigitalAsset/standard/LSP8Burnable.test.ts index 8377b0970..24aab6554 100644 --- a/tests/LSP8IdentifiableDigitalAsset/standard/LSP8Burnable.test.ts +++ b/tests/LSP8IdentifiableDigitalAsset/standard/LSP8Burnable.test.ts @@ -4,6 +4,7 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; import { LSP8BurnableTester, LSP8BurnableTester__factory } from '../../../types'; import { shouldInitializeLikeLSP8 } from '../LSP8IdentifiableDigitalAsset.behaviour'; +import { LSP8_TOKENID_TYPES } from '../../../constants'; type LSP8BurnableTestContext = { accounts: SignerWithAddress[]; @@ -23,7 +24,7 @@ describe('LSP8Burnable with constructor', () => { name: 'LSP8 Burnable - deployed with constructor', symbol: 'BRN', newOwner: accounts[0].address, - tokenIdType: 0, + tokenIdType: LSP8_TOKENID_TYPES.NUMBER, }; const lsp8Burnable = await new LSP8BurnableTester__factory(accounts[0]).deploy( diff --git a/tests/LSP8IdentifiableDigitalAsset/standard/LSP8CappedSupply.test.ts b/tests/LSP8IdentifiableDigitalAsset/standard/LSP8CappedSupply.test.ts index b6b62989d..3e6c870bf 100644 --- a/tests/LSP8IdentifiableDigitalAsset/standard/LSP8CappedSupply.test.ts +++ b/tests/LSP8IdentifiableDigitalAsset/standard/LSP8CappedSupply.test.ts @@ -8,6 +8,7 @@ import { LSP8CappedSupplyTestContext, getNamedAccounts, } from '../LSP8CappedSupply.behaviour'; +import { LSP8_TOKENID_TYPES } from '../../../constants'; describe('LSP8CappedSupply with constructor', () => { const buildTestContext = async () => { @@ -16,7 +17,7 @@ describe('LSP8CappedSupply with constructor', () => { name: 'LSP8 capped supply - deployed with constructor', symbol: 'CAP', newOwner: accounts.owner.address, - tokenIdType: 0, + tokenIdType: LSP8_TOKENID_TYPES.NUMBER, tokenSupplyCap: ethers.BigNumber.from('2'), }; const lsp8CappedSupply = await new LSP8CappedSupplyTester__factory(accounts.owner).deploy( diff --git a/tests/LSP8IdentifiableDigitalAsset/standard/LSP8CompatibleERC721.test.ts b/tests/LSP8IdentifiableDigitalAsset/standard/LSP8CompatibleERC721.test.ts index 7908e197e..9d94d01f7 100644 --- a/tests/LSP8IdentifiableDigitalAsset/standard/LSP8CompatibleERC721.test.ts +++ b/tests/LSP8IdentifiableDigitalAsset/standard/LSP8CompatibleERC721.test.ts @@ -8,6 +8,7 @@ import { shouldInitializeLikeLSP8CompatibleERC721, LSP8CompatibleERC721TestContext, } from '../LSP8CompatibleERC721.behaviour'; +import { LSP8_TOKENID_TYPES } from '../../../constants'; describe('LSP8CompatibleERC721 with constructor', () => { const buildTestContext = async (): Promise => { @@ -25,7 +26,7 @@ describe('LSP8CompatibleERC721 with constructor', () => { name: 'Compat for ERC721', symbol: 'NFT', newOwner: accounts.owner.address, - tokenIdType: 0, + tokenIdType: LSP8_TOKENID_TYPES.NUMBER, lsp4MetadataValue, }; diff --git a/tests/LSP8IdentifiableDigitalAsset/standard/LSP8Enumerable.test.ts b/tests/LSP8IdentifiableDigitalAsset/standard/LSP8Enumerable.test.ts index fc8ad37f9..5689126ab 100644 --- a/tests/LSP8IdentifiableDigitalAsset/standard/LSP8Enumerable.test.ts +++ b/tests/LSP8IdentifiableDigitalAsset/standard/LSP8Enumerable.test.ts @@ -6,6 +6,7 @@ import { LSP8EnumerableTestContext, getNamedAccounts, } from '../LSP8Enumerable.behaviour'; +import { LSP8_TOKENID_TYPES } from '../../../constants'; describe('LSP8Enumerable with constructor', () => { const buildTestContext = async () => { @@ -15,7 +16,7 @@ describe('LSP8Enumerable with constructor', () => { name: 'LSP8 Enumerable - deployed with constructor', symbol: 'LSP8 NMRBL', newOwner: accounts.owner.address, - tokenIdType: 0, + tokenIdType: LSP8_TOKENID_TYPES.NUMBER, }; const lsp8Enumerable: LSP8EnumerableTester = await new LSP8EnumerableTester__factory( diff --git a/tests/LSP8IdentifiableDigitalAsset/standard/LSP8IdentifiableDigitalAsset.test.ts b/tests/LSP8IdentifiableDigitalAsset/standard/LSP8IdentifiableDigitalAsset.test.ts index b133958df..38abab0aa 100644 --- a/tests/LSP8IdentifiableDigitalAsset/standard/LSP8IdentifiableDigitalAsset.test.ts +++ b/tests/LSP8IdentifiableDigitalAsset/standard/LSP8IdentifiableDigitalAsset.test.ts @@ -19,6 +19,7 @@ import { LS4DigitalAssetMetadataTestContext, shouldBehaveLikeLSP4DigitalAssetMetadata, } from '../../LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.behaviour'; +import { LSP8_TOKENID_TYPES } from '../../../constants'; describe('LSP8IdentifiableDigitalAsset with constructor', () => { const buildTestContext = async (nftType: number): Promise => { @@ -62,7 +63,7 @@ describe('LSP8IdentifiableDigitalAsset with constructor', () => { name: 'LSP8 - deployed with constructor', symbol: 'NFT', owner: accounts[0], - tokenIdType: 0, + tokenIdType: LSP8_TOKENID_TYPES.NUMBER, }; const contract = await new LSP8Tester__factory(accounts[0]).deploy( deployParams.name, diff --git a/tests/LSP8IdentifiableDigitalAsset/standard/LSP8Mintable.test.ts b/tests/LSP8IdentifiableDigitalAsset/standard/LSP8Mintable.test.ts index 7a3dad6fc..122c943ed 100644 --- a/tests/LSP8IdentifiableDigitalAsset/standard/LSP8Mintable.test.ts +++ b/tests/LSP8IdentifiableDigitalAsset/standard/LSP8Mintable.test.ts @@ -1,3 +1,4 @@ +import { LSP8_TOKENID_TYPES } from '../../../constants'; import { LSP8Mintable, LSP8Mintable__factory } from '../../../types'; import { shouldInitializeLikeLSP8 } from '../LSP8IdentifiableDigitalAsset.behaviour'; @@ -15,7 +16,7 @@ describe('LSP8Mintable with constructor', () => { name: 'LSP8 Mintable - deployed with constructor', symbol: 'LSP8 MNTBL', newOwner: accounts.owner.address, - tokenIdType: 0, + tokenIdType: LSP8_TOKENID_TYPES.NUMBER, }; const lsp8Mintable: LSP8Mintable = await new LSP8Mintable__factory(accounts.owner).deploy(