@lukso/lsp-smart-contracts 0.4.3 → 0.6.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.
Files changed (141) hide show
  1. package/README.md +38 -9
  2. package/artifacts/LSP0ERC725Account.json +398 -0
  3. package/artifacts/LSP0ERC725AccountInit.json +439 -0
  4. package/artifacts/LSP1UniversalReceiverDelegateUP.json +7 -7
  5. package/artifacts/LSP1UniversalReceiverDelegateVault.json +7 -7
  6. package/artifacts/LSP4Compatibility.json +195 -0
  7. package/artifacts/LSP4DigitalAssetMetadata.json +169 -0
  8. package/artifacts/LSP4DigitalAssetMetadataInit.json +231 -0
  9. package/artifacts/LSP6KeyManager.json +50 -28
  10. package/artifacts/LSP6KeyManagerInit.json +58 -23
  11. package/artifacts/LSP7CappedSupply.json +136 -11
  12. package/artifacts/LSP7CappedSupplyInit.json +163 -35
  13. package/artifacts/LSP7CompatibilityForERC20.json +204 -13
  14. package/artifacts/LSP7CompatibilityForERC20Init.json +727 -0
  15. package/artifacts/LSP7DigitalAsset.json +128 -13
  16. package/artifacts/LSP7DigitalAssetInit.json +152 -34
  17. package/artifacts/LSP7Mintable.json +129 -14
  18. package/artifacts/LSP7MintableInit.json +153 -35
  19. package/artifacts/LSP8CappedSupply.json +137 -11
  20. package/artifacts/LSP8CappedSupplyInit.json +172 -20
  21. package/artifacts/LSP8CompatibilityForERC721.json +138 -17
  22. package/artifacts/LSP8CompatibilityForERC721Init.json +873 -0
  23. package/artifacts/LSP8IdentifiableDigitalAsset.json +129 -13
  24. package/artifacts/LSP8IdentifiableDigitalAssetInit.json +161 -19
  25. package/artifacts/LSP8Mintable.json +141 -14
  26. package/artifacts/LSP8MintableInit.json +173 -20
  27. package/artifacts/LSP9Vault.json +374 -0
  28. package/artifacts/LSP9VaultInit.json +415 -0
  29. package/artifacts/UniversalFactory.json +127 -0
  30. package/artifacts/UniversalProfile.json +78 -53
  31. package/artifacts/UniversalProfileInit.json +117 -53
  32. package/artifacts/UniversalReceiverAddressStore.json +209 -0
  33. package/constants.js +500 -0
  34. package/contracts/Custom/ClaimOwnership.sol +31 -0
  35. package/contracts/Custom/ERC165Checker.sol +130 -0
  36. package/contracts/Custom/IClaimOwnership.sol +10 -0
  37. package/contracts/Factories/UniversalFactory.sol +155 -0
  38. package/contracts/LSP0ERC725Account/LSP0Constants.sol +5 -9
  39. package/contracts/LSP0ERC725Account/LSP0ERC725Account.sol +6 -8
  40. package/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +92 -48
  41. package/contracts/LSP0ERC725Account/LSP0ERC725AccountInit.sol +5 -5
  42. package/contracts/LSP0ERC725Account/LSP0ERC725AccountInitAbstract.sol +6 -21
  43. package/contracts/LSP10ReceivedVaults/LSP10Constants.sol +10 -0
  44. package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiver.sol +3 -0
  45. package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiverDelegate.sol +4 -2
  46. package/contracts/LSP1UniversalReceiver/LSP1Constants.sol +3 -9
  47. package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/Handling/TokenAndVaultHandling.sol +61 -165
  48. package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol +49 -6
  49. package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/Handling/TokenHandling.sol +50 -90
  50. package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol +40 -6
  51. package/contracts/LSP1UniversalReceiver/LSP1Utils.sol +48 -0
  52. package/contracts/LSP2ERC725YJSONSchema/LSP2Utils.sol +205 -0
  53. package/contracts/LSP3UniversalProfile/LSP3Constants.sol +11 -0
  54. package/contracts/LSP4DigitalAssetMetadata/ILSP4Compatibility.sol +1 -1
  55. package/contracts/LSP4DigitalAssetMetadata/LSP4Compatibility.sol +6 -15
  56. package/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol +10 -4
  57. package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol +11 -8
  58. package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInit.sol +9 -13
  59. package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol +14 -20
  60. package/contracts/LSP5ReceivedAssets/LSP5Constants.sol +10 -0
  61. package/contracts/LSP5ReceivedAssets/LSP5Utils.sol +205 -0
  62. package/contracts/LSP6KeyManager/ILSP6KeyManager.sol +21 -18
  63. package/contracts/LSP6KeyManager/LSP6Constants.sol +61 -24
  64. package/contracts/LSP6KeyManager/LSP6Errors.sol +37 -0
  65. package/contracts/LSP6KeyManager/LSP6KeyManager.sol +3 -4
  66. package/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol +475 -260
  67. package/contracts/LSP6KeyManager/LSP6KeyManagerInit.sol +6 -5
  68. package/contracts/LSP6KeyManager/LSP6KeyManagerInitAbstract.sol +7 -15
  69. package/contracts/LSP6KeyManager/LSP6Utils.sol +111 -0
  70. package/contracts/LSP7DigitalAsset/ILSP7DigitalAsset.sol +3 -8
  71. package/contracts/LSP7DigitalAsset/LSP7Constants.sol +5 -4
  72. package/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol +22 -8
  73. package/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +70 -96
  74. package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInit.sol +8 -9
  75. package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol +23 -21
  76. package/contracts/LSP7DigitalAsset/LSP7Errors.sol +23 -0
  77. package/contracts/LSP7DigitalAsset/extensions/ILSP7CappedSupply.sol +1 -1
  78. package/contracts/LSP7DigitalAsset/extensions/ILSP7CompatibilityForERC20.sol +22 -6
  79. package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol +7 -6
  80. package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyCore.sol +14 -12
  81. package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyInit.sol +3 -8
  82. package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyInitAbstract.sol +9 -17
  83. package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibilityForERC20.sol +37 -45
  84. package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibilityForERC20Core.sol +107 -0
  85. package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibilityForERC20Init.sol +22 -0
  86. package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibilityForERC20InitAbstract.sol +66 -0
  87. package/contracts/LSP7DigitalAsset/{extensions → presets}/ILSP7Mintable.sol +1 -1
  88. package/contracts/LSP7DigitalAsset/{extensions → presets}/LSP7Mintable.sol +4 -3
  89. package/contracts/LSP7DigitalAsset/{extensions → presets}/LSP7MintableCore.sol +5 -5
  90. package/contracts/LSP7DigitalAsset/{extensions → presets}/LSP7MintableInit.sol +3 -2
  91. package/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol +34 -0
  92. package/contracts/LSP8IdentifiableDigitalAsset/ILSP8IdentifiableDigitalAsset.sol +5 -16
  93. package/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol +6 -3
  94. package/contracts/LSP8IdentifiableDigitalAsset/LSP8Errors.sol +22 -0
  95. package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol +21 -8
  96. package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +102 -135
  97. package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInit.sol +8 -11
  98. package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol +22 -19
  99. package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CappedSupply.sol +1 -1
  100. package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CompatibilityForERC721.sol +17 -22
  101. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol +9 -15
  102. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyCore.sol +14 -12
  103. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInit.sol +3 -8
  104. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInitAbstract.sol +9 -18
  105. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibilityForERC721.sol +37 -189
  106. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibilityForERC721Core.sol +187 -0
  107. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibilityForERC721Init.sol +25 -0
  108. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibilityForERC721InitAbstract.sol +89 -0
  109. package/contracts/LSP8IdentifiableDigitalAsset/{extensions → presets}/ILSP8Mintable.sol +1 -1
  110. package/contracts/LSP8IdentifiableDigitalAsset/{extensions → presets}/LSP8Mintable.sol +4 -3
  111. package/contracts/LSP8IdentifiableDigitalAsset/{extensions → presets}/LSP8MintableCore.sol +5 -8
  112. package/contracts/LSP8IdentifiableDigitalAsset/{extensions → presets}/LSP8MintableInit.sol +4 -3
  113. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol +35 -0
  114. package/contracts/LSP9Vault/LSP9Constants.sol +14 -5
  115. package/contracts/LSP9Vault/LSP9Vault.sol +15 -37
  116. package/contracts/LSP9Vault/LSP9VaultCore.sol +105 -85
  117. package/contracts/LSP9Vault/LSP9VaultInit.sol +5 -4
  118. package/contracts/LSP9Vault/LSP9VaultInitAbstract.sol +15 -45
  119. package/contracts/Legacy/Registries/AddressRegistry.sol +43 -0
  120. package/contracts/Legacy/Registries/AddressRegistryRequiresERC725.sol +33 -0
  121. package/contracts/Legacy/UniversalReceiverAddressStore.sol +60 -0
  122. package/contracts/UniversalProfile.sol +11 -20
  123. package/contracts/UniversalProfileInit.sol +5 -4
  124. package/contracts/UniversalProfileInitAbstract.sol +14 -35
  125. package/contracts/Utils/UtilsLib.sol +47 -11
  126. package/package.json +23 -9
  127. package/artifacts/LSP1UniversalReceiverDelegateUPInit.json +0 -66
  128. package/artifacts/LSP1UniversalReceiverDelegateVaultInit.json +0 -66
  129. package/constants.ts +0 -350
  130. package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUPCore.sol +0 -52
  131. package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUPInit.sol +0 -26
  132. package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUPInitAbstract.sol +0 -28
  133. package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVaultCore.sol +0 -41
  134. package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVaultInit.sol +0 -23
  135. package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVaultInitAbstract.sol +0 -25
  136. package/contracts/LSP7DigitalAsset/extensions/LSP7MintableInitAbstract.sol +0 -47
  137. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8MintableInitAbstract.sol +0 -44
  138. package/contracts/UniversalProfileCore.sol +0 -56
  139. package/contracts/Utils/ERC725Utils.sol +0 -169
  140. package/contracts/Utils/LSP2Utils.sol +0 -127
  141. package/contracts/Utils/LSP6Utils.sol +0 -77
