@lukso/universalprofile-contracts 0.15.0-rc.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.
package/README.md ADDED
@@ -0,0 +1,22 @@
1
+ # Universal Profile · [![npm version](https://img.shields.io/npm/v/@lukso/universalprofile-contracts.svg?style=flat)](https://www.npmjs.com/package/@lukso/universalprofile-contracts)
2
+
3
+ Smart Contract implementation for **Universal Profile**, a combination of LSP0 ERC725 Account and LSP3 Profile Metadata.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm i @lukso/universalprofile-contracts
9
+ ```
10
+
11
+ ## Solidity constants
12
+
13
+ The constants related to LSP3 Profile Metadata can be directly imported from the `Constants.sol` file.
14
+
15
+ <!-- prettier-ignore -->
16
+ ```solidity
17
+ import {
18
+ _LSP3_SUPPORTED_STANDARDS_KEY,
19
+ _LSP3_SUPPORTED_STANDARDS_VALUE,
20
+ _LSP3_PROFILE_KEY
21
+ } from "universalprofile/contracts/Constants.sol";
22
+ ```
@@ -0,0 +1,14 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.0;
3
+
4
+ /// @dev This files makes constants related to LSP3 Profile Metadata available to be imported
5
+ /// directly from the UniversalProfile package.
6
+
7
+ // solhint-disable no-unused-import
8
+ import {
9
+ _LSP3_SUPPORTED_STANDARDS_KEY,
10
+ _LSP3_SUPPORTED_STANDARDS_VALUE,
11
+ _LSP3_PROFILE_KEY
12
+ } from "@lukso/lsp3-contracts/contracts/LSP3Constants.sol";
13
+
14
+ // solhint-enable
@@ -0,0 +1,42 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.4;
3
+
4
+ // modules
5
+ import {
6
+ LSP0ERC725Account
7
+ } from "@lukso/lsp0-contracts/contracts/LSP0ERC725Account.sol";
8
+
9
+ // constants
10
+ import {
11
+ _LSP3_SUPPORTED_STANDARDS_KEY,
12
+ _LSP3_SUPPORTED_STANDARDS_VALUE
13
+ } from "@lukso/lsp3-contracts/contracts/LSP3Constants.sol";
14
+
15
+ /**
16
+ * @title implementation of a LUKSO's Universal Profile based on LSP3
17
+ * @author Fabian Vogelsteller <fabian@lukso.network>
18
+ * @dev Implementation of the ERC725Account + LSP1 universalReceiver
19
+ */
20
+ contract UniversalProfile is LSP0ERC725Account {
21
+ /**
22
+ * @notice Deploying a UniversalProfile contract with owner set to address `initialOwner`.
23
+ *
24
+ * @dev Set `initialOwner` as the contract owner and the `SupportedStandards:LSP3Profile` data key in the ERC725Y data key/value store.
25
+ * - The `constructor` is payable and allows funding the contract on deployment.
26
+ * - The `initialOwner` will then be allowed to call protected functions marked with the `onlyOwner` modifier.
27
+ *
28
+ * @param initialOwner the owner of the contract
29
+ *
30
+ * @custom:events
31
+ * - {UniversalReceiver} event when funding the contract on deployment.
32
+ * - {OwnershipTransferred} event when `initialOwner` is set as the contract {owner}.
33
+ * - {DataChanged} event when setting the {_LSP3_SUPPORTED_STANDARDS_KEY}.
34
+ */
35
+ constructor(address initialOwner) payable LSP0ERC725Account(initialOwner) {
36
+ // set data key SupportedStandards:LSP3Profile
37
+ _setData(
38
+ _LSP3_SUPPORTED_STANDARDS_KEY,
39
+ _LSP3_SUPPORTED_STANDARDS_VALUE
40
+ );
41
+ }
42
+ }
@@ -0,0 +1,42 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.4;
3
+
4
+ // modules
5
+ import {Version} from "./Version.sol";
6
+ import {UniversalProfileInitAbstract} from "./UniversalProfileInitAbstract.sol";
7
+
8
+ /**
9
+ * @title Deployable Proxy implementation of a LUKSO's Universal Profile based on LSP3
10
+ * @author Fabian Vogelsteller <fabian@lukso.network>
11
+ * @dev Implementation of the ERC725Account + LSP1 universalReceiver
12
+ */
13
+ contract UniversalProfileInit is UniversalProfileInitAbstract, Version {
14
+ /**
15
+ * @notice deploying a `UniversalProfileInit` base contract to be used behind proxy
16
+ * @dev Locks the base contract on deployment, so that it cannot be initialized, owned and controlled by anyone after it has been deployed.
17
+ * This is intended so that the sole purpose of this contract is to be used as a base contract behind a proxy.
18
+ */
19
+ constructor() {
20
+ _disableInitializers();
21
+ }
22
+
23
+ /**
24
+ * @notice Initializing a UniversalProfile contract with owner set to address `initialOwner`.
25
+ *
26
+ * @dev Set `initialOwner` as the contract owner and the `SupportedStandards:LSP3Profile` data key in the ERC725Y data key/value store.
27
+ * - The `initialize(address)` function is payable and allows funding the contract on initialization.
28
+ * - The `initialOwner` will then be allowed to call protected functions marked with the `onlyOwner` modifier.
29
+ *
30
+ * @param initialOwner the owner of the contract
31
+ *
32
+ * @custom:events
33
+ * - {UniversalReceiver} event when funding the contract on deployment.
34
+ * - {OwnershipTransferred} event when `initialOwner` is set as the contract {owner}.
35
+ * - {DataChanged} event when setting the {_LSP3_SUPPORTED_STANDARDS_KEY}.
36
+ */
37
+ function initialize(
38
+ address initialOwner
39
+ ) external payable virtual initializer {
40
+ UniversalProfileInitAbstract._initialize(initialOwner);
41
+ }
42
+ }
@@ -0,0 +1,47 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.4;
3
+
4
+ // modules
5
+ import {
6
+ LSP0ERC725AccountInitAbstract
7
+ } from "@lukso/lsp0-contracts/contracts/LSP0ERC725AccountInitAbstract.sol";
8
+
9
+ // constants
10
+ import {
11
+ _LSP3_SUPPORTED_STANDARDS_KEY,
12
+ _LSP3_SUPPORTED_STANDARDS_VALUE
13
+ } from "@lukso/lsp3-contracts/contracts/LSP3Constants.sol";
14
+
15
+ /**
16
+ * @title Inheritable Proxy implementation of a LUKSO's Universal Profile based on LSP3
17
+ * @author Fabian Vogelsteller <fabian@lukso.network>
18
+ * @dev Implementation of the ERC725Account + LSP1 universalReceiver
19
+ */
20
+ abstract contract UniversalProfileInitAbstract is
21
+ LSP0ERC725AccountInitAbstract
22
+ {
23
+ /**
24
+ * @dev Set `initialOwner` as the contract owner and the `SupportedStandards:LSP3Profile` data key in the ERC725Y data key/value store.
25
+ * The `initialOwner` will then be allowed to call protected functions marked with the `onlyOwner` modifier.
26
+ *
27
+ * @param initialOwner The owner of the contract.
28
+ *
29
+ * @custom:warning ERC725X & ERC725Y parent contracts are not initialised as they don't have non-zero initial state. If you decide to add non-zero initial state to any of those contracts, you must initialize them here.
30
+ *
31
+ * @custom:events
32
+ * - {UniversalReceiver} event when funding the contract on deployment.
33
+ * - {OwnershipTransferred} event when `initialOwner` is set as the contract {owner}.
34
+ * - {DataChanged} event when setting the {_LSP3_SUPPORTED_STANDARDS_KEY}.
35
+ */
36
+ function _initialize(
37
+ address initialOwner
38
+ ) internal virtual override onlyInitializing {
39
+ LSP0ERC725AccountInitAbstract._initialize(initialOwner);
40
+
41
+ // set data key SupportedStandards:LSP3Profile
42
+ _setData(
43
+ _LSP3_SUPPORTED_STANDARDS_KEY,
44
+ _LSP3_SUPPORTED_STANDARDS_VALUE
45
+ );
46
+ }
47
+ }
@@ -0,0 +1,17 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.4;
3
+
4
+ abstract contract Version {
5
+ /**
6
+ * @dev Get the version of the contract.
7
+ * @notice Contract version.
8
+ *
9
+ * @return The version of the the contract.
10
+ */
11
+ // DO NOT CHANGE
12
+ // Comments block below is used by release-please to automatically update the version in this file.
13
+ // x-release-please-start-version
14
+ string public constant VERSION = "0.14.0";
15
+
16
+ // x-release-please-end
17
+ }
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@lukso/universalprofile-contracts",
3
+ "version": "0.15.0-rc.0",
4
+ "description": "Package for Universal Profile, an implementation of LSP0 ERC725 Account & LSP3 Profile Metadata standards combined together.",
5
+ "license": "Apache-2.0",
6
+ "author": "",
7
+ "keywords": [
8
+ "LUKSO",
9
+ "LSP",
10
+ "Blockchain",
11
+ "Standards",
12
+ "Smart Contracts",
13
+ "Ethereum",
14
+ "EVM",
15
+ "Solidity"
16
+ ],
17
+ "main": "./dist/index.cjs",
18
+ "module": "./dist/index.mjs",
19
+ "typings": "./dist/index.d.ts",
20
+ "exports": {
21
+ ".": {
22
+ "require": "./dist/index.cjs",
23
+ "import": "./dist/index.mjs",
24
+ "types": "./dist/index.d.ts"
25
+ },
26
+ "./artifacts/*": "./artifacts/*",
27
+ "./package.json": "./package.json"
28
+ },
29
+ "files": [
30
+ "contracts/**/*.sol",
31
+ "!contracts/Mocks/**/*.sol",
32
+ "artifacts/*.json",
33
+ "dist",
34
+ "./README.md"
35
+ ],
36
+ "scripts": {
37
+ "build": "hardhat compile --show-stack-traces",
38
+ "clean": "hardhat clean && rm -Rf dist/",
39
+ "format": "prettier --write .",
40
+ "lint": "eslint . --ext .ts,.js",
41
+ "lint:solidity": "solhint 'contracts/**/*.sol' && prettier --check 'contracts/**/*.sol'"
42
+ },
43
+ "dependencies": {
44
+ "@erc725/smart-contracts": "^7.0.0",
45
+ "@openzeppelin/contracts": "^4.9.3",
46
+ "@lukso/lsp0-contracts": "*",
47
+ "@lukso/lsp3-contracts": "*"
48
+ }
49
+ }