@lukso/lsp-smart-contracts 0.6.2 → 0.8.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/CONTRIBUTING.md +31 -0
- package/README.md +73 -28
- package/artifacts/Create2Factory.json +2 -2
- package/artifacts/LSP0ERC725Account.json +227 -15
- package/artifacts/LSP0ERC725AccountInit.json +227 -41
- package/artifacts/LSP11BasicSocialRecovery.json +493 -0
- package/artifacts/LSP11BasicSocialRecoveryInit.json +513 -0
- package/artifacts/LSP16UniversalFactory.json +236 -0
- package/artifacts/LSP1UniversalReceiverDelegateUP.json +134 -15
- package/artifacts/LSP1UniversalReceiverDelegateVault.json +80 -15
- package/artifacts/LSP4Compatibility.json +22 -0
- package/artifacts/LSP4DigitalAssetMetadata.json +22 -0
- package/artifacts/{LSP4DigitalAssetMetadataInit.json → LSP4DigitalAssetMetadataInitAbstract.json} +24 -51
- package/artifacts/LSP6KeyManager.json +188 -33
- package/artifacts/LSP6KeyManagerInit.json +188 -33
- package/artifacts/LSP7CappedSupply.json +58 -31
- package/artifacts/{LSP7CappedSupplyInit.json → LSP7CappedSupplyInitAbstract.json} +60 -72
- package/artifacts/LSP7CompatibleERC20.json +52 -46
- package/artifacts/LSP7CompatibleERC20InitAbstract.json +733 -0
- package/artifacts/LSP7CompatibleERC20Mintable.json +61 -34
- package/artifacts/LSP7CompatibleERC20MintableInit.json +66 -60
- package/artifacts/LSP7DigitalAsset.json +52 -51
- package/artifacts/LSP7DigitalAssetInitAbstract.json +556 -0
- package/artifacts/LSP7Mintable.json +62 -35
- package/artifacts/LSP7MintableInit.json +62 -61
- package/artifacts/LSP8CappedSupply.json +64 -5
- package/artifacts/LSP8CappedSupplyInitAbstract.json +667 -0
- package/artifacts/LSP8CompatibleERC721.json +102 -21
- package/artifacts/LSP8CompatibleERC721InitAbstract.json +936 -0
- package/artifacts/LSP8CompatibleERC721Mintable.json +111 -9
- package/artifacts/LSP8CompatibleERC721MintableInit.json +116 -35
- package/artifacts/LSP8IdentifiableDigitalAsset.json +58 -20
- package/artifacts/{LSP8CappedSupplyInit.json → LSP8IdentifiableDigitalAssetInitAbstract.json} +62 -65
- package/artifacts/LSP8Mintable.json +67 -8
- package/artifacts/LSP8MintableInit.json +67 -34
- package/artifacts/LSP9Vault.json +235 -17
- package/artifacts/LSP9VaultInit.json +235 -43
- package/artifacts/UniversalProfile.json +227 -15
- package/artifacts/UniversalProfileInit.json +227 -41
- package/artifacts/UniversalReceiverAddressStore.json +3 -3
- package/constants.js +416 -95
- package/contracts/Custom/EIP191Signer.sol +12 -0
- package/contracts/Factories/Create2Factory.sol +1 -3
- package/contracts/LSP0ERC725Account/LSP0Constants.sol +13 -2
- package/contracts/LSP0ERC725Account/LSP0ERC725Account.sol +2 -1
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +274 -74
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountInit.sol +2 -2
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountInitAbstract.sol +3 -2
- package/contracts/LSP10ReceivedVaults/LSP10Constants.sol +4 -4
- package/contracts/LSP10ReceivedVaults/LSP10Utils.sol +214 -0
- package/contracts/LSP11BasicSocialRecovery/ILSP11BasicSocialRecovery.sol +177 -0
- package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol +23 -0
- package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecoveryCore.sol +258 -0
- package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecoveryInit.sol +26 -0
- package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecoveryInitAbstract.sol +19 -0
- package/contracts/LSP11BasicSocialRecovery/LSP11Constants.sol +6 -0
- package/contracts/LSP11BasicSocialRecovery/LSP11Errors.sol +60 -0
- package/contracts/LSP14Ownable2Step/ILSP14Ownable2Step.sol +53 -0
- package/contracts/LSP14Ownable2Step/LSP14Constants.sol +15 -0
- package/contracts/LSP14Ownable2Step/LSP14Errors.sol +12 -0
- package/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol +212 -0
- package/contracts/LSP16UniversalFactory/LSP16UniversalFactory.sol +246 -0
- package/contracts/LSP17ContractExtension/LSP17Constants.sol +17 -0
- package/contracts/LSP17ContractExtension/LSP17Errors.sol +7 -0
- package/contracts/LSP17ContractExtension/LSP17Extendable.sol +104 -0
- package/contracts/LSP17ContractExtension/LSP17Extension.sol +45 -0
- package/contracts/LSP17ContractExtension/LSP17Utils.sol +20 -0
- package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiver.sol +5 -5
- package/contracts/LSP1UniversalReceiver/LSP1Constants.sol +5 -3
- package/contracts/LSP1UniversalReceiver/LSP1Errors.sol +21 -0
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol +156 -42
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol +64 -31
- package/contracts/LSP1UniversalReceiver/LSP1Utils.sol +54 -41
- package/contracts/LSP2ERC725YJSONSchema/LSP2Utils.sol +136 -28
- package/contracts/LSP3UniversalProfile/LSP3Constants.sol +1 -1
- package/contracts/LSP4DigitalAssetMetadata/ILSP4Compatibility.sol +1 -1
- package/contracts/LSP4DigitalAssetMetadata/LSP4Compatibility.sol +1 -1
- package/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol +1 -1
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol +16 -7
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol +16 -7
- package/contracts/LSP4DigitalAssetMetadata/LSP4Errors.sol +3 -3
- package/contracts/LSP5ReceivedAssets/LSP5Constants.sol +4 -4
- package/contracts/LSP5ReceivedAssets/LSP5Utils.sol +103 -115
- package/contracts/LSP6KeyManager/ILSP6KeyManager.sol +26 -8
- package/contracts/LSP6KeyManager/LSP6Constants.sol +45 -45
- package/contracts/LSP6KeyManager/LSP6Errors.sol +97 -20
- package/contracts/LSP6KeyManager/LSP6KeyManager.sol +3 -2
- package/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol +786 -359
- package/contracts/LSP6KeyManager/LSP6KeyManagerInit.sol +2 -2
- package/contracts/LSP6KeyManager/LSP6KeyManagerInitAbstract.sol +4 -3
- package/contracts/LSP6KeyManager/LSP6Utils.sol +127 -35
- package/contracts/LSP7DigitalAsset/ILSP7DigitalAsset.sol +26 -13
- package/contracts/LSP7DigitalAsset/LSP7Constants.sol +6 -6
- package/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol +5 -5
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +65 -52
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol +3 -3
- package/contracts/LSP7DigitalAsset/LSP7Errors.sol +30 -1
- package/contracts/LSP7DigitalAsset/extensions/ILSP7CompatibleERC20.sol +1 -1
- package/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol +24 -0
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol +28 -8
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyInitAbstract.sol +28 -11
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol +87 -20
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20InitAbstract.sol +97 -19
- package/contracts/LSP7DigitalAsset/presets/ILSP7Mintable.sol +3 -3
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol +3 -4
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInit.sol +9 -2
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInitAbstract.sol +3 -3
- package/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol +12 -12
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableInit.sol +5 -5
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol +11 -10
- package/contracts/LSP8IdentifiableDigitalAsset/ILSP8IdentifiableDigitalAsset.sol +10 -8
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol +11 -11
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Errors.sol +45 -1
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol +3 -3
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +75 -71
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol +1 -1
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CompatibleERC721.sol +20 -3
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol +20 -0
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol +27 -7
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInitAbstract.sol +27 -10
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol +236 -30
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol +240 -30
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol +49 -0
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableInitAbstract.sol +51 -0
- package/contracts/LSP8IdentifiableDigitalAsset/presets/ILSP8Mintable.sol +3 -3
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol +3 -4
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol +9 -2
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.sol +3 -3
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol +9 -8
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInit.sol +2 -2
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol +8 -7
- package/contracts/LSP9Vault/LSP9Constants.sol +11 -8
- package/contracts/LSP9Vault/LSP9Errors.sol +8 -0
- package/contracts/LSP9Vault/LSP9Vault.sol +6 -4
- package/contracts/LSP9Vault/LSP9VaultCore.sol +324 -90
- package/contracts/LSP9Vault/LSP9VaultInit.sol +2 -2
- package/contracts/LSP9Vault/LSP9VaultInitAbstract.sol +5 -4
- package/contracts/Legacy/Registries/AddressRegistry.sol +1 -1
- package/contracts/Legacy/Registries/AddressRegistryRequiresERC725.sol +1 -1
- package/contracts/Legacy/UniversalReceiverAddressStore.sol +4 -13
- package/contracts/UniversalProfile.sol +2 -2
- package/contracts/UniversalProfileInit.sol +2 -2
- package/contracts/UniversalProfileInitAbstract.sol +1 -1
- package/contracts/Utils/GasLib.sol +17 -0
- package/package.json +37 -32
- package/artifacts/LSP7CompatibleERC20Init.json +0 -760
- package/artifacts/LSP7DigitalAssetInit.json +0 -588
- package/artifacts/LSP8CompatibleERC721Init.json +0 -883
- package/artifacts/LSP8IdentifiableDigitalAssetInit.json +0 -639
- package/artifacts/UniversalFactory.json +0 -127
- package/contracts/Custom/ClaimOwnership.sol +0 -34
- package/contracts/Custom/ERC165Checker.sol +0 -130
- package/contracts/Custom/IClaimOwnership.sol +0 -10
- package/contracts/Factories/UniversalFactory.sol +0 -164
- package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiverDelegate.sol +0 -24
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/Handling/TokenAndVaultHandling.sol +0 -85
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/Handling/TokenHandling.sol +0 -76
- package/contracts/LSP2ERC725YJSONSchema/LSP2Errors.sol +0 -9
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInit.sol +0 -26
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInit.sol +0 -39
- package/contracts/LSP7DigitalAsset/extensions/ILSP7CappedSupply.sol +0 -17
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyCore.sol +0 -57
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyInit.sol +0 -19
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20Core.sol +0 -112
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20Init.sol +0 -29
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableCore.sol +0 -26
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInit.sol +0 -35
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CappedSupply.sol +0 -17
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyCore.sol +0 -58
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInit.sol +0 -19
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleConstants.sol +0 -6
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721Core.sol +0 -187
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721Init.sol +0 -25
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableCore.sol +0 -26
- package/contracts/Utils/UtilsLib.sol +0 -31
|
@@ -1,123 +1,191 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
pragma solidity ^0.8.
|
|
2
|
+
pragma solidity ^0.8.4;
|
|
3
3
|
|
|
4
4
|
// interfaces
|
|
5
|
-
import {IERC725Y} from "@erc725/smart-contracts/contracts/interfaces/IERC725Y.sol";
|
|
6
5
|
import {ILSP1UniversalReceiver} from "../LSP1UniversalReceiver/ILSP1UniversalReceiver.sol";
|
|
7
|
-
import {
|
|
8
|
-
ILSP1UniversalReceiverDelegate
|
|
9
|
-
} from "../LSP1UniversalReceiver/ILSP1UniversalReceiverDelegate.sol";
|
|
10
6
|
|
|
11
7
|
// libraries
|
|
12
|
-
import {
|
|
8
|
+
import {BytesLib} from "solidity-bytes-utils/contracts/BytesLib.sol";
|
|
9
|
+
import {GasLib} from "../Utils/GasLib.sol";
|
|
10
|
+
|
|
11
|
+
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
|
|
12
|
+
import {ERC165Checker} from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
|
|
13
|
+
import {LSP1Utils} from "../LSP1UniversalReceiver/LSP1Utils.sol";
|
|
14
|
+
import {LSP2Utils} from "../LSP2ERC725YJSONSchema/LSP2Utils.sol";
|
|
13
15
|
|
|
14
16
|
// modules
|
|
15
|
-
import {ERC725XCore} from "@erc725/smart-contracts/contracts/ERC725XCore.sol";
|
|
16
|
-
import {ERC725YCore} from "@erc725/smart-contracts/contracts/ERC725YCore.sol";
|
|
17
|
+
import {ERC725XCore, IERC725X} from "@erc725/smart-contracts/contracts/ERC725XCore.sol";
|
|
18
|
+
import {ERC725YCore, IERC725Y} from "@erc725/smart-contracts/contracts/ERC725YCore.sol";
|
|
17
19
|
import {OwnableUnset} from "@erc725/smart-contracts/contracts/custom/OwnableUnset.sol";
|
|
18
|
-
import {
|
|
20
|
+
import {LSP14Ownable2Step} from "../LSP14Ownable2Step/LSP14Ownable2Step.sol";
|
|
21
|
+
import {LSP17Extendable} from "../LSP17ContractExtension/LSP17Extendable.sol";
|
|
19
22
|
|
|
20
23
|
// constants
|
|
21
|
-
import
|
|
24
|
+
import "@erc725/smart-contracts/contracts/errors.sol";
|
|
25
|
+
import {
|
|
26
|
+
OPERATION_0_CALL,
|
|
27
|
+
OPERATION_1_CREATE,
|
|
28
|
+
OPERATION_2_CREATE2,
|
|
29
|
+
OPERATION_3_STATICCALL
|
|
30
|
+
} from "@erc725/smart-contracts/contracts/constants.sol";
|
|
22
31
|
import {
|
|
23
32
|
_INTERFACEID_LSP1,
|
|
24
|
-
|
|
33
|
+
_LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX,
|
|
25
34
|
_LSP1_UNIVERSAL_RECEIVER_DELEGATE_KEY
|
|
26
35
|
} from "../LSP1UniversalReceiver/LSP1Constants.sol";
|
|
36
|
+
|
|
37
|
+
import {_LSP6KEY_ADDRESSPERMISSIONS_PREFIX} from "../LSP6KeyManager/LSP6Constants.sol";
|
|
27
38
|
import {
|
|
28
39
|
_INTERFACEID_LSP9,
|
|
29
|
-
|
|
30
|
-
|
|
40
|
+
_TYPEID_LSP9_OwnershipTransferStarted,
|
|
41
|
+
_TYPEID_LSP9_OwnershipTransferred_SenderNotification,
|
|
42
|
+
_TYPEID_LSP9_OwnershipTransferred_RecipientNotification
|
|
31
43
|
} from "./LSP9Constants.sol";
|
|
44
|
+
import {_INTERFACEID_LSP14} from "../LSP14Ownable2Step/LSP14Constants.sol";
|
|
45
|
+
import {_LSP17_EXTENSION_PREFIX} from "../LSP17ContractExtension/LSP17Constants.sol";
|
|
46
|
+
|
|
47
|
+
// errors
|
|
48
|
+
import "./LSP9Errors.sol";
|
|
32
49
|
|
|
33
50
|
/**
|
|
34
51
|
* @title Core Implementation of LSP9Vault built on top of ERC725, LSP1UniversalReceiver
|
|
35
52
|
* @author Fabian Vogelsteller, Yamen Merhi, Jean Cavallera
|
|
36
53
|
* @dev Could be owned by a UniversalProfile and able to register received asset with UniversalReceiverDelegateVault
|
|
37
54
|
*/
|
|
38
|
-
contract LSP9VaultCore is
|
|
55
|
+
contract LSP9VaultCore is
|
|
56
|
+
ERC725XCore,
|
|
57
|
+
ERC725YCore,
|
|
58
|
+
LSP14Ownable2Step,
|
|
59
|
+
LSP17Extendable,
|
|
60
|
+
ILSP1UniversalReceiver
|
|
61
|
+
{
|
|
62
|
+
using ERC165Checker for address;
|
|
63
|
+
using LSP1Utils for address;
|
|
64
|
+
|
|
65
|
+
address private _reentrantDelegate;
|
|
66
|
+
|
|
39
67
|
/**
|
|
40
68
|
* @notice Emitted when receiving native tokens
|
|
41
69
|
* @param sender The address of the sender
|
|
42
|
-
* @param value The amount of
|
|
70
|
+
* @param value The amount of native tokens received
|
|
43
71
|
*/
|
|
44
72
|
event ValueReceived(address indexed sender, uint256 indexed value);
|
|
45
73
|
|
|
46
|
-
|
|
74
|
+
/**
|
|
75
|
+
* @dev Emits an event when receiving native tokens
|
|
76
|
+
*
|
|
77
|
+
* Executed when receiving native tokens with empty calldata.
|
|
78
|
+
*/
|
|
79
|
+
receive() external payable virtual {
|
|
80
|
+
if (msg.value > 0) emit ValueReceived(msg.sender, msg.value);
|
|
81
|
+
}
|
|
47
82
|
|
|
48
83
|
/**
|
|
49
|
-
* @dev
|
|
84
|
+
* @dev Returns the extension stored under the `_LSP17_EXTENSION_PREFIX` data key
|
|
85
|
+
* mapped to the functionSelector provided.
|
|
86
|
+
*
|
|
87
|
+
* If no extension is stored, returns the address(0)
|
|
50
88
|
*/
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
89
|
+
function _getExtension(bytes4 functionSelector)
|
|
90
|
+
internal
|
|
91
|
+
view
|
|
92
|
+
virtual
|
|
93
|
+
override
|
|
94
|
+
returns (address)
|
|
95
|
+
{
|
|
96
|
+
bytes32 mappedExtensionDataKey = LSP2Utils.generateMappingKey(
|
|
97
|
+
_LSP17_EXTENSION_PREFIX,
|
|
98
|
+
functionSelector
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
// Check if there is an extension for the function selector provided
|
|
102
|
+
address extension = address(bytes20(_getData(mappedExtensionDataKey)));
|
|
103
|
+
|
|
104
|
+
return extension;
|
|
63
105
|
}
|
|
64
106
|
|
|
65
|
-
//
|
|
107
|
+
// solhint-disable no-complex-fallback
|
|
66
108
|
|
|
67
109
|
/**
|
|
68
110
|
* @dev Emits an event when receiving native tokens
|
|
111
|
+
*
|
|
112
|
+
* Forwards the call to an extension (address) stored under a _LSP17_FALLBACK_EXTENSIONS_HANDLER_ appended
|
|
113
|
+
* to a function selector. If there is no extension stored under the data key, return.
|
|
114
|
+
*
|
|
115
|
+
* The call to the extension is appended with bytes20 (msg.sender) and bytes32 (msg.value).
|
|
116
|
+
* Returns the return value on success and revert in case of failure.
|
|
117
|
+
*
|
|
118
|
+
* If the msg.data is shorter than 4 bytes or the first 4 bytes are 0s
|
|
119
|
+
* do not check for an extension and return
|
|
120
|
+
*
|
|
121
|
+
* Executed when:
|
|
122
|
+
* - the first 4 bytes of the calldata do not match any publicly callable functions from the contract ABI.
|
|
123
|
+
* - receiving native tokens with some calldata.
|
|
69
124
|
*/
|
|
70
125
|
fallback() external payable virtual {
|
|
71
|
-
if (msg.value
|
|
126
|
+
if (msg.value != 0) emit ValueReceived(msg.sender, msg.value);
|
|
127
|
+
if (msg.data.length < 4 || msg.sig == bytes4(0)) return;
|
|
128
|
+
_fallbackLSP17Extendable();
|
|
72
129
|
}
|
|
73
130
|
|
|
74
|
-
// ERC165
|
|
75
|
-
|
|
76
131
|
/**
|
|
77
|
-
* @dev
|
|
132
|
+
* @dev Returns true if this contract implements the interface defined by
|
|
133
|
+
* `interfaceId`.
|
|
134
|
+
*
|
|
135
|
+
* If the contract doesn't support the `interfaceId`, it forwards the call to the
|
|
136
|
+
* `supportsInterface` extension according to LSP17, and checks if the extension
|
|
137
|
+
* implements the interface defined by `interfaceId`.
|
|
78
138
|
*/
|
|
79
139
|
function supportsInterface(bytes4 interfaceId)
|
|
80
140
|
public
|
|
81
141
|
view
|
|
82
142
|
virtual
|
|
83
|
-
override(ERC725XCore, ERC725YCore)
|
|
143
|
+
override(ERC725XCore, ERC725YCore, LSP17Extendable)
|
|
84
144
|
returns (bool)
|
|
85
145
|
{
|
|
86
146
|
return
|
|
87
147
|
interfaceId == _INTERFACEID_LSP9 ||
|
|
88
148
|
interfaceId == _INTERFACEID_LSP1 ||
|
|
89
|
-
interfaceId ==
|
|
90
|
-
super.supportsInterface(interfaceId)
|
|
149
|
+
interfaceId == _INTERFACEID_LSP14 ||
|
|
150
|
+
super.supportsInterface(interfaceId) ||
|
|
151
|
+
_supportsInterfaceInERC165Extension(interfaceId);
|
|
91
152
|
}
|
|
92
153
|
|
|
93
|
-
// ERC173 - Modified ClaimOwnership
|
|
94
|
-
|
|
95
154
|
/**
|
|
96
|
-
* @
|
|
155
|
+
* @inheritdoc IERC725X
|
|
156
|
+
* @param operationType The operation to execute: CALL = 0 CREATE = 1 CREATE2 = 2 STATICCALL = 3
|
|
157
|
+
* @dev Executes any other smart contract.
|
|
158
|
+
* SHOULD only be callable by the owner of the contract set via ERC173
|
|
159
|
+
*
|
|
160
|
+
* Emits a {Executed} event, when a call is executed under `operationType` 0 and 3
|
|
161
|
+
* Emits a {ContractCreated} event, when a contract is created under `operationType` 1 and 2
|
|
162
|
+
* Emits a {ValueReceived} event, when receives native token
|
|
97
163
|
*/
|
|
98
|
-
function
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
{
|
|
104
|
-
|
|
164
|
+
function execute(
|
|
165
|
+
uint256 operationType,
|
|
166
|
+
address target,
|
|
167
|
+
uint256 value,
|
|
168
|
+
bytes memory data
|
|
169
|
+
) public payable virtual override onlyOwner returns (bytes memory) {
|
|
170
|
+
if (msg.value != 0) emit ValueReceived(msg.sender, msg.value);
|
|
171
|
+
return _execute(operationType, target, value, data);
|
|
105
172
|
}
|
|
106
173
|
|
|
107
174
|
/**
|
|
108
|
-
* @
|
|
175
|
+
* @inheritdoc ERC725XCore
|
|
176
|
+
*
|
|
177
|
+
* @dev Emits a {ValueReceived} event when receiving native tokens.
|
|
109
178
|
*/
|
|
110
|
-
function
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
179
|
+
function execute(
|
|
180
|
+
uint256[] memory operationsType,
|
|
181
|
+
address[] memory targets,
|
|
182
|
+
uint256[] memory values,
|
|
183
|
+
bytes[] memory datas
|
|
184
|
+
) public payable virtual override onlyOwner returns (bytes[] memory) {
|
|
185
|
+
if (msg.value != 0) emit ValueReceived(msg.sender, msg.value);
|
|
186
|
+
return _execute(operationsType, targets, values, datas);
|
|
117
187
|
}
|
|
118
188
|
|
|
119
|
-
// ERC725
|
|
120
|
-
|
|
121
189
|
/**
|
|
122
190
|
* @inheritdoc IERC725Y
|
|
123
191
|
* @dev Sets data as bytes in the vault storage for a single key.
|
|
@@ -126,7 +194,17 @@ contract LSP9VaultCore is ERC725XCore, ERC725YCore, ClaimOwnership, ILSP1Univers
|
|
|
126
194
|
*
|
|
127
195
|
* Emits a {DataChanged} event.
|
|
128
196
|
*/
|
|
129
|
-
function setData(bytes32 dataKey, bytes memory dataValue) public virtual override
|
|
197
|
+
function setData(bytes32 dataKey, bytes memory dataValue) public virtual override {
|
|
198
|
+
bool isURD = _validateAndIdentifyCaller();
|
|
199
|
+
if (isURD) {
|
|
200
|
+
if (
|
|
201
|
+
bytes12(dataKey) == _LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX ||
|
|
202
|
+
bytes6(dataKey) == _LSP6KEY_ADDRESSPERMISSIONS_PREFIX ||
|
|
203
|
+
bytes12(dataKey) == _LSP17_EXTENSION_PREFIX
|
|
204
|
+
) {
|
|
205
|
+
revert LSP1DelegateNotAllowedToSetDataKey(dataKey);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
130
208
|
_setData(dataKey, dataValue);
|
|
131
209
|
}
|
|
132
210
|
|
|
@@ -138,68 +216,224 @@ contract LSP9VaultCore is ERC725XCore, ERC725YCore, ClaimOwnership, ILSP1Univers
|
|
|
138
216
|
*
|
|
139
217
|
* Emits a {DataChanged} event.
|
|
140
218
|
*/
|
|
141
|
-
function setData(bytes32[] memory dataKeys, bytes[] memory dataValues)
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
219
|
+
function setData(bytes32[] memory dataKeys, bytes[] memory dataValues) public virtual override {
|
|
220
|
+
bool isURD = _validateAndIdentifyCaller();
|
|
221
|
+
if (dataKeys.length != dataValues.length) {
|
|
222
|
+
revert ERC725Y_DataKeysValuesLengthMismatch(dataKeys.length, dataValues.length);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
for (uint256 i = 0; i < dataKeys.length; i = GasLib.uncheckedIncrement(i)) {
|
|
226
|
+
if (isURD) {
|
|
227
|
+
if (
|
|
228
|
+
bytes12(dataKeys[i]) == _LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX ||
|
|
229
|
+
bytes6(dataKeys[i]) == _LSP6KEY_ADDRESSPERMISSIONS_PREFIX ||
|
|
230
|
+
bytes12(dataKeys[i]) == _LSP17_EXTENSION_PREFIX
|
|
231
|
+
) {
|
|
232
|
+
revert LSP1DelegateNotAllowedToSetDataKey(dataKeys[i]);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
149
235
|
_setData(dataKeys[i], dataValues[i]);
|
|
150
236
|
}
|
|
151
237
|
}
|
|
152
238
|
|
|
153
|
-
|
|
239
|
+
/**
|
|
240
|
+
* @dev Modifier restricting the call to the owner of the contract and the UniversalReceiverDelegate
|
|
241
|
+
*/
|
|
242
|
+
function _validateAndIdentifyCaller() internal view returns (bool isURD) {
|
|
243
|
+
if (msg.sender != owner()) {
|
|
244
|
+
require(
|
|
245
|
+
msg.sender == _reentrantDelegate,
|
|
246
|
+
"Only Owner or reentered Universal Receiver Delegate allowed"
|
|
247
|
+
);
|
|
248
|
+
isURD = true;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
154
251
|
|
|
155
252
|
/**
|
|
156
253
|
* @notice Triggers the UniversalReceiver event when this function gets executed successfully.
|
|
157
|
-
*
|
|
254
|
+
* Forwards the call to the addresses stored in the ERC725Y storage under the LSP1UniversalReceiverDelegate
|
|
255
|
+
* Key and the typeId Key (param) respectively. The call will be discarded if no addresses are set.
|
|
256
|
+
*
|
|
158
257
|
* @param typeId The type of call received.
|
|
159
|
-
* @param
|
|
258
|
+
* @param receivedData The data received.
|
|
259
|
+
* @return returnedValues The ABI encoded return value of the LSP1UniversalReceiverDelegate call
|
|
260
|
+
* and the LSP1TypeIdDelegate call.
|
|
160
261
|
*/
|
|
161
|
-
function universalReceiver(bytes32 typeId, bytes calldata
|
|
262
|
+
function universalReceiver(bytes32 typeId, bytes calldata receivedData)
|
|
162
263
|
public
|
|
163
264
|
payable
|
|
164
265
|
virtual
|
|
165
|
-
|
|
166
|
-
returns (bytes memory returnValue)
|
|
266
|
+
returns (bytes memory returnedValues)
|
|
167
267
|
{
|
|
268
|
+
if (msg.value != 0) emit ValueReceived(msg.sender, msg.value);
|
|
168
269
|
bytes memory lsp1DelegateValue = _getData(_LSP1_UNIVERSAL_RECEIVER_DELEGATE_KEY);
|
|
270
|
+
bytes memory resultDefaultDelegate;
|
|
169
271
|
|
|
170
272
|
if (lsp1DelegateValue.length >= 20) {
|
|
171
273
|
address universalReceiverDelegate = address(bytes20(lsp1DelegateValue));
|
|
172
274
|
|
|
173
|
-
if (
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
275
|
+
if (universalReceiverDelegate.supportsERC165InterfaceUnchecked(_INTERFACEID_LSP1)) {
|
|
276
|
+
_reentrantDelegate = universalReceiverDelegate;
|
|
277
|
+
resultDefaultDelegate = universalReceiverDelegate
|
|
278
|
+
.callUniversalReceiverWithCallerInfos(
|
|
279
|
+
typeId,
|
|
280
|
+
receivedData,
|
|
281
|
+
msg.sender,
|
|
282
|
+
msg.value
|
|
283
|
+
);
|
|
181
284
|
}
|
|
182
285
|
}
|
|
183
|
-
|
|
286
|
+
|
|
287
|
+
bytes32 lsp1typeIdDelegateKey = LSP2Utils.generateMappingKey(
|
|
288
|
+
_LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX,
|
|
289
|
+
bytes20(typeId)
|
|
290
|
+
);
|
|
291
|
+
|
|
292
|
+
bytes memory lsp1TypeIdDelegateValue = _getData(lsp1typeIdDelegateKey);
|
|
293
|
+
bytes memory resultTypeIdDelegate;
|
|
294
|
+
|
|
295
|
+
if (lsp1TypeIdDelegateValue.length >= 20) {
|
|
296
|
+
address universalReceiverDelegate = address(bytes20(lsp1TypeIdDelegateValue));
|
|
297
|
+
|
|
298
|
+
if (universalReceiverDelegate.supportsERC165InterfaceUnchecked(_INTERFACEID_LSP1)) {
|
|
299
|
+
_reentrantDelegate = universalReceiverDelegate;
|
|
300
|
+
resultTypeIdDelegate = universalReceiverDelegate
|
|
301
|
+
.callUniversalReceiverWithCallerInfos(
|
|
302
|
+
typeId,
|
|
303
|
+
receivedData,
|
|
304
|
+
msg.sender,
|
|
305
|
+
msg.value
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
delete _reentrantDelegate;
|
|
311
|
+
returnedValues = abi.encode(resultDefaultDelegate, resultTypeIdDelegate);
|
|
312
|
+
emit UniversalReceiver(msg.sender, msg.value, typeId, receivedData, returnedValues);
|
|
184
313
|
}
|
|
185
314
|
|
|
186
|
-
|
|
315
|
+
/**
|
|
316
|
+
* @dev Sets the pending owner and notify the pending owner
|
|
317
|
+
*
|
|
318
|
+
* @param _newOwner The address nofied and set as `pendingOwner`
|
|
319
|
+
*/
|
|
320
|
+
function transferOwnership(address _newOwner)
|
|
321
|
+
public
|
|
322
|
+
virtual
|
|
323
|
+
override(LSP14Ownable2Step, OwnableUnset)
|
|
324
|
+
onlyOwner
|
|
325
|
+
{
|
|
326
|
+
LSP14Ownable2Step._transferOwnership(_newOwner);
|
|
327
|
+
}
|
|
187
328
|
|
|
188
329
|
/**
|
|
189
|
-
* @dev
|
|
330
|
+
* @dev Renounce ownership of the contract in a 2-step process
|
|
190
331
|
*/
|
|
191
|
-
function
|
|
192
|
-
|
|
193
|
-
|
|
332
|
+
function renounceOwnership()
|
|
333
|
+
public
|
|
334
|
+
virtual
|
|
335
|
+
override(LSP14Ownable2Step, OwnableUnset)
|
|
336
|
+
onlyOwner
|
|
337
|
+
{
|
|
338
|
+
LSP14Ownable2Step._renounceOwnership();
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* @dev SAVE GAS by emitting the DataChanged event with only the first 256 bytes of dataValue
|
|
343
|
+
*/
|
|
344
|
+
function _setData(bytes32 dataKey, bytes memory dataValue) internal virtual override {
|
|
345
|
+
_store[dataKey] = dataValue;
|
|
346
|
+
emit DataChanged(
|
|
347
|
+
dataKey,
|
|
348
|
+
dataValue.length <= 256 ? dataValue : BytesLib.slice(dataValue, 0, 256)
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* @dev disable operation type DELEGATECALL (4).
|
|
354
|
+
* NB: providing operation type DELEGATECALL (4) as argument will result
|
|
355
|
+
* in custom error ERC725X_UnknownOperationType(4)
|
|
356
|
+
*/
|
|
357
|
+
function _execute(
|
|
358
|
+
uint256 operationType,
|
|
359
|
+
address target,
|
|
360
|
+
uint256 value,
|
|
361
|
+
bytes memory data
|
|
362
|
+
) internal virtual override returns (bytes memory) {
|
|
363
|
+
// CALL
|
|
364
|
+
if (operationType == OPERATION_0_CALL) {
|
|
365
|
+
return _executeCall(target, value, data);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
// Deploy with CREATE
|
|
369
|
+
if (operationType == uint256(OPERATION_1_CREATE)) {
|
|
370
|
+
if (target != address(0)) revert ERC725X_CreateOperationsRequireEmptyRecipientAddress();
|
|
371
|
+
return _deployCreate(value, data);
|
|
194
372
|
}
|
|
373
|
+
|
|
374
|
+
// Deploy with CREATE2
|
|
375
|
+
if (operationType == uint256(OPERATION_2_CREATE2)) {
|
|
376
|
+
if (target != address(0)) revert ERC725X_CreateOperationsRequireEmptyRecipientAddress();
|
|
377
|
+
return _deployCreate2(value, data);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// STATICCALL
|
|
381
|
+
if (operationType == uint256(OPERATION_3_STATICCALL)) {
|
|
382
|
+
if (value != 0) revert ERC725X_MsgValueDisallowedInStaticCall();
|
|
383
|
+
return _executeStaticCall(target, data);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
revert ERC725X_UnknownOperationType(operationType);
|
|
195
387
|
}
|
|
196
388
|
|
|
389
|
+
// --- LSP14 URD Hooks
|
|
390
|
+
|
|
197
391
|
/**
|
|
198
|
-
* @dev Calls the universalReceiver function of the
|
|
392
|
+
* @dev Calls the universalReceiver function of the sender when ownerhsip transfer starts
|
|
393
|
+
* if supports LSP1 InterfaceId
|
|
199
394
|
*/
|
|
200
|
-
function
|
|
201
|
-
|
|
202
|
-
|
|
395
|
+
function _notifyLSP1SenderOnOwnershipTransferStart(address notifiedContract, bytes memory data)
|
|
396
|
+
internal
|
|
397
|
+
virtual
|
|
398
|
+
override
|
|
399
|
+
{
|
|
400
|
+
if (ERC165Checker.supportsERC165InterfaceUnchecked(notifiedContract, _INTERFACEID_LSP1)) {
|
|
401
|
+
ILSP1UniversalReceiver(notifiedContract).universalReceiver(
|
|
402
|
+
_TYPEID_LSP9_OwnershipTransferStarted,
|
|
403
|
+
data
|
|
404
|
+
);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* @dev Calls the universalReceiver function of the sender when ownerhsip transfer is complete
|
|
410
|
+
* if supports LSP1 InterfaceId
|
|
411
|
+
*/
|
|
412
|
+
function _notifyLSP1SenderOnOwnershipTransferCompletion(
|
|
413
|
+
address notifiedContract,
|
|
414
|
+
bytes memory data
|
|
415
|
+
) internal virtual override {
|
|
416
|
+
if (ERC165Checker.supportsERC165InterfaceUnchecked(notifiedContract, _INTERFACEID_LSP1)) {
|
|
417
|
+
ILSP1UniversalReceiver(notifiedContract).universalReceiver(
|
|
418
|
+
_TYPEID_LSP9_OwnershipTransferred_SenderNotification,
|
|
419
|
+
data
|
|
420
|
+
);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* @dev Calls the universalReceiver function of the recipient when ownerhsip transfer is complete
|
|
426
|
+
* if supports LSP1 InterfaceId
|
|
427
|
+
*/
|
|
428
|
+
function _notifyLSP1RecipientOnOwnershipTransferCompletion(
|
|
429
|
+
address notifiedContract,
|
|
430
|
+
bytes memory data
|
|
431
|
+
) internal virtual override {
|
|
432
|
+
if (ERC165Checker.supportsERC165InterfaceUnchecked(notifiedContract, _INTERFACEID_LSP1)) {
|
|
433
|
+
ILSP1UniversalReceiver(notifiedContract).universalReceiver(
|
|
434
|
+
_TYPEID_LSP9_OwnershipTransferred_RecipientNotification,
|
|
435
|
+
data
|
|
436
|
+
);
|
|
203
437
|
}
|
|
204
438
|
}
|
|
205
439
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
pragma solidity ^0.8.
|
|
2
|
+
pragma solidity ^0.8.4;
|
|
3
3
|
|
|
4
4
|
// modules
|
|
5
5
|
import {LSP9VaultInitAbstract} from "./LSP9VaultInitAbstract.sol";
|
|
@@ -21,7 +21,7 @@ contract LSP9VaultInit is LSP9VaultInitAbstract {
|
|
|
21
21
|
* @notice Sets the owner of the contract and sets the SupportedStandards:LSP9Vault key
|
|
22
22
|
* @param newOwner the owner of the contract
|
|
23
23
|
*/
|
|
24
|
-
function initialize(address newOwner)
|
|
24
|
+
function initialize(address newOwner) external payable virtual initializer {
|
|
25
25
|
LSP9VaultInitAbstract._initialize(newOwner);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
pragma solidity ^0.8.
|
|
2
|
+
pragma solidity ^0.8.4;
|
|
3
3
|
|
|
4
4
|
// interfaces
|
|
5
5
|
import {IERC725Y} from "@erc725/smart-contracts/contracts/interfaces/IERC725Y.sol";
|
|
6
6
|
|
|
7
7
|
// modules
|
|
8
8
|
import {OwnableUnset} from "@erc725/smart-contracts/contracts/custom/OwnableUnset.sol";
|
|
9
|
-
import {Initializable} from "@
|
|
10
|
-
import {LSP9VaultCore
|
|
9
|
+
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
|
10
|
+
import {LSP9VaultCore} from "./LSP9VaultCore.sol";
|
|
11
11
|
|
|
12
12
|
// constants
|
|
13
13
|
import {_INTERFACEID_LSP1} from "../LSP1UniversalReceiver/LSP1Constants.sol";
|
|
@@ -24,11 +24,12 @@ import {
|
|
|
24
24
|
*/
|
|
25
25
|
abstract contract LSP9VaultInitAbstract is Initializable, LSP9VaultCore {
|
|
26
26
|
function _initialize(address newOwner) internal virtual onlyInitializing {
|
|
27
|
+
if (msg.value != 0) emit ValueReceived(msg.sender, msg.value);
|
|
27
28
|
OwnableUnset._setOwner(newOwner);
|
|
28
29
|
|
|
29
30
|
// set key SupportedStandards:LSP9Vault
|
|
30
31
|
_setData(_LSP9_SUPPORTED_STANDARDS_KEY, _LSP9_SUPPORTED_STANDARDS_VALUE);
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
_notifyLSP1RecipientOnOwnershipTransferCompletion(newOwner, "");
|
|
33
34
|
}
|
|
34
35
|
}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
pragma solidity ^0.8.
|
|
3
|
-
|
|
4
|
-
// interfaces
|
|
5
|
-
import {
|
|
6
|
-
ILSP1UniversalReceiverDelegate
|
|
7
|
-
} from "../LSP1UniversalReceiver/ILSP1UniversalReceiverDelegate.sol";
|
|
2
|
+
pragma solidity ^0.8.4;
|
|
8
3
|
|
|
9
4
|
// libraries
|
|
10
5
|
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
|
@@ -13,11 +8,7 @@ import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet
|
|
|
13
8
|
import {ERC165Storage} from "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol";
|
|
14
9
|
import {AddressRegistry} from "./Registries/AddressRegistry.sol";
|
|
15
10
|
|
|
16
|
-
contract UniversalReceiverAddressStore is
|
|
17
|
-
ERC165Storage,
|
|
18
|
-
ILSP1UniversalReceiverDelegate,
|
|
19
|
-
AddressRegistry
|
|
20
|
-
{
|
|
11
|
+
contract UniversalReceiverAddressStore is ERC165Storage, AddressRegistry {
|
|
21
12
|
using EnumerableSet for EnumerableSet.AddressSet;
|
|
22
13
|
|
|
23
14
|
bytes4 internal constant _INTERFACE_ID_LSP1DELEGATE = 0xa245bbda;
|
|
@@ -42,10 +33,10 @@ contract UniversalReceiverAddressStore is
|
|
|
42
33
|
|
|
43
34
|
function universalReceiverDelegate(
|
|
44
35
|
address sender,
|
|
45
|
-
uint256 value
|
|
36
|
+
uint256, /* value */
|
|
46
37
|
bytes32 typeId,
|
|
47
38
|
bytes memory
|
|
48
|
-
) external
|
|
39
|
+
) external onlyAccount returns (bytes memory) {
|
|
49
40
|
// require(typeId == _TOKENS_RECIPIENT_INTERFACE_HASH, 'UniversalReceiverDelegate: Type not supported');
|
|
50
41
|
|
|
51
42
|
// store tokens only if received, DO NOT revert on _TOKENS_SENDER_INTERFACE_HASH
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
pragma solidity ^0.8.
|
|
2
|
+
pragma solidity ^0.8.4;
|
|
3
3
|
|
|
4
4
|
// modules
|
|
5
5
|
import {LSP0ERC725Account} from "./LSP0ERC725Account/LSP0ERC725Account.sol";
|
|
@@ -20,7 +20,7 @@ contract UniversalProfile is LSP0ERC725Account {
|
|
|
20
20
|
* @notice Sets the owner of the contract and sets the SupportedStandards:LSP3UniversalProfile key
|
|
21
21
|
* @param newOwner the owner of the contract
|
|
22
22
|
*/
|
|
23
|
-
constructor(address newOwner) LSP0ERC725Account(newOwner)
|
|
23
|
+
constructor(address newOwner) payable LSP0ERC725Account(newOwner) {
|
|
24
24
|
// set key SupportedStandards:LSP3UniversalProfile
|
|
25
25
|
_setData(_LSP3_SUPPORTED_STANDARDS_KEY, _LSP3_SUPPORTED_STANDARDS_VALUE);
|
|
26
26
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
pragma solidity ^0.8.
|
|
2
|
+
pragma solidity ^0.8.4;
|
|
3
3
|
|
|
4
4
|
// modules
|
|
5
5
|
import {UniversalProfileInitAbstract} from "./UniversalProfileInitAbstract.sol";
|
|
@@ -21,7 +21,7 @@ contract UniversalProfileInit is UniversalProfileInitAbstract {
|
|
|
21
21
|
* @notice Sets the owner of the contract and sets the SupportedStandards:LSP3UniversalProfile key
|
|
22
22
|
* @param newOwner the owner of the contract
|
|
23
23
|
*/
|
|
24
|
-
function initialize(address newOwner)
|
|
24
|
+
function initialize(address newOwner) external payable virtual initializer {
|
|
25
25
|
UniversalProfileInitAbstract._initialize(newOwner);
|
|
26
26
|
}
|
|
27
27
|
}
|