@lukso/lsp-smart-contracts 0.4.3 → 0.5.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 (49) hide show
  1. package/artifacts/LSP1UniversalReceiverDelegateUP.json +2 -2
  2. package/artifacts/LSP1UniversalReceiverDelegateUPInit.json +2 -2
  3. package/artifacts/LSP6KeyManager.json +18 -2
  4. package/artifacts/LSP6KeyManagerInit.json +18 -2
  5. package/artifacts/LSP7CompatibilityForERC20.json +78 -2
  6. package/artifacts/LSP7DigitalAsset.json +2 -2
  7. package/artifacts/LSP7DigitalAssetInit.json +2 -2
  8. package/artifacts/LSP7Mintable.json +2 -2
  9. package/artifacts/LSP7MintableInit.json +2 -2
  10. package/artifacts/LSP8CompatibilityForERC721.json +11 -6
  11. package/artifacts/LSP8IdentifiableDigitalAsset.json +2 -2
  12. package/artifacts/LSP8IdentifiableDigitalAssetInit.json +2 -2
  13. package/artifacts/LSP8Mintable.json +2 -2
  14. package/artifacts/LSP8MintableInit.json +2 -2
  15. package/artifacts/UniversalProfile.json +2 -34
  16. package/artifacts/UniversalProfileInit.json +2 -34
  17. package/constants.ts +6 -0
  18. package/contracts/LSP0ERC725Account/LSP0ERC725Account.sol +1 -1
  19. package/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +3 -3
  20. package/contracts/LSP0ERC725Account/LSP0ERC725AccountInitAbstract.sol +2 -2
  21. package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/Handling/TokenAndVaultHandling.sol +13 -0
  22. package/contracts/LSP4DigitalAssetMetadata/LSP4Compatibility.sol +2 -2
  23. package/contracts/LSP6KeyManager/LSP6Constants.sol +2 -1
  24. package/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol +166 -48
  25. package/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol +1 -1
  26. package/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +0 -2
  27. package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol +2 -2
  28. package/contracts/LSP7DigitalAsset/extensions/ILSP7CompatibilityForERC20.sol +20 -2
  29. package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol +1 -1
  30. package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyInitAbstract.sol +2 -2
  31. package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibilityForERC20.sol +25 -45
  32. package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibilityForERC20Core.sol +126 -0
  33. package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibilityForERC20Init.sol +22 -0
  34. package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibilityForERC20InitAbstract.sol +55 -0
  35. package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol +2 -2
  36. package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol +2 -2
  37. package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CompatibilityForERC721.sol +14 -11
  38. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol +2 -2
  39. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInitAbstract.sol +2 -2
  40. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibilityForERC721.sol +25 -185
  41. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibilityForERC721Core.sol +244 -0
  42. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibilityForERC721Init.sol +27 -0
  43. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibilityForERC721InitAbstract.sol +90 -0
  44. package/contracts/LSP9Vault/LSP9VaultCore.sol +1 -1
  45. package/contracts/UniversalProfile.sol +1 -15
  46. package/contracts/UniversalProfileInitAbstract.sol +1 -16
  47. package/contracts/Utils/LSP6Utils.sol +0 -14
  48. package/package.json +1 -1
  49. package/contracts/UniversalProfileCore.sol +0 -56
