@lukso/lsp8-contracts 0.15.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +3 -0
  2. package/artifacts/LSP8CappedSupply.json +959 -0
  3. package/artifacts/LSP8CappedSupplyInitAbstract.json +972 -0
  4. package/artifacts/LSP8IdentifiableDigitalAsset.json +936 -0
  5. package/artifacts/LSP8IdentifiableDigitalAssetInitAbstract.json +949 -0
  6. package/artifacts/LSP8Mintable.json +1006 -0
  7. package/artifacts/LSP8MintableInit.json +1026 -0
  8. package/contracts/ILSP8IdentifiableDigitalAsset.sol +328 -0
  9. package/contracts/LSP8Constants.sol +41 -0
  10. package/contracts/LSP8Errors.sol +118 -0
  11. package/contracts/LSP8IdentifiableDigitalAsset.sol +241 -0
  12. package/contracts/LSP8IdentifiableDigitalAssetCore.sol +806 -0
  13. package/contracts/LSP8IdentifiableDigitalAssetInitAbstract.sol +248 -0
  14. package/contracts/extensions/LSP8Burnable.sol +30 -0
  15. package/contracts/extensions/LSP8BurnableInitAbstract.sol +24 -0
  16. package/contracts/extensions/LSP8CappedSupply.sol +85 -0
  17. package/contracts/extensions/LSP8CappedSupplyInitAbstract.sol +88 -0
  18. package/contracts/extensions/LSP8Enumerable.sol +69 -0
  19. package/contracts/extensions/LSP8EnumerableInitAbstract.sol +64 -0
  20. package/contracts/presets/ILSP8Mintable.sol +33 -0
  21. package/contracts/presets/LSP8Mintable.sol +60 -0
  22. package/contracts/presets/LSP8MintableInit.sol +43 -0
  23. package/contracts/presets/LSP8MintableInitAbstract.sol +62 -0
  24. package/dist/index.cjs +33 -0
  25. package/dist/index.d.cts +29 -0
  26. package/dist/index.d.mts +29 -0
  27. package/dist/index.d.ts +29 -0
  28. package/dist/index.mjs +28 -0
  29. package/package.json +56 -0
  30. package/types/LSP8CappedSupply.ts +792 -0
  31. package/types/LSP8CappedSupplyInitAbstract.ts +824 -0
  32. package/types/LSP8IdentifiableDigitalAsset.ts +778 -0
  33. package/types/LSP8IdentifiableDigitalAssetInitAbstract.ts +813 -0
  34. package/types/LSP8Mintable.ts +797 -0
  35. package/types/LSP8MintableInit.ts +860 -0
  36. package/types/common.ts +131 -0
  37. package/types/contracts/LSP8IdentifiableDigitalAsset.ts +778 -0
  38. package/types/contracts/LSP8IdentifiableDigitalAssetInitAbstract.ts +813 -0
  39. package/types/contracts/extensions/LSP8CappedSupply.ts +792 -0
  40. package/types/contracts/extensions/LSP8CappedSupplyInitAbstract.ts +824 -0
  41. package/types/contracts/presets/LSP8Mintable.ts +797 -0
  42. package/types/contracts/presets/LSP8MintableInit.ts +860 -0
  43. package/types/index.ts +16 -0
