@lukso/lsp-smart-contracts 0.6.2 → 0.7.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 (112) hide show
  1. package/README.md +2 -10
  2. package/artifacts/Create2Factory.json +2 -2
  3. package/artifacts/LSP0ERC725Account.json +36 -3
  4. package/artifacts/LSP0ERC725AccountInit.json +36 -29
  5. package/artifacts/LSP1UniversalReceiverDelegateUP.json +2 -2
  6. package/artifacts/LSP1UniversalReceiverDelegateVault.json +2 -2
  7. package/artifacts/LSP4Compatibility.json +6 -0
  8. package/artifacts/LSP4DigitalAssetMetadata.json +6 -0
  9. package/artifacts/{LSP4DigitalAssetMetadataInit.json → LSP4DigitalAssetMetadataInitAbstract.json} +8 -51
  10. package/artifacts/LSP6KeyManager.json +13 -2
  11. package/artifacts/LSP6KeyManagerInit.json +13 -2
  12. package/artifacts/LSP7CappedSupply.json +37 -26
  13. package/artifacts/{LSP7CappedSupplyInit.json → LSP7CappedSupplyInitAbstract.json} +39 -67
  14. package/artifacts/LSP7CompatibleERC20.json +39 -49
  15. package/artifacts/LSP7CompatibleERC20InitAbstract.json +717 -0
  16. package/artifacts/LSP7CompatibleERC20Mintable.json +39 -28
  17. package/artifacts/LSP7CompatibleERC20MintableInit.json +44 -54
  18. package/artifacts/LSP7DigitalAsset.json +39 -54
  19. package/artifacts/LSP7DigitalAssetInitAbstract.json +540 -0
  20. package/artifacts/LSP7Mintable.json +40 -29
  21. package/artifacts/LSP7MintableInit.json +40 -55
  22. package/artifacts/LSP8CappedSupply.json +43 -0
  23. package/artifacts/{LSP8CappedSupplyInit.json → LSP8CappedSupplyInitAbstract.json} +45 -41
  24. package/artifacts/LSP8CompatibleERC721.json +88 -23
  25. package/artifacts/LSP8CompatibleERC721InitAbstract.json +920 -0
  26. package/artifacts/LSP8CompatibleERC721Mintable.json +88 -2
  27. package/artifacts/LSP8CompatibleERC721MintableInit.json +93 -28
  28. package/artifacts/LSP8IdentifiableDigitalAsset.json +45 -23
  29. package/artifacts/LSP8IdentifiableDigitalAssetInitAbstract.json +628 -0
  30. package/artifacts/LSP8Mintable.json +45 -2
  31. package/artifacts/LSP8MintableInit.json +45 -28
  32. package/artifacts/LSP9Vault.json +36 -3
  33. package/artifacts/LSP9VaultInit.json +36 -29
  34. package/artifacts/UniversalFactory.json +2 -2
  35. package/artifacts/UniversalProfile.json +36 -3
  36. package/artifacts/UniversalProfileInit.json +36 -29
  37. package/artifacts/UniversalReceiverAddressStore.json +2 -2
  38. package/constants.js +73 -14
  39. package/contracts/Custom/ClaimOwnership.sol +67 -5
  40. package/contracts/Custom/ERC165Checker.sol +1 -1
  41. package/contracts/Custom/IClaimOwnership.sol +3 -1
  42. package/contracts/Factories/UniversalFactory.sol +7 -12
  43. package/contracts/LSP0ERC725Account/LSP0Constants.sol +1 -1
  44. package/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +20 -18
  45. package/contracts/LSP0ERC725Account/LSP0ERC725AccountInitAbstract.sol +1 -1
  46. package/contracts/LSP10ReceivedVaults/LSP10Constants.sol +2 -2
  47. package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/Handling/TokenAndVaultHandling.sol +1 -4
  48. package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol +2 -8
  49. package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/Handling/TokenHandling.sol +1 -4
  50. package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol +2 -2
  51. package/contracts/LSP1UniversalReceiver/LSP1Utils.sol +1 -1
  52. package/contracts/LSP2ERC725YJSONSchema/LSP2Utils.sol +92 -6
  53. package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol +15 -6
  54. package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol +15 -6
  55. package/contracts/LSP5ReceivedAssets/LSP5Constants.sol +2 -2
  56. package/contracts/LSP5ReceivedAssets/LSP5Utils.sol +3 -3
  57. package/contracts/LSP6KeyManager/ILSP6KeyManager.sol +1 -1
  58. package/contracts/LSP6KeyManager/LSP6Constants.sol +16 -21
  59. package/contracts/LSP6KeyManager/LSP6Errors.sol +8 -0
  60. package/contracts/LSP6KeyManager/LSP6KeyManager.sol +1 -1
  61. package/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol +103 -84
  62. package/contracts/LSP6KeyManager/LSP6KeyManagerInit.sol +1 -1
  63. package/contracts/LSP6KeyManager/LSP6KeyManagerInitAbstract.sol +1 -1
  64. package/contracts/LSP6KeyManager/LSP6Utils.sol +2 -1
  65. package/contracts/LSP7DigitalAsset/ILSP7DigitalAsset.sol +18 -5
  66. package/contracts/LSP7DigitalAsset/LSP7Constants.sol +1 -1
  67. package/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol +4 -4
  68. package/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +33 -24
  69. package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol +2 -2
  70. package/contracts/LSP7DigitalAsset/LSP7Errors.sol +2 -0
  71. package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyCore.sol +1 -1
  72. package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol +1 -1
  73. package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20Core.sol +5 -6
  74. package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInit.sol +7 -0
  75. package/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol +9 -7
  76. package/contracts/LSP7DigitalAsset/presets/LSP7MintableInit.sol +3 -3
  77. package/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol +8 -7
  78. package/contracts/LSP8IdentifiableDigitalAsset/ILSP8IdentifiableDigitalAsset.sol +3 -1
  79. package/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol +4 -4
  80. package/contracts/LSP8IdentifiableDigitalAsset/LSP8Errors.sol +6 -0
  81. package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol +1 -1
  82. package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +31 -30
  83. package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CompatibleERC721.sol +15 -1
  84. package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8Enumerable.sol +17 -0
  85. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyCore.sol +1 -1
  86. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol +1 -1
  87. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721Core.sol +51 -27
  88. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol +21 -0
  89. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableCore.sol +50 -0
  90. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableInitAbstract.sol +24 -0
  91. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol +7 -0
  92. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol +6 -4
  93. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol +5 -4
  94. package/contracts/LSP9Vault/LSP9Constants.sol +4 -1
  95. package/contracts/LSP9Vault/LSP9VaultCore.sol +117 -46
  96. package/contracts/LSP9Vault/LSP9VaultInitAbstract.sol +1 -1
  97. package/contracts/Legacy/UniversalReceiverAddressStore.sol +1 -0
  98. package/contracts/Utils/GasLib.sol +17 -0
  99. package/package.json +27 -30
  100. package/artifacts/LSP7CompatibleERC20Init.json +0 -760
  101. package/artifacts/LSP7DigitalAssetInit.json +0 -588
  102. package/artifacts/LSP8CompatibleERC721Init.json +0 -883
  103. package/artifacts/LSP8IdentifiableDigitalAssetInit.json +0 -639
  104. package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInit.sol +0 -26
  105. package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInit.sol +0 -39
  106. package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyInit.sol +0 -19
  107. package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20Init.sol +0 -29
  108. package/contracts/LSP7DigitalAsset/presets/LSP7MintableCore.sol +0 -26
  109. package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInit.sol +0 -35
  110. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInit.sol +0 -19
  111. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721Init.sol +0 -25
  112. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableCore.sol +0 -26
