@lukso/lsp8-contracts 0.17.3 → 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/README.md +69 -24
- 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 +8 -2
- package/artifacts/ILSP8Revokable.json +38 -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 +64 -21
- package/artifacts/LSP8CustomizableTokenInit.json +59 -16
- 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 +20 -14
- package/artifacts/LSP8NonTransferableInitAbstract.json +20 -14
- package/artifacts/LSP8RevokableAbstract.json +38 -1
- package/artifacts/LSP8RevokableInitAbstract.json +38 -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/ILSP8NonTransferable.sol +9 -3
- package/contracts/extensions/LSP8NonTransferable/LSP8NonTransferableAbstract.sol +22 -14
- package/contracts/extensions/LSP8NonTransferable/LSP8NonTransferableInitAbstract.sol +23 -17
- package/contracts/extensions/LSP8Revokable/ILSP8Revokable.sol +15 -1
- package/contracts/extensions/LSP8Revokable/LSP8RevokableAbstract.sol +11 -9
- package/contracts/extensions/LSP8Revokable/LSP8RevokableInitAbstract.sol +19 -13
- 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 +189 -29
- package/dist/abi.d.cts +244 -41
- package/dist/abi.d.mts +244 -41
- package/dist/abi.d.ts +244 -41
- package/dist/abi.mjs +189 -29
- package/package.json +5 -1
package/artifacts/LSP8Votes.json
CHANGED
|
@@ -1229,5 +1229,5 @@
|
|
|
1229
1229
|
"deployedLinkReferences": {},
|
|
1230
1230
|
"immutableReferences": {},
|
|
1231
1231
|
"inputSourceName": "project/contracts/extensions/LSP8Votes/LSP8Votes.sol",
|
|
1232
|
-
"buildInfoId": "solc-0_8_28-
|
|
1232
|
+
"buildInfoId": "solc-0_8_28-8610856c8312e4aa6bc92fb7dbed2eac43c4c1c3"
|
|
1233
1233
|
}
|
|
@@ -1221,5 +1221,5 @@
|
|
|
1221
1221
|
"deployedLinkReferences": {},
|
|
1222
1222
|
"immutableReferences": {},
|
|
1223
1223
|
"inputSourceName": "project/contracts/extensions/LSP8Votes/LSP8VotesInitAbstract.sol",
|
|
1224
|
-
"buildInfoId": "solc-0_8_28-
|
|
1224
|
+
"buildInfoId": "solc-0_8_28-8610856c8312e4aa6bc92fb7dbed2eac43c4c1c3"
|
|
1225
1225
|
}
|
|
@@ -2,21 +2,15 @@
|
|
|
2
2
|
pragma solidity ^0.8.27;
|
|
3
3
|
|
|
4
4
|
// interfaces
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
} from "@openzeppelin/contracts/access/IAccessControl.sol";
|
|
8
|
-
import {
|
|
9
|
-
IAccessControlEnumerable
|
|
10
|
-
} from "@openzeppelin/contracts/access/IAccessControlEnumerable.sol";
|
|
5
|
+
import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol";
|
|
6
|
+
import {IAccessControlEnumerable} from "@openzeppelin/contracts/access/IAccessControlEnumerable.sol";
|
|
11
7
|
import {IAccessControlExtended} from "./IAccessControlExtended.sol";
|
|
12
8
|
|
|
13
9
|
// modules
|
|
14
10
|
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
|
|
15
11
|
|
|
16
12
|
// libraries
|
|
17
|
-
import {
|
|
18
|
-
EnumerableSet
|
|
19
|
-
} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
|
13
|
+
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
|
20
14
|
|
|
21
15
|
// constants
|
|
22
16
|
import {
|
|
@@ -2,23 +2,15 @@
|
|
|
2
2
|
pragma solidity ^0.8.27;
|
|
3
3
|
|
|
4
4
|
// interfaces
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
} from "@openzeppelin/contracts/access/IAccessControl.sol";
|
|
8
|
-
import {
|
|
9
|
-
IAccessControlEnumerable
|
|
10
|
-
} from "@openzeppelin/contracts/access/IAccessControlEnumerable.sol";
|
|
5
|
+
import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol";
|
|
6
|
+
import {IAccessControlEnumerable} from "@openzeppelin/contracts/access/IAccessControlEnumerable.sol";
|
|
11
7
|
import {IAccessControlExtended} from "./IAccessControlExtended.sol";
|
|
12
8
|
|
|
13
9
|
// modules
|
|
14
|
-
import {
|
|
15
|
-
OwnableUpgradeable
|
|
16
|
-
} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
|
|
10
|
+
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
|
|
17
11
|
|
|
18
12
|
// libraries
|
|
19
|
-
import {
|
|
20
|
-
EnumerableSet
|
|
21
|
-
} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
|
13
|
+
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
|
22
14
|
|
|
23
15
|
// constants
|
|
24
16
|
import {
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
pragma solidity ^0.8.27;
|
|
3
3
|
|
|
4
4
|
// interfaces
|
|
5
|
-
import {
|
|
6
|
-
IAccessControlEnumerable
|
|
7
|
-
} from "@openzeppelin/contracts/access/IAccessControlEnumerable.sol";
|
|
5
|
+
import {IAccessControlEnumerable} from "@openzeppelin/contracts/access/IAccessControlEnumerable.sol";
|
|
8
6
|
|
|
9
7
|
/**
|
|
10
8
|
* @title IAccessControlExtended
|
|
@@ -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
|
|
|
8
6
|
// errors
|
|
9
7
|
import {LSP8NotTokenOperator} from "../../LSP8Errors.sol";
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
pragma solidity ^0.8.27;
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
LSP8IdentifiableDigitalAssetInitAbstract
|
|
6
|
-
} from "../../LSP8IdentifiableDigitalAssetInitAbstract.sol";
|
|
4
|
+
import {LSP8IdentifiableDigitalAssetInitAbstract} from "../../LSP8IdentifiableDigitalAssetInitAbstract.sol";
|
|
7
5
|
|
|
8
6
|
// errors
|
|
9
7
|
import {LSP8NotTokenOperator} from "../../LSP8Errors.sol";
|
|
@@ -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 {ILSP8CappedBalance} from "./ILSP8CappedBalance.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 {ILSP8CappedBalance} from "./ILSP8CappedBalance.sol";
|
|
@@ -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
|
// interfaces
|
|
10
8
|
import {ILSP8CappedSupply} from "./ILSP8CappedSupply.sol";
|
|
@@ -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
|
// interfaces
|
|
10
8
|
import {ILSP8CappedSupply} from "./ILSP8CappedSupply.sol";
|
|
@@ -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;
|
|
@@ -5,9 +5,14 @@ pragma solidity ^0.8.27;
|
|
|
5
5
|
/// @dev Interface for a non-transferable LSP8 token, enabling control over transferability, lock periods, and role-based exemptions.
|
|
6
6
|
interface ILSP8NonTransferable {
|
|
7
7
|
/// @dev Emitted when the transfer lock period is updated.
|
|
8
|
+
/// @param nonTransferabilityEnabled Whether the non-transferability feature is enabled or not.
|
|
8
9
|
/// @param start The new start timestamp of the transfer lock period.
|
|
9
10
|
/// @param end The new end timestamp of the transfer lock period.
|
|
10
|
-
event TransferLockPeriodChanged(
|
|
11
|
+
event TransferLockPeriodChanged(
|
|
12
|
+
bool indexed nonTransferabilityEnabled,
|
|
13
|
+
uint256 indexed start,
|
|
14
|
+
uint256 indexed end
|
|
15
|
+
);
|
|
11
16
|
|
|
12
17
|
/// @notice The start timestamp of the transfer lock period, at which point the token becomes non-transferable.
|
|
13
18
|
function transferLockStart() external view returns (uint256);
|
|
@@ -17,7 +22,7 @@ interface ILSP8NonTransferable {
|
|
|
17
22
|
|
|
18
23
|
/// @notice Returns whether the transfer lock feature is still enabled.
|
|
19
24
|
/// @dev When this returns `false`, the token has been permanently made transferable and the lock period can no longer be updated.
|
|
20
|
-
function
|
|
25
|
+
function nonTransferabilityEnabled() external view returns (bool);
|
|
21
26
|
|
|
22
27
|
/// @notice Checks if the token is currently transferable.
|
|
23
28
|
/// @dev Returns true if the token is transferable (based on the lock period). Note that transfers from addresses holding the bypass role and burning (transfers to address(0)) is always allowed, regardless of transferability status.
|
|
@@ -34,7 +39,8 @@ interface ILSP8NonTransferable {
|
|
|
34
39
|
/// - When `transferLockStart` is set to a value and `transferLockEnd` is 0, it means the tokens becomes non-transferable at a certain point in time and indefinitely (no end time).
|
|
35
40
|
///
|
|
36
41
|
/// - To make the token always non-transferable, set `transferLockStart` to 0 and `transferLockEnd` to type(uint256).max.
|
|
37
|
-
/// - To
|
|
42
|
+
/// - To remove the active lock while keeping the non-transferability feature configurable, set both `newTransferLockStart` and `newTransferLockEnd` to 0. In this state, transfers are currently unrestricted, but the owner can still configure a new lock period later.
|
|
43
|
+
/// - To permanently disable the non-transferability feature and prevent future lock-period updates, use the {makeTransferable} function.
|
|
38
44
|
///
|
|
39
45
|
/// @dev Can only be called by the contract owner. Reverts once {makeTransferable} has been called.
|
|
40
46
|
///
|
|
@@ -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";
|
|
@@ -39,7 +35,7 @@ abstract contract LSP8NonTransferableAbstract is
|
|
|
39
35
|
uint256 public transferLockEnd;
|
|
40
36
|
|
|
41
37
|
/// @inheritdoc ILSP8NonTransferable
|
|
42
|
-
bool public
|
|
38
|
+
bool public nonTransferabilityEnabled;
|
|
43
39
|
|
|
44
40
|
/// @notice Initializes the contract with lock period.
|
|
45
41
|
/// @param transferLockStart_ The start timestamp of the transfer lock period, 0 to disable.
|
|
@@ -51,9 +47,13 @@ abstract contract LSP8NonTransferableAbstract is
|
|
|
51
47
|
);
|
|
52
48
|
transferLockStart = transferLockStart_;
|
|
53
49
|
transferLockEnd = transferLockEnd_;
|
|
54
|
-
|
|
50
|
+
nonTransferabilityEnabled = true;
|
|
55
51
|
|
|
56
|
-
emit TransferLockPeriodChanged(
|
|
52
|
+
emit TransferLockPeriodChanged({
|
|
53
|
+
nonTransferabilityEnabled: true,
|
|
54
|
+
start: transferLockStart_,
|
|
55
|
+
end: transferLockEnd_
|
|
56
|
+
});
|
|
57
57
|
_grantRole(NON_TRANSFERABLE_BYPASS_ROLE, owner());
|
|
58
58
|
}
|
|
59
59
|
|
|
@@ -75,7 +75,7 @@ abstract contract LSP8NonTransferableAbstract is
|
|
|
75
75
|
// solhint-disable not-rely-on-time
|
|
76
76
|
// Transfer-lock windows are inherently time-based; `block.timestamp` is the intended source.
|
|
77
77
|
function isTransferable() public view virtual override returns (bool) {
|
|
78
|
-
if (!
|
|
78
|
+
if (!nonTransferabilityEnabled) return true;
|
|
79
79
|
|
|
80
80
|
bool isTransferLockStartEnabled = transferLockStart != 0;
|
|
81
81
|
bool isTransferLockEndEnabled = transferLockEnd != 0;
|
|
@@ -105,13 +105,17 @@ abstract contract LSP8NonTransferableAbstract is
|
|
|
105
105
|
/// @inheritdoc ILSP8NonTransferable
|
|
106
106
|
/// @custom:info The list of addresses holding the `NON_TRANSFERABLE_BYPASS_ROLE` remains populated after the non-transferable feature is switched off.
|
|
107
107
|
function makeTransferable() public virtual override onlyOwner {
|
|
108
|
-
require(
|
|
108
|
+
require(nonTransferabilityEnabled, LSP8TokenAlreadyTransferable());
|
|
109
109
|
|
|
110
|
-
|
|
110
|
+
nonTransferabilityEnabled = false;
|
|
111
111
|
transferLockStart = 0;
|
|
112
112
|
transferLockEnd = 0;
|
|
113
113
|
|
|
114
|
-
emit TransferLockPeriodChanged({
|
|
114
|
+
emit TransferLockPeriodChanged({
|
|
115
|
+
nonTransferabilityEnabled: false,
|
|
116
|
+
start: 0,
|
|
117
|
+
end: 0
|
|
118
|
+
});
|
|
115
119
|
}
|
|
116
120
|
|
|
117
121
|
/// @inheritdoc ILSP8NonTransferable
|
|
@@ -119,7 +123,10 @@ abstract contract LSP8NonTransferableAbstract is
|
|
|
119
123
|
uint256 newTransferLockStart,
|
|
120
124
|
uint256 newTransferLockEnd
|
|
121
125
|
) public virtual override onlyOwner {
|
|
122
|
-
require(
|
|
126
|
+
require(
|
|
127
|
+
nonTransferabilityEnabled,
|
|
128
|
+
LSP8CannotUpdateTransferLockPeriod()
|
|
129
|
+
);
|
|
123
130
|
|
|
124
131
|
// When transferLockEnd is 0, it means no end time is set (transfers locked indefinitely after transferLockStart)
|
|
125
132
|
// When transferLockStart is 0, it means no start time is set (transfers locked up until transferLockEnd)
|
|
@@ -134,6 +141,7 @@ abstract contract LSP8NonTransferableAbstract is
|
|
|
134
141
|
transferLockEnd = newTransferLockEnd;
|
|
135
142
|
|
|
136
143
|
emit TransferLockPeriodChanged({
|
|
144
|
+
nonTransferabilityEnabled: true,
|
|
137
145
|
start: newTransferLockStart,
|
|
138
146
|
end: newTransferLockEnd
|
|
139
147
|
});
|
|
@@ -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";
|
|
@@ -42,7 +36,7 @@ abstract contract LSP8NonTransferableInitAbstract is
|
|
|
42
36
|
uint256 public transferLockEnd;
|
|
43
37
|
|
|
44
38
|
/// @inheritdoc ILSP8NonTransferable
|
|
45
|
-
bool public
|
|
39
|
+
bool public nonTransferabilityEnabled;
|
|
46
40
|
|
|
47
41
|
/// @notice Initializes the LSP8NonTransferable contract with base token params and transfer settings.
|
|
48
42
|
/// @dev Initializes the LSP8IdentifiableDigitalAsset base, the access control layer and transfer settings.
|
|
@@ -90,9 +84,13 @@ abstract contract LSP8NonTransferableInitAbstract is
|
|
|
90
84
|
);
|
|
91
85
|
transferLockStart = transferLockStart_;
|
|
92
86
|
transferLockEnd = transferLockEnd_;
|
|
93
|
-
|
|
87
|
+
nonTransferabilityEnabled = true;
|
|
94
88
|
|
|
95
|
-
emit TransferLockPeriodChanged(
|
|
89
|
+
emit TransferLockPeriodChanged({
|
|
90
|
+
nonTransferabilityEnabled: true,
|
|
91
|
+
start: transferLockStart_,
|
|
92
|
+
end: transferLockEnd_
|
|
93
|
+
});
|
|
96
94
|
_grantRole(NON_TRANSFERABLE_BYPASS_ROLE, owner());
|
|
97
95
|
}
|
|
98
96
|
|
|
@@ -119,7 +117,7 @@ abstract contract LSP8NonTransferableInitAbstract is
|
|
|
119
117
|
// solhint-disable not-rely-on-time
|
|
120
118
|
// Transfer-lock windows are inherently time-based; `block.timestamp` is the intended source.
|
|
121
119
|
function isTransferable() public view virtual override returns (bool) {
|
|
122
|
-
if (!
|
|
120
|
+
if (!nonTransferabilityEnabled) return true;
|
|
123
121
|
|
|
124
122
|
bool isTransferLockStartEnabled = transferLockStart != 0;
|
|
125
123
|
bool isTransferLockEndEnabled = transferLockEnd != 0;
|
|
@@ -149,13 +147,17 @@ abstract contract LSP8NonTransferableInitAbstract is
|
|
|
149
147
|
/// @inheritdoc ILSP8NonTransferable
|
|
150
148
|
/// @custom:info The list of addresses holding the `NON_TRANSFERABLE_BYPASS_ROLE` remains populated after the non-transferable feature is switched off.
|
|
151
149
|
function makeTransferable() public virtual override onlyOwner {
|
|
152
|
-
require(
|
|
150
|
+
require(nonTransferabilityEnabled, LSP8TokenAlreadyTransferable());
|
|
153
151
|
|
|
154
|
-
|
|
152
|
+
nonTransferabilityEnabled = false;
|
|
155
153
|
transferLockStart = 0;
|
|
156
154
|
transferLockEnd = 0;
|
|
157
155
|
|
|
158
|
-
emit TransferLockPeriodChanged({
|
|
156
|
+
emit TransferLockPeriodChanged({
|
|
157
|
+
nonTransferabilityEnabled: false,
|
|
158
|
+
start: 0,
|
|
159
|
+
end: 0
|
|
160
|
+
});
|
|
159
161
|
}
|
|
160
162
|
|
|
161
163
|
/// @inheritdoc ILSP8NonTransferable
|
|
@@ -163,7 +165,10 @@ abstract contract LSP8NonTransferableInitAbstract is
|
|
|
163
165
|
uint256 newTransferLockStart,
|
|
164
166
|
uint256 newTransferLockEnd
|
|
165
167
|
) public virtual override onlyOwner {
|
|
166
|
-
require(
|
|
168
|
+
require(
|
|
169
|
+
nonTransferabilityEnabled,
|
|
170
|
+
LSP8CannotUpdateTransferLockPeriod()
|
|
171
|
+
);
|
|
167
172
|
|
|
168
173
|
// When transferLockEnd is 0, it means no end time is set (transfers locked indefinitely after transferLockStart)
|
|
169
174
|
// When transferLockStart is 0, it means no start time is set (transfers locked up until transferLockEnd)
|
|
@@ -178,6 +183,7 @@ abstract contract LSP8NonTransferableInitAbstract is
|
|
|
178
183
|
transferLockEnd = newTransferLockEnd;
|
|
179
184
|
|
|
180
185
|
emit TransferLockPeriodChanged({
|
|
186
|
+
nonTransferabilityEnabled: true,
|
|
181
187
|
start: newTransferLockStart,
|
|
182
188
|
end: newTransferLockEnd
|
|
183
189
|
});
|
|
@@ -9,6 +9,15 @@ interface ILSP8Revokable {
|
|
|
9
9
|
/// @dev Emitted when revokable status is changed.
|
|
10
10
|
event RevokableStatusChanged(bool indexed enabled);
|
|
11
11
|
|
|
12
|
+
/// @dev Emitted when a token is revoked from a holder.
|
|
13
|
+
event TokenRevoked(
|
|
14
|
+
address indexed revoker,
|
|
15
|
+
address indexed from,
|
|
16
|
+
address indexed to,
|
|
17
|
+
bytes32 tokenId,
|
|
18
|
+
bytes data
|
|
19
|
+
);
|
|
20
|
+
|
|
12
21
|
/// @notice Returns whether the feature to revoke tokens from users is enabled or not.
|
|
13
22
|
function isRevokable() external view returns (bool);
|
|
14
23
|
|
|
@@ -24,5 +33,10 @@ interface ILSP8Revokable {
|
|
|
24
33
|
/// @param to The address receiving the revoked token.
|
|
25
34
|
/// @param tokenId The tokenId to revoke.
|
|
26
35
|
/// @param data Additional data to include in the transfer notification.
|
|
27
|
-
function revoke(
|
|
36
|
+
function revoke(
|
|
37
|
+
address from,
|
|
38
|
+
address to,
|
|
39
|
+
bytes32 tokenId,
|
|
40
|
+
bytes memory data
|
|
41
|
+
) external;
|
|
28
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
|
|
@@ -75,6 +69,14 @@ abstract contract LSP8RevokableAbstract is
|
|
|
75
69
|
AccessControlUnauthorizedAccount(to, REVOKER_ROLE)
|
|
76
70
|
);
|
|
77
71
|
|
|
72
|
+
emit TokenRevoked({
|
|
73
|
+
revoker: msg.sender,
|
|
74
|
+
from: from,
|
|
75
|
+
to: to,
|
|
76
|
+
tokenId: tokenId,
|
|
77
|
+
data: data
|
|
78
|
+
});
|
|
79
|
+
|
|
78
80
|
// We assume revokers are trusted when specifying revocation destinations.
|
|
79
81
|
// Therefore, we bypass LSP1 receiver checks.
|
|
80
82
|
_transfer({
|
|
@@ -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
|
|
@@ -109,9 +101,23 @@ abstract contract LSP8RevokableInitAbstract is
|
|
|
109
101
|
AccessControlUnauthorizedAccount(to, REVOKER_ROLE)
|
|
110
102
|
);
|
|
111
103
|
|
|
104
|
+
emit TokenRevoked({
|
|
105
|
+
revoker: msg.sender,
|
|
106
|
+
from: from,
|
|
107
|
+
to: to,
|
|
108
|
+
tokenId: tokenId,
|
|
109
|
+
data: data
|
|
110
|
+
});
|
|
111
|
+
|
|
112
112
|
// We assume revokers are trusted when specifying revocation destinations.
|
|
113
113
|
// Therefore, we bypass LSP1 receiver checks.
|
|
114
|
-
_transfer(
|
|
114
|
+
_transfer({
|
|
115
|
+
from: from,
|
|
116
|
+
to: to,
|
|
117
|
+
tokenId: tokenId,
|
|
118
|
+
force: true,
|
|
119
|
+
data: data
|
|
120
|
+
});
|
|
115
121
|
}
|
|
116
122
|
|
|
117
123
|
function supportsInterface(
|
|
@@ -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
|