@@ -0,0 +1,60 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.12;
3
+
4
+ // interfaces
5
+ import {ILSP8Mintable} from "./ILSP8Mintable.sol";
6
+
7
+ // modules
8
+ import {
9
+ LSP8IdentifiableDigitalAsset
10
+ } from "../LSP8IdentifiableDigitalAsset.sol";
11
+
12
+ /**
13
+ * @title LSP8IdentifiableDigitalAsset deployable preset contract with a public {mint} function callable only by the contract {owner}.
14
+ */
15
+ contract LSP8Mintable is LSP8IdentifiableDigitalAsset, ILSP8Mintable {
16
+ /**
17
+ * @notice Deploying a `LSP8Mintable` token contract with: token name = `name_`, token symbol = `symbol_`, and
18
+ * address `newOwner_` as the token contract owner.
19
+ *
20
+ * @param name_ The name of the token.
21
+ * @param symbol_ The symbol of the token.
22
+ * @param newOwner_ The owner of the token contract.
23
+ * @param lsp4TokenType_ The type of token this digital asset contract represents (`0` = Token, `1` = NFT, `2` = Collection).
24
+ * @param lsp8TokenIdFormat_ The format of tokenIds (= NFTs) that this contract will create.
25
+ */
26
+ constructor(
27
+ string memory name_,
28
+ string memory symbol_,
29
+ address newOwner_,
30
+ uint256 lsp4TokenType_,
31
+ uint256 lsp8TokenIdFormat_
32
+ )
33
+ LSP8IdentifiableDigitalAsset(
34
+ name_,
35
+ symbol_,
36
+ newOwner_,
37
+ lsp4TokenType_,
38
+ lsp8TokenIdFormat_
39
+ )
40
+ {}
41
+
42
+ /**
43
+ * @notice Minting tokenId `tokenId` for address `to` with the additional data `data` (Note: allow non-LSP1 recipient is set to `force`).
44
+ *
45
+ * @dev Public {_mint} function only callable by the {owner}.
46
+ *
47
+ * @param to The address that will receive the minted `tokenId`.
48
+ * @param tokenId The tokenId to mint.
49
+ * @param force Set to `false` to ensure that you are minting for a recipient that implements LSP1, `false` otherwise for forcing the minting.
50
+ * @param data Any addition data to be sent alongside the minting.
51
+ */
52
+ function mint(
53
+ address to,
54
+ bytes32 tokenId,
55
+ bool force,
56
+ bytes memory data
57
+ ) public virtual override onlyOwner {
58
+ _mint(to, tokenId, force, data);
59
+ }
60
+ }
@@ -0,0 +1,43 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.12;
3
+
4
+ // modules
5
+ import {LSP8MintableInitAbstract} from "./LSP8MintableInitAbstract.sol";
6
+
7
+ /**
8
+ * @dev LSP8IdentifiableDigitalAsset deployable preset contract (proxy version) with a public {mint} function callable only by the contract {owner}.
9
+ */
10
+ contract LSP8MintableInit is LSP8MintableInitAbstract {
11
+ /**
12
+ * @dev initialize (= lock) base implementation contract on deployment
13
+ */
14
+ constructor() {
15
+ _disableInitializers();
16
+ }
17
+
18
+ /**
19
+ * @notice Initializing a `LSP8MintableInit` token contract with: token name = `name_`, token symbol = `symbol_`, and
20
+ * address `newOwner_` as the token contract owner.
21
+ *
22
+ * @param name_ The name of the token.
23
+ * @param symbol_ The symbol of the token.
24
+ * @param newOwner_ The owner of the token contract.
25
+ * @param lsp4TokenType_ The type of token this digital asset contract represents (`0` = Token, `1` = NFT, `2` = Collection).
26
+ * @param lsp8TokenIdFormat_ The format of tokenIds (= NFTs) that this contract will create.
27
+ */
28
+ function initialize(
29
+ string memory name_,
30
+ string memory symbol_,
31
+ address newOwner_,
32
+ uint256 lsp4TokenType_,
33
+ uint256 lsp8TokenIdFormat_
34
+ ) external virtual initializer {
35
+ LSP8MintableInitAbstract._initialize(
36
+ name_,
37
+ symbol_,
38
+ newOwner_,
39
+ lsp4TokenType_,
40
+ lsp8TokenIdFormat_
41
+ );
42
+ }
43
+ }
@@ -0,0 +1,62 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.12;
3
+
4
+ // interfaces
5
+ import {ILSP8Mintable} from "./ILSP8Mintable.sol";
6
+ // modules
7
+ import {
8
+ LSP8IdentifiableDigitalAssetInitAbstract
9
+ } from "../LSP8IdentifiableDigitalAssetInitAbstract.sol";
10
+
11
+ /**
12
+ * @dev LSP8IdentifiableDigitalAsset deployable preset contract (inheritable proxy version) with a public {mint} function callable only by the contract {owner}.
13
+ */
14
+ abstract contract LSP8MintableInitAbstract is
15
+ LSP8IdentifiableDigitalAssetInitAbstract,
16
+ ILSP8Mintable
17
+ {
18
+ /**
19
+ * @notice Initialize a `LSP7MintableInitAbstract` token contract with: token name = `name_`, token symbol = `symbol_`, and
20
+ * address `newOwner_` as the token contract owner.
21
+ *
22
+ * @param name_ The name of the token.
23
+ * @param symbol_ The symbol of the token.
24
+ * @param newOwner_ The owner of the token contract.
25
+ * @param lsp4TokenType_ The type of token this digital asset contract represents (`0` = Token, `1` = NFT, `2` = Collection).
26
+ * @param lsp8TokenIdFormat_ The format of tokenIds (= NFTs) that this contract will create.
27
+ */
28
+ function _initialize(
29
+ string memory name_,
30
+ string memory symbol_,
31
+ address newOwner_,
32
+ uint256 lsp4TokenType_,
33
+ uint256 lsp8TokenIdFormat_
34
+ ) internal virtual override onlyInitializing {
35
+ LSP8IdentifiableDigitalAssetInitAbstract._initialize(
36
+ name_,
37
+ symbol_,
38
+ newOwner_,
39
+ lsp4TokenType_,
40
+ lsp8TokenIdFormat_
41
+ );
42
+ }
43
+
44
+ /**
45
+ * @notice Minting tokenId `tokenId` for address `to` with the additional data `data` (Note: allow non-LSP1 recipient is set to `force`).
46
+ *
47
+ * @dev Public {_mint} function only callable by the {owner}.
48
+ *
49
+ * @param to The address that will receive the minted `tokenId`.
50
+ * @param tokenId The tokenId to mint.
51
+ * @param force Set to `false` to ensure that you are minting for a recipient that implements LSP1, `false` otherwise for forcing the minting.
52
+ * @param data Any addition data to be sent alongside the minting.
53
+ */
54
+ function mint(
55
+ address to,
56
+ bytes32 tokenId,
57
+ bool force,
58
+ bytes memory data
59
+ ) public virtual override onlyOwner {
60
+ _mint(to, tokenId, force, data);
61
+ }
62
+ }
package/dist/index.cjs ADDED
@@ -0,0 +1,33 @@
1
+ 'use strict';
2
+
3
+ const INTERFACE_ID_LSP8 = "0x3a271706";
4
+ const LSP8DataKeys = {
5
+ LSP8TokenIdFormat: "0xf675e9361af1c1664c1868cfa3eb97672d6b1a513aa5b81dec34c9ee330e818d",
6
+ LSP8TokenMetadataBaseURI: "0x1a7628600c3bac7101f53697f48df381ddc36b9015e7d7c9c5633d1252aa2843",
7
+ LSP8ReferenceContract: "0x708e7b881795f2e6b6c2752108c177ec89248458de3bf69d0d43480b3e5034e6"
8
+ };
9
+ const LSP8_TYPE_IDS = {
10
+ // keccak256('LSP8Tokens_SenderNotification')
11
+ LSP8Tokens_SenderNotification: "0xb23eae7e6d1564b295b4c3e3be402d9a2f0776c57bdf365903496f6fa481ab00",
12
+ // keccak256('LSP8Tokens_RecipientNotification')
13
+ LSP8Tokens_RecipientNotification: "0x0b084a55ebf70fd3c06fd755269dac2212c4d3f0f4d09079780bfa50c1b2984d",
14
+ // keccak256('LSP8Tokens_OperatorNotification')
15
+ LSP8Tokens_OperatorNotification: "0x8a1c15a8799f71b547e08e2bcb2e85257e81b0a07eee2ce6712549eef1f00970"
16
+ };
17
+ const LSP8_TOKEN_ID_FORMAT = {
18
+ NUMBER: 0,
19
+ STRING: 1,
20
+ ADDRESS: 2,
21
+ UNIQUE_ID: 3,
22
+ HASH: 4,
23
+ MIXED_DEFAULT_NUMBER: 100,
24
+ MIXED_DEFAULT_STRING: 101,
25
+ MIXED_DEFAULT_ADDRESS: 102,
26
+ MIXED_DEFAULT_UNIQUE_ID: 103,
27
+ MIXED_DEFAULT_HASH: 104
28
+ };
29
+
30
+ exports.INTERFACE_ID_LSP8 = INTERFACE_ID_LSP8;
31
+ exports.LSP8DataKeys = LSP8DataKeys;
32
+ exports.LSP8_TOKEN_ID_FORMAT = LSP8_TOKEN_ID_FORMAT;
33
+ exports.LSP8_TYPE_IDS = LSP8_TYPE_IDS;
@@ -0,0 +1,29 @@
1
+ declare const INTERFACE_ID_LSP8 = "0x3a271706";
2
+ declare const LSP8DataKeys: {
3
+ LSP8TokenIdFormat: string;
4
+ LSP8TokenMetadataBaseURI: string;
5
+ LSP8ReferenceContract: string;
6
+ };
7
+ declare const LSP8_TYPE_IDS: {
8
+ LSP8Tokens_SenderNotification: string;
9
+ LSP8Tokens_RecipientNotification: string;
10
+ LSP8Tokens_OperatorNotification: string;
11
+ };
12
+ /**
13
+ * @dev List of LSP8 Token ID Formats that can be used to create different types of NFTs and represent each NFT identifiers (= tokenIds) differently.
14
+ * @see For details see: https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidformat
15
+ */
16
+ declare const LSP8_TOKEN_ID_FORMAT: {
17
+ NUMBER: number;
18
+ STRING: number;
19
+ ADDRESS: number;
20
+ UNIQUE_ID: number;
21
+ HASH: number;
22
+ MIXED_DEFAULT_NUMBER: number;
23
+ MIXED_DEFAULT_STRING: number;
24
+ MIXED_DEFAULT_ADDRESS: number;
25
+ MIXED_DEFAULT_UNIQUE_ID: number;
26
+ MIXED_DEFAULT_HASH: number;
27
+ };
28
+
29
+ export { INTERFACE_ID_LSP8, LSP8DataKeys, LSP8_TOKEN_ID_FORMAT, LSP8_TYPE_IDS };
@@ -0,0 +1,29 @@
1
+ declare const INTERFACE_ID_LSP8 = "0x3a271706";
2
+ declare const LSP8DataKeys: {
3
+ LSP8TokenIdFormat: string;
4
+ LSP8TokenMetadataBaseURI: string;
5
+ LSP8ReferenceContract: string;
6
+ };
7
+ declare const LSP8_TYPE_IDS: {
8
+ LSP8Tokens_SenderNotification: string;
9
+ LSP8Tokens_RecipientNotification: string;
10
+ LSP8Tokens_OperatorNotification: string;
11
+ };
12
+ /**
13
+ * @dev List of LSP8 Token ID Formats that can be used to create different types of NFTs and represent each NFT identifiers (= tokenIds) differently.
14
+ * @see For details see: https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidformat
15
+ */
16
+ declare const LSP8_TOKEN_ID_FORMAT: {
17
+ NUMBER: number;
18
+ STRING: number;
19
+ ADDRESS: number;
20
+ UNIQUE_ID: number;
21
+ HASH: number;
22
+ MIXED_DEFAULT_NUMBER: number;
23
+ MIXED_DEFAULT_STRING: number;
24
+ MIXED_DEFAULT_ADDRESS: number;
25
+ MIXED_DEFAULT_UNIQUE_ID: number;
26
+ MIXED_DEFAULT_HASH: number;
27
+ };
28
+
29
+ export { INTERFACE_ID_LSP8, LSP8DataKeys, LSP8_TOKEN_ID_FORMAT, LSP8_TYPE_IDS };
@@ -0,0 +1,29 @@
1
+ declare const INTERFACE_ID_LSP8 = "0x3a271706";
2
+ declare const LSP8DataKeys: {
3
+ LSP8TokenIdFormat: string;
4
+ LSP8TokenMetadataBaseURI: string;
5
+ LSP8ReferenceContract: string;
6
+ };
7
+ declare const LSP8_TYPE_IDS: {
8
+ LSP8Tokens_SenderNotification: string;
9
+ LSP8Tokens_RecipientNotification: string;
10
+ LSP8Tokens_OperatorNotification: string;
11
+ };
12
+ /**
13
+ * @dev List of LSP8 Token ID Formats that can be used to create different types of NFTs and represent each NFT identifiers (= tokenIds) differently.
14
+ * @see For details see: https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidformat
15
+ */
16
+ declare const LSP8_TOKEN_ID_FORMAT: {
17
+ NUMBER: number;
18
+ STRING: number;
19
+ ADDRESS: number;
20
+ UNIQUE_ID: number;
21
+ HASH: number;
22
+ MIXED_DEFAULT_NUMBER: number;
23
+ MIXED_DEFAULT_STRING: number;
24
+ MIXED_DEFAULT_ADDRESS: number;
25
+ MIXED_DEFAULT_UNIQUE_ID: number;
26
+ MIXED_DEFAULT_HASH: number;
27
+ };
28
+
29
+ export { INTERFACE_ID_LSP8, LSP8DataKeys, LSP8_TOKEN_ID_FORMAT, LSP8_TYPE_IDS };
package/dist/index.mjs ADDED
@@ -0,0 +1,28 @@
1
+ const INTERFACE_ID_LSP8 = "0x3a271706";
2
+ const LSP8DataKeys = {
3
+ LSP8TokenIdFormat: "0xf675e9361af1c1664c1868cfa3eb97672d6b1a513aa5b81dec34c9ee330e818d",
4
+ LSP8TokenMetadataBaseURI: "0x1a7628600c3bac7101f53697f48df381ddc36b9015e7d7c9c5633d1252aa2843",
5
+ LSP8ReferenceContract: "0x708e7b881795f2e6b6c2752108c177ec89248458de3bf69d0d43480b3e5034e6"
6
+ };
7
+ const LSP8_TYPE_IDS = {
8
+ // keccak256('LSP8Tokens_SenderNotification')
9
+ LSP8Tokens_SenderNotification: "0xb23eae7e6d1564b295b4c3e3be402d9a2f0776c57bdf365903496f6fa481ab00",
10
+ // keccak256('LSP8Tokens_RecipientNotification')
11
+ LSP8Tokens_RecipientNotification: "0x0b084a55ebf70fd3c06fd755269dac2212c4d3f0f4d09079780bfa50c1b2984d",
12
+ // keccak256('LSP8Tokens_OperatorNotification')
13
+ LSP8Tokens_OperatorNotification: "0x8a1c15a8799f71b547e08e2bcb2e85257e81b0a07eee2ce6712549eef1f00970"
14
+ };
15
+ const LSP8_TOKEN_ID_FORMAT = {
16
+ NUMBER: 0,
17
+ STRING: 1,
18
+ ADDRESS: 2,
19
+ UNIQUE_ID: 3,
20
+ HASH: 4,
21
+ MIXED_DEFAULT_NUMBER: 100,
22
+ MIXED_DEFAULT_STRING: 101,
23
+ MIXED_DEFAULT_ADDRESS: 102,
24
+ MIXED_DEFAULT_UNIQUE_ID: 103,
25
+ MIXED_DEFAULT_HASH: 104
26
+ };
27
+
28
+ export { INTERFACE_ID_LSP8, LSP8DataKeys, LSP8_TOKEN_ID_FORMAT, LSP8_TYPE_IDS };
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@lukso/lsp8-contracts",
3
+ "version": "0.15.0-rc.0",
4
+ "description": "Package for the LSP8 Identifiable Digital Asset standard",
5
+ "license": "Apache-2.0",
6
+ "author": "",
7
+ "main": "./dist/index.cjs",
8
+ "module": "./dist/index.mjs",
9
+ "typings": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "require": "./dist/index.cjs",
13
+ "import": "./dist/index.mjs",
14
+ "types": "./dist/index.d.ts"
15
+ },
16
+ "./artifacts/*": "./artifacts/*",
17
+ "./package.json": "./package.json"
18
+ },
19
+ "files": [
20
+ "contracts/**/*.sol",
21
+ "!contracts/Mocks/**/*.sol",
22
+ "artifacts/*.json",
23
+ "dist",
24
+ "types",
25
+ "!types/factories",
26
+ "./README.md"
27
+ ],
28
+ "keywords": [
29
+ "LUKSO",
30
+ "LSP",
31
+ "Blockchain",
32
+ "Standards",
33
+ "Smart Contracts",
34
+ "Ethereum",
35
+ "EVM",
36
+ "Solidity"
37
+ ],
38
+ "scripts": {
39
+ "package": "hardhat prepare-package",
40
+ "build": "hardhat compile --show-stack-traces",
41
+ "build:js": "unbuild",
42
+ "build:types": "npx typechain --target=ethers-v6 ./artifacts/*.json --out-dir types",
43
+ "clean": "hardhat clean && rm -Rf dist/",
44
+ "format": "prettier --write .",
45
+ "lint": "eslint . --ext .ts,.js",
46
+ "lint:solidity": "solhint 'contracts/**/*.sol' && prettier --check 'contracts/**/*.sol'"
47
+ },
48
+ "dependencies": {
49
+ "@erc725/smart-contracts": "^7.0.0",
50
+ "@openzeppelin/contracts": "^4.9.3",
51
+ "@lukso/lsp1-contracts": "*",
52
+ "@lukso/lsp2-contracts": "*",
53
+ "@lukso/lsp4-contracts": "*",
54
+ "@lukso/lsp17contractextension-contracts": "*"
55
+ }
56
+ }