@lukso/lsp-smart-contracts 0.5.0 → 0.6.2
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 +38 -9
- package/artifacts/Create2Factory.json +2 -2
- package/artifacts/LSP0ERC725Account.json +398 -0
- package/artifacts/LSP0ERC725AccountInit.json +444 -0
- package/artifacts/LSP1UniversalReceiverDelegateUP.json +21 -5
- package/artifacts/LSP1UniversalReceiverDelegateVault.json +21 -5
- package/artifacts/LSP4Compatibility.json +195 -0
- package/artifacts/LSP4DigitalAssetMetadata.json +179 -0
- package/artifacts/LSP4DigitalAssetMetadataInit.json +241 -0
- package/artifacts/LSP6KeyManager.json +110 -35
- package/artifacts/LSP6KeyManagerInit.json +123 -30
- package/artifacts/LSP7CappedSupply.json +146 -11
- package/artifacts/LSP7CappedSupplyInit.json +167 -57
- package/artifacts/LSP7CompatibleERC20.json +714 -0
- package/artifacts/LSP7CompatibleERC20Init.json +760 -0
- package/artifacts/LSP7CompatibleERC20Mintable.json +742 -0
- package/artifacts/LSP7CompatibleERC20MintableInit.json +783 -0
- package/artifacts/LSP7DigitalAsset.json +138 -13
- package/artifacts/LSP7DigitalAssetInit.json +167 -34
- package/artifacts/LSP7Mintable.json +139 -14
- package/artifacts/LSP7MintableInit.json +168 -35
- package/artifacts/LSP8CappedSupply.json +147 -11
- package/artifacts/LSP8CappedSupplyInit.json +176 -37
- package/artifacts/LSP8CompatibleERC721.json +842 -0
- package/artifacts/LSP8CompatibleERC721Init.json +883 -0
- package/artifacts/LSP8CompatibleERC721Mintable.json +881 -0
- package/artifacts/LSP8CompatibleERC721MintableInit.json +922 -0
- package/artifacts/LSP8IdentifiableDigitalAsset.json +139 -13
- package/artifacts/LSP8IdentifiableDigitalAssetInit.json +176 -19
- package/artifacts/LSP8Mintable.json +151 -14
- package/artifacts/LSP8MintableInit.json +188 -20
- package/artifacts/LSP9Vault.json +374 -0
- package/artifacts/LSP9VaultInit.json +420 -0
- package/artifacts/UniversalFactory.json +127 -0
- package/artifacts/UniversalProfile.json +89 -32
- package/artifacts/UniversalProfileInit.json +133 -32
- package/artifacts/UniversalReceiverAddressStore.json +209 -0
- package/constants.js +535 -0
- package/contracts/Custom/ClaimOwnership.sol +34 -0
- package/contracts/Custom/ERC165Checker.sol +130 -0
- package/contracts/Custom/IClaimOwnership.sol +10 -0
- package/contracts/Factories/Create2Factory.sol +3 -13
- package/contracts/Factories/UniversalFactory.sol +164 -0
- package/contracts/LSP0ERC725Account/LSP0Constants.sol +5 -9
- package/contracts/LSP0ERC725Account/LSP0ERC725Account.sol +7 -9
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +108 -55
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountInit.sol +11 -4
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountInitAbstract.sol +6 -21
- package/contracts/LSP10ReceivedVaults/LSP10Constants.sol +10 -0
- package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiver.sol +3 -0
- package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiverDelegate.sol +4 -2
- package/contracts/LSP1UniversalReceiver/LSP1Constants.sol +3 -9
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/Handling/TokenAndVaultHandling.sol +67 -184
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol +58 -6
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/Handling/TokenHandling.sol +51 -89
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol +46 -6
- package/contracts/LSP1UniversalReceiver/LSP1Utils.sol +62 -0
- package/contracts/LSP2ERC725YJSONSchema/LSP2Errors.sol +9 -0
- package/contracts/LSP2ERC725YJSONSchema/LSP2Utils.sol +201 -0
- package/contracts/LSP3UniversalProfile/LSP3Constants.sol +11 -0
- package/contracts/LSP4DigitalAssetMetadata/ILSP4Compatibility.sol +1 -1
- package/contracts/LSP4DigitalAssetMetadata/LSP4Compatibility.sol +5 -14
- package/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol +10 -4
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol +22 -8
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInit.sol +9 -13
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol +26 -20
- package/contracts/LSP4DigitalAssetMetadata/LSP4Errors.sol +16 -0
- package/contracts/LSP5ReceivedAssets/LSP5Constants.sol +10 -0
- package/contracts/LSP5ReceivedAssets/LSP5Utils.sol +231 -0
- package/contracts/LSP6KeyManager/ILSP6KeyManager.sol +28 -25
- package/contracts/LSP6KeyManager/LSP6Constants.sol +61 -25
- package/contracts/LSP6KeyManager/LSP6Errors.sol +66 -0
- package/contracts/LSP6KeyManager/LSP6KeyManager.sol +7 -6
- package/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol +465 -378
- package/contracts/LSP6KeyManager/LSP6KeyManagerInit.sol +13 -5
- package/contracts/LSP6KeyManager/LSP6KeyManagerInitAbstract.sol +9 -15
- package/contracts/LSP6KeyManager/LSP6Utils.sol +107 -0
- package/contracts/LSP7DigitalAsset/ILSP7DigitalAsset.sol +3 -8
- package/contracts/LSP7DigitalAsset/LSP7Constants.sol +5 -4
- package/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol +27 -9
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +73 -95
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInit.sol +19 -9
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol +27 -23
- package/contracts/LSP7DigitalAsset/LSP7Errors.sol +23 -0
- package/contracts/LSP7DigitalAsset/extensions/ILSP7CappedSupply.sol +1 -1
- package/contracts/LSP7DigitalAsset/extensions/{ILSP7CompatibilityForERC20.sol → ILSP7CompatibleERC20.sol} +7 -9
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol +8 -7
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyCore.sol +14 -12
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyInit.sol +3 -8
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyInitAbstract.sol +10 -15
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol +67 -0
- package/contracts/LSP7DigitalAsset/extensions/{LSP7CompatibilityForERC20Core.sol → LSP7CompatibleERC20Core.sol} +36 -50
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20Init.sol +29 -0
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20InitAbstract.sol +67 -0
- package/contracts/LSP7DigitalAsset/{extensions → presets}/ILSP7Mintable.sol +1 -1
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol +22 -0
- package/contracts/LSP7DigitalAsset/{extensions/LSP7CompatibilityForERC20Init.sol → presets/LSP7CompatibleERC20MintableInit.sol} +6 -5
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInitAbstract.sol +27 -0
- package/contracts/LSP7DigitalAsset/{extensions → presets}/LSP7Mintable.sol +4 -3
- package/contracts/LSP7DigitalAsset/{extensions → presets}/LSP7MintableCore.sol +5 -5
- package/contracts/LSP7DigitalAsset/{extensions → presets}/LSP7MintableInit.sol +11 -3
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol +34 -0
- package/contracts/LSP8IdentifiableDigitalAsset/ILSP8IdentifiableDigitalAsset.sol +5 -16
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol +6 -3
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Errors.sol +22 -0
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol +23 -10
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +103 -136
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInit.sol +17 -11
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol +26 -21
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CappedSupply.sol +1 -1
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/{ILSP8CompatibilityForERC721.sol → ILSP8CompatibleERC721.sol} +4 -12
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol +9 -15
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyCore.sol +14 -12
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInit.sol +3 -8
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInitAbstract.sol +13 -20
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/{LSP8CompatibilityConstants.sol → LSP8CompatibleConstants.sol} +0 -0
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol +101 -0
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/{LSP8CompatibilityForERC721Core.sol → LSP8CompatibleERC721Core.sol} +38 -95
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/{LSP8CompatibilityForERC721Init.sol → LSP8CompatibleERC721Init.sol} +4 -6
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol +93 -0
- package/contracts/LSP8IdentifiableDigitalAsset/{extensions → presets}/ILSP8Mintable.sol +1 -1
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol +22 -0
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol +23 -0
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.sol +27 -0
- package/contracts/LSP8IdentifiableDigitalAsset/{extensions → presets}/LSP8Mintable.sol +4 -3
- package/contracts/LSP8IdentifiableDigitalAsset/{extensions → presets}/LSP8MintableCore.sol +5 -8
- package/contracts/LSP8IdentifiableDigitalAsset/{extensions → presets}/LSP8MintableInit.sol +11 -3
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol +37 -0
- package/contracts/LSP9Vault/LSP9Constants.sol +14 -5
- package/contracts/LSP9Vault/LSP9Vault.sol +20 -38
- package/contracts/LSP9Vault/LSP9VaultCore.sol +123 -92
- package/contracts/LSP9Vault/LSP9VaultInit.sol +12 -4
- package/contracts/LSP9Vault/LSP9VaultInitAbstract.sol +20 -46
- package/contracts/Legacy/Registries/AddressRegistry.sol +43 -0
- package/contracts/Legacy/Registries/AddressRegistryRequiresERC725.sol +33 -0
- package/contracts/Legacy/UniversalReceiverAddressStore.sol +62 -0
- package/contracts/UniversalProfile.sol +11 -7
- package/contracts/UniversalProfileInit.sol +12 -4
- package/contracts/UniversalProfileInitAbstract.sol +12 -20
- package/contracts/Utils/UtilsLib.sol +21 -13
- package/package.json +23 -9
- package/artifacts/LSP1UniversalReceiverDelegateUPInit.json +0 -66
- package/artifacts/LSP1UniversalReceiverDelegateVaultInit.json +0 -66
- package/artifacts/LSP7CompatibilityForERC20.json +0 -571
- package/artifacts/LSP8CompatibilityForERC721.json +0 -716
- package/constants.ts +0 -356
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUPCore.sol +0 -52
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUPInit.sol +0 -26
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUPInitAbstract.sol +0 -28
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVaultCore.sol +0 -41
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVaultInit.sol +0 -23
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVaultInitAbstract.sol +0 -25
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibilityForERC20.sol +0 -56
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibilityForERC20InitAbstract.sol +0 -55
- package/contracts/LSP7DigitalAsset/extensions/LSP7MintableInitAbstract.sol +0 -47
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibilityForERC721.sol +0 -92
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibilityForERC721InitAbstract.sol +0 -90
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8MintableInitAbstract.sol +0 -44
- package/contracts/Utils/ERC725Utils.sol +0 -169
- package/contracts/Utils/LSP2Utils.sol +0 -127
- package/contracts/Utils/LSP6Utils.sol +0 -63
|
@@ -2,18 +2,26 @@
|
|
|
2
2
|
pragma solidity ^0.8.6;
|
|
3
3
|
|
|
4
4
|
// modules
|
|
5
|
-
import "./LSP6KeyManagerInitAbstract.sol";
|
|
5
|
+
import {LSP6KeyManagerInitAbstract} from "./LSP6KeyManagerInitAbstract.sol";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @title Proxy implementation of a contract acting as a controller of an ERC725 Account, using permissions stored in the ERC725Y storage
|
|
9
|
-
* @author Fabian Vogelsteller
|
|
9
|
+
* @author Fabian Vogelsteller <frozeman>, Jean Cavallera (CJ42), Yamen Merhi (YamenMerhi)
|
|
10
10
|
* @dev all the permissions can be set on the ERC725 Account using `setData(...)` with the keys constants below
|
|
11
11
|
*/
|
|
12
12
|
contract LSP6KeyManagerInit is LSP6KeyManagerInitAbstract {
|
|
13
13
|
/**
|
|
14
|
-
* @
|
|
14
|
+
* @dev initialize (= lock) base implementation contract on deployment
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
constructor() {
|
|
17
|
+
_disableInitializers();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @notice Initiate the account with the address of the ERC725Account contract and sets LSP6KeyManager InterfaceId
|
|
22
|
+
* @param target_ The address of the ER725Account to control
|
|
23
|
+
*/
|
|
24
|
+
function initialize(address target_) public virtual initializer {
|
|
25
|
+
LSP6KeyManagerInitAbstract._initialize(target_);
|
|
18
26
|
}
|
|
19
27
|
}
|
|
@@ -2,25 +2,19 @@
|
|
|
2
2
|
pragma solidity ^0.8.6;
|
|
3
3
|
|
|
4
4
|
// modules
|
|
5
|
-
import "
|
|
6
|
-
import "@openzeppelin/contracts/utils/
|
|
7
|
-
import "
|
|
5
|
+
import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
|
|
6
|
+
import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
|
|
7
|
+
import {LSP6KeyManagerCore} from "./LSP6KeyManagerCore.sol";
|
|
8
|
+
import {InvalidLSP6Target} from "./LSP6Errors.sol";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* @title Proxy implementation of a contract acting as a controller of an ERC725 Account, using permissions stored in the ERC725Y storage
|
|
11
|
-
* @author Fabian Vogelsteller
|
|
12
|
+
* @author Fabian Vogelsteller <frozeman>, Jean Cavallera (CJ42), Yamen Merhi (YamenMerhi)
|
|
12
13
|
* @dev all the permissions can be set on the ERC725 Account using `setData(...)` with the keys constants below
|
|
13
14
|
*/
|
|
14
|
-
abstract contract LSP6KeyManagerInitAbstract is
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @notice Initiate the account with the address of the ERC725Account contract and sets LSP6KeyManager InterfaceId
|
|
20
|
-
* @param _account The address of the ER725Account to control
|
|
21
|
-
*/
|
|
22
|
-
function initialize(address _account) public virtual onlyInitializing {
|
|
23
|
-
account = ERC725(_account);
|
|
24
|
-
_registerInterface(_INTERFACEID_LSP6);
|
|
15
|
+
abstract contract LSP6KeyManagerInitAbstract is Initializable, LSP6KeyManagerCore {
|
|
16
|
+
function _initialize(address target_) internal virtual onlyInitializing {
|
|
17
|
+
if (target_ == address(0)) revert InvalidLSP6Target();
|
|
18
|
+
target = target_;
|
|
25
19
|
}
|
|
26
20
|
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
// interfaces
|
|
5
|
+
import {IERC725Y} from "@erc725/smart-contracts/contracts/interfaces/IERC725Y.sol";
|
|
6
|
+
import {ILSP6KeyManager} from "./ILSP6KeyManager.sol";
|
|
7
|
+
|
|
8
|
+
// libraries
|
|
9
|
+
import {LSP2Utils} from "../LSP2ERC725YJSONSchema/LSP2Utils.sol";
|
|
10
|
+
|
|
11
|
+
// constants
|
|
12
|
+
import "../LSP6KeyManager/LSP6Constants.sol";
|
|
13
|
+
|
|
14
|
+
library LSP6Utils {
|
|
15
|
+
using LSP2Utils for bytes12;
|
|
16
|
+
|
|
17
|
+
function getPermissionsFor(IERC725Y target, address caller) internal view returns (bytes32) {
|
|
18
|
+
bytes memory permissions = target.getData(
|
|
19
|
+
LSP2Utils.generateMappingWithGroupingKey(
|
|
20
|
+
_LSP6KEY_ADDRESSPERMISSIONS_PERMISSIONS_PREFIX,
|
|
21
|
+
bytes20(caller)
|
|
22
|
+
)
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
return bytes32(permissions);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function getAllowedAddressesFor(IERC725Y target, address caller)
|
|
29
|
+
internal
|
|
30
|
+
view
|
|
31
|
+
returns (bytes memory)
|
|
32
|
+
{
|
|
33
|
+
return
|
|
34
|
+
target.getData(
|
|
35
|
+
LSP2Utils.generateMappingWithGroupingKey(
|
|
36
|
+
_LSP6KEY_ADDRESSPERMISSIONS_ALLOWEDADDRESSES_PREFIX,
|
|
37
|
+
bytes20(caller)
|
|
38
|
+
)
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function getAllowedFunctionsFor(IERC725Y target, address caller)
|
|
43
|
+
internal
|
|
44
|
+
view
|
|
45
|
+
returns (bytes memory)
|
|
46
|
+
{
|
|
47
|
+
return
|
|
48
|
+
target.getData(
|
|
49
|
+
LSP2Utils.generateMappingWithGroupingKey(
|
|
50
|
+
_LSP6KEY_ADDRESSPERMISSIONS_ALLOWEDFUNCTIONS_PREFIX,
|
|
51
|
+
bytes20(caller)
|
|
52
|
+
)
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function getAllowedStandardsFor(IERC725Y target, address caller)
|
|
57
|
+
internal
|
|
58
|
+
view
|
|
59
|
+
returns (bytes memory)
|
|
60
|
+
{
|
|
61
|
+
return
|
|
62
|
+
target.getData(
|
|
63
|
+
LSP2Utils.generateMappingWithGroupingKey(
|
|
64
|
+
_LSP6KEY_ADDRESSPERMISSIONS_ALLOWEDSTANDARDS_PREFIX,
|
|
65
|
+
bytes20(caller)
|
|
66
|
+
)
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function getAllowedERC725YKeysFor(IERC725Y target, address caller)
|
|
71
|
+
internal
|
|
72
|
+
view
|
|
73
|
+
returns (bytes memory)
|
|
74
|
+
{
|
|
75
|
+
return
|
|
76
|
+
target.getData(
|
|
77
|
+
LSP2Utils.generateMappingWithGroupingKey(
|
|
78
|
+
_LSP6KEY_ADDRESSPERMISSIONS_ALLOWEDERC725YKEYS_PREFIX,
|
|
79
|
+
bytes20(caller)
|
|
80
|
+
)
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @dev compare the permissions `addressPermissions` of an address
|
|
86
|
+
* to check if they includes the permissions `permissionToCheck`
|
|
87
|
+
* @param addressPermission the permissions of an address stored on an ERC725 account
|
|
88
|
+
* @param permissionToCheck the permissions to check
|
|
89
|
+
* @return true if `addressPermissions` includes `permissionToCheck`, false otherwise
|
|
90
|
+
*/
|
|
91
|
+
function hasPermission(bytes32 addressPermission, bytes32 permissionToCheck)
|
|
92
|
+
internal
|
|
93
|
+
pure
|
|
94
|
+
returns (bool)
|
|
95
|
+
{
|
|
96
|
+
return (addressPermission & permissionToCheck) == permissionToCheck;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function setDataViaKeyManager(
|
|
100
|
+
address keyManagerAddress,
|
|
101
|
+
bytes32[] memory keys,
|
|
102
|
+
bytes[] memory values
|
|
103
|
+
) internal returns (bytes memory result) {
|
|
104
|
+
bytes memory payload = abi.encodeWithSelector(hex"14a6e293", keys, values);
|
|
105
|
+
result = ILSP6KeyManager(keyManagerAddress).execute(payload);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
pragma solidity ^0.8.0;
|
|
4
4
|
|
|
5
5
|
// interfaces
|
|
6
|
-
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
|
7
|
-
import "@erc725/smart-contracts/contracts/interfaces/IERC725Y.sol";
|
|
6
|
+
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
|
7
|
+
import {IERC725Y} from "@erc725/smart-contracts/contracts/interfaces/IERC725Y.sol";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @dev Required interface of a LSP8 compliant contract.
|
|
@@ -88,7 +88,6 @@ interface ILSP7DigitalAsset is IERC165, IERC725Y {
|
|
|
88
88
|
*
|
|
89
89
|
* Requirements
|
|
90
90
|
*
|
|
91
|
-
* - `operator` cannot be calling address.
|
|
92
91
|
* - `operator` cannot be the zero address.
|
|
93
92
|
*
|
|
94
93
|
* Emits an {AuthorizedOperator} event.
|
|
@@ -103,7 +102,6 @@ interface ILSP7DigitalAsset is IERC165, IERC725Y {
|
|
|
103
102
|
*
|
|
104
103
|
* Requirements
|
|
105
104
|
*
|
|
106
|
-
* - `operator` cannot be calling address.
|
|
107
105
|
* - `operator` cannot be the zero address.
|
|
108
106
|
*
|
|
109
107
|
* Emits a {RevokedOperator} event.
|
|
@@ -118,10 +116,7 @@ interface ILSP7DigitalAsset is IERC165, IERC725Y {
|
|
|
118
116
|
* Operators can send and burn tokens on behalf of their owners. The tokenOwner is their own
|
|
119
117
|
* operator.
|
|
120
118
|
*/
|
|
121
|
-
function isOperatorFor(address operator, address tokenOwner)
|
|
122
|
-
external
|
|
123
|
-
view
|
|
124
|
-
returns (uint256);
|
|
119
|
+
function isOperatorFor(address operator, address tokenOwner) external view returns (uint256);
|
|
125
120
|
|
|
126
121
|
// --- Transfer functionality
|
|
127
122
|
|
|
@@ -4,9 +4,10 @@ pragma solidity ^0.8.0;
|
|
|
4
4
|
// --- ERC165 interface ids
|
|
5
5
|
bytes4 constant _INTERFACEID_LSP7 = 0xe33f65c3;
|
|
6
6
|
|
|
7
|
-
// --- ERC725Y entries
|
|
8
|
-
|
|
9
7
|
// --- Token Hooks
|
|
10
|
-
bytes32 constant _TYPEID_LSP7_TOKENSSENDER = 0x40b8bec57d7b5ff0dbd9e9acd0a47dfeb0101e1a203766f5ccab00445fbf39e9; // keccak256("LSP7TokensSender")
|
|
11
8
|
|
|
12
|
-
|
|
9
|
+
// keccak256('LSP7TokensSender')
|
|
10
|
+
bytes32 constant _TYPEID_LSP7_TOKENSSENDER = 0x40b8bec57d7b5ff0dbd9e9acd0a47dfeb0101e1a203766f5ccab00445fbf39e9;
|
|
11
|
+
|
|
12
|
+
// keccak256('LSP7TokensRecipient')
|
|
13
|
+
bytes32 constant _TYPEID_LSP7_TOKENSRECIPIENT = 0xdbe2c314e1aee2970c72666f2ebe8933a8575263ea71e5ff6a9178e95d47a26f;
|
|
@@ -1,23 +1,29 @@
|
|
|
1
1
|
// SPDX-License-Identifier: CC0-1.0
|
|
2
2
|
pragma solidity ^0.8.0;
|
|
3
3
|
|
|
4
|
-
//
|
|
5
|
-
import "
|
|
6
|
-
import "../LSP4DigitalAssetMetadata/LSP4Constants.sol";
|
|
4
|
+
// interfaces
|
|
5
|
+
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
|
7
6
|
|
|
8
7
|
// modules
|
|
9
|
-
import "
|
|
10
|
-
import "../LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol";
|
|
11
|
-
import "
|
|
8
|
+
import {ERC725YCore} from "@erc725/smart-contracts/contracts/ERC725YCore.sol";
|
|
9
|
+
import {LSP4DigitalAssetMetadata} from "../LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol";
|
|
10
|
+
import {LSP7DigitalAssetCore} from "./LSP7DigitalAssetCore.sol";
|
|
11
|
+
|
|
12
|
+
// constants
|
|
13
|
+
import {_INTERFACEID_LSP7} from "./LSP7Constants.sol";
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* @title LSP7DigitalAsset contract
|
|
15
17
|
* @author Matthew Stevens
|
|
16
18
|
* @dev Implementation of a LSP7 compliant contract.
|
|
19
|
+
*
|
|
20
|
+
* This implementation is agnostic to the way tokens are created.
|
|
21
|
+
* A supply mechanism has to be added in a derived contract using {_mint}
|
|
22
|
+
* For a generic mechanism, see {LSP7Mintable}.
|
|
17
23
|
*/
|
|
18
|
-
contract LSP7DigitalAsset is
|
|
24
|
+
contract LSP7DigitalAsset is LSP4DigitalAssetMetadata, LSP7DigitalAssetCore {
|
|
19
25
|
/**
|
|
20
|
-
* @notice Sets the token-Metadata
|
|
26
|
+
* @notice Sets the token-Metadata
|
|
21
27
|
* @param name_ The name of the token
|
|
22
28
|
* @param symbol_ The symbol of the token
|
|
23
29
|
* @param newOwner_ The owner of the the token-Metadata
|
|
@@ -30,6 +36,18 @@ contract LSP7DigitalAsset is LSP7DigitalAssetCore, LSP4DigitalAssetMetadata {
|
|
|
30
36
|
bool isNFT_
|
|
31
37
|
) LSP4DigitalAssetMetadata(name_, symbol_, newOwner_) {
|
|
32
38
|
_isNFT = isNFT_;
|
|
33
|
-
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @dev See {IERC165-supportsInterface}.
|
|
43
|
+
*/
|
|
44
|
+
function supportsInterface(bytes4 interfaceId)
|
|
45
|
+
public
|
|
46
|
+
view
|
|
47
|
+
virtual
|
|
48
|
+
override(IERC165, ERC725YCore)
|
|
49
|
+
returns (bool)
|
|
50
|
+
{
|
|
51
|
+
return interfaceId == _INTERFACEID_LSP7 || super.supportsInterface(interfaceId);
|
|
34
52
|
}
|
|
35
53
|
}
|
|
@@ -1,28 +1,32 @@
|
|
|
1
1
|
// SPDX-License-Identifier: CC0-1.0
|
|
2
2
|
pragma solidity ^0.8.0;
|
|
3
3
|
|
|
4
|
-
// constants
|
|
5
|
-
import "./LSP7Constants.sol";
|
|
6
|
-
import "../LSP1UniversalReceiver/LSP1Constants.sol";
|
|
7
|
-
import "../LSP4DigitalAssetMetadata/LSP4Constants.sol";
|
|
8
|
-
|
|
9
4
|
// interfaces
|
|
10
|
-
import "../LSP1UniversalReceiver/ILSP1UniversalReceiver.sol";
|
|
11
|
-
import "./ILSP7DigitalAsset.sol";
|
|
5
|
+
import {ILSP1UniversalReceiver} from "../LSP1UniversalReceiver/ILSP1UniversalReceiver.sol";
|
|
6
|
+
import {ILSP7DigitalAsset} from "./ILSP7DigitalAsset.sol";
|
|
7
|
+
|
|
8
|
+
// libraries
|
|
9
|
+
import {ERC165Checker} from "../Custom/ERC165Checker.sol";
|
|
12
10
|
|
|
13
11
|
// modules
|
|
14
|
-
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
|
15
|
-
import "@openzeppelin/contracts/utils/Address.sol";
|
|
16
|
-
import "@openzeppelin/contracts/utils/Context.sol";
|
|
17
|
-
import "@erc725/smart-contracts/contracts/ERC725Y.sol";
|
|
12
|
+
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
|
13
|
+
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
|
|
14
|
+
import {Context} from "@openzeppelin/contracts/utils/Context.sol";
|
|
15
|
+
import {ERC725Y} from "@erc725/smart-contracts/contracts/ERC725Y.sol";
|
|
18
16
|
|
|
19
|
-
//
|
|
20
|
-
import "
|
|
17
|
+
// errors
|
|
18
|
+
import "./LSP7Errors.sol";
|
|
19
|
+
|
|
20
|
+
// constants
|
|
21
|
+
import {_INTERFACEID_LSP1} from "../LSP1UniversalReceiver/LSP1Constants.sol";
|
|
22
|
+
import {_TYPEID_LSP7_TOKENSSENDER, _TYPEID_LSP7_TOKENSRECIPIENT} from "./LSP7Constants.sol";
|
|
21
23
|
|
|
22
24
|
/**
|
|
23
25
|
* @title LSP7DigitalAsset contract
|
|
24
26
|
* @author Matthew Stevens
|
|
25
27
|
* @dev Core Implementation of a LSP7 compliant contract.
|
|
28
|
+
*
|
|
29
|
+
* This contract implement the core logic of the functions for the {ILSP7DigitalAsset} interface.
|
|
26
30
|
*/
|
|
27
31
|
abstract contract LSP7DigitalAssetCore is Context, ILSP7DigitalAsset {
|
|
28
32
|
using Address for address;
|
|
@@ -37,8 +41,7 @@ abstract contract LSP7DigitalAssetCore is Context, ILSP7DigitalAsset {
|
|
|
37
41
|
mapping(address => uint256) internal _tokenOwnerBalances;
|
|
38
42
|
|
|
39
43
|
// Mapping a `tokenOwner` to an `operator` to `amount` of tokens.
|
|
40
|
-
mapping(address => mapping(address => uint256))
|
|
41
|
-
internal _operatorAuthorizedAmount;
|
|
44
|
+
mapping(address => mapping(address => uint256)) internal _operatorAuthorizedAmount;
|
|
42
45
|
|
|
43
46
|
// --- Token queries
|
|
44
47
|
|
|
@@ -61,12 +64,7 @@ abstract contract LSP7DigitalAssetCore is Context, ILSP7DigitalAsset {
|
|
|
61
64
|
/**
|
|
62
65
|
* @inheritdoc ILSP7DigitalAsset
|
|
63
66
|
*/
|
|
64
|
-
function balanceOf(address tokenOwner)
|
|
65
|
-
public
|
|
66
|
-
view
|
|
67
|
-
override
|
|
68
|
-
returns (uint256)
|
|
69
|
-
{
|
|
67
|
+
function balanceOf(address tokenOwner) public view override returns (uint256) {
|
|
70
68
|
return _tokenOwnerBalances[tokenOwner];
|
|
71
69
|
}
|
|
72
70
|
|
|
@@ -75,11 +73,7 @@ abstract contract LSP7DigitalAssetCore is Context, ILSP7DigitalAsset {
|
|
|
75
73
|
/**
|
|
76
74
|
* @inheritdoc ILSP7DigitalAsset
|
|
77
75
|
*/
|
|
78
|
-
function authorizeOperator(address operator, uint256 amount)
|
|
79
|
-
public
|
|
80
|
-
virtual
|
|
81
|
-
override
|
|
82
|
-
{
|
|
76
|
+
function authorizeOperator(address operator, uint256 amount) public virtual override {
|
|
83
77
|
_updateOperator(_msgSender(), operator, amount);
|
|
84
78
|
}
|
|
85
79
|
|
|
@@ -122,15 +116,11 @@ abstract contract LSP7DigitalAssetCore is Context, ILSP7DigitalAsset {
|
|
|
122
116
|
address operator = _msgSender();
|
|
123
117
|
if (operator != from) {
|
|
124
118
|
uint256 operatorAmount = _operatorAuthorizedAmount[from][operator];
|
|
125
|
-
|
|
126
|
-
operatorAmount
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
_updateOperator(
|
|
130
|
-
from,
|
|
131
|
-
operator,
|
|
132
|
-
_operatorAuthorizedAmount[from][operator] - amount
|
|
133
|
-
);
|
|
119
|
+
if (amount > operatorAmount) {
|
|
120
|
+
revert LSP7AmountExceedsAuthorizedAmount(from, operatorAmount, operator, amount);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
_updateOperator(from, operator, operatorAmount - amount);
|
|
134
124
|
}
|
|
135
125
|
|
|
136
126
|
_transfer(from, to, amount, force, data);
|
|
@@ -145,13 +135,12 @@ abstract contract LSP7DigitalAssetCore is Context, ILSP7DigitalAsset {
|
|
|
145
135
|
uint256[] memory amount,
|
|
146
136
|
bool force,
|
|
147
137
|
bytes[] memory data
|
|
148
|
-
)
|
|
149
|
-
|
|
150
|
-
from.length
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
);
|
|
138
|
+
) public virtual override {
|
|
139
|
+
if (
|
|
140
|
+
from.length != to.length || from.length != amount.length || from.length != data.length
|
|
141
|
+
) {
|
|
142
|
+
revert LSP7InvalidTransferBatch();
|
|
143
|
+
}
|
|
155
144
|
|
|
156
145
|
for (uint256 i = 0; i < from.length; i++) {
|
|
157
146
|
// using the public transfer function to handle updates to operator authorized amounts
|
|
@@ -170,7 +159,6 @@ abstract contract LSP7DigitalAssetCore is Context, ILSP7DigitalAsset {
|
|
|
170
159
|
*
|
|
171
160
|
* Requirements
|
|
172
161
|
*
|
|
173
|
-
* - `operator` cannot be calling address.
|
|
174
162
|
* - `operator` cannot be the zero address.
|
|
175
163
|
*/
|
|
176
164
|
function _updateOperator(
|
|
@@ -178,22 +166,18 @@ abstract contract LSP7DigitalAssetCore is Context, ILSP7DigitalAsset {
|
|
|
178
166
|
address operator,
|
|
179
167
|
uint256 amount
|
|
180
168
|
) internal virtual {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
require(
|
|
190
|
-
tokenOwner != address(0),
|
|
191
|
-
"LSP7: updating operator failed, can not set operator for zero address"
|
|
192
|
-
);
|
|
169
|
+
if (operator == address(0)) {
|
|
170
|
+
revert LSP7CannotUseAddressZeroAsOperator();
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// tokenOwner is always their own operator, no update required
|
|
174
|
+
if (operator == tokenOwner) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
193
177
|
|
|
194
178
|
_operatorAuthorizedAmount[tokenOwner][operator] = amount;
|
|
195
179
|
|
|
196
|
-
if (amount
|
|
180
|
+
if (amount != 0) {
|
|
197
181
|
emit AuthorizedOperator(operator, tokenOwner, amount);
|
|
198
182
|
} else {
|
|
199
183
|
emit RevokedOperator(operator, tokenOwner);
|
|
@@ -215,7 +199,9 @@ abstract contract LSP7DigitalAssetCore is Context, ILSP7DigitalAsset {
|
|
|
215
199
|
bool force,
|
|
216
200
|
bytes memory data
|
|
217
201
|
) internal virtual {
|
|
218
|
-
|
|
202
|
+
if (to == address(0)) {
|
|
203
|
+
revert LSP7CannotSendWithAddressZero();
|
|
204
|
+
}
|
|
219
205
|
|
|
220
206
|
address operator = _msgSender();
|
|
221
207
|
|
|
@@ -245,28 +231,31 @@ abstract contract LSP7DigitalAssetCore is Context, ILSP7DigitalAsset {
|
|
|
245
231
|
uint256 amount,
|
|
246
232
|
bytes memory data
|
|
247
233
|
) internal virtual {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
234
|
+
if (from == address(0)) {
|
|
235
|
+
revert LSP7CannotSendWithAddressZero();
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
uint256 balance = _tokenOwnerBalances[from];
|
|
239
|
+
if (amount > balance) {
|
|
240
|
+
revert LSP7AmountExceedsBalance(balance, from, amount);
|
|
241
|
+
}
|
|
253
242
|
|
|
254
243
|
address operator = _msgSender();
|
|
255
244
|
if (operator != from) {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
245
|
+
uint256 authorizedAmount = _operatorAuthorizedAmount[from][operator];
|
|
246
|
+
if (amount > authorizedAmount) {
|
|
247
|
+
revert LSP7AmountExceedsAuthorizedAmount(from, authorizedAmount, operator, amount);
|
|
248
|
+
}
|
|
260
249
|
_operatorAuthorizedAmount[from][operator] -= amount;
|
|
261
250
|
}
|
|
262
251
|
|
|
263
|
-
_notifyTokenSender(from, address(0), amount, data);
|
|
264
|
-
|
|
265
252
|
_beforeTokenTransfer(from, address(0), amount);
|
|
266
253
|
|
|
267
254
|
_tokenOwnerBalances[from] -= amount;
|
|
268
255
|
|
|
269
256
|
emit Transfer(operator, from, address(0), amount, false, data);
|
|
257
|
+
|
|
258
|
+
_notifyTokenSender(from, address(0), amount, data);
|
|
270
259
|
}
|
|
271
260
|
|
|
272
261
|
/**
|
|
@@ -289,16 +278,16 @@ abstract contract LSP7DigitalAssetCore is Context, ILSP7DigitalAsset {
|
|
|
289
278
|
bool force,
|
|
290
279
|
bytes memory data
|
|
291
280
|
) internal virtual {
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
_tokenOwnerBalances[from] >= amount,
|
|
296
|
-
"LSP7: transfer amount exceeds tokenOwner balance"
|
|
297
|
-
);
|
|
281
|
+
if (from == address(0) || to == address(0)) {
|
|
282
|
+
revert LSP7CannotSendWithAddressZero();
|
|
283
|
+
}
|
|
298
284
|
|
|
299
|
-
|
|
285
|
+
uint256 balance = _tokenOwnerBalances[from];
|
|
286
|
+
if (amount > balance) {
|
|
287
|
+
revert LSP7AmountExceedsBalance(balance, from, amount);
|
|
288
|
+
}
|
|
300
289
|
|
|
301
|
-
|
|
290
|
+
address operator = _msgSender();
|
|
302
291
|
|
|
303
292
|
_beforeTokenTransfer(from, to, amount);
|
|
304
293
|
|
|
@@ -307,6 +296,7 @@ abstract contract LSP7DigitalAssetCore is Context, ILSP7DigitalAsset {
|
|
|
307
296
|
|
|
308
297
|
emit Transfer(operator, from, to, amount, force, data);
|
|
309
298
|
|
|
299
|
+
_notifyTokenSender(from, to, amount, data);
|
|
310
300
|
_notifyTokenReceiver(from, to, amount, force, data);
|
|
311
301
|
}
|
|
312
302
|
|
|
@@ -347,15 +337,9 @@ abstract contract LSP7DigitalAssetCore is Context, ILSP7DigitalAsset {
|
|
|
347
337
|
uint256 amount,
|
|
348
338
|
bytes memory data
|
|
349
339
|
) internal virtual {
|
|
350
|
-
if (
|
|
351
|
-
ERC165Checker.supportsERC165(from) &&
|
|
352
|
-
ERC165Checker.supportsInterface(from, _INTERFACEID_LSP1)
|
|
353
|
-
) {
|
|
340
|
+
if (ERC165Checker.supportsERC165Interface(from, _INTERFACEID_LSP1)) {
|
|
354
341
|
bytes memory packedData = abi.encodePacked(from, to, amount, data);
|
|
355
|
-
ILSP1UniversalReceiver(from).universalReceiver(
|
|
356
|
-
_TYPEID_LSP7_TOKENSSENDER,
|
|
357
|
-
packedData
|
|
358
|
-
);
|
|
342
|
+
ILSP1UniversalReceiver(from).universalReceiver(_TYPEID_LSP7_TOKENSSENDER, packedData);
|
|
359
343
|
}
|
|
360
344
|
}
|
|
361
345
|
|
|
@@ -372,20 +356,14 @@ abstract contract LSP7DigitalAssetCore is Context, ILSP7DigitalAsset {
|
|
|
372
356
|
bool force,
|
|
373
357
|
bytes memory data
|
|
374
358
|
) internal virtual {
|
|
375
|
-
if (
|
|
376
|
-
ERC165Checker.supportsERC165(to) &&
|
|
377
|
-
ERC165Checker.supportsInterface(to, _INTERFACEID_LSP1)
|
|
378
|
-
) {
|
|
359
|
+
if (ERC165Checker.supportsERC165Interface(to, _INTERFACEID_LSP1)) {
|
|
379
360
|
bytes memory packedData = abi.encodePacked(from, to, amount, data);
|
|
380
|
-
ILSP1UniversalReceiver(to).universalReceiver(
|
|
381
|
-
_TYPEID_LSP7_TOKENSRECIPIENT,
|
|
382
|
-
packedData
|
|
383
|
-
);
|
|
361
|
+
ILSP1UniversalReceiver(to).universalReceiver(_TYPEID_LSP7_TOKENSRECIPIENT, packedData);
|
|
384
362
|
} else if (!force) {
|
|
385
|
-
if (to.
|
|
386
|
-
revert(
|
|
363
|
+
if (to.code.length != 0) {
|
|
364
|
+
revert LSP7NotifyTokenReceiverContractMissingLSP1Interface(to);
|
|
387
365
|
} else {
|
|
388
|
-
revert(
|
|
366
|
+
revert LSP7NotifyTokenReceiverIsEOA(to);
|
|
389
367
|
}
|
|
390
368
|
}
|
|
391
369
|
}
|
|
@@ -2,28 +2,38 @@
|
|
|
2
2
|
pragma solidity ^0.8.0;
|
|
3
3
|
|
|
4
4
|
// modules
|
|
5
|
-
import "./LSP7DigitalAssetInitAbstract.sol";
|
|
5
|
+
import {LSP7DigitalAssetInitAbstract} from "./LSP7DigitalAssetInitAbstract.sol";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @title LSP7DigitalAsset contract
|
|
9
9
|
* @author Matthew Stevens
|
|
10
10
|
* @dev Proxy Implementation of a LSP7 compliant contract.
|
|
11
|
+
*
|
|
12
|
+
* This implementation is agnostic to the way tokens are created.
|
|
13
|
+
* A supply mechanism has to be added in a derived contract using {_mint}
|
|
14
|
+
* For a generic mechanism, see {LSP7Mintable}.
|
|
11
15
|
*/
|
|
12
16
|
contract LSP7DigitalAssetInit is LSP7DigitalAssetInitAbstract {
|
|
13
17
|
/**
|
|
14
|
-
* @
|
|
18
|
+
* @dev initialize (= lock) base implementation contract on deployment
|
|
19
|
+
*/
|
|
20
|
+
constructor() {
|
|
21
|
+
_disableInitializers();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @notice Sets the token-Metadata
|
|
26
|
+
* @param name_ The name of the token
|
|
27
|
+
* @param symbol_ The symbol of the token
|
|
28
|
+
* @param newOwner_ The owner of the the token-Metadata
|
|
29
|
+
* @param isNFT_ Specify if the LSP7 token is a fungible or non-fungible token
|
|
15
30
|
*/
|
|
16
31
|
function initialize(
|
|
17
32
|
string memory name_,
|
|
18
33
|
string memory symbol_,
|
|
19
34
|
address newOwner_,
|
|
20
35
|
bool isNFT_
|
|
21
|
-
) public virtual
|
|
22
|
-
LSP7DigitalAssetInitAbstract.
|
|
23
|
-
name_,
|
|
24
|
-
symbol_,
|
|
25
|
-
newOwner_,
|
|
26
|
-
isNFT_
|
|
27
|
-
);
|
|
36
|
+
) public virtual initializer {
|
|
37
|
+
LSP7DigitalAssetInitAbstract._initialize(name_, symbol_, newOwner_, isNFT_);
|
|
28
38
|
}
|
|
29
39
|
}
|