@@ -0,0 +1,90 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma solidity ^0.8.0;
4
+
5
+ // modules
6
+ import "./LSP8CompatibilityForERC721Core.sol";
7
+ import "../LSP8IdentifiableDigitalAssetInitAbstract.sol";
8
+
9
+ // constants
10
+ import "./LSP8CompatibilityConstants.sol";
11
+
12
+ /**
13
+ * @dev LSP8 extension, for compatibility for clients / tools that expect ERC721.
14
+ */
15
+ contract LSP8CompatibilityForERC721InitAbstract is
16
+ LSP8CompatibilityForERC721Core,
17
+ LSP8IdentifiableDigitalAssetInitAbstract
18
+ {
19
+ /**
20
+ * @notice Sets the name, the symbol and the owner of the token
21
+ * @param name_ The name of the token
22
+ * @param symbol_ The symbol of the token
23
+ * @param newOwner_ The owner of the token
24
+ */
25
+ function initialize(
26
+ string memory name_,
27
+ string memory symbol_,
28
+ address newOwner_
29
+ ) public virtual override onlyInitializing {
30
+ LSP8IdentifiableDigitalAssetInitAbstract.initialize(name_, symbol_, newOwner_);
31
+
32
+ _registerInterface(_INTERFACEID_ERC721);
33
+ _registerInterface(_INTERFACEID_ERC721METADATA);
34
+ }
35
+
36
+ function authorizeOperator(address operator, bytes32 tokenId)
37
+ public
38
+ virtual
39
+ override(
40
+ LSP8IdentifiableDigitalAssetCore,
41
+ LSP8CompatibilityForERC721Core
42
+ )
43
+ {
44
+ super.authorizeOperator(operator, tokenId);
45
+ }
46
+
47
+ function _transfer(
48
+ address from,
49
+ address to,
50
+ bytes32 tokenId,
51
+ bool force,
52
+ bytes memory data
53
+ )
54
+ internal
55
+ virtual
56
+ override(
57
+ LSP8IdentifiableDigitalAssetCore,
58
+ LSP8CompatibilityForERC721Core
59
+ )
60
+ {
61
+ super._transfer(from, to, tokenId, force, data);
62
+ }
63
+
64
+ function _mint(
65
+ address to,
66
+ bytes32 tokenId,
67
+ bool force,
68
+ bytes memory data
69
+ )
70
+ internal
71
+ virtual
72
+ override(
73
+ LSP8IdentifiableDigitalAssetCore,
74
+ LSP8CompatibilityForERC721Core
75
+ )
76
+ {
77
+ super._mint(to, tokenId, force, data);
78
+ }
79
+
80
+ function _burn(bytes32 tokenId, bytes memory data)
81
+ internal
82
+ virtual
83
+ override(
84
+ LSP8IdentifiableDigitalAssetCore,
85
+ LSP8CompatibilityForERC721Core
86
+ )
87
+ {
88
+ super._burn(tokenId, data);
89
+ }
90
+ }
@@ -22,7 +22,7 @@ import "./LSP9Constants.sol";
22
22
  * @author Fabian Vogelsteller, Yamen Merhi, Jean Cavallera
23
23
  * @dev Could be owned by a UniversalProfile and able to register received asset with UniversalReceiverDelegateVault
24
24
  */
