@lukso/lsp-smart-contracts 0.11.0-rc.0 → 0.11.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/README.md +1 -0
- package/artifacts/LSP0ERC725Account.json +7 -2
- package/artifacts/LSP0ERC725AccountInit.json +7 -2
- package/artifacts/LSP11BasicSocialRecovery.json +2 -2
- package/artifacts/LSP11BasicSocialRecoveryInit.json +2 -2
- package/artifacts/LSP1UniversalReceiverDelegateUP.json +3 -79
- package/artifacts/LSP1UniversalReceiverDelegateVault.json +3 -41
- package/artifacts/LSP23LinkedContractsFactory.json +544 -0
- package/artifacts/LSP6KeyManager.json +24 -19
- package/artifacts/LSP6KeyManagerInit.json +24 -19
- package/artifacts/LSP7CappedSupply.json +88 -0
- package/artifacts/LSP7CappedSupplyInitAbstract.json +88 -0
- package/artifacts/LSP7CompatibleERC20.json +88 -0
- package/artifacts/LSP7CompatibleERC20InitAbstract.json +88 -0
- package/artifacts/LSP7CompatibleERC20Mintable.json +90 -2
- package/artifacts/LSP7CompatibleERC20MintableInit.json +90 -2
- package/artifacts/LSP7DigitalAsset.json +88 -0
- package/artifacts/LSP7DigitalAssetInitAbstract.json +88 -0
- package/artifacts/LSP7Mintable.json +90 -2
- package/artifacts/LSP7MintableInit.json +90 -2
- package/artifacts/LSP8CappedSupply.json +59 -0
- package/artifacts/LSP8CappedSupplyInitAbstract.json +59 -0
- package/artifacts/LSP8CompatibleERC721.json +60 -1
- package/artifacts/LSP8CompatibleERC721InitAbstract.json +60 -1
- package/artifacts/LSP8CompatibleERC721Mintable.json +62 -3
- package/artifacts/LSP8CompatibleERC721MintableInit.json +62 -3
- package/artifacts/LSP8IdentifiableDigitalAsset.json +59 -0
- package/artifacts/LSP8IdentifiableDigitalAssetInitAbstract.json +59 -0
- package/artifacts/LSP8Mintable.json +61 -2
- package/artifacts/LSP8MintableInit.json +61 -2
- package/artifacts/LSP9Vault.json +7 -2
- package/artifacts/LSP9VaultInit.json +7 -2
- package/artifacts/UniversalProfile.json +7 -2
- package/artifacts/UniversalProfileInit.json +7 -2
- package/contracts/LSP0ERC725Account/ILSP0ERC725Account.sol +8 -36
- package/contracts/LSP0ERC725Account/LSP0Constants.sol +1 -1
- package/contracts/LSP0ERC725Account/LSP0ERC725Account.sol +15 -30
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +122 -206
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountInit.sol +18 -36
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountInitAbstract.sol +8 -34
- package/contracts/LSP10ReceivedVaults/LSP10Utils.sol +148 -177
- package/contracts/LSP14Ownable2Step/ILSP14Ownable2Step.sol +21 -20
- package/contracts/LSP14Ownable2Step/LSP14Errors.sol +13 -2
- package/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol +50 -20
- package/contracts/LSP17ContractExtension/LSP17Errors.sol +10 -0
- package/contracts/LSP17ContractExtension/LSP17Extendable.sol +16 -34
- package/contracts/LSP17ContractExtension/LSP17Utils.sol +1 -1
- package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiver.sol +16 -11
- package/contracts/LSP1UniversalReceiver/LSP1Errors.sol +5 -10
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol +192 -177
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol +150 -88
- package/contracts/LSP1UniversalReceiver/LSP1Utils.sol +66 -48
- package/contracts/LSP20CallVerification/LSP20CallVerification.sol +1 -1
- package/contracts/LSP23LinkedContractsDeployment/ILSP23LinkedContractsFactory.sol +192 -0
- package/contracts/LSP23LinkedContractsDeployment/IPostDeploymentModule.sol +18 -0
- package/contracts/LSP23LinkedContractsDeployment/LSP23Errors.sol +24 -0
- package/contracts/LSP23LinkedContractsDeployment/LSP23LinkedContractsFactory.sol +392 -0
- package/contracts/{LSP23MultiChainDeployment → LSP23LinkedContractsDeployment}/modules/UniversalProfileInitPostDeploymentModule.sol +5 -1
- package/contracts/LSP23LinkedContractsDeployment/modules/UniversalProfilePostDeploymentModule.sol +61 -0
- package/contracts/LSP25ExecuteRelayCall/ILSP25ExecuteRelayCall.sol +68 -0
- package/contracts/LSP25ExecuteRelayCall/LSP25Constants.sol +8 -0
- package/contracts/LSP25ExecuteRelayCall/LSP25Errors.sol +17 -0
- package/contracts/LSP25ExecuteRelayCall/LSP25MultiChannelNonce.sol +143 -0
- package/contracts/LSP2ERC725YJSONSchema/LSP2Utils.sol +256 -61
- package/contracts/{LSP3UniversalProfile → LSP3ProfileMetadata}/LSP3Constants.sol +3 -3
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol +9 -8
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol +13 -6
- package/contracts/LSP4DigitalAssetMetadata/LSP4Errors.sol +4 -4
- package/contracts/LSP5ReceivedAssets/LSP5Utils.sol +148 -189
- package/contracts/LSP6KeyManager/ILSP6KeyManager.sol +26 -54
- package/contracts/LSP6KeyManager/LSP6Constants.sol +1 -3
- package/contracts/LSP6KeyManager/LSP6Errors.sol +142 -63
- package/contracts/LSP6KeyManager/LSP6KeyManager.sol +7 -4
- package/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol +125 -80
- package/contracts/LSP6KeyManager/LSP6KeyManagerInit.sol +8 -4
- package/contracts/LSP6KeyManager/LSP6KeyManagerInitAbstract.sol +1 -1
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6ExecuteModule.sol +52 -84
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6SetDataModule.sol +59 -10
- package/contracts/LSP6KeyManager/LSP6Utils.sol +67 -46
- package/contracts/LSP7DigitalAsset/ILSP7DigitalAsset.sol +116 -78
- package/contracts/LSP7DigitalAsset/LSP7Constants.sol +4 -1
- package/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol +128 -6
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +212 -80
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol +126 -3
- package/contracts/LSP7DigitalAsset/LSP7Errors.sol +7 -5
- package/contracts/LSP7DigitalAsset/extensions/ILSP7CompatibleERC20.sol +27 -14
- package/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol +2 -4
- package/contracts/LSP7DigitalAsset/extensions/LSP7BurnableInitAbstract.sol +2 -4
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol +29 -11
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyInitAbstract.sol +30 -9
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol +46 -14
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20InitAbstract.sol +43 -12
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol +14 -0
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInit.sol +9 -4
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInitAbstract.sol +7 -1
- package/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol +8 -8
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableInit.sol +7 -6
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol +10 -2
- package/contracts/LSP8IdentifiableDigitalAsset/ILSP8IdentifiableDigitalAsset.sol +120 -92
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol +4 -1
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol +135 -6
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +128 -38
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol +134 -5
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CompatibleERC721.sol +83 -41
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol +13 -5
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8BurnableInitAbstract.sol +24 -0
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol +30 -12
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInitAbstract.sol +31 -10
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol +96 -31
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol +98 -23
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol +21 -4
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableInitAbstract.sol +12 -2
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol +21 -0
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol +9 -4
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.sol +13 -0
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol +15 -6
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInit.sol +7 -5
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol +17 -2
- package/contracts/LSP9Vault/ILSP9Vault.sol +10 -5
- package/contracts/LSP9Vault/LSP9Errors.sol +3 -2
- package/contracts/LSP9Vault/LSP9Vault.sol +12 -4
- package/contracts/LSP9Vault/LSP9VaultCore.sol +245 -182
- package/contracts/LSP9Vault/LSP9VaultInit.sol +10 -3
- package/contracts/LSP9Vault/LSP9VaultInitAbstract.sol +11 -6
- package/contracts/UniversalProfile.sol +8 -6
- package/contracts/UniversalProfileInit.sol +6 -6
- package/contracts/UniversalProfileInitAbstract.sol +10 -3
- package/devdocs/LSP0ERC725Account.json +54 -37
- package/devdocs/LSP0ERC725AccountInit.json +56 -38
- package/devdocs/LSP1UniversalReceiverDelegateUP.json +14 -55
- package/devdocs/LSP1UniversalReceiverDelegateVault.json +9 -33
- package/devdocs/LSP23LinkedContractsFactory.json +81 -0
- package/devdocs/LSP4DigitalAssetMetadata.json +5 -5
- package/devdocs/LSP4DigitalAssetMetadataInitAbstract.json +4 -4
- package/devdocs/LSP6KeyManager.json +109 -70
- package/devdocs/LSP6KeyManagerInit.json +109 -70
- package/devdocs/LSP7CappedSupply.json +90 -42
- package/devdocs/LSP7CappedSupplyInitAbstract.json +86 -40
- package/devdocs/LSP7CompatibleERC20.json +79 -43
- package/devdocs/LSP7CompatibleERC20InitAbstract.json +75 -39
- package/devdocs/LSP7CompatibleERC20Mintable.json +87 -40
- package/devdocs/LSP7CompatibleERC20MintableInit.json +82 -42
- package/devdocs/LSP7DigitalAsset.json +76 -40
- package/devdocs/LSP7DigitalAssetInitAbstract.json +73 -37
- package/devdocs/LSP7Mintable.json +79 -51
- package/devdocs/LSP7MintableInit.json +78 -49
- package/devdocs/LSP8CappedSupply.json +72 -43
- package/devdocs/LSP8CappedSupplyInitAbstract.json +68 -41
- package/devdocs/LSP8CompatibleERC721.json +85 -64
- package/devdocs/LSP8CompatibleERC721InitAbstract.json +81 -60
- package/devdocs/LSP8CompatibleERC721Mintable.json +98 -60
- package/devdocs/LSP8CompatibleERC721MintableInit.json +93 -62
- package/devdocs/LSP8IdentifiableDigitalAsset.json +58 -41
- package/devdocs/LSP8IdentifiableDigitalAssetInitAbstract.json +57 -40
- package/devdocs/LSP8Mintable.json +65 -48
- package/devdocs/LSP8MintableInit.json +64 -47
- package/devdocs/LSP9Vault.json +61 -18
- package/devdocs/LSP9VaultInit.json +59 -17
- package/devdocs/UniversalProfile.json +53 -35
- package/devdocs/UniversalProfileInit.json +53 -35
- package/dist/constants.cjs.js +6236 -2587
- package/dist/constants.d.ts +3851 -1129
- package/dist/constants.es.js +6236 -2587
- package/package.json +6 -4
- package/userdocs/LSP0ERC725Account.json +40 -8
- package/userdocs/LSP0ERC725AccountInit.json +40 -8
- package/userdocs/LSP1UniversalReceiverDelegateUP.json +18 -2
- package/userdocs/LSP1UniversalReceiverDelegateVault.json +18 -2
- package/userdocs/LSP23LinkedContractsFactory.json +29 -0
- package/userdocs/LSP4DigitalAssetMetadata.json +1 -1
- package/userdocs/LSP6KeyManager.json +144 -6
- package/userdocs/LSP6KeyManagerInit.json +147 -6
- package/userdocs/LSP7CappedSupply.json +18 -3
- package/userdocs/LSP7CappedSupplyInitAbstract.json +17 -2
- package/userdocs/LSP7CompatibleERC20.json +3 -9
- package/userdocs/LSP7CompatibleERC20InitAbstract.json +2 -8
- package/userdocs/LSP7CompatibleERC20Mintable.json +5 -8
- package/userdocs/LSP7CompatibleERC20MintableInit.json +3 -9
- package/userdocs/LSP7DigitalAsset.json +2 -2
- package/userdocs/LSP7DigitalAssetInitAbstract.json +2 -2
- package/userdocs/LSP7Mintable.json +3 -3
- package/userdocs/LSP7MintableInit.json +3 -3
- package/userdocs/LSP8CappedSupply.json +16 -1
- package/userdocs/LSP8CappedSupplyInitAbstract.json +15 -0
- package/userdocs/LSP8CompatibleERC721.json +24 -3
- package/userdocs/LSP8CompatibleERC721InitAbstract.json +23 -2
- package/userdocs/LSP8CompatibleERC721Mintable.json +29 -2
- package/userdocs/LSP8CompatibleERC721MintableInit.json +27 -3
- package/userdocs/LSP8Mintable.json +4 -1
- package/userdocs/LSP8MintableInit.json +4 -1
- package/userdocs/LSP9Vault.json +50 -4
- package/userdocs/LSP9VaultInit.json +50 -4
- package/userdocs/UniversalProfile.json +40 -8
- package/userdocs/UniversalProfileInit.json +40 -8
- package/contracts/LSP0ERC725Account/LSP0Utils.sol +0 -47
- package/contracts/LSP23MultiChainDeployment/IOwnerControlledContractDeployer.sol +0 -174
- package/contracts/LSP23MultiChainDeployment/IPostDeploymentModule.sol +0 -10
- package/contracts/LSP23MultiChainDeployment/LSP23Errors.sol +0 -24
- package/contracts/LSP23MultiChainDeployment/OwnerControlledContractDeployer.sol +0 -388
|
@@ -64,10 +64,14 @@ import {
|
|
|
64
64
|
import "./LSP9Errors.sol";
|
|
65
65
|
import "../LSP17ContractExtension/LSP17Errors.sol";
|
|
66
66
|
|
|
67
|
+
import {
|
|
68
|
+
LSP14MustAcceptOwnershipInSeparateTransaction
|
|
69
|
+
} from "../LSP14Ownable2Step/LSP14Errors.sol";
|
|
70
|
+
|
|
67
71
|
/**
|
|
68
|
-
* @title Core Implementation of LSP9Vault built on top of ERC725, LSP1UniversalReceiver
|
|
72
|
+
* @title Core Implementation of LSP9Vault built on top of [ERC725], [LSP1UniversalReceiver]
|
|
69
73
|
* @author Fabian Vogelsteller, Yamen Merhi, Jean Cavallera
|
|
70
|
-
* @dev Could be owned by a
|
|
74
|
+
* @dev Could be owned by an EOA or by a contract and is able to receive and send assets. Also allows for registering received assets by leveraging the key-value storage.
|
|
71
75
|
*/
|
|
72
76
|
contract LSP9VaultCore is
|
|
73
77
|
ERC725XCore,
|
|
@@ -83,11 +87,11 @@ contract LSP9VaultCore is
|
|
|
83
87
|
address private _reentrantDelegate;
|
|
84
88
|
|
|
85
89
|
/**
|
|
86
|
-
* @dev
|
|
90
|
+
* @dev Executed:
|
|
91
|
+
* - When receiving some native tokens without any additional data.
|
|
92
|
+
* - On empty calls to the contract.
|
|
87
93
|
*
|
|
88
|
-
*
|
|
89
|
-
* - when receiving some native tokens without any additional data.
|
|
90
|
-
* - on empty calls to the contract.
|
|
94
|
+
* @custom:events {ValueReceived} when receiving native tokens.
|
|
91
95
|
*/
|
|
92
96
|
receive() external payable virtual {
|
|
93
97
|
if (msg.value > 0) emit ValueReceived(msg.sender, msg.value);
|
|
@@ -96,140 +100,44 @@ contract LSP9VaultCore is
|
|
|
96
100
|
// solhint-disable no-complex-fallback
|
|
97
101
|
|
|
98
102
|
/**
|
|
99
|
-
* @
|
|
100
|
-
*
|
|
101
|
-
* Forwards the call to an extension contract (address). This address can be retrieved from
|
|
102
|
-
* the ERC725Y data key-value store using the data key below (function selector appended to the prefix):
|
|
103
|
-
*_LSP17_FALLBACK_EXTENSIONS_HANDLER_ + <function-selector>
|
|
104
|
-
* If there is no extension stored under the data key, return.
|
|
103
|
+
* @notice The `fallback` function was called with the following amount of native tokens: `msg.value`; and the following calldata: `callData`.
|
|
105
104
|
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
105
|
+
* @dev Achieves the goal of [LSP-17-ContractExtension] standard by extending the contract to handle calls of functions that do not exist natively,
|
|
106
|
+
* forwarding the function call to the extension address mapped to the function being called.
|
|
108
107
|
*
|
|
109
|
-
*
|
|
108
|
+
* This function is executed when:
|
|
109
|
+
* - Sending data of length less than 4 bytes to the contract.
|
|
110
|
+
* - The first 4 bytes of the calldata do not match any publicly callable functions from the contract ABI.
|
|
111
|
+
* - Receiving native tokens with some calldata.
|
|
110
112
|
*
|
|
111
|
-
*
|
|
112
|
-
* - the first 4 bytes of the calldata do not match any publicly callable functions from the contract ABI.
|
|
113
|
-
* - receiving native tokens with some calldata.
|
|
114
|
-
*/
|
|
115
|
-
fallback() external payable virtual {
|
|
116
|
-
if (msg.value != 0) emit ValueReceived(msg.sender, msg.value);
|
|
117
|
-
if (msg.data.length < 4) return;
|
|
118
|
-
|
|
119
|
-
_fallbackLSP17Extendable();
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* @dev Forwards the call to an extension mapped to a function selector. If no extension address
|
|
124
|
-
* is mapped to the function selector (address(0)), then revert.
|
|
113
|
+
* 1. If the data is equal or longer than 4 bytes, the [ERC-725Y] storage is queried with the following data key: [_LSP17_EXTENSION_PREFIX] + `bytes4(msg.sig)` (Check [LSP-2-ERC725YJSONSchema] for encoding the data key)
|
|
125
114
|
*
|
|
126
|
-
* The bytes4(0)
|
|
127
|
-
* mapped to bytes4(0), but will execute the call to the extension in case it existed.
|
|
115
|
+
* - If there is no address stored under the following data key, revert with {NoExtensionFoundForFunctionSelector(bytes4)}. The data key relative to `bytes4(0)` is an exception, where no reverts occurs if there is no extension address stored under. This exception is made to allow users to send random data (graffiti) to the account and to be able to react on it.
|
|
128
116
|
*
|
|
129
|
-
*
|
|
130
|
-
* Returns the return value on success and revert in case of failure.
|
|
117
|
+
* - If there is an address, forward the `msg.data` to the extension using the CALL opcode, appending 52 bytes (20 bytes of `msg.sender` and 32 bytes of `msg.value`). Return what the calls returns, or revert if the call failed.
|
|
131
118
|
*
|
|
132
|
-
*
|
|
133
|
-
* called before other codes in fallback().
|
|
119
|
+
* 2. If the data sent to this function is of length less than 4 bytes (not a function selector), return.
|
|
134
120
|
*
|
|
135
|
-
*
|
|
121
|
+
* @custom:events {ValueReceived} event when receiving native tokens.
|
|
136
122
|
*/
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
if (msg.sig == bytes4(0) && extension == address(0)) return;
|
|
143
|
-
|
|
144
|
-
// if no extension was found, revert
|
|
145
|
-
if (extension == address(0))
|
|
146
|
-
revert NoExtensionFoundForFunctionSelector(msg.sig);
|
|
147
|
-
|
|
148
|
-
// solhint-disable no-inline-assembly
|
|
149
|
-
// if the extension was found, call the extension with the msg.data
|
|
150
|
-
// appended with bytes20(address) and bytes32(msg.value)
|
|
151
|
-
assembly {
|
|
152
|
-
calldatacopy(0, 0, calldatasize())
|
|
153
|
-
|
|
154
|
-
// The msg.sender address is shifted to the left by 12 bytes to remove the padding
|
|
155
|
-
// Then the address without padding is stored right after the calldata
|
|
156
|
-
mstore(calldatasize(), shl(96, caller()))
|
|
157
|
-
|
|
158
|
-
// The msg.value is stored right after the calldata + msg.sender
|
|
159
|
-
mstore(add(calldatasize(), 20), callvalue())
|
|
160
|
-
|
|
161
|
-
// Add 52 bytes for the msg.sender and msg.value appended at the end of the calldata
|
|
162
|
-
let success := call(
|
|
163
|
-
gas(),
|
|
164
|
-
extension,
|
|
165
|
-
0,
|
|
166
|
-
0,
|
|
167
|
-
add(calldatasize(), 52),
|
|
168
|
-
0,
|
|
169
|
-
0
|
|
170
|
-
)
|
|
171
|
-
|
|
172
|
-
// Copy the returned data
|
|
173
|
-
returndatacopy(0, 0, returndatasize())
|
|
174
|
-
|
|
175
|
-
switch success
|
|
176
|
-
// call returns 0 on failed calls
|
|
177
|
-
case 0 {
|
|
178
|
-
revert(0, returndatasize())
|
|
179
|
-
}
|
|
180
|
-
default {
|
|
181
|
-
return(0, returndatasize())
|
|
182
|
-
}
|
|
123
|
+
fallback(
|
|
124
|
+
bytes calldata callData
|
|
125
|
+
) external payable virtual returns (bytes memory) {
|
|
126
|
+
if (msg.value != 0) {
|
|
127
|
+
emit ValueReceived(msg.sender, msg.value);
|
|
183
128
|
}
|
|
184
|
-
}
|
|
185
129
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
*
|
|
190
|
-
* If no extension is stored, returns the address(0)
|
|
191
|
-
*/
|
|
192
|
-
function _getExtension(
|
|
193
|
-
bytes4 functionSelector
|
|
194
|
-
) internal view virtual override returns (address) {
|
|
195
|
-
bytes32 mappedExtensionDataKey = LSP2Utils.generateMappingKey(
|
|
196
|
-
_LSP17_EXTENSION_PREFIX,
|
|
197
|
-
functionSelector
|
|
198
|
-
);
|
|
199
|
-
|
|
200
|
-
// Check if there is an extension for the function selector provided
|
|
201
|
-
address extension = address(bytes20(_getData(mappedExtensionDataKey)));
|
|
130
|
+
if (msg.data.length < 4) {
|
|
131
|
+
return "";
|
|
132
|
+
}
|
|
202
133
|
|
|
203
|
-
return
|
|
134
|
+
return _fallbackLSP17Extendable(callData);
|
|
204
135
|
}
|
|
205
136
|
|
|
206
137
|
/**
|
|
207
|
-
* @
|
|
208
|
-
* `interfaceId`.
|
|
138
|
+
* @inheritdoc ILSP9Vault
|
|
209
139
|
*
|
|
210
|
-
*
|
|
211
|
-
* `supportsInterface` extension according to LSP17, and checks if the extension
|
|
212
|
-
* implements the interface defined by `interfaceId`.
|
|
213
|
-
*/
|
|
214
|
-
function supportsInterface(
|
|
215
|
-
bytes4 interfaceId
|
|
216
|
-
)
|
|
217
|
-
public
|
|
218
|
-
view
|
|
219
|
-
virtual
|
|
220
|
-
override(ERC725XCore, ERC725YCore, LSP17Extendable)
|
|
221
|
-
returns (bool)
|
|
222
|
-
{
|
|
223
|
-
return
|
|
224
|
-
interfaceId == _INTERFACEID_LSP9 ||
|
|
225
|
-
interfaceId == _INTERFACEID_LSP1 ||
|
|
226
|
-
interfaceId == _INTERFACEID_LSP14 ||
|
|
227
|
-
super.supportsInterface(interfaceId) ||
|
|
228
|
-
_supportsInterfaceInERC165Extension(interfaceId);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* @dev Receives and executes a batch of function calls on this contract.
|
|
140
|
+
* @custom:info It's not possible to send value along the functions call due to the use of `delegatecall`.
|
|
233
141
|
*/
|
|
234
142
|
function batchCalls(
|
|
235
143
|
bytes[] calldata data
|
|
@@ -265,13 +173,19 @@ contract LSP9VaultCore is
|
|
|
265
173
|
|
|
266
174
|
/**
|
|
267
175
|
* @inheritdoc IERC725X
|
|
268
|
-
* @param operationType The operation to execute: CALL = 0 CREATE = 1 CREATE2 = 2 STATICCALL = 3
|
|
269
|
-
* @dev Executes any other smart contract.
|
|
270
|
-
* SHOULD only be callable by the owner of the contract set via ERC173
|
|
271
176
|
*
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
*
|
|
177
|
+
* @custom:requirements
|
|
178
|
+
* - Can be only called by the {owner} or by an authorised address that pass the verification check performed on the owner.
|
|
179
|
+
* - If a `value` is provided, the contract must have at least this amount in its balance to execute successfully.
|
|
180
|
+
* - If the operation type is `CREATE` (1) or `CREATE2` (2), `target` must be `address(0)`.
|
|
181
|
+
* - If the operation type is `STATICCALL` (3), `value` transfer is disallowed and must be 0.
|
|
182
|
+
*
|
|
183
|
+
* @custom:events
|
|
184
|
+
* - {Executed} event for each call that uses under `operationType`: `CALL` (0) and `STATICCALL` (3).
|
|
185
|
+
* - {ContractCreated} event, when a contract is created under `operationType`: `CREATE` (1) and `CREATE2` (2).
|
|
186
|
+
* - {ValueReceived} event when receiving native tokens.
|
|
187
|
+
*
|
|
188
|
+
* @custom:info The `operationType` 4 `DELEGATECALL` is disabled by default in the LSP9 Vault.
|
|
275
189
|
*/
|
|
276
190
|
function execute(
|
|
277
191
|
uint256 operationType,
|
|
@@ -286,7 +200,19 @@ contract LSP9VaultCore is
|
|
|
286
200
|
/**
|
|
287
201
|
* @inheritdoc ERC725XCore
|
|
288
202
|
*
|
|
289
|
-
* @
|
|
203
|
+
* @custom:requirements
|
|
204
|
+
* - The length of the parameters provided must be equal.
|
|
205
|
+
* - Can be only called by the {owner} or by an authorised address that pass the verification check performed on the owner.
|
|
206
|
+
* - If a `value` is provided, the contract must have at least this amount in its balance to execute successfully.
|
|
207
|
+
* - If the operation type is `CREATE` (1) or `CREATE2` (2), `target` must be `address(0)`.
|
|
208
|
+
* - If the operation type is `STATICCALL` (3), `value` transfer is disallowed and must be 0.
|
|
209
|
+
*
|
|
210
|
+
* @custom:events
|
|
211
|
+
* - {Executed} event for each call that uses under `operationType`: `CALL` (0) and `STATICCALL` (3). (each iteration)
|
|
212
|
+
* - {ContractCreated} event, when a contract is created under `operationType`: `CREATE` (1) and `CREATE2` (2). (each iteration)
|
|
213
|
+
* - {ValueReceived} event when receiving native tokens.
|
|
214
|
+
*
|
|
215
|
+
* @custom:info The `operationType` 4 `DELEGATECALL` is disabled by default in the LSP9 Vault.
|
|
290
216
|
*/
|
|
291
217
|
function executeBatch(
|
|
292
218
|
uint256[] memory operationsType,
|
|
@@ -300,11 +226,12 @@ contract LSP9VaultCore is
|
|
|
300
226
|
|
|
301
227
|
/**
|
|
302
228
|
* @inheritdoc IERC725Y
|
|
303
|
-
* @dev Sets data as bytes in the vault storage for a single key.
|
|
304
|
-
* SHOULD only be callable by the owner of the contract set via ERC173
|
|
305
|
-
* and the UniversalReceiverDelegate
|
|
306
229
|
*
|
|
307
|
-
*
|
|
230
|
+
* @custom:requirements Can be only called by the {owner} or by an authorised address that pass the verification check performed on the owner.
|
|
231
|
+
*
|
|
232
|
+
* @custom:events
|
|
233
|
+
* - {ValueReceived} event when receiving native tokens.
|
|
234
|
+
* - {DataChanged} event.
|
|
308
235
|
*/
|
|
309
236
|
function setData(
|
|
310
237
|
bytes32 dataKey,
|
|
@@ -327,11 +254,12 @@ contract LSP9VaultCore is
|
|
|
327
254
|
|
|
328
255
|
/**
|
|
329
256
|
* @inheritdoc IERC725Y
|
|
330
|
-
* @dev Sets array of data at multiple given `key`
|
|
331
|
-
* SHOULD only be callable by the owner of the contract set via ERC173
|
|
332
|
-
* and the UniversalReceiverDelegate
|
|
333
257
|
*
|
|
334
|
-
*
|
|
258
|
+
* @custom:requirements Can be only called by the {owner} or by an authorised address that pass the verification check performed on the owner.
|
|
259
|
+
*
|
|
260
|
+
* @custom:events
|
|
261
|
+
* - {ValueReceived} event when receiving native tokens.
|
|
262
|
+
* - {DataChanged} event. (on each iteration of setting data)
|
|
335
263
|
*/
|
|
336
264
|
function setDataBatch(
|
|
337
265
|
bytes32[] memory dataKeys,
|
|
@@ -364,38 +292,43 @@ contract LSP9VaultCore is
|
|
|
364
292
|
}
|
|
365
293
|
|
|
366
294
|
/**
|
|
367
|
-
* @
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
*
|
|
386
|
-
* Forwards the call to the addresses stored in the ERC725Y storage under the LSP1UniversalReceiverDelegate
|
|
387
|
-
* Key and the typeId Key (param) respectively. The call will be discarded if no addresses are set.
|
|
295
|
+
* @notice Notifying the contract by calling its `universalReceiver` function with the following informations: typeId: `typeId`; data: `data`.
|
|
296
|
+
*
|
|
297
|
+
* @dev Achieves the goal of [LSP-1-UniversalReceiver] by allowing the account to be notified about incoming/outgoing transactions and enabling reactions to these actions.
|
|
298
|
+
* The reaction is achieved by having two external contracts ([LSP1UniversalReceiverDelegate]) that react on the whole transaction and on the specific typeId, respectively.
|
|
299
|
+
*
|
|
300
|
+
* The function performs the following steps:
|
|
301
|
+
*
|
|
302
|
+
* 1. Query the [ERC-725Y] storage with the data key [_LSP1_UNIVERSAL_RECEIVER_DELEGATE_KEY].
|
|
303
|
+
* - If there is an address stored under the data key, check if this address supports the LSP1 interfaceId.
|
|
304
|
+
*
|
|
305
|
+
* - If yes, call this address with the typeId and data (params), along with additional calldata consisting of 20 bytes of `msg.sender` and 32 bytes of `msg.value`. If not, continue the execution of the function.
|
|
306
|
+
*
|
|
307
|
+
*
|
|
308
|
+
* 2. Query the [ERC-725Y] storage with the data key [_LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX] + `bytes32(typeId)`.
|
|
309
|
+
* (Check [LSP-2-ERC725YJSONSchema] for encoding the data key)
|
|
310
|
+
*
|
|
311
|
+
* - If there is an address stored under the data key, check if this address supports the LSP1 interfaceId.
|
|
312
|
+
*
|
|
313
|
+
* - If yes, call this address with the typeId and data (params), along with additional calldata consisting of 20 bytes of `msg.sender` and 32 bytes of `msg.value`. If not, continue the execution of the function.
|
|
388
314
|
*
|
|
389
315
|
* @param typeId The type of call received.
|
|
390
316
|
* @param receivedData The data received.
|
|
391
|
-
*
|
|
392
|
-
* and the LSP1TypeIdDelegate call.
|
|
317
|
+
*
|
|
318
|
+
* @return returnedValues The ABI encoded return value of the LSP1UniversalReceiverDelegate call and the LSP1TypeIdDelegate call.
|
|
319
|
+
*
|
|
320
|
+
* @custom:events
|
|
321
|
+
* - {ValueReceived} when receiving native tokens.
|
|
322
|
+
* - {UniversalReceiver} event with the function parameters, call options, and the response of the UniversalReceiverDelegates (URD) contract that was called.
|
|
393
323
|
*/
|
|
394
324
|
function universalReceiver(
|
|
395
325
|
bytes32 typeId,
|
|
396
326
|
bytes calldata receivedData
|
|
397
327
|
) public payable virtual returns (bytes memory returnedValues) {
|
|
398
|
-
if (msg.value != 0)
|
|
328
|
+
if (msg.value != 0) {
|
|
329
|
+
emit ValueReceived(msg.sender, msg.value);
|
|
330
|
+
}
|
|
331
|
+
|
|
399
332
|
bytes memory lsp1DelegateValue = _getData(
|
|
400
333
|
_LSP1_UNIVERSAL_RECEIVER_DELEGATE_KEY
|
|
401
334
|
);
|
|
@@ -468,14 +401,17 @@ contract LSP9VaultCore is
|
|
|
468
401
|
/**
|
|
469
402
|
* @inheritdoc LSP14Ownable2Step
|
|
470
403
|
*
|
|
471
|
-
* @
|
|
472
|
-
*
|
|
473
|
-
*
|
|
474
|
-
*
|
|
404
|
+
* @custom:requirements
|
|
405
|
+
* - Can be only called by the {owner} or by an authorised address that pass the verification check performed on the owner.
|
|
406
|
+
* - When notifying the new owner via LSP1, the `typeId` used must be the `keccak256(...)` hash of [LSP0OwnershipTransferStarted].
|
|
407
|
+
* - Pending owner cannot accept ownership in the same tx via the LSP1 hook.
|
|
475
408
|
*/
|
|
476
409
|
function transferOwnership(
|
|
477
410
|
address newOwner
|
|
478
411
|
) public virtual override(LSP14Ownable2Step, OwnableUnset) onlyOwner {
|
|
412
|
+
// set the transfer ownership lock
|
|
413
|
+
_inTransferOwnership = true;
|
|
414
|
+
|
|
479
415
|
LSP14Ownable2Step._transferOwnership(newOwner);
|
|
480
416
|
|
|
481
417
|
address currentOwner = owner();
|
|
@@ -486,22 +422,19 @@ contract LSP9VaultCore is
|
|
|
486
422
|
""
|
|
487
423
|
);
|
|
488
424
|
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
"LSP14: newOwner MUST accept ownership in a separate transaction"
|
|
492
|
-
);
|
|
425
|
+
// reset the transfer ownership lock
|
|
426
|
+
_inTransferOwnership = false;
|
|
493
427
|
}
|
|
494
428
|
|
|
495
429
|
/**
|
|
496
430
|
* @inheritdoc LSP14Ownable2Step
|
|
497
431
|
*
|
|
498
|
-
* @
|
|
499
|
-
*
|
|
500
|
-
*
|
|
501
|
-
* -
|
|
502
|
-
* - when notifying the new owner via LSP1, the typeId used MUST be keccak256('LSP9OwnershipTransferred_RecipientNotification')
|
|
432
|
+
* @custom:requirements
|
|
433
|
+
* - Only the {pendingOwner} can call this function.
|
|
434
|
+
* - When notifying the previous owner via LSP1, the typeId used must be the `keccak256(...)` hash of [LSP0OwnershipTransferred_SenderNotification].
|
|
435
|
+
* - When notifying the new owner via LSP1, the typeId used must be the `keccak256(...)` hash of [LSP0OwnershipTransferred_RecipientNotification].
|
|
503
436
|
*/
|
|
504
|
-
function acceptOwnership() public virtual override {
|
|
437
|
+
function acceptOwnership() public virtual override NotInTransferOwnership {
|
|
505
438
|
address previousOwner = owner();
|
|
506
439
|
|
|
507
440
|
_acceptOwnership();
|
|
@@ -519,6 +452,10 @@ contract LSP9VaultCore is
|
|
|
519
452
|
|
|
520
453
|
/**
|
|
521
454
|
* @inheritdoc LSP14Ownable2Step
|
|
455
|
+
*
|
|
456
|
+
* @custom:requirements Can be only called by the {owner} or by an authorised address that pass the verification check performed on the owner.
|
|
457
|
+
*
|
|
458
|
+
* @custom:danger Leaves the contract without an owner. Once ownership of the contract has been renounced, any functions that are restricted to be called by the owner will be permanently inaccessible, making these functions not callable anymore and unusable.
|
|
522
459
|
*/
|
|
523
460
|
function renounceOwnership()
|
|
524
461
|
public
|
|
@@ -526,11 +463,132 @@ contract LSP9VaultCore is
|
|
|
526
463
|
override(LSP14Ownable2Step, OwnableUnset)
|
|
527
464
|
onlyOwner
|
|
528
465
|
{
|
|
466
|
+
address previousOwner = owner();
|
|
529
467
|
LSP14Ownable2Step._renounceOwnership();
|
|
468
|
+
|
|
469
|
+
if (owner() == address(0)) {
|
|
470
|
+
previousOwner.tryNotifyUniversalReceiver(
|
|
471
|
+
_TYPEID_LSP9_OwnershipTransferred_SenderNotification,
|
|
472
|
+
""
|
|
473
|
+
);
|
|
474
|
+
}
|
|
530
475
|
}
|
|
531
476
|
|
|
532
477
|
/**
|
|
533
|
-
* @
|
|
478
|
+
* @notice Checking if this contract supports the interface defined by the `bytes4` interface ID `interfaceId`.
|
|
479
|
+
*
|
|
480
|
+
* @dev Achieves the goal of [ERC-165] to detect supported interfaces and [LSP-17-ContractExtension] by
|
|
481
|
+
* checking if the interfaceId being queried is supported on another linked extension.
|
|
482
|
+
*
|
|
483
|
+
* If the contract doesn't support the `interfaceId`, it forwards the call to the
|
|
484
|
+
* `supportsInterface` extension according to [LSP-17-ContractExtension], and checks if the extension
|
|
485
|
+
* implements the interface defined by `interfaceId`.
|
|
486
|
+
*
|
|
487
|
+
* @param interfaceId The interface ID to check if the contract supports it.
|
|
488
|
+
*
|
|
489
|
+
* @return `true` if this contract implements the interface defined by `interfaceId`, `false` otherwise.
|
|
490
|
+
*/
|
|
491
|
+
function supportsInterface(
|
|
492
|
+
bytes4 interfaceId
|
|
493
|
+
)
|
|
494
|
+
public
|
|
495
|
+
view
|
|
496
|
+
virtual
|
|
497
|
+
override(ERC725XCore, ERC725YCore, LSP17Extendable)
|
|
498
|
+
returns (bool)
|
|
499
|
+
{
|
|
500
|
+
return
|
|
501
|
+
interfaceId == _INTERFACEID_LSP9 ||
|
|
502
|
+
interfaceId == _INTERFACEID_LSP1 ||
|
|
503
|
+
interfaceId == _INTERFACEID_LSP14 ||
|
|
504
|
+
super.supportsInterface(interfaceId) ||
|
|
505
|
+
_supportsInterfaceInERC165Extension(interfaceId);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* @dev Forwards the call to an extension mapped to a function selector.
|
|
510
|
+
*
|
|
511
|
+
* Calls {_getExtension} to get the address of the extension mapped to the function selector being called on the account. If there is no extension, the `address(0)` will be returned.
|
|
512
|
+
*
|
|
513
|
+
* Reverts if there is no extension for the function being called, except for the bytes4(0) function selector, which passes even if there is no extension for it.
|
|
514
|
+
*
|
|
515
|
+
* If there is an extension for the function selector being called, it calls the extension with the CALL opcode, passing the `msg.data` appended with the 20 bytes of the `msg.sender` and 32 bytes of the `msg.value`
|
|
516
|
+
*/
|
|
517
|
+
function _fallbackLSP17Extendable(
|
|
518
|
+
bytes calldata callData
|
|
519
|
+
) internal virtual override returns (bytes memory) {
|
|
520
|
+
// If there is a function selector
|
|
521
|
+
address extension = _getExtension(msg.sig);
|
|
522
|
+
|
|
523
|
+
// if no extension was found for bytes4(0) return don't revert
|
|
524
|
+
if (msg.sig == bytes4(0) && extension == address(0)) return "";
|
|
525
|
+
|
|
526
|
+
// if no extension was found for other function selectors, revert
|
|
527
|
+
if (extension == address(0))
|
|
528
|
+
revert NoExtensionFoundForFunctionSelector(msg.sig);
|
|
529
|
+
|
|
530
|
+
(bool success, bytes memory result) = extension.call(
|
|
531
|
+
abi.encodePacked(callData, msg.sender, msg.value)
|
|
532
|
+
);
|
|
533
|
+
|
|
534
|
+
if (success) {
|
|
535
|
+
return result;
|
|
536
|
+
} else {
|
|
537
|
+
// `mload(result)` -> offset in memory where `result.length` is located
|
|
538
|
+
// `add(result, 32)` -> offset in memory where `result` data starts
|
|
539
|
+
// solhint-disable no-inline-assembly
|
|
540
|
+
/// @solidity memory-safe-assembly
|
|
541
|
+
assembly {
|
|
542
|
+
let resultdata_size := mload(result)
|
|
543
|
+
revert(add(result, 32), resultdata_size)
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* @dev Returns the extension address stored under the following data key:
|
|
550
|
+
* - {_LSP17_EXTENSION_PREFIX} + `<bytes4>` (Check [LSP2-ERC725YJSONSchema] for encoding the data key).
|
|
551
|
+
* - If no extension is stored, returns the address(0).
|
|
552
|
+
*/
|
|
553
|
+
function _getExtension(
|
|
554
|
+
bytes4 functionSelector
|
|
555
|
+
) internal view virtual override returns (address) {
|
|
556
|
+
bytes32 mappedExtensionDataKey = LSP2Utils.generateMappingKey(
|
|
557
|
+
_LSP17_EXTENSION_PREFIX,
|
|
558
|
+
functionSelector
|
|
559
|
+
);
|
|
560
|
+
|
|
561
|
+
// Check if there is an extension for the function selector provided
|
|
562
|
+
address extension = address(bytes20(_getData(mappedExtensionDataKey)));
|
|
563
|
+
|
|
564
|
+
return extension;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* @dev Modifier restricting the call to the owner of the contract and the UniversalReceiverDelegate
|
|
569
|
+
*/
|
|
570
|
+
function _validateAndIdentifyCaller()
|
|
571
|
+
internal
|
|
572
|
+
view
|
|
573
|
+
virtual
|
|
574
|
+
returns (bool isURD)
|
|
575
|
+
{
|
|
576
|
+
if (msg.sender != owner()) {
|
|
577
|
+
require(
|
|
578
|
+
msg.sender == _reentrantDelegate,
|
|
579
|
+
"Only Owner or reentered Universal Receiver Delegate allowed"
|
|
580
|
+
);
|
|
581
|
+
isURD = true;
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* @dev This function overrides the {ERC725YCore} internal {_setData} function to optimize gas usage by emitting only the first 256 bytes of the `dataValue`.
|
|
587
|
+
*
|
|
588
|
+
* @custom:events {DataChanged} event with only the first 256 bytes of {dataValue}.
|
|
589
|
+
*
|
|
590
|
+
* @param dataKey The key to store the data value under.
|
|
591
|
+
* @param dataValue The data value to be stored.
|
|
534
592
|
*/
|
|
535
593
|
function _setData(
|
|
536
594
|
bytes32 dataKey,
|
|
@@ -546,9 +604,14 @@ contract LSP9VaultCore is
|
|
|
546
604
|
}
|
|
547
605
|
|
|
548
606
|
/**
|
|
549
|
-
* @dev disable operation type DELEGATECALL (4).
|
|
550
|
-
*
|
|
551
|
-
* in custom error ERC725X_UnknownOperationType(4)
|
|
607
|
+
* @dev This function overrides the {ERC725XCore} internal {_execute} function to disable operation type DELEGATECALL (4).
|
|
608
|
+
*
|
|
609
|
+
* @custom:warning Providing operation type DELEGATECALL (4) as argument will result in custom error {ERC725X_UnknownOperationType(4)}
|
|
610
|
+
*
|
|
611
|
+
* @param operationType The operation type used: CALL = 0; CREATE = 1; CREATE2 = 2; STATICCALL = 3.
|
|
612
|
+
* @param target The address of the EOA or smart contract. (unused if a contract is created via operation type 1 or 2).
|
|
613
|
+
* @param value The amount of native tokens to transfer (in Wei).
|
|
614
|
+
* @param data The call data, or the creation bytecode of the contract to deploy if `operationType` is `1` or `2`.
|
|
552
615
|
*/
|
|
553
616
|
function _execute(
|
|
554
617
|
uint256 operationType,
|
|
@@ -18,9 +18,16 @@ contract LSP9VaultInit is LSP9VaultInitAbstract {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* @notice Initializing
|
|
22
|
-
* @dev Sets
|
|
23
|
-
*
|
|
21
|
+
* @notice Initializing a LSP9Vault contract with owner set to address `initialOwner`.
|
|
22
|
+
* @dev Sets `initialOwner` as the contract owner and the `SupportedStandards:LSP9Vault` Data Key. The `initialize(address)` also allows funding the contract on deployment.
|
|
23
|
+
*
|
|
24
|
+
* @param newOwner The new owner of the contract.
|
|
25
|
+
*
|
|
26
|
+
* @custom:events
|
|
27
|
+
* - {ValueReceived} event when funding the contract on deployment.
|
|
28
|
+
* - {OwnershipTransferred} event when `initialOwner` is set as the contract {owner}.
|
|
29
|
+
* - {DataChanged} event when updating the {_LSP9_SUPPORTED_STANDARDS_KEY}.
|
|
30
|
+
* - {UniversalReceiver} event when notifying the `initialOwner`.
|
|
24
31
|
*/
|
|
25
32
|
function initialize(address newOwner) external payable virtual initializer {
|
|
26
33
|
LSP9VaultInitAbstract._initialize(newOwner);
|
|
@@ -29,12 +29,17 @@ abstract contract LSP9VaultInitAbstract is Initializable, LSP9VaultCore {
|
|
|
29
29
|
using LSP1Utils for address;
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
|
-
* @
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* contracts, you
|
|
37
|
-
*
|
|
32
|
+
* @dev Sets `initialOwner` as the contract owner and the `SupportedStandards:LSP9Vault` Data Key. The `constructor` also allows funding the contract on deployment.
|
|
33
|
+
*
|
|
34
|
+
* @param newOwner The new owner of the contract.
|
|
35
|
+
*
|
|
36
|
+
* @custom:warning ERC725X & ERC725Y parent contracts are not initialised as they don't have non-zero initial state. If you decide to add non-zero initial state to any of those contracts, you must initialize them here.
|
|
37
|
+
*
|
|
38
|
+
* @custom:events
|
|
39
|
+
* - {ValueReceived} event when funding the contract on deployment.
|
|
40
|
+
* - {OwnershipTransferred} event when `initialOwner` is set as the contract {owner}.
|
|
41
|
+
* - {DataChanged} event when updating the {_LSP9_SUPPORTED_STANDARDS_KEY}.
|
|
42
|
+
* - {UniversalReceiver} event when notifying the `initialOwner`.
|
|
38
43
|
*/
|
|
39
44
|
function _initialize(address newOwner) internal virtual onlyInitializing {
|
|
40
45
|
if (msg.value != 0) emit ValueReceived(msg.sender, msg.value);
|
|
@@ -8,7 +8,7 @@ import {LSP0ERC725Account} from "./LSP0ERC725Account/LSP0ERC725Account.sol";
|
|
|
8
8
|
import {
|
|
9
9
|
_LSP3_SUPPORTED_STANDARDS_KEY,
|
|
10
10
|
_LSP3_SUPPORTED_STANDARDS_VALUE
|
|
11
|
-
} from "./
|
|
11
|
+
} from "./LSP3ProfileMetadata/LSP3Constants.sol";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @title implementation of a LUKSO's Universal Profile based on LSP3
|
|
@@ -17,14 +17,16 @@ import {
|
|
|
17
17
|
*/
|
|
18
18
|
contract UniversalProfile is LSP0ERC725Account {
|
|
19
19
|
/**
|
|
20
|
-
* @notice Deploying
|
|
21
|
-
* @dev Set `initialOwner` as the contract owner and set the `SupportedStandards:LSP3UniversalProfile` data key
|
|
22
|
-
* in the ERC725Y data key/value store. The `constructor` also allows funding the contract on deployment.
|
|
20
|
+
* @notice Deploying a UniversalProfile contract with owner set to address `initialOwner`.
|
|
23
21
|
*
|
|
24
|
-
*
|
|
25
|
-
* - ValueReceived: when the contract is funded on deployment.
|
|
22
|
+
* @dev Set `initialOwner` as the contract owner and the `SupportedStandards:LSP3UniversalProfile` data key in the ERC725Y data key/value store. The `constructor` also allows funding the contract on deployment.
|
|
26
23
|
*
|
|
27
24
|
* @param initialOwner the owner of the contract
|
|
25
|
+
*
|
|
26
|
+
* @custom:events
|
|
27
|
+
* - {ValueReceived} event when funding the contract on deployment.
|
|
28
|
+
* - {OwnershipTransferred} event when `initialOwner` is set as the contract {owner}.
|
|
29
|
+
* - {DataChanged} event when setting the {_LSP3_SUPPORTED_STANDARDS_KEY}.
|
|
28
30
|
*/
|
|
29
31
|
constructor(address initialOwner) payable LSP0ERC725Account(initialOwner) {
|
|
30
32
|
// set data key SupportedStandards:LSP3UniversalProfile
|
|
@@ -21,15 +21,15 @@ contract UniversalProfileInit is UniversalProfileInitAbstract {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
* @notice Initializing
|
|
25
|
-
* @dev Set `initialOwner` as the contract owner and set the `SupportedStandards:LSP3UniversalProfile` data key in the ERC725Y data key/value store.
|
|
26
|
-
* The `initialOwner` will then be allowed to call protected functions marked with the `onlyOwner` modifier.
|
|
27
|
-
* The `initialize(address)` function also allows funding the contract on initialization.
|
|
24
|
+
* @notice Initializing a UniversalProfile contract with owner set to address `initialOwner`.
|
|
28
25
|
*
|
|
29
|
-
*
|
|
30
|
-
* - ValueReceived: when the contract is funded on initialization.
|
|
26
|
+
* @dev Set `initialOwner` as the contract owner and the `SupportedStandards:LSP3UniversalProfile` data key in the ERC725Y data key/value store. The `constructor` also allows funding the contract on deployment. The `initialOwner` will then be allowed to call protected functions marked with the `onlyOwner` modifier. The `initialize(address)` function also allows funding the contract on initialization.
|
|
31
27
|
*
|
|
32
28
|
* @param initialOwner the owner of the contract
|
|
29
|
+
*
|
|
30
|
+
* @custom:events
|
|
31
|
+
* - {ValueReceived} event when funding the contract on deployment.
|
|
32
|
+
* - {OwnershipTransferred} event when `initialOwner` is set as the contract {owner}.
|
|
33
33
|
*/
|
|
34
34
|
function initialize(
|
|
35
35
|
address initialOwner
|