@lukso/lsp8-contracts 0.18.1 → 0.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/IAccessControlExtended.json +1 -1
- package/artifacts/ILSP8CappedBalance.json +1 -1
- package/artifacts/ILSP8CappedSupply.json +1 -1
- package/artifacts/ILSP8IdentifiableDigitalAsset.json +1 -1
- package/artifacts/ILSP8Mintable.json +1 -1
- package/artifacts/ILSP8NonTransferable.json +1 -1
- package/artifacts/ILSP8Revokable.json +1 -1
- package/artifacts/LSP8Burnable.json +1 -1
- package/artifacts/LSP8BurnableInitAbstract.json +1 -1
- package/artifacts/LSP8CappedBalanceAbstract.json +1 -1
- package/artifacts/LSP8CappedBalanceInitAbstract.json +1 -1
- package/artifacts/LSP8CappedSupplyAbstract.json +1 -1
- package/artifacts/LSP8CappedSupplyInitAbstract.json +1 -1
- package/artifacts/LSP8CustomizableToken.json +3 -3
- package/artifacts/LSP8CustomizableTokenInit.json +3 -3
- package/artifacts/LSP8Enumerable.json +1 -1
- package/artifacts/LSP8EnumerableInitAbstract.json +1 -1
- package/artifacts/LSP8IdentifiableDigitalAsset.json +1 -1
- package/artifacts/LSP8IdentifiableDigitalAssetInitAbstract.json +1 -1
- package/artifacts/LSP8Mintable.json +21 -3
- package/artifacts/LSP8MintableAbstract.json +1 -1
- package/artifacts/LSP8MintableInit.json +21 -3
- package/artifacts/LSP8MintableInitAbstract.json +1 -1
- package/artifacts/LSP8NonTransferableAbstract.json +1 -1
- package/artifacts/LSP8NonTransferableInitAbstract.json +1 -1
- package/artifacts/LSP8RevokableAbstract.json +1 -1
- package/artifacts/LSP8RevokableInitAbstract.json +1 -1
- package/artifacts/LSP8Votes.json +1 -1
- package/artifacts/LSP8VotesInitAbstract.json +1 -1
- package/contracts/extensions/AccessControlExtended/AccessControlExtendedAbstract.sol +3 -9
- package/contracts/extensions/AccessControlExtended/AccessControlExtendedInitAbstract.sol +4 -12
- package/contracts/extensions/AccessControlExtended/IAccessControlExtended.sol +1 -3
- package/contracts/extensions/LSP8Burnable/LSP8Burnable.sol +1 -3
- package/contracts/extensions/LSP8Burnable/LSP8BurnableInitAbstract.sol +1 -3
- package/contracts/extensions/LSP8CappedBalance/LSP8CappedBalanceAbstract.sol +2 -6
- package/contracts/extensions/LSP8CappedBalance/LSP8CappedBalanceInitAbstract.sol +3 -9
- package/contracts/extensions/LSP8CappedSupply/LSP8CappedSupplyAbstract.sol +1 -3
- package/contracts/extensions/LSP8CappedSupply/LSP8CappedSupplyInitAbstract.sol +1 -3
- package/contracts/extensions/LSP8Enumerable/LSP8Enumerable.sol +1 -3
- package/contracts/extensions/LSP8Enumerable/LSP8EnumerableInitAbstract.sol +1 -3
- package/contracts/extensions/LSP8Mintable/LSP8MintableAbstract.sol +2 -6
- package/contracts/extensions/LSP8Mintable/LSP8MintableInitAbstract.sol +3 -9
- package/contracts/extensions/LSP8MusicNFT/LSP8MusicNFTAbstract.sol +30 -0
- package/contracts/extensions/LSP8MusicNFT/LSP8MusicNFTConstants.sol +13 -0
- package/contracts/extensions/LSP8NonTransferable/LSP8NonTransferableAbstract.sol +6 -7
- package/contracts/extensions/LSP8NonTransferable/LSP8NonTransferableInitAbstract.sol +7 -10
- package/contracts/extensions/LSP8Revokable/ILSP8Revokable.sol +6 -1
- package/contracts/extensions/LSP8Revokable/LSP8RevokableAbstract.sol +3 -9
- package/contracts/extensions/LSP8Revokable/LSP8RevokableInitAbstract.sol +4 -12
- package/contracts/extensions/LSP8Votes/LSP8Votes.sol +1 -3
- package/contracts/extensions/LSP8Votes/LSP8VotesInitAbstract.sol +2 -6
- package/contracts/presets/LSP8CustomizableToken.sol +9 -27
- package/contracts/presets/LSP8CustomizableTokenInit.sol +10 -30
- package/contracts/presets/LSP8Mintable.sol +47 -11
- package/contracts/presets/LSP8MintableInit.sol +55 -8
- package/dist/abi.cjs +20 -0
- package/dist/abi.d.cts +28 -0
- package/dist/abi.d.mts +28 -0
- package/dist/abi.d.ts +28 -0
- package/dist/abi.mjs +20 -0
- package/package.json +5 -1
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
pragma solidity ^0.8.27;
|
|
3
3
|
|
|
4
4
|
// modules
|
|
5
|
-
import {
|
|
6
|
-
LSP8IdentifiableDigitalAsset
|
|
7
|
-
} from "../../LSP8IdentifiableDigitalAsset.sol";
|
|
5
|
+
import {LSP8IdentifiableDigitalAsset} from "../../LSP8IdentifiableDigitalAsset.sol";
|
|
8
6
|
|
|
9
7
|
/**
|
|
10
8
|
* @dev LSP8 extension that enables to enumerate over all the `tokenIds` ever minted.
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
pragma solidity ^0.8.27;
|
|
3
3
|
|
|
4
4
|
// modules
|
|
5
|
-
import {
|
|
6
|
-
LSP8IdentifiableDigitalAssetInitAbstract
|
|
7
|
-
} from "../../LSP8IdentifiableDigitalAssetInitAbstract.sol";
|
|
5
|
+
import {LSP8IdentifiableDigitalAssetInitAbstract} from "../../LSP8IdentifiableDigitalAssetInitAbstract.sol";
|
|
8
6
|
|
|
9
7
|
/**
|
|
10
8
|
* @dev LSP8 extension.
|
|
@@ -3,12 +3,8 @@ pragma solidity ^0.8.27;
|
|
|
3
3
|
|
|
4
4
|
// modules
|
|
5
5
|
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
} from "../../LSP8IdentifiableDigitalAsset.sol";
|
|
9
|
-
import {
|
|
10
|
-
AccessControlExtendedAbstract
|
|
11
|
-
} from "../AccessControlExtended/AccessControlExtendedAbstract.sol";
|
|
6
|
+
import {LSP8IdentifiableDigitalAsset} from "../../LSP8IdentifiableDigitalAsset.sol";
|
|
7
|
+
import {AccessControlExtendedAbstract} from "../AccessControlExtended/AccessControlExtendedAbstract.sol";
|
|
12
8
|
|
|
13
9
|
// interfaces
|
|
14
10
|
import {ILSP8Mintable} from "./ILSP8Mintable.sol";
|
|
@@ -2,15 +2,9 @@
|
|
|
2
2
|
pragma solidity ^0.8.27;
|
|
3
3
|
|
|
4
4
|
// modules
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
} from "
|
|
8
|
-
import {
|
|
9
|
-
LSP8IdentifiableDigitalAssetInitAbstract
|
|
10
|
-
} from "../../LSP8IdentifiableDigitalAssetInitAbstract.sol";
|
|
11
|
-
import {
|
|
12
|
-
AccessControlExtendedInitAbstract
|
|
13
|
-
} from "../AccessControlExtended/AccessControlExtendedInitAbstract.sol";
|
|
5
|
+
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
|
|
6
|
+
import {LSP8IdentifiableDigitalAssetInitAbstract} from "../../LSP8IdentifiableDigitalAssetInitAbstract.sol";
|
|
7
|
+
import {AccessControlExtendedInitAbstract} from "../AccessControlExtended/AccessControlExtendedInitAbstract.sol";
|
|
14
8
|
|
|
15
9
|
// interfaces
|
|
16
10
|
import {ILSP8Mintable} from "./ILSP8Mintable.sol";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
pragma solidity ^0.8.27;
|
|
3
|
+
|
|
4
|
+
// modules
|
|
5
|
+
import {LSP8IdentifiableDigitalAsset} from "../../LSP8IdentifiableDigitalAsset.sol";
|
|
6
|
+
|
|
7
|
+
import {ERC725Y} from "@erc725/smart-contracts-v8/contracts/ERC725Y.sol";
|
|
8
|
+
|
|
9
|
+
// constants
|
|
10
|
+
import {
|
|
11
|
+
_LSP33_SUPPORTED_STANDARDS_KEY,
|
|
12
|
+
_LSP33_SUPPORTED_STANDARDS_VALUE
|
|
13
|
+
} from "./LSP8MusicNFTConstants.sol";
|
|
14
|
+
|
|
15
|
+
/// @title LSP8MusicNFTAbstract
|
|
16
|
+
/// @dev LSP33 Music NFT carrier for an LSP8 collection.
|
|
17
|
+
///
|
|
18
|
+
/// The only responsibility of this extension is to mark the LSP8 collection as
|
|
19
|
+
/// an LSP33 carrier by writing `SupportedStandards:LSP33MusicNFT` at
|
|
20
|
+
/// construction. All other behaviour — including per-tokenId storage of
|
|
21
|
+
/// `LSP4Metadata` / `LSP33Metadata` via `setDataForTokenId` — is provided by
|
|
22
|
+
/// the standard LSP8 base contract and is already sufficient for LSP33.
|
|
23
|
+
abstract contract LSP8MusicNFTAbstract is LSP8IdentifiableDigitalAsset {
|
|
24
|
+
constructor() {
|
|
25
|
+
ERC725Y._setData(
|
|
26
|
+
_LSP33_SUPPORTED_STANDARDS_KEY,
|
|
27
|
+
_LSP33_SUPPORTED_STANDARDS_VALUE
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
pragma solidity ^0.8.27;
|
|
3
|
+
|
|
4
|
+
// bytes10(keccak256('SupportedStandards')) + bytes2(0) + bytes20(keccak256('LSP33MusicNFT'))
|
|
5
|
+
// LSP2 Mapping: bytes20(...) keeps the first 20 bytes of keccak256('LSP33MusicNFT').
|
|
6
|
+
// The legacy draft key ...0000f43ae543...ff2ca4 (last 20 bytes) is mis-derived and is not written.
|
|
7
|
+
bytes32 constant _LSP33_SUPPORTED_STANDARDS_KEY = 0xeafec4d89fa9619884b600003cd4661761f237efa2fead11f43ae543d533ae73;
|
|
8
|
+
|
|
9
|
+
// bytes4(keccak256('LSP33MusicNFT'))
|
|
10
|
+
bytes constant _LSP33_SUPPORTED_STANDARDS_VALUE = hex"3cd46617";
|
|
11
|
+
|
|
12
|
+
// keccak256('LSP33Metadata')
|
|
13
|
+
bytes32 constant _LSP33_METADATA_KEY = 0xbecee5b67fa43fb2e96c7c6ccdc23007fffc2b24205416b2122cd7b8d8ef48fa;
|
|
@@ -3,12 +3,8 @@ pragma solidity ^0.8.27;
|
|
|
3
3
|
|
|
4
4
|
// modules
|
|
5
5
|
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
} from "../../LSP8IdentifiableDigitalAsset.sol";
|
|
9
|
-
import {
|
|
10
|
-
AccessControlExtendedAbstract
|
|
11
|
-
} from "../AccessControlExtended/AccessControlExtendedAbstract.sol";
|
|
6
|
+
import {LSP8IdentifiableDigitalAsset} from "../../LSP8IdentifiableDigitalAsset.sol";
|
|
7
|
+
import {AccessControlExtendedAbstract} from "../AccessControlExtended/AccessControlExtendedAbstract.sol";
|
|
12
8
|
|
|
13
9
|
// interfaces
|
|
14
10
|
import {ILSP8NonTransferable} from "./ILSP8NonTransferable.sol";
|
|
@@ -127,7 +123,10 @@ abstract contract LSP8NonTransferableAbstract is
|
|
|
127
123
|
uint256 newTransferLockStart,
|
|
128
124
|
uint256 newTransferLockEnd
|
|
129
125
|
) public virtual override onlyOwner {
|
|
130
|
-
require(
|
|
126
|
+
require(
|
|
127
|
+
nonTransferabilityEnabled,
|
|
128
|
+
LSP8CannotUpdateTransferLockPeriod()
|
|
129
|
+
);
|
|
131
130
|
|
|
132
131
|
// When transferLockEnd is 0, it means no end time is set (transfers locked indefinitely after transferLockStart)
|
|
133
132
|
// When transferLockStart is 0, it means no start time is set (transfers locked up until transferLockEnd)
|
|
@@ -2,15 +2,9 @@
|
|
|
2
2
|
pragma solidity ^0.8.27;
|
|
3
3
|
|
|
4
4
|
// modules
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
} from "
|
|
8
|
-
import {
|
|
9
|
-
LSP8IdentifiableDigitalAssetInitAbstract
|
|
10
|
-
} from "../../LSP8IdentifiableDigitalAssetInitAbstract.sol";
|
|
11
|
-
import {
|
|
12
|
-
AccessControlExtendedInitAbstract
|
|
13
|
-
} from "../AccessControlExtended/AccessControlExtendedInitAbstract.sol";
|
|
5
|
+
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
|
|
6
|
+
import {LSP8IdentifiableDigitalAssetInitAbstract} from "../../LSP8IdentifiableDigitalAssetInitAbstract.sol";
|
|
7
|
+
import {AccessControlExtendedInitAbstract} from "../AccessControlExtended/AccessControlExtendedInitAbstract.sol";
|
|
14
8
|
|
|
15
9
|
// interfaces
|
|
16
10
|
import {ILSP8NonTransferable} from "./ILSP8NonTransferable.sol";
|
|
@@ -171,7 +165,10 @@ abstract contract LSP8NonTransferableInitAbstract is
|
|
|
171
165
|
uint256 newTransferLockStart,
|
|
172
166
|
uint256 newTransferLockEnd
|
|
173
167
|
) public virtual override onlyOwner {
|
|
174
|
-
require(
|
|
168
|
+
require(
|
|
169
|
+
nonTransferabilityEnabled,
|
|
170
|
+
LSP8CannotUpdateTransferLockPeriod()
|
|
171
|
+
);
|
|
175
172
|
|
|
176
173
|
// When transferLockEnd is 0, it means no end time is set (transfers locked indefinitely after transferLockStart)
|
|
177
174
|
// When transferLockStart is 0, it means no start time is set (transfers locked up until transferLockEnd)
|
|
@@ -33,5 +33,10 @@ interface ILSP8Revokable {
|
|
|
33
33
|
/// @param to The address receiving the revoked token.
|
|
34
34
|
/// @param tokenId The tokenId to revoke.
|
|
35
35
|
/// @param data Additional data to include in the transfer notification.
|
|
36
|
-
function revoke(
|
|
36
|
+
function revoke(
|
|
37
|
+
address from,
|
|
38
|
+
address to,
|
|
39
|
+
bytes32 tokenId,
|
|
40
|
+
bytes memory data
|
|
41
|
+
) external;
|
|
37
42
|
}
|
|
@@ -3,20 +3,14 @@ pragma solidity ^0.8.27;
|
|
|
3
3
|
|
|
4
4
|
// modules
|
|
5
5
|
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
} from "../../LSP8IdentifiableDigitalAsset.sol";
|
|
9
|
-
import {
|
|
10
|
-
AccessControlExtendedAbstract
|
|
11
|
-
} from "../AccessControlExtended/AccessControlExtendedAbstract.sol";
|
|
6
|
+
import {LSP8IdentifiableDigitalAsset} from "../../LSP8IdentifiableDigitalAsset.sol";
|
|
7
|
+
import {AccessControlExtendedAbstract} from "../AccessControlExtended/AccessControlExtendedAbstract.sol";
|
|
12
8
|
|
|
13
9
|
// interfaces
|
|
14
10
|
import {ILSP8Revokable} from "./ILSP8Revokable.sol";
|
|
15
11
|
|
|
16
12
|
// errors
|
|
17
|
-
import {
|
|
18
|
-
AccessControlUnauthorizedAccount
|
|
19
|
-
} from "../AccessControlExtended/AccessControlExtendedErrors.sol";
|
|
13
|
+
import {AccessControlUnauthorizedAccount} from "../AccessControlExtended/AccessControlExtendedErrors.sol";
|
|
20
14
|
import {LSP8RevokableFeatureDisabled} from "./LSP8RevokableErrors.sol";
|
|
21
15
|
|
|
22
16
|
/// @title LSP8RevokableAbstract
|
|
@@ -2,23 +2,15 @@
|
|
|
2
2
|
pragma solidity ^0.8.27;
|
|
3
3
|
|
|
4
4
|
// modules
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
} from "
|
|
8
|
-
import {
|
|
9
|
-
LSP8IdentifiableDigitalAssetInitAbstract
|
|
10
|
-
} from "../../LSP8IdentifiableDigitalAssetInitAbstract.sol";
|
|
11
|
-
import {
|
|
12
|
-
AccessControlExtendedInitAbstract
|
|
13
|
-
} from "../AccessControlExtended/AccessControlExtendedInitAbstract.sol";
|
|
5
|
+
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
|
|
6
|
+
import {LSP8IdentifiableDigitalAssetInitAbstract} from "../../LSP8IdentifiableDigitalAssetInitAbstract.sol";
|
|
7
|
+
import {AccessControlExtendedInitAbstract} from "../AccessControlExtended/AccessControlExtendedInitAbstract.sol";
|
|
14
8
|
|
|
15
9
|
// interfaces
|
|
16
10
|
import {ILSP8Revokable} from "./ILSP8Revokable.sol";
|
|
17
11
|
|
|
18
12
|
// errors
|
|
19
|
-
import {
|
|
20
|
-
AccessControlUnauthorizedAccount
|
|
21
|
-
} from "../AccessControlExtended/AccessControlExtendedErrors.sol";
|
|
13
|
+
import {AccessControlUnauthorizedAccount} from "../AccessControlExtended/AccessControlExtendedErrors.sol";
|
|
22
14
|
import {LSP8RevokableFeatureDisabled} from "./LSP8RevokableErrors.sol";
|
|
23
15
|
|
|
24
16
|
/// @title LSP8RevokableInitAbstract
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
pragma solidity ^0.8.27;
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
LSP8IdentifiableDigitalAsset
|
|
6
|
-
} from "../../LSP8IdentifiableDigitalAsset.sol";
|
|
4
|
+
import {LSP8IdentifiableDigitalAsset} from "../../LSP8IdentifiableDigitalAsset.sol";
|
|
7
5
|
import {Votes} from "@openzeppelin/contracts/governance/utils/Votes.sol";
|
|
8
6
|
import {
|
|
9
7
|
_TYPEID_LSP8_VOTESDELEGATOR,
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
pragma solidity ^0.8.27;
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
} from "../../LSP8IdentifiableDigitalAssetInitAbstract.sol";
|
|
7
|
-
import {
|
|
8
|
-
VotesUpgradeable
|
|
9
|
-
} from "@openzeppelin/contracts-upgradeable/governance/utils/VotesUpgradeable.sol";
|
|
4
|
+
import {LSP8IdentifiableDigitalAssetInitAbstract} from "../../LSP8IdentifiableDigitalAssetInitAbstract.sol";
|
|
5
|
+
import {VotesUpgradeable} from "@openzeppelin/contracts-upgradeable/governance/utils/VotesUpgradeable.sol";
|
|
10
6
|
import {
|
|
11
7
|
_TYPEID_LSP8_VOTESDELEGATOR,
|
|
12
8
|
_TYPEID_LSP8_VOTESDELEGATEE
|
|
@@ -3,30 +3,16 @@ pragma solidity ^0.8.27;
|
|
|
3
3
|
|
|
4
4
|
// modules
|
|
5
5
|
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
} from "../extensions/AccessControlExtended/AccessControlExtendedAbstract.sol";
|
|
9
|
-
import {
|
|
10
|
-
LSP8IdentifiableDigitalAsset
|
|
11
|
-
} from "../LSP8IdentifiableDigitalAsset.sol";
|
|
6
|
+
import {AccessControlExtendedAbstract} from "../extensions/AccessControlExtended/AccessControlExtendedAbstract.sol";
|
|
7
|
+
import {LSP8IdentifiableDigitalAsset} from "../LSP8IdentifiableDigitalAsset.sol";
|
|
12
8
|
|
|
13
9
|
// extensions
|
|
14
10
|
import {LSP8Burnable} from "../extensions/LSP8Burnable/LSP8Burnable.sol";
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
} from "../extensions/
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
} from "../extensions/LSP8CappedSupply/LSP8CappedSupplyAbstract.sol";
|
|
21
|
-
import {
|
|
22
|
-
LSP8CappedBalanceAbstract
|
|
23
|
-
} from "../extensions/LSP8CappedBalance/LSP8CappedBalanceAbstract.sol";
|
|
24
|
-
import {
|
|
25
|
-
LSP8NonTransferableAbstract
|
|
26
|
-
} from "../extensions/LSP8NonTransferable/LSP8NonTransferableAbstract.sol";
|
|
27
|
-
import {
|
|
28
|
-
LSP8RevokableAbstract
|
|
29
|
-
} from "../extensions/LSP8Revokable/LSP8RevokableAbstract.sol";
|
|
11
|
+
import {LSP8MintableAbstract} from "../extensions/LSP8Mintable/LSP8MintableAbstract.sol";
|
|
12
|
+
import {LSP8CappedSupplyAbstract} from "../extensions/LSP8CappedSupply/LSP8CappedSupplyAbstract.sol";
|
|
13
|
+
import {LSP8CappedBalanceAbstract} from "../extensions/LSP8CappedBalance/LSP8CappedBalanceAbstract.sol";
|
|
14
|
+
import {LSP8NonTransferableAbstract} from "../extensions/LSP8NonTransferable/LSP8NonTransferableAbstract.sol";
|
|
15
|
+
import {LSP8RevokableAbstract} from "../extensions/LSP8Revokable/LSP8RevokableAbstract.sol";
|
|
30
16
|
|
|
31
17
|
// constants
|
|
32
18
|
import {
|
|
@@ -37,12 +23,8 @@ import {
|
|
|
37
23
|
} from "./LSP8CustomizableTokenConstants.sol";
|
|
38
24
|
|
|
39
25
|
// errors
|
|
40
|
-
import {
|
|
41
|
-
|
|
42
|
-
} from "../extensions/LSP8Mintable/LSP8MintableErrors.sol";
|
|
43
|
-
import {
|
|
44
|
-
LSP8CappedSupplyCannotMintOverCap
|
|
45
|
-
} from "../extensions/LSP8CappedSupply/LSP8CappedSupplyErrors.sol";
|
|
26
|
+
import {LSP8MintDisabled} from "../extensions/LSP8Mintable/LSP8MintableErrors.sol";
|
|
27
|
+
import {LSP8CappedSupplyCannotMintOverCap} from "../extensions/LSP8CappedSupply/LSP8CappedSupplyErrors.sol";
|
|
46
28
|
|
|
47
29
|
/// @title LSP8CustomizableToken
|
|
48
30
|
/// @dev A customizable LSP8 token that implements multiple features and uses role-based exemptions.
|
|
@@ -2,32 +2,16 @@
|
|
|
2
2
|
pragma solidity ^0.8.27;
|
|
3
3
|
|
|
4
4
|
// modules
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
|
|
8
|
-
import {
|
|
9
|
-
LSP8IdentifiableDigitalAssetInitAbstract
|
|
10
|
-
} from "../LSP8IdentifiableDigitalAssetInitAbstract.sol";
|
|
5
|
+
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
|
|
6
|
+
import {LSP8IdentifiableDigitalAssetInitAbstract} from "../LSP8IdentifiableDigitalAssetInitAbstract.sol";
|
|
11
7
|
|
|
12
8
|
// extensions
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
} from "../extensions/
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
} from "../extensions/
|
|
19
|
-
import {
|
|
20
|
-
LSP8CappedSupplyInitAbstract
|
|
21
|
-
} from "../extensions/LSP8CappedSupply/LSP8CappedSupplyInitAbstract.sol";
|
|
22
|
-
import {
|
|
23
|
-
LSP8CappedBalanceInitAbstract
|
|
24
|
-
} from "../extensions/LSP8CappedBalance/LSP8CappedBalanceInitAbstract.sol";
|
|
25
|
-
import {
|
|
26
|
-
LSP8NonTransferableInitAbstract
|
|
27
|
-
} from "../extensions/LSP8NonTransferable/LSP8NonTransferableInitAbstract.sol";
|
|
28
|
-
import {
|
|
29
|
-
LSP8RevokableInitAbstract
|
|
30
|
-
} from "../extensions/LSP8Revokable/LSP8RevokableInitAbstract.sol";
|
|
9
|
+
import {LSP8BurnableInitAbstract} from "../extensions/LSP8Burnable/LSP8BurnableInitAbstract.sol";
|
|
10
|
+
import {LSP8MintableInitAbstract} from "../extensions/LSP8Mintable/LSP8MintableInitAbstract.sol";
|
|
11
|
+
import {LSP8CappedSupplyInitAbstract} from "../extensions/LSP8CappedSupply/LSP8CappedSupplyInitAbstract.sol";
|
|
12
|
+
import {LSP8CappedBalanceInitAbstract} from "../extensions/LSP8CappedBalance/LSP8CappedBalanceInitAbstract.sol";
|
|
13
|
+
import {LSP8NonTransferableInitAbstract} from "../extensions/LSP8NonTransferable/LSP8NonTransferableInitAbstract.sol";
|
|
14
|
+
import {LSP8RevokableInitAbstract} from "../extensions/LSP8Revokable/LSP8RevokableInitAbstract.sol";
|
|
31
15
|
|
|
32
16
|
// constants
|
|
33
17
|
import {
|
|
@@ -38,12 +22,8 @@ import {
|
|
|
38
22
|
} from "./LSP8CustomizableTokenConstants.sol";
|
|
39
23
|
|
|
40
24
|
// errors
|
|
41
|
-
import {
|
|
42
|
-
|
|
43
|
-
} from "../extensions/LSP8Mintable/LSP8MintableErrors.sol";
|
|
44
|
-
import {
|
|
45
|
-
LSP8CappedSupplyCannotMintOverCap
|
|
46
|
-
} from "../extensions/LSP8CappedSupply/LSP8CappedSupplyErrors.sol";
|
|
25
|
+
import {LSP8MintDisabled} from "../extensions/LSP8Mintable/LSP8MintableErrors.sol";
|
|
26
|
+
import {LSP8CappedSupplyCannotMintOverCap} from "../extensions/LSP8CappedSupply/LSP8CappedSupplyErrors.sol";
|
|
47
27
|
|
|
48
28
|
/// @title LSP8CustomizableTokenInit
|
|
49
29
|
/// @dev A customizable LSP8 token that implements multiple features and uses role-based exemptions. This version of the contract is the implementation to use behind proxies.
|
|
@@ -2,20 +2,18 @@
|
|
|
2
2
|
pragma solidity ^0.8.27;
|
|
3
3
|
|
|
4
4
|
// modules
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
} from "../
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
} from "../extensions/LSP8Mintable/LSP8MintableAbstract.sol";
|
|
11
|
-
import {
|
|
12
|
-
AccessControlExtendedAbstract
|
|
13
|
-
} from "../extensions/AccessControlExtended/AccessControlExtendedAbstract.sol";
|
|
5
|
+
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
|
|
6
|
+
import {LSP8IdentifiableDigitalAsset} from "../LSP8IdentifiableDigitalAsset.sol";
|
|
7
|
+
import {LSP8Burnable} from "../extensions/LSP8Burnable/LSP8Burnable.sol";
|
|
8
|
+
import {LSP8MintableAbstract} from "../extensions/LSP8Mintable/LSP8MintableAbstract.sol";
|
|
9
|
+
import {AccessControlExtendedAbstract} from "../extensions/AccessControlExtended/AccessControlExtendedAbstract.sol";
|
|
14
10
|
|
|
15
11
|
/**
|
|
16
|
-
* @title LSP8IdentifiableDigitalAsset deployable preset contract with
|
|
12
|
+
* @title LSP8IdentifiableDigitalAsset deployable preset contract with:
|
|
13
|
+
* - a public {mint} function callable by addresses holding `MINTER_ROLE`.
|
|
14
|
+
* - a public {burn} function callable by any token holder or operator.
|
|
17
15
|
*/
|
|
18
|
-
contract LSP8Mintable is LSP8MintableAbstract {
|
|
16
|
+
contract LSP8Mintable is LSP8MintableAbstract, LSP8Burnable {
|
|
19
17
|
/**
|
|
20
18
|
* @notice Deploying a `LSP8Mintable` token contract.
|
|
21
19
|
* @dev Set the token to be mintable to allow minting more tokens after deployment.
|
|
@@ -42,4 +40,42 @@ contract LSP8Mintable is LSP8MintableAbstract {
|
|
|
42
40
|
AccessControlExtendedAbstract()
|
|
43
41
|
LSP8MintableAbstract(true)
|
|
44
42
|
{}
|
|
43
|
+
|
|
44
|
+
/// @dev Required override to resolve multiple inheritance. Delegates via `super` to the parent implementation
|
|
45
|
+
/// that aggregates the interface IDs supported across all inherited modules.
|
|
46
|
+
function supportsInterface(
|
|
47
|
+
bytes4 interfaceId
|
|
48
|
+
)
|
|
49
|
+
public
|
|
50
|
+
view
|
|
51
|
+
virtual
|
|
52
|
+
override(LSP8MintableAbstract, LSP8IdentifiableDigitalAsset)
|
|
53
|
+
returns (bool)
|
|
54
|
+
{
|
|
55
|
+
return super.supportsInterface(interfaceId);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/// @inheritdoc LSP8MintableAbstract
|
|
59
|
+
/// @dev Required override to resolve multiple inheritance. Calls every parent {_mint} function via `super`.
|
|
60
|
+
function _mint(
|
|
61
|
+
address to,
|
|
62
|
+
bytes32 tokenId,
|
|
63
|
+
bool force,
|
|
64
|
+
bytes memory data
|
|
65
|
+
)
|
|
66
|
+
internal
|
|
67
|
+
virtual
|
|
68
|
+
override(LSP8MintableAbstract, LSP8IdentifiableDigitalAsset)
|
|
69
|
+
{
|
|
70
|
+
super._mint(to, tokenId, force, data);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/// @dev Required override to resolve multiple inheritance. Calls every parent {_transferOwnership} function
|
|
74
|
+
/// via `super` so that each inherited module updates its ownership-dependent state.
|
|
75
|
+
/// When contract ownership changes, this resets the admin role of `MINTER_ROLE` back to `DEFAULT_ADMIN_ROLE`.
|
|
76
|
+
function _transferOwnership(
|
|
77
|
+
address newOwner
|
|
78
|
+
) internal virtual override(LSP8MintableAbstract, Ownable) {
|
|
79
|
+
super._transferOwnership(newOwner);
|
|
80
|
+
}
|
|
45
81
|
}
|
|
@@ -2,17 +2,20 @@
|
|
|
2
2
|
pragma solidity ^0.8.27;
|
|
3
3
|
|
|
4
4
|
// modules
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
} from "../LSP8IdentifiableDigitalAssetInitAbstract.sol";
|
|
8
|
-
import {
|
|
9
|
-
LSP8MintableInitAbstract
|
|
10
|
-
} from "../extensions/LSP8Mintable/LSP8MintableInitAbstract.sol";
|
|
5
|
+
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
|
|
6
|
+
import {LSP8BurnableInitAbstract} from "../extensions/LSP8Burnable/LSP8BurnableInitAbstract.sol";
|
|
7
|
+
import {LSP8IdentifiableDigitalAssetInitAbstract} from "../LSP8IdentifiableDigitalAssetInitAbstract.sol";
|
|
8
|
+
import {LSP8MintableInitAbstract} from "../extensions/LSP8Mintable/LSP8MintableInitAbstract.sol";
|
|
11
9
|
|
|
12
10
|
/**
|
|
13
|
-
* @dev LSP8IdentifiableDigitalAsset deployable preset contract (proxy version) with
|
|
11
|
+
* @dev LSP8IdentifiableDigitalAsset deployable preset contract (proxy version) with:
|
|
12
|
+
* - a public {mint} function callable by addresses holding `MINTER_ROLE`.
|
|
13
|
+
* - a public {burn} function callable by any token holder or operator.
|
|
14
14
|
*/
|
|
15
|
-
contract LSP8MintableInit is
|
|
15
|
+
contract LSP8MintableInit is
|
|
16
|
+
LSP8MintableInitAbstract,
|
|
17
|
+
LSP8BurnableInitAbstract
|
|
18
|
+
{
|
|
16
19
|
/**
|
|
17
20
|
* @dev initialize (= lock) base implementation contract on deployment
|
|
18
21
|
*/
|
|
@@ -47,4 +50,48 @@ contract LSP8MintableInit is LSP8MintableInitAbstract {
|
|
|
47
50
|
__AccessControlExtended_init();
|
|
48
51
|
__LSP8Mintable_init_unchained(true);
|
|
49
52
|
}
|
|
53
|
+
|
|
54
|
+
/// @dev Required override to resolve multiple inheritance. Delegates via `super` to the parent implementation
|
|
55
|
+
/// that aggregates the interface IDs supported across all inherited modules.
|
|
56
|
+
function supportsInterface(
|
|
57
|
+
bytes4 interfaceId
|
|
58
|
+
)
|
|
59
|
+
public
|
|
60
|
+
view
|
|
61
|
+
virtual
|
|
62
|
+
override(
|
|
63
|
+
LSP8MintableInitAbstract,
|
|
64
|
+
LSP8IdentifiableDigitalAssetInitAbstract
|
|
65
|
+
)
|
|
66
|
+
returns (bool)
|
|
67
|
+
{
|
|
68
|
+
return super.supportsInterface(interfaceId);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/// @inheritdoc LSP8MintableInitAbstract
|
|
72
|
+
/// @dev Required override to resolve multiple inheritance. Calls every parent {_mint} function via `super`.
|
|
73
|
+
function _mint(
|
|
74
|
+
address to,
|
|
75
|
+
bytes32 tokenId,
|
|
76
|
+
bool force,
|
|
77
|
+
bytes memory data
|
|
78
|
+
)
|
|
79
|
+
internal
|
|
80
|
+
virtual
|
|
81
|
+
override(
|
|
82
|
+
LSP8MintableInitAbstract,
|
|
83
|
+
LSP8IdentifiableDigitalAssetInitAbstract
|
|
84
|
+
)
|
|
85
|
+
{
|
|
86
|
+
super._mint(to, tokenId, force, data);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/// @dev Required override to resolve multiple inheritance. Calls every parent {_transferOwnership} function
|
|
90
|
+
/// via `super` so that each inherited module updates its ownership-dependent state.
|
|
91
|
+
/// When contract ownership changes, this resets the admin role of `MINTER_ROLE` back to `DEFAULT_ADMIN_ROLE`.
|
|
92
|
+
function _transferOwnership(
|
|
93
|
+
address newOwner
|
|
94
|
+
) internal virtual override(LSP8MintableInitAbstract, OwnableUpgradeable) {
|
|
95
|
+
super._transferOwnership(newOwner);
|
|
96
|
+
}
|
|
50
97
|
}
|
package/dist/abi.cjs
CHANGED
|
@@ -8078,6 +8078,16 @@ const lsp8MintableAbi = [
|
|
|
8078
8078
|
outputs: [{ name: "results", internalType: "bytes[]", type: "bytes[]" }],
|
|
8079
8079
|
stateMutability: "nonpayable"
|
|
8080
8080
|
},
|
|
8081
|
+
{
|
|
8082
|
+
type: "function",
|
|
8083
|
+
inputs: [
|
|
8084
|
+
{ name: "tokenId", internalType: "bytes32", type: "bytes32" },
|
|
8085
|
+
{ name: "data", internalType: "bytes", type: "bytes" }
|
|
8086
|
+
],
|
|
8087
|
+
name: "burn",
|
|
8088
|
+
outputs: [],
|
|
8089
|
+
stateMutability: "nonpayable"
|
|
8090
|
+
},
|
|
8081
8091
|
{
|
|
8082
8092
|
type: "function",
|
|
8083
8093
|
inputs: [],
|
|
@@ -9469,6 +9479,16 @@ const lsp8MintableInitAbi = [
|
|
|
9469
9479
|
outputs: [{ name: "results", internalType: "bytes[]", type: "bytes[]" }],
|
|
9470
9480
|
stateMutability: "nonpayable"
|
|
9471
9481
|
},
|
|
9482
|
+
{
|
|
9483
|
+
type: "function",
|
|
9484
|
+
inputs: [
|
|
9485
|
+
{ name: "tokenId", internalType: "bytes32", type: "bytes32" },
|
|
9486
|
+
{ name: "data", internalType: "bytes", type: "bytes" }
|
|
9487
|
+
],
|
|
9488
|
+
name: "burn",
|
|
9489
|
+
outputs: [],
|
|
9490
|
+
stateMutability: "nonpayable"
|
|
9491
|
+
},
|
|
9472
9492
|
{
|
|
9473
9493
|
type: "function",
|
|
9474
9494
|
inputs: [],
|
package/dist/abi.d.cts
CHANGED
|
@@ -11750,6 +11750,20 @@ declare const lsp8MintableAbi: readonly [{
|
|
|
11750
11750
|
readonly type: "bytes[]";
|
|
11751
11751
|
}];
|
|
11752
11752
|
readonly stateMutability: "nonpayable";
|
|
11753
|
+
}, {
|
|
11754
|
+
readonly type: "function";
|
|
11755
|
+
readonly inputs: readonly [{
|
|
11756
|
+
readonly name: "tokenId";
|
|
11757
|
+
readonly internalType: "bytes32";
|
|
11758
|
+
readonly type: "bytes32";
|
|
11759
|
+
}, {
|
|
11760
|
+
readonly name: "data";
|
|
11761
|
+
readonly internalType: "bytes";
|
|
11762
|
+
readonly type: "bytes";
|
|
11763
|
+
}];
|
|
11764
|
+
readonly name: "burn";
|
|
11765
|
+
readonly outputs: readonly [];
|
|
11766
|
+
readonly stateMutability: "nonpayable";
|
|
11753
11767
|
}, {
|
|
11754
11768
|
readonly type: "function";
|
|
11755
11769
|
readonly inputs: readonly [];
|
|
@@ -13790,6 +13804,20 @@ declare const lsp8MintableInitAbi: readonly [{
|
|
|
13790
13804
|
readonly type: "bytes[]";
|
|
13791
13805
|
}];
|
|
13792
13806
|
readonly stateMutability: "nonpayable";
|
|
13807
|
+
}, {
|
|
13808
|
+
readonly type: "function";
|
|
13809
|
+
readonly inputs: readonly [{
|
|
13810
|
+
readonly name: "tokenId";
|
|
13811
|
+
readonly internalType: "bytes32";
|
|
13812
|
+
readonly type: "bytes32";
|
|
13813
|
+
}, {
|
|
13814
|
+
readonly name: "data";
|
|
13815
|
+
readonly internalType: "bytes";
|
|
13816
|
+
readonly type: "bytes";
|
|
13817
|
+
}];
|
|
13818
|
+
readonly name: "burn";
|
|
13819
|
+
readonly outputs: readonly [];
|
|
13820
|
+
readonly stateMutability: "nonpayable";
|
|
13793
13821
|
}, {
|
|
13794
13822
|
readonly type: "function";
|
|
13795
13823
|
readonly inputs: readonly [];
|
package/dist/abi.d.mts
CHANGED
|
@@ -11750,6 +11750,20 @@ declare const lsp8MintableAbi: readonly [{
|
|
|
11750
11750
|
readonly type: "bytes[]";
|
|
11751
11751
|
}];
|
|
11752
11752
|
readonly stateMutability: "nonpayable";
|
|
11753
|
+
}, {
|
|
11754
|
+
readonly type: "function";
|
|
11755
|
+
readonly inputs: readonly [{
|
|
11756
|
+
readonly name: "tokenId";
|
|
11757
|
+
readonly internalType: "bytes32";
|
|
11758
|
+
readonly type: "bytes32";
|
|
11759
|
+
}, {
|
|
11760
|
+
readonly name: "data";
|
|
11761
|
+
readonly internalType: "bytes";
|
|
11762
|
+
readonly type: "bytes";
|
|
11763
|
+
}];
|
|
11764
|
+
readonly name: "burn";
|
|
11765
|
+
readonly outputs: readonly [];
|
|
11766
|
+
readonly stateMutability: "nonpayable";
|
|
11753
11767
|
}, {
|
|
11754
11768
|
readonly type: "function";
|
|
11755
11769
|
readonly inputs: readonly [];
|
|
@@ -13790,6 +13804,20 @@ declare const lsp8MintableInitAbi: readonly [{
|
|
|
13790
13804
|
readonly type: "bytes[]";
|
|
13791
13805
|
}];
|
|
13792
13806
|
readonly stateMutability: "nonpayable";
|
|
13807
|
+
}, {
|
|
13808
|
+
readonly type: "function";
|
|
13809
|
+
readonly inputs: readonly [{
|
|
13810
|
+
readonly name: "tokenId";
|
|
13811
|
+
readonly internalType: "bytes32";
|
|
13812
|
+
readonly type: "bytes32";
|
|
13813
|
+
}, {
|
|
13814
|
+
readonly name: "data";
|
|
13815
|
+
readonly internalType: "bytes";
|
|
13816
|
+
readonly type: "bytes";
|
|
13817
|
+
}];
|
|
13818
|
+
readonly name: "burn";
|
|
13819
|
+
readonly outputs: readonly [];
|
|
13820
|
+
readonly stateMutability: "nonpayable";
|
|
13793
13821
|
}, {
|
|
13794
13822
|
readonly type: "function";
|
|
13795
13823
|
readonly inputs: readonly [];
|