25
- contract LSP9VaultCore is ERC725XCore, ERC725YCore, ILSP1UniversalReceiver {
25
+ contract LSP9VaultCore is ILSP1UniversalReceiver, ERC725XCore, ERC725YCore {
26
26
  using ERC725Utils for IERC725Y;
27
27
 
28
28
  /**
@@ -2,7 +2,6 @@
2
2
  pragma solidity ^0.8.0;
3
3
 
4
4
  // modules
5
- import "./UniversalProfileCore.sol";
6
5
  import "./LSP0ERC725Account/LSP0ERC725Account.sol";
7
6
 
8
7
  /**
@@ -10,7 +9,7 @@ import "./LSP0ERC725Account/LSP0ERC725Account.sol";
10
9
  * @author Fabian Vogelsteller <fabian@lukso.network>
11
10
  * @dev Implementation of the ERC725Account + LSP1 universalReceiver
12
11
  */
13
- contract UniversalProfile is LSP0ERC725Account, UniversalProfileCore {
12
+ contract UniversalProfile is LSP0ERC725Account {
14
13
  /**
15
14
  * @notice Sets the owner of the contract and sets the SupportedStandards:LSP3UniversalProfile key
16
15
  * @param _newOwner the owner of the contract
@@ -20,18 +19,5 @@ contract UniversalProfile is LSP0ERC725Account, UniversalProfileCore {
20
19
  bytes32 key = 0xeafec4d89fa9619884b6b89135626455000000000000000000000000abe425d6;
21
20
  bytes memory value = hex"abe425d6";
22
21
  _setData(key, value);
23
-
24
- dataKeys.push(key);
25
- }
26
-
27
- /**
28
- * @inheritdoc UniversalProfileCore
29
- */
30
- function setData(bytes32[] memory _keys, bytes[] memory _values)
31
- public
32
- override(UniversalProfileCore, ERC725YCore)
33
- onlyOwner
34
- {
35
- UniversalProfileCore.setData(_keys, _values);
36
22
  }
37
23
  }
@@ -2,7 +2,6 @@
2
2
  pragma solidity ^0.8.0;
3
3
 
4
4
  // modules
5
- import "./UniversalProfileCore.sol";
6
5
  import "./LSP0ERC725Account/LSP0ERC725AccountInitAbstract.sol";
7
6
 
8
7
  /**
@@ -12,8 +11,7 @@ import "./LSP0ERC725Account/LSP0ERC725AccountInitAbstract.sol";
12
11
  */
13
12
  abstract contract UniversalProfileInitAbstract is
14
13
  Initializable,
15
- LSP0ERC725AccountInitAbstract,
16
- UniversalProfileCore
14
+ LSP0ERC725AccountInitAbstract
17
15
  {
18
16
  /**
19
17
  * @notice Sets the owner of the contract and sets the SupportedStandards:LSP3UniversalProfile key
@@ -31,18 +29,5 @@ abstract contract UniversalProfileInitAbstract is
31
29
  bytes32 key = 0xeafec4d89fa9619884b6b89135626455000000000000000000000000abe425d6;
32
30
  bytes memory value = hex"abe425d6";
33
31
  _setData(key, value);
34
-
35
- dataKeys.push(key);
36
- }
37
-
38
- /**
39
- * @inheritdoc UniversalProfileCore
40
- */
41
- function setData(bytes32[] memory _keys, bytes[] memory _values)
42
- public
43
- override(UniversalProfileCore, ERC725YCore)
44
- onlyOwner
45
- {
46
- UniversalProfileCore.setData(_keys, _values);
47
32
  }
48
33
  }
@@ -60,18 +60,4 @@ library LSP6Utils {
60
60
  )
61
61
  );
62
62
  }
63
-
64
- function getAllowedStandardsFor(IERC725Y _account, address _address)
65
- internal
66
- view
67
- returns (bytes memory)
68
- {
69
- return
70
- _account.getDataSingle(
71
- LSP2Utils.generateBytes20MappingWithGroupingKey(
72
- _ADDRESS_ALLOWEDSTANDARDS,
73
- bytes20(_address)
74
- )
75
- );
76
- }
77
63
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lukso/lsp-smart-contracts",
3
- "version": "0.4.3",
3
+ "version": "0.5.0",
4
4
  "description": "The reference implementation for universal profiles smart contracts",
5
5
  "directories": {
6
6
  "test": "test"
@@ -1,56 +0,0 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- pragma solidity ^0.8.0;
3
-
4
- // modules
5
- import "./LSP0ERC725Account/LSP0ERC725AccountCore.sol";
6
- import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";
7
-
8
- // libraries
9
- import "./Utils/ERC725Utils.sol";
10
-
11
- /**
12
- * @title Core implementation of a LUKSO's Universal Profile based on LSP3
13
- * @author Fabian Vogelsteller <fabian@lukso.network>, Jean Cavallera, Yamen Merhi
14
- * @dev Implementation of the ERC725Account + LSP1 universalReceiver
15
- */
16
- abstract contract UniversalProfileCore is ERC165Storage, LSP0ERC725AccountCore {
17
- bytes32[] public dataKeys;
18
-
19
- /* non-standard public functions */
20
-
21
- /**
22
- * @dev Returns all the keys set on the account
23
- * @return The array of keys set on the account
24
- */
25
- function allDataKeys() public view returns (bytes32[] memory) {
26
- return dataKeys;
27
- }
28
-
29
- /* Standard public functions */
30
-
31
- /**
32
- * @inheritdoc IERC725Y
33
- * @dev Sets array of data at multiple given `key`
34
- * Push all the keys to the `dataKeys` array
35
- * SHOULD only be callable by the owner of the contract set via ERC173
36
- *
37
- * Emits a {DataChanged} event.
38
- */
39
- function setData(bytes32[] memory _keys, bytes[] memory _values)
40
- public
41
- virtual
42
- override
43
- onlyOwner
44
- {
45
- require(
46
- _keys.length == _values.length,
47
- "Keys length not equal to values length"
48
- );
49
- for (uint256 ii = 0; ii < _keys.length; ii++) {
50
- if (store[_keys[ii]].length == 0) {
51
- dataKeys.push(_keys[ii]);
52
- }
53
- _setData(_keys[ii], _values[ii]);
54
- }
55
- }
56
- }