@@ -27,6 +27,12 @@ interface ILSP8CompatibleERC721 is ILSP8IdentifiableDigitalAsset {
27
27
  */
28
28
  event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
29
29
 
30
+ /**
31
+ * @dev This emits when an operator is enabled or disabled for an owner.
32
+ * The operator can manage all NFTs of the owner.
33
+ */
34
+ event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);
35
+
30
36
  /**
31
37
  * @dev Compatible with ERC721 transferFrom.
32
38
  * @param from The sending address
@@ -74,11 +80,19 @@ interface ILSP8CompatibleERC721 is ILSP8IdentifiableDigitalAsset {
74
80
 
75
81
  /**
76
82
  * @dev Compatible with ERC721 approve.
77
- * @param operator The address to approve for `amount`
83
+ * @param operator The address to approve for `tokenId`
78
84
  * @param tokenId The tokenId to approve
79
85
  */
80
86
  function approve(address operator, uint256 tokenId) external;
81
87
 
88
+ /**
89
+ * @notice Enable or disable approval for a third party ("operator") to manage all of `msg.sender`'s assets
90
+ * @dev Emits the ApprovalForAll event. The contract MUST allow multiple operators per owner.
91
+ * @param _operator Address to add to the set of authorized operators
92
+ * @param _approved True if the operator is approved, false to revoke approval
93
+ */
94
+ function setApprovalForAll(address _operator, bool _approved) external;
95
+
82
96
  /**
83
97
  * @dev Compatible with ERC721 getApproved.
84
98
  * @param tokenId The tokenId to query
@@ -0,0 +1,17 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma solidity ^0.8.0;
4
+
5
+ // interfaces
6
+ import {ILSP8IdentifiableDigitalAsset} from "../ILSP8IdentifiableDigitalAsset.sol";
7
+
8
+ /**
9
+ * @dev LSP8 extension, adds access to a token id by an index.
10
+ */
11
+ interface ILSP8Enumerable is ILSP8IdentifiableDigitalAsset {
12
+ /**
13
+ * @dev Returns a token id at index. See totalSupply() to get total number of minted tokens.
14
+ * @return TokenId or 0x00 if no token exist at the index `index`
15
+ */
16
+ function tokenAt(uint256 index) external view returns (bytes32);
17
+ }
@@ -26,7 +26,7 @@ abstract contract LSP8CappedSupplyCore is LSP8IdentifiableDigitalAssetCore, ILSP
26
26
  /**
27
27
  * @inheritdoc ILSP8CappedSupply
28
28
  */