@@ -0,0 +1,187 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma solidity ^0.8.0;
4
+
5
+ // interfaces
6
+ import {ILSP8IdentifiableDigitalAsset} from "../ILSP8IdentifiableDigitalAsset.sol";
7
+ import {ILSP8CompatibilityForERC721} from "./ILSP8CompatibilityForERC721.sol";
8
+
9
+ // libraries
10
+ import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
11
+ import {BytesLib} from "solidity-bytes-utils/contracts/BytesLib.sol";
12
+
13
+ // modules
14
+ import {LSP4Compatibility} from "../../LSP4DigitalAssetMetadata/LSP4Compatibility.sol";
15
+ import {LSP8IdentifiableDigitalAssetCore} from "../LSP8IdentifiableDigitalAssetCore.sol";
16
+
17
+ // constants
18
+ import {_LSP4_METADATA_KEY} from "../../LSP4DigitalAssetMetadata/LSP4Constants.sol";
19
+
20
+ /**
21
+ * @dev LSP8 extension, for compatibility for clients / tools that expect ERC721.
22
+ */
23
+ abstract contract LSP8CompatibilityForERC721Core is
24
+ LSP4Compatibility,
25
+ LSP8IdentifiableDigitalAssetCore,
26
+ ILSP8CompatibilityForERC721
27
+ {
28
+ using EnumerableSet for EnumerableSet.AddressSet;
29
+
30
+ /*
31
+ * @inheritdoc ILSP8CompatibilityForERC721
32
+ */
33
+ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
34
+ // silence compiler warning about unused variable
35
+ tokenId;
36
+
37
+ bytes memory data = _getData(_LSP4_METADATA_KEY);
38
+
39
+ // offset = bytes4(hashSig) + bytes32(contentHash) -> 4 + 32 = 36
40
+ uint256 offset = 36;
41
+
42
+ bytes memory uriBytes = BytesLib.slice(data, offset, data.length - offset);
43
+ return string(uriBytes);
44
+ }
45
+
46
+ /**
47
+ * @inheritdoc ILSP8CompatibilityForERC721
48
+ */
49
+ function ownerOf(uint256 tokenId) external view virtual override returns (address) {
50
+ return tokenOwnerOf(bytes32(tokenId));
51
+ }
52
+
53
+ /**
54
+ * @inheritdoc ILSP8CompatibilityForERC721
55
+ */
56
+ function approve(address operator, uint256 tokenId) external virtual override {
57
+ authorizeOperator(operator, bytes32(tokenId));
58
+
59
+ emit Approval(tokenOwnerOf(bytes32(tokenId)), operator, tokenId);
60
+ }
61
+
62
+ /**
63
+ * @inheritdoc ILSP8CompatibilityForERC721
64
+ */
65
+ function getApproved(uint256 tokenId) external view virtual override returns (address) {
66
+ bytes32 tokenIdAsBytes32 = bytes32(tokenId);
67
+ _existsOrError(tokenIdAsBytes32);
68
+
69
+ EnumerableSet.AddressSet storage operatorsForTokenId = _operators[tokenIdAsBytes32];
70
+ uint256 operatorListLength = operatorsForTokenId.length();
71
+
72
+ if (operatorListLength == 0) {
73
+ return address(0);
74
+ } else {
75
+ // Read the last added operator authorized to provide "best" compatibility.
76
+ // In ERC721 there is one operator address at a time for a tokenId, so multiple calls to
77
+ // `approve` would cause `getApproved` to return the last added operator. In this
78
+ // compatibility version the same is true, when the authorized operators were not previously
79
+ // authorized. If addresses are removed, then `getApproved` returned address can change due
80
+ // to implementation of `EnumberableSet._remove`.
81
+ return operatorsForTokenId.at(operatorListLength - 1);
82
+ }
83
+ }
84
+
85
+ /*
86
+ * @inheritdoc ILSP8CompatibilityForERC721
87
+ */
88
+ function isApprovedForAll(address tokenOwner, address operator)
89
+ public
90
+ view
91
+ virtual
92
+ override
93
+ returns (bool)
94
+ {
95
+ // silence compiler warning about unused variable
96
+ tokenOwner;
97
+ operator;
98
+
99
+ return false;
100
+ }
101
+
102
+ /**
103
+ * @inheritdoc ILSP8CompatibilityForERC721
104
+ * @dev Compatible with ERC721 transferFrom.
105
+ * Using force=true so that EOA and any contract may receive the tokenId.
106
+ */
107
+ function transferFrom(
108
+ address from,
109
+ address to,
110
+ uint256 tokenId
111
+ ) external virtual override {
112
+ return transfer(from, to, bytes32(tokenId), true, "");
113
+ }
114
+
115
+ /**
116
+ * @inheritdoc ILSP8CompatibilityForERC721
117
+ * @dev Compatible with ERC721 safeTransferFrom.
118
+ * Using force=false so that no EOA and only contracts supporting LSP1 interface may receive the tokenId.
119
+ */
120
+ function safeTransferFrom(
121
+ address from,
122
+ address to,
123
+ uint256 tokenId
124
+ ) external virtual override {
125
+ return transfer(from, to, bytes32(tokenId), false, "");
126
+ }
127
+
128
+ /*
129
+ * @dev Compatible with ERC721 safeTransferFrom.
130
+ * Using force=false so that no EOA and only contracts supporting LSP1 interface may receive the tokenId.
131
+ */
132
+ function safeTransferFrom(
133
+ address from,
134
+ address to,
135
+ uint256 tokenId,
136
+ bytes memory data
137
+ ) external virtual override {
138
+ return transfer(from, to, bytes32(tokenId), false, data);
139
+ }
140
+
141
+ // --- Overrides
142
+
143
+ function authorizeOperator(address operator, bytes32 tokenId)
144
+ public
145
+ virtual
146
+ override(ILSP8IdentifiableDigitalAsset, LSP8IdentifiableDigitalAssetCore)
147
+ {
148
+ super.authorizeOperator(operator, tokenId);
149
+
150
+ emit Approval(
151
+ tokenOwnerOf(tokenId),
152
+ operator,
153
+ abi.decode(abi.encodePacked(tokenId), (uint256))
154
+ );
155
+ }
156
+
157
+ function _transfer(
158
+ address from,
159
+ address to,
160
+ bytes32 tokenId,
161
+ bool force,
162
+ bytes memory data
163
+ ) internal virtual override {
164
+ super._transfer(from, to, tokenId, force, data);
165
+
166
+ emit Transfer(from, to, abi.decode(abi.encodePacked(tokenId), (uint256)));
167
+ }
168
+
169
+ function _mint(
170
+ address to,
171
+ bytes32 tokenId,
172
+ bool force,
173
+ bytes memory data
174
+ ) internal virtual override {
175
+ super._mint(to, tokenId, force, data);
176
+
177
+ emit Transfer(address(0), to, abi.decode(abi.encodePacked(tokenId), (uint256)));
178
+ }
179
+
180
+ function _burn(bytes32 tokenId, bytes memory data) internal virtual override {
181
+ address tokenOwner = tokenOwnerOf(tokenId);
182
+
183
+ super._burn(tokenId, data);
184
+
185
+ emit Transfer(tokenOwner, address(0), abi.decode(abi.encodePacked(tokenId), (uint256)));
186
+ }
187
+ }
@@ -0,0 +1,25 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma solidity ^0.8.0;
4
+
5
+ // modules
6
+ import {LSP8CompatibilityForERC721InitAbstract} from "./LSP8CompatibilityForERC721InitAbstract.sol";
7
+
8
+ /**
9
+ * @dev LSP8 extension, for compatibility for clients / tools that expect ERC721.
10
+ */
11
+ contract LSP8CompatibilityForERC721Init is LSP8CompatibilityForERC721InitAbstract {
12
+ /**
13
+ * @notice Sets the name, the symbol and the owner of the token
14
+ * @param name_ The name of the token
15
+ * @param symbol_ The symbol of the token
16
+ * @param newOwner_ The owner of the token
17
+ */
18
+ function initialize(
19
+ string memory name_,
20
+ string memory symbol_,
21
+ address newOwner_
22
+ ) public virtual initializer {
23
+ LSP8CompatibilityForERC721InitAbstract._initialize(name_, symbol_, newOwner_);
24
+ }
25
+ }
@@ -0,0 +1,89 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma solidity ^0.8.0;
4
+
5
+ // interfaces
6
+ import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
7
+
8
+ // modules
9
+ import {LSP8IdentifiableDigitalAssetInitAbstract, LSP4DigitalAssetMetadataInitAbstract, ERC725YCore} from "../LSP8IdentifiableDigitalAssetInitAbstract.sol";
10
+ import {LSP8IdentifiableDigitalAssetCore} from "../LSP8IdentifiableDigitalAssetCore.sol";
11
+ import {LSP8CompatibilityForERC721Core} from "./LSP8CompatibilityForERC721Core.sol";
12
+
13
+ // constants
14
+ import {_INTERFACEID_ERC721, _INTERFACEID_ERC721METADATA} from "./LSP8CompatibilityConstants.sol";
15
+
16
+ /**
17
+ * @dev LSP8 extension, for compatibility for clients / tools that expect ERC721.
18
+ */
19
+ contract LSP8CompatibilityForERC721InitAbstract is
20
+ LSP8IdentifiableDigitalAssetInitAbstract,
21
+ LSP8CompatibilityForERC721Core
22
+ {
23
+ function _initialize(
24
+ string memory name_,
25
+ string memory symbol_,
26
+ address newOwner_
27
+ ) internal virtual override onlyInitializing {
28
+ LSP8IdentifiableDigitalAssetInitAbstract._initialize(name_, symbol_, newOwner_);
29
+ }
30
+
31
+ function authorizeOperator(address operator, bytes32 tokenId)
32
+ public
33
+ virtual
34
+ override(LSP8IdentifiableDigitalAssetCore, LSP8CompatibilityForERC721Core)
35
+ {
36
+ super.authorizeOperator(operator, tokenId);
37
+ }
38
+
39
+ function _transfer(
40
+ address from,
41
+ address to,
42
+ bytes32 tokenId,
43
+ bool force,
44
+ bytes memory data
45
+ ) internal virtual override(LSP8IdentifiableDigitalAssetCore, LSP8CompatibilityForERC721Core) {
46
+ super._transfer(from, to, tokenId, force, data);
47
+ }
48
+
49
+ function _mint(
50
+ address to,
51
+ bytes32 tokenId,
52
+ bool force,
53
+ bytes memory data
54
+ ) internal virtual override(LSP8IdentifiableDigitalAssetCore, LSP8CompatibilityForERC721Core) {
55
+ super._mint(to, tokenId, force, data);
56
+ }
57
+
58
+ function _burn(bytes32 tokenId, bytes memory data)
59
+ internal
60
+ virtual
61
+ override(LSP8IdentifiableDigitalAssetCore, LSP8CompatibilityForERC721Core)
62
+ {
63
+ super._burn(tokenId, data);
64
+ }
65
+
66
+ /**
67
+ * @dev See {IERC165-supportsInterface}.
68
+ */
69
+ function supportsInterface(bytes4 interfaceId)
70
+ public
71
+ view
72
+ virtual
73
+ override(IERC165, LSP8IdentifiableDigitalAssetInitAbstract)
74
+ returns (bool)
75
+ {
76
+ return
77
+ interfaceId == _INTERFACEID_ERC721 ||
78
+ interfaceId == _INTERFACEID_ERC721METADATA ||
79
+ super.supportsInterface(interfaceId);
80
+ }
81
+
82
+ function _setData(bytes32 key, bytes memory value)
83
+ internal
84
+ virtual
85
+ override(LSP4DigitalAssetMetadataInitAbstract, ERC725YCore)
86
+ {
87
+ super._setData(key, value);
88
+ }
89
+ }
@@ -3,7 +3,7 @@
3
3
  pragma solidity ^0.8.0;
