@lukso/lsp-smart-contracts 0.7.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +39 -0
- package/README.md +93 -40
- package/artifacts/Create2Factory.json +2 -2
- package/artifacts/LSP0ERC725Account.json +194 -15
- package/artifacts/LSP0ERC725AccountInit.json +194 -15
- 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 +16 -0
- package/artifacts/LSP4DigitalAssetMetadata.json +16 -0
- package/artifacts/LSP4DigitalAssetMetadataInitAbstract.json +16 -0
- package/artifacts/LSP6KeyManager.json +177 -33
- package/artifacts/LSP6KeyManagerInit.json +177 -33
- package/artifacts/LSP7CappedSupply.json +26 -5
- package/artifacts/LSP7CappedSupplyInitAbstract.json +26 -5
- package/artifacts/LSP7CompatibleERC20.json +26 -5
- package/artifacts/LSP7CompatibleERC20InitAbstract.json +28 -7
- package/artifacts/LSP7CompatibleERC20Mintable.json +29 -8
- package/artifacts/LSP7CompatibleERC20MintableInit.json +29 -8
- package/artifacts/LSP7DigitalAsset.json +26 -5
- package/artifacts/LSP7DigitalAssetInitAbstract.json +26 -5
- package/artifacts/LSP7Mintable.json +29 -8
- package/artifacts/LSP7MintableInit.json +29 -8
- package/artifacts/LSP8CappedSupply.json +27 -6
- package/artifacts/LSP8CappedSupplyInitAbstract.json +27 -6
- package/artifacts/LSP8CompatibleERC721.json +28 -7
- package/artifacts/LSP8CompatibleERC721InitAbstract.json +30 -9
- package/artifacts/LSP8CompatibleERC721Mintable.json +31 -10
- package/artifacts/LSP8CompatibleERC721MintableInit.json +31 -10
- package/artifacts/LSP8IdentifiableDigitalAsset.json +27 -6
- package/artifacts/LSP8IdentifiableDigitalAssetInitAbstract.json +27 -6
- package/artifacts/LSP8Mintable.json +30 -9
- package/artifacts/LSP8MintableInit.json +30 -9
- package/artifacts/LSP9Vault.json +202 -17
- package/artifacts/LSP9VaultInit.json +202 -17
- package/artifacts/UniversalProfile.json +194 -15
- package/artifacts/UniversalProfileInit.json +194 -15
- package/artifacts/UniversalReceiverAddressStore.json +3 -3
- package/common/constants.d.ts +738 -0
- package/common/constants.js +785 -0
- 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 +320 -63
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountInit.sol +2 -2
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountInitAbstract.sol +2 -1
- package/contracts/LSP0ERC725Account/LSP0Utils.sol +50 -0
- package/contracts/LSP10ReceivedVaults/LSP10Constants.sol +2 -2
- package/contracts/LSP10ReceivedVaults/LSP10Utils.sol +212 -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 +155 -37
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol +64 -31
- package/contracts/LSP1UniversalReceiver/LSP1Utils.sol +53 -40
- package/contracts/LSP2ERC725YJSONSchema/LSP2Utils.sol +45 -23
- 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 +2 -2
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol +2 -2
- package/contracts/LSP4DigitalAssetMetadata/LSP4Errors.sol +3 -3
- package/contracts/LSP5ReceivedAssets/LSP5Constants.sol +2 -2
- package/contracts/LSP5ReceivedAssets/LSP5Utils.sol +102 -114
- package/contracts/LSP6KeyManager/ILSP6KeyManager.sol +25 -7
- package/contracts/LSP6KeyManager/LSP6Constants.sol +43 -38
- package/contracts/LSP6KeyManager/LSP6Errors.sol +90 -21
- package/contracts/LSP6KeyManager/LSP6KeyManager.sol +2 -1
- package/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol +224 -506
- package/contracts/LSP6KeyManager/LSP6KeyManagerInit.sol +1 -1
- package/contracts/LSP6KeyManager/LSP6KeyManagerInitAbstract.sol +3 -2
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6ExecuteModule.sol +229 -0
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6OwnershipModule.sol +25 -0
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6SetDataModule.sol +606 -0
- package/contracts/LSP6KeyManager/LSP6Utils.sol +156 -35
- package/contracts/LSP7DigitalAsset/ILSP7DigitalAsset.sol +8 -8
- package/contracts/LSP7DigitalAsset/LSP7Constants.sol +6 -6
- package/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol +1 -1
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +36 -36
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol +1 -1
- package/contracts/LSP7DigitalAsset/LSP7Errors.sol +33 -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 +2 -2
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInitAbstract.sol +3 -3
- package/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol +3 -5
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableInit.sol +2 -2
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol +3 -3
- package/contracts/LSP8IdentifiableDigitalAsset/ILSP8IdentifiableDigitalAsset.sol +7 -7
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol +7 -7
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Errors.sol +45 -2
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol +2 -2
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +57 -60
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol +1 -1
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CompatibleERC721.sol +5 -2
- 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 +234 -30
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol +238 -30
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol +32 -4
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableInitAbstract.sol +35 -8
- package/contracts/LSP8IdentifiableDigitalAsset/presets/ILSP8Mintable.sol +3 -3
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol +3 -4
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol +3 -3
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.sol +3 -3
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol +3 -4
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInit.sol +2 -2
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol +3 -3
- package/contracts/LSP9Vault/LSP9Constants.sol +10 -10
- package/contracts/LSP9Vault/LSP9Errors.sol +8 -0
- package/contracts/LSP9Vault/LSP9Vault.sol +6 -4
- package/contracts/LSP9Vault/LSP9VaultCore.sol +350 -127
- package/contracts/LSP9Vault/LSP9VaultInit.sol +2 -2
- package/contracts/LSP9Vault/LSP9VaultInitAbstract.sol +4 -3
- package/contracts/Legacy/Registries/AddressRegistry.sol +1 -1
- package/contracts/Legacy/Registries/AddressRegistryRequiresERC725.sol +1 -1
- package/contracts/Legacy/UniversalReceiverAddressStore.sol +4 -14
- package/contracts/UniversalProfile.sol +2 -2
- package/contracts/UniversalProfileInit.sol +2 -2
- package/contracts/UniversalProfileInitAbstract.sol +1 -1
- package/contracts/Utils/GasLib.sol +1 -1
- package/module/constants.d.ts +738 -0
- package/module/constants.js +782 -0
- package/package.json +42 -12
- package/artifacts/UniversalFactory.json +0 -127
- package/constants.js +0 -594
- package/contracts/Custom/ClaimOwnership.sol +0 -96
- package/contracts/Custom/ERC165Checker.sol +0 -130
- package/contracts/Custom/IClaimOwnership.sol +0 -12
- package/contracts/Factories/UniversalFactory.sol +0 -159
- package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiverDelegate.sol +0 -24
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/Handling/TokenAndVaultHandling.sol +0 -82
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/Handling/TokenHandling.sol +0 -73
- package/contracts/LSP2ERC725YJSONSchema/LSP2Errors.sol +0 -9
- package/contracts/LSP7DigitalAsset/extensions/ILSP7CappedSupply.sol +0 -17
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyCore.sol +0 -57
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20Core.sol +0 -111
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CappedSupply.sol +0 -17
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8Enumerable.sol +0 -17
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyCore.sol +0 -58
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleConstants.sol +0 -6
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721Core.sol +0 -211
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableCore.sol +0 -50
- package/contracts/Utils/UtilsLib.sol +0 -31
|
@@ -1,117 +1,249 @@
|
|
|
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 {ILSP1UniversalReceiver} from "../LSP1UniversalReceiver/ILSP1UniversalReceiver.sol";
|
|
6
|
-
import {
|
|
7
|
-
ILSP1UniversalReceiverDelegate
|
|
8
|
-
} from "../LSP1UniversalReceiver/ILSP1UniversalReceiverDelegate.sol";
|
|
9
6
|
|
|
10
7
|
// libraries
|
|
11
8
|
import {BytesLib} from "solidity-bytes-utils/contracts/BytesLib.sol";
|
|
12
9
|
import {GasLib} from "../Utils/GasLib.sol";
|
|
13
|
-
|
|
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";
|
|
14
15
|
|
|
15
16
|
// modules
|
|
16
17
|
import {ERC725XCore, IERC725X} from "@erc725/smart-contracts/contracts/ERC725XCore.sol";
|
|
17
18
|
import {ERC725YCore, IERC725Y} from "@erc725/smart-contracts/contracts/ERC725YCore.sol";
|
|
18
19
|
import {OwnableUnset} from "@erc725/smart-contracts/contracts/custom/OwnableUnset.sol";
|
|
19
|
-
import {
|
|
20
|
+
import {LSP14Ownable2Step} from "../LSP14Ownable2Step/LSP14Ownable2Step.sol";
|
|
21
|
+
import {LSP17Extendable} from "../LSP17ContractExtension/LSP17Extendable.sol";
|
|
20
22
|
|
|
21
23
|
// constants
|
|
22
|
-
import
|
|
23
|
-
|
|
24
|
+
import "@erc725/smart-contracts/contracts/errors.sol";
|
|
24
25
|
import {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
OPERATION_0_CALL,
|
|
27
|
+
OPERATION_1_CREATE,
|
|
28
|
+
OPERATION_2_CREATE2,
|
|
29
|
+
OPERATION_3_STATICCALL
|
|
29
30
|
} from "@erc725/smart-contracts/contracts/constants.sol";
|
|
30
31
|
import {
|
|
31
32
|
_INTERFACEID_LSP1,
|
|
32
|
-
|
|
33
|
+
_LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX,
|
|
33
34
|
_LSP1_UNIVERSAL_RECEIVER_DELEGATE_KEY
|
|
34
35
|
} from "../LSP1UniversalReceiver/LSP1Constants.sol";
|
|
36
|
+
|
|
37
|
+
import {_LSP6KEY_ADDRESSPERMISSIONS_PREFIX} from "../LSP6KeyManager/LSP6Constants.sol";
|
|
35
38
|
import {
|
|
36
39
|
_INTERFACEID_LSP9,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
_TYPEID_LSP9_OwnershipTransferStarted,
|
|
41
|
+
_TYPEID_LSP9_OwnershipTransferred_SenderNotification,
|
|
42
|
+
_TYPEID_LSP9_OwnershipTransferred_RecipientNotification
|
|
40
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";
|
|
49
|
+
import "../LSP17ContractExtension/LSP17Errors.sol";
|
|
41
50
|
|
|
42
51
|
/**
|
|
43
52
|
* @title Core Implementation of LSP9Vault built on top of ERC725, LSP1UniversalReceiver
|
|
44
53
|
* @author Fabian Vogelsteller, Yamen Merhi, Jean Cavallera
|
|
45
54
|
* @dev Could be owned by a UniversalProfile and able to register received asset with UniversalReceiverDelegateVault
|
|
46
55
|
*/
|
|
47
|
-
contract LSP9VaultCore is
|
|
56
|
+
contract LSP9VaultCore is
|
|
57
|
+
ERC725XCore,
|
|
58
|
+
ERC725YCore,
|
|
59
|
+
LSP14Ownable2Step,
|
|
60
|
+
LSP17Extendable,
|
|
61
|
+
ILSP1UniversalReceiver
|
|
62
|
+
{
|
|
63
|
+
using ERC165Checker for address;
|
|
64
|
+
using LSP1Utils for address;
|
|
65
|
+
|
|
66
|
+
address private _reentrantDelegate;
|
|
67
|
+
|
|
48
68
|
/**
|
|
49
69
|
* @notice Emitted when receiving native tokens
|
|
50
70
|
* @param sender The address of the sender
|
|
51
|
-
* @param value The amount of
|
|
71
|
+
* @param value The amount of native tokens received
|
|
52
72
|
*/
|
|
53
73
|
event ValueReceived(address indexed sender, uint256 indexed value);
|
|
54
74
|
|
|
55
|
-
// modifiers
|
|
56
|
-
|
|
57
75
|
/**
|
|
58
|
-
* @dev
|
|
76
|
+
* @dev Emits an event when receiving native tokens
|
|
77
|
+
*
|
|
78
|
+
* Executed:
|
|
79
|
+
* - when receiving some native tokens without any additional data.
|
|
80
|
+
* - on empty calls to the contract.
|
|
59
81
|
*/
|
|
60
|
-
|
|
61
|
-
if (msg.
|
|
62
|
-
address universalReceiverAddress = address(
|
|
63
|
-
bytes20(_getData(_LSP1_UNIVERSAL_RECEIVER_DELEGATE_KEY))
|
|
64
|
-
);
|
|
65
|
-
require(
|
|
66
|
-
ERC165Checker.supportsERC165Interface(msg.sender, _INTERFACEID_LSP1_DELEGATE) &&
|
|
67
|
-
msg.sender == universalReceiverAddress,
|
|
68
|
-
"Only Owner or Universal Receiver Delegate allowed"
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
_;
|
|
82
|
+
receive() external payable virtual {
|
|
83
|
+
if (msg.value > 0) emit ValueReceived(msg.sender, msg.value);
|
|
72
84
|
}
|
|
73
85
|
|
|
74
|
-
//
|
|
86
|
+
// solhint-disable no-complex-fallback
|
|
75
87
|
|
|
76
88
|
/**
|
|
77
89
|
* @dev Emits an event when receiving native tokens
|
|
90
|
+
*
|
|
91
|
+
* Forwards the call to an extension contract (address). This address can be retrieved from
|
|
92
|
+
* the ERC725Y data key-value store using the data key below (function selector appended to the prefix):
|
|
93
|
+
*_LSP17_FALLBACK_EXTENSIONS_HANDLER_ + <function-selector>
|
|
94
|
+
* If there is no extension stored under the data key, return.
|
|
95
|
+
*
|
|
96
|
+
* The call to the extension is appended with bytes20 (msg.sender) and bytes32 (msg.value).
|
|
97
|
+
* Returns the return value on success and revert in case of failure.
|
|
98
|
+
*
|
|
99
|
+
* If the msg.data is shorter than 4 bytes do not check for an extension and return
|
|
100
|
+
*
|
|
101
|
+
* Executed when:
|
|
102
|
+
* - the first 4 bytes of the calldata do not match any publicly callable functions from the contract ABI.
|
|
103
|
+
* - receiving native tokens with some calldata.
|
|
78
104
|
*/
|
|
79
105
|
fallback() external payable virtual {
|
|
80
106
|
if (msg.value != 0) emit ValueReceived(msg.sender, msg.value);
|
|
107
|
+
if (msg.data.length < 4) return;
|
|
108
|
+
|
|
109
|
+
_fallbackLSP17Extendable();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* @dev Forwards the call to an extension mapped to a function selector. If no extension address
|
|
114
|
+
* is mapped to the function selector (address(0)), then revert.
|
|
115
|
+
*
|
|
116
|
+
* The bytes4(0) msg.sig is an exception, the function won't revert if there is no extension found
|
|
117
|
+
* mapped to bytes4(0), but will execute the call to the extension in case it existed.
|
|
118
|
+
*
|
|
119
|
+
* The call to the extension is appended with bytes20 (msg.sender) and bytes32 (msg.value).
|
|
120
|
+
* Returns the return value on success and revert in case of failure.
|
|
121
|
+
*
|
|
122
|
+
* Because the function uses assembly {return()/revert()} to terminate the call, it cannot be
|
|
123
|
+
* called before other codes in fallback().
|
|
124
|
+
*
|
|
125
|
+
* Otherwise, the codes after _fallbackLSP17Extendable() may never be reached.
|
|
126
|
+
*/
|
|
127
|
+
function _fallbackLSP17Extendable() internal virtual override {
|
|
128
|
+
// If there is a function selector
|
|
129
|
+
address extension = _getExtension(msg.sig);
|
|
130
|
+
|
|
131
|
+
// if no extension was found for bytes4(0) return don't revert
|
|
132
|
+
if (msg.sig == bytes4(0) && extension == address(0)) return;
|
|
133
|
+
|
|
134
|
+
// if no extension was found, revert
|
|
135
|
+
if (extension == address(0)) revert NoExtensionFoundForFunctionSelector(msg.sig);
|
|
136
|
+
|
|
137
|
+
// solhint-disable no-inline-assembly
|
|
138
|
+
// if the extension was found, call the extension with the msg.data
|
|
139
|
+
// appended with bytes20(address) and bytes32(msg.value)
|
|
140
|
+
assembly {
|
|
141
|
+
calldatacopy(0, 0, calldatasize())
|
|
142
|
+
|
|
143
|
+
// The msg.sender address is shifted to the left by 12 bytes to remove the padding
|
|
144
|
+
// Then the address without padding is stored right after the calldata
|
|
145
|
+
mstore(calldatasize(), shl(96, caller()))
|
|
146
|
+
|
|
147
|
+
// The msg.value is stored right after the calldata + msg.sender
|
|
148
|
+
mstore(add(calldatasize(), 20), callvalue())
|
|
149
|
+
|
|
150
|
+
// Add 52 bytes for the msg.sender and msg.value appended at the end of the calldata
|
|
151
|
+
let success := call(gas(), extension, 0, 0, add(calldatasize(), 52), 0, 0)
|
|
152
|
+
|
|
153
|
+
// Copy the returned data
|
|
154
|
+
returndatacopy(0, 0, returndatasize())
|
|
155
|
+
|
|
156
|
+
switch success
|
|
157
|
+
// call returns 0 on failed calls
|
|
158
|
+
case 0 {
|
|
159
|
+
revert(0, returndatasize())
|
|
160
|
+
}
|
|
161
|
+
default {
|
|
162
|
+
return(0, returndatasize())
|
|
163
|
+
}
|
|
164
|
+
}
|
|
81
165
|
}
|
|
82
166
|
|
|
83
|
-
|
|
167
|
+
/**
|
|
168
|
+
* @dev Returns the extension stored under the `_LSP17_EXTENSION_PREFIX` data key
|
|
169
|
+
* mapped to the functionSelector provided.
|
|
170
|
+
*
|
|
171
|
+
* If no extension is stored, returns the address(0)
|
|
172
|
+
*/
|
|
173
|
+
function _getExtension(bytes4 functionSelector)
|
|
174
|
+
internal
|
|
175
|
+
view
|
|
176
|
+
virtual
|
|
177
|
+
override
|
|
178
|
+
returns (address)
|
|
179
|
+
{
|
|
180
|
+
bytes32 mappedExtensionDataKey = LSP2Utils.generateMappingKey(
|
|
181
|
+
_LSP17_EXTENSION_PREFIX,
|
|
182
|
+
functionSelector
|
|
183
|
+
);
|
|
184
|
+
|
|
185
|
+
// Check if there is an extension for the function selector provided
|
|
186
|
+
address extension = address(bytes20(_getData(mappedExtensionDataKey)));
|
|
187
|
+
|
|
188
|
+
return extension;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* @dev Returns true if this contract implements the interface defined by
|
|
193
|
+
* `interfaceId`.
|
|
194
|
+
*
|
|
195
|
+
* If the contract doesn't support the `interfaceId`, it forwards the call to the
|
|
196
|
+
* `supportsInterface` extension according to LSP17, and checks if the extension
|
|
197
|
+
* implements the interface defined by `interfaceId`.
|
|
198
|
+
*/
|
|
199
|
+
function supportsInterface(bytes4 interfaceId)
|
|
200
|
+
public
|
|
201
|
+
view
|
|
202
|
+
virtual
|
|
203
|
+
override(ERC725XCore, ERC725YCore, LSP17Extendable)
|
|
204
|
+
returns (bool)
|
|
205
|
+
{
|
|
206
|
+
return
|
|
207
|
+
interfaceId == _INTERFACEID_LSP9 ||
|
|
208
|
+
interfaceId == _INTERFACEID_LSP1 ||
|
|
209
|
+
interfaceId == _INTERFACEID_LSP14 ||
|
|
210
|
+
super.supportsInterface(interfaceId) ||
|
|
211
|
+
_supportsInterfaceInERC165Extension(interfaceId);
|
|
212
|
+
}
|
|
84
213
|
|
|
85
214
|
/**
|
|
86
215
|
* @inheritdoc IERC725X
|
|
87
|
-
* @param
|
|
216
|
+
* @param operationType The operation to execute: CALL = 0 CREATE = 1 CREATE2 = 2 STATICCALL = 3
|
|
88
217
|
* @dev Executes any other smart contract.
|
|
89
218
|
* SHOULD only be callable by the owner of the contract set via ERC173
|
|
90
219
|
*
|
|
91
220
|
* Emits a {Executed} event, when a call is executed under `operationType` 0 and 3
|
|
92
221
|
* Emits a {ContractCreated} event, when a contract is created under `operationType` 1 and 2
|
|
222
|
+
* Emits a {ValueReceived} event, when receives native token
|
|
93
223
|
*/
|
|
94
224
|
function execute(
|
|
95
|
-
uint256
|
|
96
|
-
address
|
|
225
|
+
uint256 operationType,
|
|
226
|
+
address target,
|
|
97
227
|
uint256 value,
|
|
98
228
|
bytes memory data
|
|
99
229
|
) public payable virtual override onlyOwner returns (bytes memory) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
if (operation == OPERATION_CALL) return _executeCall(to, value, data);
|
|
104
|
-
|
|
105
|
-
// Deploy with CREATE
|
|
106
|
-
if (operation == OPERATION_CREATE) return _deployCreate(to, value, data);
|
|
107
|
-
|
|
108
|
-
// Deploy with CREATE2
|
|
109
|
-
if (operation == OPERATION_CREATE2) return _deployCreate2(to, value, data);
|
|
110
|
-
|
|
111
|
-
// STATICCALL
|
|
112
|
-
if (operation == OPERATION_STATICCALL) return _executeStaticCall(to, value, data);
|
|
230
|
+
if (msg.value != 0) emit ValueReceived(msg.sender, msg.value);
|
|
231
|
+
return _execute(operationType, target, value, data);
|
|
232
|
+
}
|
|
113
233
|
|
|
114
|
-
|
|
234
|
+
/**
|
|
235
|
+
* @inheritdoc ERC725XCore
|
|
236
|
+
*
|
|
237
|
+
* @dev Emits a {ValueReceived} event when receiving native tokens.
|
|
238
|
+
*/
|
|
239
|
+
function execute(
|
|
240
|
+
uint256[] memory operationsType,
|
|
241
|
+
address[] memory targets,
|
|
242
|
+
uint256[] memory values,
|
|
243
|
+
bytes[] memory datas
|
|
244
|
+
) public payable virtual override onlyOwner returns (bytes[] memory) {
|
|
245
|
+
if (msg.value != 0) emit ValueReceived(msg.sender, msg.value);
|
|
246
|
+
return _execute(operationsType, targets, values, datas);
|
|
115
247
|
}
|
|
116
248
|
|
|
117
249
|
/**
|
|
@@ -122,7 +254,17 @@ contract LSP9VaultCore is ERC725XCore, ERC725YCore, ClaimOwnership, ILSP1Univers
|
|
|
122
254
|
*
|
|
123
255
|
* Emits a {DataChanged} event.
|
|
124
256
|
*/
|
|
125
|
-
function setData(bytes32 dataKey, bytes memory dataValue) public virtual override
|
|
257
|
+
function setData(bytes32 dataKey, bytes memory dataValue) public virtual override {
|
|
258
|
+
bool isURD = _validateAndIdentifyCaller();
|
|
259
|
+
if (isURD) {
|
|
260
|
+
if (
|
|
261
|
+
bytes12(dataKey) == _LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX ||
|
|
262
|
+
bytes6(dataKey) == _LSP6KEY_ADDRESSPERMISSIONS_PREFIX ||
|
|
263
|
+
bytes12(dataKey) == _LSP17_EXTENSION_PREFIX
|
|
264
|
+
) {
|
|
265
|
+
revert LSP1DelegateNotAllowedToSetDataKey(dataKey);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
126
268
|
_setData(dataKey, dataValue);
|
|
127
269
|
}
|
|
128
270
|
|
|
@@ -134,110 +276,133 @@ contract LSP9VaultCore is ERC725XCore, ERC725YCore, ClaimOwnership, ILSP1Univers
|
|
|
134
276
|
*
|
|
135
277
|
* Emits a {DataChanged} event.
|
|
136
278
|
*/
|
|
137
|
-
function setData(bytes32[] memory dataKeys, bytes[] memory dataValues)
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
require(dataKeys.length == dataValues.length, "Keys length not equal to values length");
|
|
279
|
+
function setData(bytes32[] memory dataKeys, bytes[] memory dataValues) public virtual override {
|
|
280
|
+
bool isURD = _validateAndIdentifyCaller();
|
|
281
|
+
if (dataKeys.length != dataValues.length) {
|
|
282
|
+
revert ERC725Y_DataKeysValuesLengthMismatch(dataKeys.length, dataValues.length);
|
|
283
|
+
}
|
|
284
|
+
|
|
144
285
|
for (uint256 i = 0; i < dataKeys.length; i = GasLib.uncheckedIncrement(i)) {
|
|
286
|
+
if (isURD) {
|
|
287
|
+
if (
|
|
288
|
+
bytes12(dataKeys[i]) == _LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX ||
|
|
289
|
+
bytes6(dataKeys[i]) == _LSP6KEY_ADDRESSPERMISSIONS_PREFIX ||
|
|
290
|
+
bytes12(dataKeys[i]) == _LSP17_EXTENSION_PREFIX
|
|
291
|
+
) {
|
|
292
|
+
revert LSP1DelegateNotAllowedToSetDataKey(dataKeys[i]);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
145
295
|
_setData(dataKeys[i], dataValues[i]);
|
|
146
296
|
}
|
|
147
297
|
}
|
|
148
298
|
|
|
149
|
-
|
|
299
|
+
/**
|
|
300
|
+
* @dev Modifier restricting the call to the owner of the contract and the UniversalReceiverDelegate
|
|
301
|
+
*/
|
|
302
|
+
function _validateAndIdentifyCaller() internal view returns (bool isURD) {
|
|
303
|
+
if (msg.sender != owner()) {
|
|
304
|
+
require(
|
|
305
|
+
msg.sender == _reentrantDelegate,
|
|
306
|
+
"Only Owner or reentered Universal Receiver Delegate allowed"
|
|
307
|
+
);
|
|
308
|
+
isURD = true;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
150
311
|
|
|
151
312
|
/**
|
|
152
313
|
* @notice Triggers the UniversalReceiver event when this function gets executed successfully.
|
|
153
|
-
*
|
|
314
|
+
* Forwards the call to the addresses stored in the ERC725Y storage under the LSP1UniversalReceiverDelegate
|
|
315
|
+
* Key and the typeId Key (param) respectively. The call will be discarded if no addresses are set.
|
|
316
|
+
*
|
|
154
317
|
* @param typeId The type of call received.
|
|
155
|
-
* @param
|
|
318
|
+
* @param receivedData The data received.
|
|
319
|
+
* @return returnedValues The ABI encoded return value of the LSP1UniversalReceiverDelegate call
|
|
320
|
+
* and the LSP1TypeIdDelegate call.
|
|
156
321
|
*/
|
|
157
|
-
function universalReceiver(bytes32 typeId, bytes calldata
|
|
322
|
+
function universalReceiver(bytes32 typeId, bytes calldata receivedData)
|
|
158
323
|
public
|
|
159
324
|
payable
|
|
160
325
|
virtual
|
|
161
|
-
returns (bytes memory
|
|
326
|
+
returns (bytes memory returnedValues)
|
|
162
327
|
{
|
|
328
|
+
if (msg.value != 0) emit ValueReceived(msg.sender, msg.value);
|
|
163
329
|
bytes memory lsp1DelegateValue = _getData(_LSP1_UNIVERSAL_RECEIVER_DELEGATE_KEY);
|
|
330
|
+
bytes memory resultDefaultDelegate;
|
|
164
331
|
|
|
165
332
|
if (lsp1DelegateValue.length >= 20) {
|
|
166
333
|
address universalReceiverDelegate = address(bytes20(lsp1DelegateValue));
|
|
167
334
|
|
|
168
|
-
if (
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
335
|
+
if (universalReceiverDelegate.supportsERC165InterfaceUnchecked(_INTERFACEID_LSP1)) {
|
|
336
|
+
_reentrantDelegate = universalReceiverDelegate;
|
|
337
|
+
resultDefaultDelegate = universalReceiverDelegate
|
|
338
|
+
.callUniversalReceiverWithCallerInfos(
|
|
339
|
+
typeId,
|
|
340
|
+
receivedData,
|
|
341
|
+
msg.sender,
|
|
342
|
+
msg.value
|
|
343
|
+
);
|
|
176
344
|
}
|
|
177
345
|
}
|
|
178
|
-
emit UniversalReceiver(msg.sender, msg.value, typeId, returnValue, data);
|
|
179
|
-
}
|
|
180
346
|
|
|
181
|
-
|
|
347
|
+
bytes32 lsp1typeIdDelegateKey = LSP2Utils.generateMappingKey(
|
|
348
|
+
_LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX,
|
|
349
|
+
bytes20(typeId)
|
|
350
|
+
);
|
|
351
|
+
|
|
352
|
+
bytes memory lsp1TypeIdDelegateValue = _getData(lsp1typeIdDelegateKey);
|
|
353
|
+
bytes memory resultTypeIdDelegate;
|
|
354
|
+
|
|
355
|
+
if (lsp1TypeIdDelegateValue.length >= 20) {
|
|
356
|
+
address universalReceiverDelegate = address(bytes20(lsp1TypeIdDelegateValue));
|
|
357
|
+
|
|
358
|
+
if (universalReceiverDelegate.supportsERC165InterfaceUnchecked(_INTERFACEID_LSP1)) {
|
|
359
|
+
_reentrantDelegate = universalReceiverDelegate;
|
|
360
|
+
resultTypeIdDelegate = universalReceiverDelegate
|
|
361
|
+
.callUniversalReceiverWithCallerInfos(
|
|
362
|
+
typeId,
|
|
363
|
+
receivedData,
|
|
364
|
+
msg.sender,
|
|
365
|
+
msg.value
|
|
366
|
+
);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
delete _reentrantDelegate;
|
|
371
|
+
returnedValues = abi.encode(resultDefaultDelegate, resultTypeIdDelegate);
|
|
372
|
+
emit UniversalReceiver(msg.sender, msg.value, typeId, receivedData, returnedValues);
|
|
373
|
+
}
|
|
182
374
|
|
|
183
375
|
/**
|
|
184
376
|
* @dev Sets the pending owner and notify the pending owner
|
|
377
|
+
*
|
|
378
|
+
* @param _newOwner The address nofied and set as `pendingOwner`
|
|
185
379
|
*/
|
|
186
|
-
function transferOwnership(address
|
|
380
|
+
function transferOwnership(address _newOwner)
|
|
187
381
|
public
|
|
188
382
|
virtual
|
|
189
|
-
override(
|
|
383
|
+
override(LSP14Ownable2Step, OwnableUnset)
|
|
190
384
|
onlyOwner
|
|
191
385
|
{
|
|
192
|
-
|
|
193
|
-
_notifyVaultPendingOwner(newOwner);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* @dev Transfer the ownership and notify the previous and the new owner.
|
|
198
|
-
*/
|
|
199
|
-
function claimOwnership() public virtual override {
|
|
200
|
-
address previousOwner = owner();
|
|
201
|
-
|
|
202
|
-
_claimOwnership();
|
|
203
|
-
|
|
204
|
-
_notifyVaultSender(previousOwner);
|
|
205
|
-
_notifyVaultReceiver(msg.sender);
|
|
386
|
+
LSP14Ownable2Step._transferOwnership(_newOwner);
|
|
206
387
|
}
|
|
207
388
|
|
|
208
389
|
/**
|
|
209
390
|
* @dev Renounce ownership of the contract in a 2-step process
|
|
210
391
|
*/
|
|
211
|
-
function renounceOwnership()
|
|
212
|
-
ClaimOwnership._renounceOwnership();
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// ERC165
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* @dev See {IERC165-supportsInterface}.
|
|
219
|
-
*/
|
|
220
|
-
function supportsInterface(bytes4 interfaceId)
|
|
392
|
+
function renounceOwnership()
|
|
221
393
|
public
|
|
222
|
-
view
|
|
223
394
|
virtual
|
|
224
|
-
override(
|
|
225
|
-
|
|
395
|
+
override(LSP14Ownable2Step, OwnableUnset)
|
|
396
|
+
onlyOwner
|
|
226
397
|
{
|
|
227
|
-
|
|
228
|
-
interfaceId == _INTERFACEID_LSP9 ||
|
|
229
|
-
interfaceId == _INTERFACEID_LSP1 ||
|
|
230
|
-
interfaceId == _INTERFACEID_CLAIM_OWNERSHIP ||
|
|
231
|
-
super.supportsInterface(interfaceId);
|
|
398
|
+
LSP14Ownable2Step._renounceOwnership();
|
|
232
399
|
}
|
|
233
400
|
|
|
234
|
-
// internal functions
|
|
235
|
-
|
|
236
401
|
/**
|
|
237
402
|
* @dev SAVE GAS by emitting the DataChanged event with only the first 256 bytes of dataValue
|
|
238
403
|
*/
|
|
239
404
|
function _setData(bytes32 dataKey, bytes memory dataValue) internal virtual override {
|
|
240
|
-
|
|
405
|
+
_store[dataKey] = dataValue;
|
|
241
406
|
emit DataChanged(
|
|
242
407
|
dataKey,
|
|
243
408
|
dataValue.length <= 256 ? dataValue : BytesLib.slice(dataValue, 0, 256)
|
|
@@ -245,31 +410,89 @@ contract LSP9VaultCore is ERC725XCore, ERC725YCore, ClaimOwnership, ILSP1Univers
|
|
|
245
410
|
}
|
|
246
411
|
|
|
247
412
|
/**
|
|
248
|
-
* @dev
|
|
413
|
+
* @dev disable operation type DELEGATECALL (4).
|
|
414
|
+
* NB: providing operation type DELEGATECALL (4) as argument will result
|
|
415
|
+
* in custom error ERC725X_UnknownOperationType(4)
|
|
416
|
+
*/
|
|
417
|
+
function _execute(
|
|
418
|
+
uint256 operationType,
|
|
419
|
+
address target,
|
|
420
|
+
uint256 value,
|
|
421
|
+
bytes memory data
|
|
422
|
+
) internal virtual override returns (bytes memory) {
|
|
423
|
+
// CALL
|
|
424
|
+
if (operationType == OPERATION_0_CALL) {
|
|
425
|
+
return _executeCall(target, value, data);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
// Deploy with CREATE
|
|
429
|
+
if (operationType == uint256(OPERATION_1_CREATE)) {
|
|
430
|
+
if (target != address(0)) revert ERC725X_CreateOperationsRequireEmptyRecipientAddress();
|
|
431
|
+
return _deployCreate(value, data);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
// Deploy with CREATE2
|
|
435
|
+
if (operationType == uint256(OPERATION_2_CREATE2)) {
|
|
436
|
+
if (target != address(0)) revert ERC725X_CreateOperationsRequireEmptyRecipientAddress();
|
|
437
|
+
return _deployCreate2(value, data);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
// STATICCALL
|
|
441
|
+
if (operationType == uint256(OPERATION_3_STATICCALL)) {
|
|
442
|
+
if (value != 0) revert ERC725X_MsgValueDisallowedInStaticCall();
|
|
443
|
+
return _executeStaticCall(target, data);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
revert ERC725X_UnknownOperationType(operationType);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
// --- LSP14 URD Hooks
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* @dev Calls the universalReceiver function of the sender when ownerhsip transfer starts
|
|
453
|
+
* if supports LSP1 InterfaceId
|
|
249
454
|
*/
|
|
250
|
-
function
|
|
251
|
-
|
|
252
|
-
|
|
455
|
+
function _notifyLSP1SenderOnOwnershipTransferStart(address notifiedContract, bytes memory data)
|
|
456
|
+
internal
|
|
457
|
+
virtual
|
|
458
|
+
override
|
|
459
|
+
{
|
|
460
|
+
if (ERC165Checker.supportsERC165InterfaceUnchecked(notifiedContract, _INTERFACEID_LSP1)) {
|
|
461
|
+
ILSP1UniversalReceiver(notifiedContract).universalReceiver(
|
|
462
|
+
_TYPEID_LSP9_OwnershipTransferStarted,
|
|
463
|
+
data
|
|
464
|
+
);
|
|
253
465
|
}
|
|
254
466
|
}
|
|
255
467
|
|
|
256
468
|
/**
|
|
257
|
-
* @dev Calls the universalReceiver function of the
|
|
469
|
+
* @dev Calls the universalReceiver function of the sender when ownerhsip transfer is complete
|
|
470
|
+
* if supports LSP1 InterfaceId
|
|
258
471
|
*/
|
|
259
|
-
function
|
|
260
|
-
|
|
261
|
-
|
|
472
|
+
function _notifyLSP1SenderOnOwnershipTransferCompletion(
|
|
473
|
+
address notifiedContract,
|
|
474
|
+
bytes memory data
|
|
475
|
+
) internal virtual override {
|
|
476
|
+
if (ERC165Checker.supportsERC165InterfaceUnchecked(notifiedContract, _INTERFACEID_LSP1)) {
|
|
477
|
+
ILSP1UniversalReceiver(notifiedContract).universalReceiver(
|
|
478
|
+
_TYPEID_LSP9_OwnershipTransferred_SenderNotification,
|
|
479
|
+
data
|
|
480
|
+
);
|
|
262
481
|
}
|
|
263
482
|
}
|
|
264
483
|
|
|
265
484
|
/**
|
|
266
|
-
* @dev Calls the universalReceiver function of the
|
|
485
|
+
* @dev Calls the universalReceiver function of the recipient when ownerhsip transfer is complete
|
|
486
|
+
* if supports LSP1 InterfaceId
|
|
267
487
|
*/
|
|
268
|
-
function
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
488
|
+
function _notifyLSP1RecipientOnOwnershipTransferCompletion(
|
|
489
|
+
address notifiedContract,
|
|
490
|
+
bytes memory data
|
|
491
|
+
) internal virtual override {
|
|
492
|
+
if (ERC165Checker.supportsERC165InterfaceUnchecked(notifiedContract, _INTERFACEID_LSP1)) {
|
|
493
|
+
ILSP1UniversalReceiver(notifiedContract).universalReceiver(
|
|
494
|
+
_TYPEID_LSP9_OwnershipTransferred_RecipientNotification,
|
|
495
|
+
data
|
|
273
496
|
);
|
|
274
497
|
}
|
|
275
498
|
}
|
|
@@ -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,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
|
// interfaces
|
|
5
5
|
import {IERC725Y} from "@erc725/smart-contracts/contracts/interfaces/IERC725Y.sol";
|
|
@@ -7,7 +7,7 @@ import {IERC725Y} from "@erc725/smart-contracts/contracts/interfaces/IERC725Y.so
|
|
|
7
7
|
// modules
|
|
8
8
|
import {OwnableUnset} from "@erc725/smart-contracts/contracts/custom/OwnableUnset.sol";
|
|
9
9
|
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
|
10
|
-
import {LSP9VaultCore
|
|
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
|
}
|