29
- function tokenSupplyCap() public view virtual override returns (uint256) {
29
+ function tokenSupplyCap() public view virtual returns (uint256) {
30
30
  return _tokenSupplyCap;
31
31
  }
32
32
 
@@ -23,7 +23,7 @@ import {_INTERFACEID_ERC721, _INTERFACEID_ERC721METADATA} from "./LSP8Compatible
23
23
  /**
24
24
  * @dev LSP8 extension, for compatibility for clients / tools that expect ERC721.
25
25
  */
26
- contract LSP8CompatibleERC721 is LSP8IdentifiableDigitalAsset, LSP8CompatibleERC721Core {
26
+ abstract contract LSP8CompatibleERC721 is LSP8IdentifiableDigitalAsset, LSP8CompatibleERC721Core {
27
27
  using EnumerableSet for EnumerableSet.AddressSet;
28
28
 
29
29
  /**
@@ -14,6 +14,9 @@ import {BytesLib} from "solidity-bytes-utils/contracts/BytesLib.sol";
14
14
  import {LSP4Compatibility} from "../../LSP4DigitalAssetMetadata/LSP4Compatibility.sol";
15
15
  import {LSP8IdentifiableDigitalAssetCore} from "../LSP8IdentifiableDigitalAssetCore.sol";
16
16
 
17
+ // errors
18
+ import "../LSP8Errors.sol";
19
+
17
20
  // constants
18
21
  import {_LSP4_METADATA_KEY} from "../../LSP4DigitalAssetMetadata/LSP4Constants.sol";
19
22
 
@@ -27,13 +30,18 @@ abstract contract LSP8CompatibleERC721Core is
27
30
  {
28
31
  using EnumerableSet for EnumerableSet.AddressSet;
29
32
 
33
+ /**
34
+ * Mapping from owner to operator approvals
35
+ * @dev for backward compatibility with ERC721
36
+ */
37
+ mapping(address => mapping(address => bool)) private _operatorApprovals;
38
+
30
39
  /*
31
40
  * @inheritdoc ILSP8CompatibleERC721
32
41
  */
33
- function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
34
- // silence compiler warning about unused variable
35
- tokenId;
36
-
42
+ function tokenURI(
43
+ uint256 tokenId // solhint-disable no-unused-vars
44
+ ) public view virtual returns (string memory) {
37
45
  bytes memory data = _getData(_LSP4_METADATA_KEY);
38
46
 
39
47
  // offset = bytes4(hashSig) + bytes32(contentHash) -> 4 + 32 = 36
@@ -46,23 +54,27 @@ abstract contract LSP8CompatibleERC721Core is
46
54
  /**
47
55
  * @inheritdoc ILSP8CompatibleERC721
48
56
  */
49
- function ownerOf(uint256 tokenId) public view virtual override returns (address) {
57
+ function ownerOf(uint256 tokenId) public view virtual returns (address) {
50
58
  return tokenOwnerOf(bytes32(tokenId));
51
59
  }
52
60
 
53
61
  /**
54
62
  * @inheritdoc ILSP8CompatibleERC721
55
63
  */
56
- function approve(address operator, uint256 tokenId) public virtual override {
64
+ function approve(address operator, uint256 tokenId) public virtual {
57
65
  authorizeOperator(operator, bytes32(tokenId));
58
66
 
59
67
  emit Approval(tokenOwnerOf(bytes32(tokenId)), operator, tokenId);
60
68
  }
61
69
 
70
+ function setApprovalForAll(address operator, bool approved) public virtual {
71
+ _setApprovalForAll(msg.sender, operator, approved);
72
+ }
73
+
62
74
  /**
63
75
  * @inheritdoc ILSP8CompatibleERC721
64
76
  */
65
- function getApproved(uint256 tokenId) public view virtual override returns (address) {
77
+ function getApproved(uint256 tokenId) public view virtual returns (address) {
66
78
  bytes32 tokenIdAsBytes32 = bytes32(tokenId);
67
79
  _existsOrError(tokenIdAsBytes32);
68
80
 
@@ -89,14 +101,9 @@ abstract contract LSP8CompatibleERC721Core is
89
101
  public
90
102
  view
91
103
  virtual
92
- override
93
104
  returns (bool)
94
105
  {
95
- // silence compiler warning about unused variable
96
- tokenOwner;
97
- operator;
98
-
99
- return false;
106
+ return _operatorApprovals[tokenOwner][operator];
100
107
  }
101
108
 
102
109
  /**
@@ -108,8 +115,8 @@ abstract contract LSP8CompatibleERC721Core is
108
115
  address from,
109
116
  address to,
110
117
  uint256 tokenId
111
- ) public virtual override {
112
- return transfer(from, to, bytes32(tokenId), true, "");
118
+ ) public virtual {
119
+ return _transfer(from, to, bytes32(tokenId), true, "");
113
120
  }
114
121
 
115
122
  /**
@@ -121,8 +128,8 @@ abstract contract LSP8CompatibleERC721Core is
121
128
  address from,
122
129
  address to,
123
130
  uint256 tokenId
124
- ) public virtual override {
125
- return transfer(from, to, bytes32(tokenId), false, "");
131
+ ) public virtual {
132
+ return _transfer(from, to, bytes32(tokenId), false, "");
126
133
  }
127
134
 
128
135
  /*
@@ -134,8 +141,8 @@ abstract contract LSP8CompatibleERC721Core is
134
141
  address to,
135
142
  uint256 tokenId,
136
143
  bytes memory data
137
- ) public virtual override {
138
- return transfer(from, to, bytes32(tokenId), false, data);
144
+ ) public virtual {
145
+ return _transfer(from, to, bytes32(tokenId), false, data);
139
146
  }
140
147
 
141
148
  // --- Overrides
@@ -147,11 +154,7 @@ abstract contract LSP8CompatibleERC721Core is
147
154
  {
148
155
  super.authorizeOperator(operator, tokenId);
149
156
 
150
- emit Approval(
151
- tokenOwnerOf(tokenId),
152
- operator,
153
- abi.decode(abi.encodePacked(tokenId), (uint256))
154
- );
157
+ emit Approval(tokenOwnerOf(tokenId), operator, uint256(tokenId));
155
158
  }
156
159
 
157
160
  function _transfer(
@@ -161,9 +164,15 @@ abstract contract LSP8CompatibleERC721Core is
161
164
  bool force,
162
165
  bytes memory data
163
166
  ) internal virtual override {
167
+ address operator = msg.sender;
168
+
169
+ if (!isApprovedForAll(from, operator) && !_isOperatorOrOwner(operator, tokenId)) {
170
+ revert LSP8NotTokenOperator(tokenId, operator);
171
+ }
172
+
164
173
  super._transfer(from, to, tokenId, force, data);
165
174
 
166
- emit Transfer(from, to, abi.decode(abi.encodePacked(tokenId), (uint256)));
175
+ emit Transfer(from, to, uint256(tokenId));
167
176
  }
168
177
 
169
178
  function _mint(
@@ -174,7 +183,7 @@ abstract contract LSP8CompatibleERC721Core is
174
183
  ) internal virtual override {
175
184
  super._mint(to, tokenId, force, data);
176
185
 
177
- emit Transfer(address(0), to, abi.decode(abi.encodePacked(tokenId), (uint256)));
186
+ emit Transfer(address(0), to, uint256(tokenId));
178
187
  }
179
188
 
180
189
  function _burn(bytes32 tokenId, bytes memory data) internal virtual override {
@@ -182,6 +191,21 @@ abstract contract LSP8CompatibleERC721Core is
182
191
 
183
192
  super._burn(tokenId, data);
184
193
 
185
- emit Transfer(tokenOwner, address(0), abi.decode(abi.encodePacked(tokenId), (uint256)));
194
+ emit Transfer(tokenOwner, address(0), uint256(tokenId));
195
+ }
196
+
197
+ /**
198
+ * @dev Approve `operator` to operate on all of `owner` tokens
199
+ *
200
+ * Emits an {ApprovalForAll} event.
201
+ */
202
+ function _setApprovalForAll(
203
+ address tokensOwner,
204
+ address operator,
205
+ bool approved
206
+ ) internal virtual {
207
+ require(tokensOwner != operator, "LSP8CompatibleERC721: approve to caller");
208
+ _operatorApprovals[tokensOwner][operator] = approved;
209
+ emit ApprovalForAll(tokensOwner, operator, approved);
186
210
  }
187
211
  }
@@ -0,0 +1,21 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma solidity ^0.8.0;
4
+
5
+ // modules
6
+ import {LSP8IdentifiableDigitalAsset} from "../LSP8IdentifiableDigitalAsset.sol";
7
+ import {LSP8IdentifiableDigitalAssetCore} from "../LSP8IdentifiableDigitalAssetCore.sol";
8
+ import {LSP8EnumerableCore} from "./LSP8EnumerableCore.sol";
9
+
10
+ /**
11
+ * @dev LSP8 extension.
12
+ */
13
+ abstract contract LSP8Enumerable is LSP8IdentifiableDigitalAsset, LSP8EnumerableCore {
14
+ function _beforeTokenTransfer(
15
+ address from,
16
+ address to,
17
+ bytes32 tokenId
18
+ ) internal virtual override(LSP8IdentifiableDigitalAssetCore, LSP8EnumerableCore) {
19
+ super._beforeTokenTransfer(from, to, tokenId);
20
+ }
21
+ }
@@ -0,0 +1,50 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma solidity ^0.8.0;
4
+
5
+ // interfaces
6
+ import {ILSP8Enumerable} from "./ILSP8Enumerable.sol";
7
+
8
+ // modules
9
+ import {LSP8IdentifiableDigitalAssetCore} from "../LSP8IdentifiableDigitalAssetCore.sol";
10
+
11
+ /**
12
+ * @dev LSP8 extension, adds access to a token id by an index.
13
+ */
14
+ abstract contract LSP8EnumerableCore is LSP8IdentifiableDigitalAssetCore, ILSP8Enumerable {
15
+ // Mapping from token index to token id
16
+ mapping(uint256 => bytes32) private _indexToken;
17
+
18
+ // Mapping from token id to index
19
+ mapping(bytes32 => uint256) private _tokenIndex;
20
+
21
+ /**
22
+ * @inheritdoc ILSP8Enumerable
23
+ */
24
+ function tokenAt(uint256 index) public view returns (bytes32) {
25
+ return _indexToken[index];
26
+ }
27
+
28
+ function _beforeTokenTransfer(
29
+ address from,
30
+ address to,
31
+ bytes32 tokenId
32
+ ) internal virtual override(LSP8IdentifiableDigitalAssetCore) {
33
+ if (from == address(0)) {
34
+ uint256 index = _existingTokens;
35
+ _indexToken[index] = tokenId;
36
+ _tokenIndex[tokenId] = index;
37
+ } else if (to == address(0)) {
38
+ uint256 lastIndex = _existingTokens - 1;
39
+ uint256 index = _tokenIndex[tokenId];
40
+ if (index < lastIndex) {
41
+ bytes32 lastTokenId = _indexToken[lastIndex];
42
+ _indexToken[index] = lastTokenId;
43
+ _tokenIndex[lastTokenId] = index;
44
+ }
45
+ delete _indexToken[lastIndex];
46
+ delete _tokenIndex[tokenId];
47
+ }
48
+ super._beforeTokenTransfer(from, to, tokenId);
49
+ }
50
+ }
@@ -0,0 +1,24 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma solidity ^0.8.0;
4
+
5
+ // modules
6
+ import {LSP8IdentifiableDigitalAssetInitAbstract} from "../LSP8IdentifiableDigitalAssetInitAbstract.sol";
7
+ import {LSP8IdentifiableDigitalAssetCore} from "../LSP8IdentifiableDigitalAssetCore.sol";
8
+ import {LSP8EnumerableCore} from "./LSP8EnumerableCore.sol";
9
+
10
+ /**
11
+ * @dev LSP8 extension.
12
+ */
13
+ abstract contract LSP8EnumerableInitAbstract is
14
+ LSP8IdentifiableDigitalAssetInitAbstract,
15
+ LSP8EnumerableCore
16
+ {
17
+ function _beforeTokenTransfer(
18
+ address from,
19
+ address to,
20
+ bytes32 tokenId
21
+ ) internal virtual override(LSP8IdentifiableDigitalAssetCore, LSP8EnumerableCore) {
22
+ super._beforeTokenTransfer(from, to, tokenId);
23
+ }
24
+ }
@@ -7,6 +7,13 @@ import {
7
7
  } from "./LSP8CompatibleERC721MintableInitAbstract.sol";
8
8
 
9
9
  contract LSP8CompatibleERC721MintableInit is LSP8CompatibleERC721MintableInitAbstract {
10
+ /**
11
+ * @dev initialize (= lock) base implementation contract on deployment
12
+ */
13
+ constructor() {
14
+ _disableInitializers();
15
+ }
16
+
10
17
  /**
11
18
  * @notice Sets the name, the symbol and the owner of the token
12
19
  * @param name_ The name of the token
@@ -2,14 +2,16 @@
2
2
 
3
3
  pragma solidity ^0.8.0;
4
4
 
5
+ // interfaces
6
+ import {ILSP8Mintable} from "./ILSP8Mintable.sol";
7
+
5
8
  // modules
6
9
  import {LSP8IdentifiableDigitalAsset} from "../LSP8IdentifiableDigitalAsset.sol";
7
- import {LSP8MintableCore} from "./LSP8MintableCore.sol";
8
10
 
9
11
  /**
10
12
  * @dev LSP8 extension.
11
13
  */
12
- contract LSP8Mintable is LSP8IdentifiableDigitalAsset, LSP8MintableCore {
14
+ contract LSP8Mintable is LSP8IdentifiableDigitalAsset, ILSP8Mintable {
13
15
  // solhint-disable no-empty-blocks
14
16
  /**
15
17
  * @notice Sets the token-Metadata and register LSP8InterfaceId
@@ -24,14 +26,14 @@ contract LSP8Mintable is LSP8IdentifiableDigitalAsset, LSP8MintableCore {
24
26
  ) LSP8IdentifiableDigitalAsset(name_, symbol_, newOwner_) {}
25
27
 
26
28
  /**
27
- * @inheritdoc LSP8MintableCore
29
+ * @inheritdoc ILSP8Mintable
28
30
  */
29
31
  function mint(
30
32
  address to,
31
33
  bytes32 tokenId,
32
34
  bool force,
33
35
  bytes memory data
34
- ) public override onlyOwner {
36
+ ) public virtual onlyOwner {
35
37
  _mint(to, tokenId, force, data);
36
38
  }
37
39
  }
@@ -2,18 +2,19 @@
2
2
 
3
3
  pragma solidity ^0.8.0;
4
4
 
5
+ // interfaces
6
+ import {ILSP8Mintable} from "./ILSP8Mintable.sol";
5
7
  // modules
6
8
  import {
7
9
  LSP8IdentifiableDigitalAssetInitAbstract
8
10
  } from "../LSP8IdentifiableDigitalAssetInitAbstract.sol";
9
- import {LSP8MintableCore} from "./LSP8MintableCore.sol";
10
11
 
11
12
  /**
12
13
  * @dev LSP8 extension.
13
14
  */
14
15
  abstract contract LSP8MintableInitAbstract is
15
16
  LSP8IdentifiableDigitalAssetInitAbstract,
16
- LSP8MintableCore
17
+ ILSP8Mintable
17
18
  {
18
19
  function _initialize(
19
20
  string memory name_,
@@ -24,14 +25,14 @@ abstract contract LSP8MintableInitAbstract is
24
25
  }
25
26
 
26
27
  /**
27
- * @inheritdoc LSP8MintableCore
28
+ * @inheritdoc ILSP8Mintable
28
29
  */
29
30
  function mint(
30
31
  address to,
31
32
  bytes32 tokenId,
32
33
  bool force,
33
34
  bytes memory data
34
- ) public virtual override onlyOwner {
35
+ ) public virtual onlyOwner {
35
36
  _mint(to, tokenId, force, data);
36
37
  }
37
38
  }
@@ -2,7 +2,7 @@
2
2
  pragma solidity ^0.8.0;
3
3
 
4
4
  // --- ERC165 interface ids
5
- bytes4 constant _INTERFACEID_LSP9 = 0x8c1d44f6;
5
+ bytes4 constant _INTERFACEID_LSP9 = 0xfd4d5c50;
6
6
 
7
7
  // --- ERC725Y Keys
8
8
 
@@ -19,3 +19,6 @@ bytes32 constant _TYPEID_LSP9_VAULTSENDER = 0x3ca9f769340018257ac15b3a00e502e8fb
19
19
 
20
20
  // keccak256("LSP9VaultRecipient")
21
21
  bytes32 constant _TYPEID_LSP9_VAULTRECIPIENT = 0x09aaf55960715d8d86b57af40be36b0bfd469c9a3643445d8c65d39e27b4c56f;
22
+
23
+ // keccak256("LSP9VaultPendingOwner")
24
+ bytes32 constant _TYPEID_LSP9_VAULTPENDINGOWNER = 0x50d401f7017708f51f2a7a1c24146f786926c831079107140037b8ebef9fd326;