4
4
 
5
5
  // interfaces
6
- import "../ILSP8IdentifiableDigitalAsset.sol";
6
+ import {ILSP8IdentifiableDigitalAsset} from "../ILSP8IdentifiableDigitalAsset.sol";
7
7
 
8
8
  /**
9
9
  * @dev LSP8 extension, mintable.
@@ -2,13 +2,14 @@
2
2
 
3
3
  pragma solidity ^0.8.0;
4
4
 
5
- import "./LSP8MintableCore.sol";
6
- import "../LSP8IdentifiableDigitalAsset.sol";
5
+ // modules
6
+ import {LSP8IdentifiableDigitalAsset} from "../LSP8IdentifiableDigitalAsset.sol";
7
+ import {LSP8MintableCore} from "./LSP8MintableCore.sol";
7
8
 
8
9
  /**
9
10
  * @dev LSP8 extension.
10
11
  */
11
- contract LSP8Mintable is LSP8MintableCore, LSP8IdentifiableDigitalAsset {
12
+ contract LSP8Mintable is LSP8IdentifiableDigitalAsset, LSP8MintableCore {
12
13
  // solhint-disable no-empty-blocks
13
14
  /**
14
15
  * @notice Sets the token-Metadata and register LSP8InterfaceId
@@ -2,19 +2,16 @@
2
2
 
3
3
  pragma solidity ^0.8.0;
4
4
 
5
- // modules
6
- import "../LSP8IdentifiableDigitalAssetCore.sol";
7
-
8
5
  // interfaces
9
- import "./ILSP8Mintable.sol";
6
+ import {ILSP8Mintable} from "./ILSP8Mintable.sol";
7
+
8
+ // modules
9
+ import {LSP8IdentifiableDigitalAssetCore} from "../LSP8IdentifiableDigitalAssetCore.sol";
10
10
 
11
11
  /**
12
12
  * @dev LSP8 extension
13
13
  */
14
- abstract contract LSP8MintableCore is
15
- ILSP8Mintable,
16
- LSP8IdentifiableDigitalAssetCore
17
- {
14
+ abstract contract LSP8MintableCore is LSP8IdentifiableDigitalAssetCore, ILSP8Mintable {
18
15
  /**
19
16
  * @inheritdoc ILSP8Mintable
20
17
  */
@@ -2,7 +2,8 @@
2
2
 
3
3
  pragma solidity ^0.8.0;
4
4
 
5
- import "./LSP8MintableInitAbstract.sol";
5
+ // modules
6
+ import {LSP8MintableInitAbstract} from "./LSP8MintableInitAbstract.sol";
6
7
 
7
8
  /**
8
9
  * @dev LSP8 extension.
@@ -18,7 +19,7 @@ contract LSP8MintableInit is LSP8MintableInitAbstract {
18
19
  string memory name_,
19
20
  string memory symbol_,
20
21
  address newOwner_
21
- ) public virtual override initializer {
22
- LSP8MintableInitAbstract.initialize(name_, symbol_, newOwner_);
22
+ ) public virtual initializer {
23
+ LSP8MintableInitAbstract._initialize(name_, symbol_, newOwner_);
23
24
  }
24
25
  }
@@ -0,0 +1,35 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma solidity ^0.8.0;
4
+
5
+ // modules
6
+ import {LSP8IdentifiableDigitalAssetInitAbstract} from "../LSP8IdentifiableDigitalAssetInitAbstract.sol";
7
+ import {LSP8MintableCore} from "./LSP8MintableCore.sol";
8
+
9
+ /**
10
+ * @dev LSP8 extension.
11
+ */
12
+ abstract contract LSP8MintableInitAbstract is
13
+ LSP8IdentifiableDigitalAssetInitAbstract,
14
+ LSP8MintableCore
15
+ {
16
+ function _initialize(
17
+ string memory name_,
18
+ string memory symbol_,
19
+ address newOwner_
20
+ ) internal virtual override onlyInitializing {
21
+ LSP8IdentifiableDigitalAssetInitAbstract._initialize(name_, symbol_, newOwner_);
22
+ }
23
+
24
+ /**
25
+ * @inheritdoc LSP8MintableCore
26
+ */
27
+ function mint(
28
+ address to,
29
+ bytes32 tokenId,
30
+ bool force,
31
+ bytes memory data
32
+ ) public virtual override onlyOwner {
33
+ _mint(to, tokenId, force, data);
34
+ }
35
+ }
@@ -2,11 +2,20 @@
2
2
  pragma solidity ^0.8.0;
3
3
 
4
4
  // --- ERC165 interface ids
5
- bytes4 constant _INTERFACEID_LSP9 = 0x75edcee5;
5
+ bytes4 constant _INTERFACEID_LSP9 = 0x8c1d44f6;
6
6
 
7
- // --- ERC725Y entries
7
+ // --- ERC725Y Keys
8
8
 
9
- // --- Token Hooks
10
- bytes32 constant _TYPEID_LSP9_VAULTSENDER = 0x3ca9f769340018257ac15b3a00e502e8fb730d66086f774210f84d0205af31e7; // keccak256("LSP9VaultSender")
9
+ // bytes10(keccak256('SupportedStandard')) + bytes2(0) + bytes20(keccak256('LSP9Vault'))
10
+ bytes32 constant _LSP9_SUPPORTED_STANDARDS_KEY = 0xeafec4d89fa9619884b600007c0334a14085fefa8b51ae5a40895018882bdb90;
11
11
 
12
- bytes32 constant _TYPEID_LSP9_VAULTRECIPIENT = 0x09aaf55960715d8d86b57af40be36b0bfd469c9a3643445d8c65d39e27b4c56f; // keccak256("LSP9VaultRecipient")
12
+ // bytes4(keccak256('LSP9Vault'))
13
+ bytes constant _LSP9_SUPPORTED_STANDARDS_VALUE = hex"7c0334a1";
14
+
15
+ // --- Vault Hooks
16
+
17
+ // keccak256("LSP9VaultSender")
18
+ bytes32 constant _TYPEID_LSP9_VAULTSENDER = 0x3ca9f769340018257ac15b3a00e502e8fb730d66086f774210f84d0205af31e7;
19
+
20
+ // keccak256("LSP9VaultRecipient")
21
+ bytes32 constant _TYPEID_LSP9_VAULTRECIPIENT = 0x09aaf55960715d8d86b57af40be36b0bfd469c9a3643445d8c65d39e27b4c56f;
@@ -1,56 +1,34 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.0;
3
3
 
4
+ // interfaces
5
+ import {IERC725Y} from "@erc725/smart-contracts/contracts/interfaces/IERC725Y.sol";
6
+
4
7
  // modules
5
- import "@erc725/smart-contracts/contracts/ERC725.sol";
6
- import "./LSP9VaultCore.sol";
8
+ import {OwnableUnset} from "@erc725/smart-contracts/contracts/custom/OwnableUnset.sol";
9
+ import {ERC725} from "@erc725/smart-contracts/contracts/ERC725.sol";
10
+ import {LSP9VaultCore, ClaimOwnership} from "./LSP9VaultCore.sol";
7
11
 
8
12
  // constants
9
- import "../LSP1UniversalReceiver/LSP1Constants.sol";
13
+ import {_INTERFACEID_LSP1} from "../LSP1UniversalReceiver/LSP1Constants.sol";
14
+ import {_INTERFACEID_LSP9, _LSP9_SUPPORTED_STANDARDS_KEY, _LSP9_SUPPORTED_STANDARDS_VALUE} from "../LSP9Vault/LSP9Constants.sol";
10
15
 
11
16
  /**
12
17
  * @title Implementation of LSP9Vault built on top of ERC725, LSP1UniversalReceiver
13
18
  * @author Fabian Vogelsteller, Yamen Merhi, Jean Cavallera
14
19
  * @dev Could be owned by a UniversalProfile and able to register received asset with UniversalReceiverDelegateVault
15
20
  */
16
- contract LSP9Vault is LSP9VaultCore, ERC725 {
21
+ contract LSP9Vault is LSP9VaultCore {
17
22
  /**
18
- * @notice Sets the owner of the contract and sets the SupportedStandards:LSP9Vault key and register
19
- * LSP1UniversalReceiver and LSP9Vault InterfaceId
23
+ * @notice Sets the owner of the contract and sets the SupportedStandards:LSP9Vault key
20
24
  * @param _newOwner the owner of the contract
21
25
  */
22
- constructor(address _newOwner) ERC725(_newOwner) {
23
- // set SupportedStandards:LSP9Vault
24
- bytes32 key = 0xeafec4d89fa9619884b6b891356264550000000000000000000000007c0334a1;
25
- bytes memory value = hex"7c0334a1";
26
- _setData(key, value);
27
-
28
- _notifyVaultReceiver(_newOwner);
26
+ constructor(address _newOwner) {
27
+ OwnableUnset._setOwner(_newOwner);
29
28
 
30
- _registerInterface(_INTERFACEID_LSP1);
31
- _registerInterface(_INTERFACEID_LSP9);
32
- }
29
+ // set key SupportedStandards:LSP9Vault
30
+ _setData(_LSP9_SUPPORTED_STANDARDS_KEY, _LSP9_SUPPORTED_STANDARDS_VALUE);
33
31
 
34
- /**
35
- * @inheritdoc OwnableUnset
36
- */
37
- function transferOwnership(address newOwner)
38
- public
39
- override(OwnableUnset, LSP9VaultCore)
40
- onlyOwner
41
- {
42
- LSP9VaultCore.transferOwnership(newOwner);
43
- }
44
-
45
- /**
46
- * @inheritdoc LSP9VaultCore
47
- */
48
- function setData(bytes32[] memory _keys, bytes[] memory _values)
49
- public
50
- virtual
51
- override(ERC725YCore, LSP9VaultCore)
52
- onlyAllowed
53
- {
54
- LSP9VaultCore.setData(_keys, _values);
32
+ _notifyVaultReceiver(_newOwner);
55
33
  }
56
34
  }