@lukso/lsp-smart-contracts 0.8.0 → 0.9.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 +8 -0
- package/README.md +34 -21
- package/artifacts/LSP0ERC725Account.json +51 -5
- package/artifacts/LSP0ERC725AccountInit.json +51 -5
- package/artifacts/LSP11BasicSocialRecovery.json +2 -2
- package/artifacts/LSP11BasicSocialRecoveryInit.json +2 -2
- package/artifacts/LSP16UniversalFactory.json +31 -2
- package/artifacts/LSP1UniversalReceiverDelegateUP.json +19 -35
- package/artifacts/LSP1UniversalReceiverDelegateVault.json +13 -13
- package/artifacts/LSP4Compatibility.json +7 -2
- package/artifacts/LSP4DigitalAssetMetadata.json +7 -2
- package/artifacts/LSP4DigitalAssetMetadataInitAbstract.json +7 -2
- package/artifacts/LSP6KeyManager.json +91 -6
- package/artifacts/LSP6KeyManagerInit.json +103 -18
- package/artifacts/LSP7CappedSupply.json +12 -2
- package/artifacts/LSP7CappedSupplyInitAbstract.json +12 -2
- package/artifacts/LSP7CompatibleERC20.json +12 -2
- package/artifacts/LSP7CompatibleERC20InitAbstract.json +12 -2
- package/artifacts/LSP7CompatibleERC20Mintable.json +14 -4
- package/artifacts/LSP7CompatibleERC20MintableInit.json +14 -4
- package/artifacts/LSP7DigitalAsset.json +12 -2
- package/artifacts/LSP7DigitalAssetInitAbstract.json +12 -2
- package/artifacts/LSP7Mintable.json +14 -4
- package/artifacts/LSP7MintableInit.json +14 -4
- package/artifacts/LSP8CappedSupply.json +12 -2
- package/artifacts/LSP8CappedSupplyInitAbstract.json +12 -2
- package/artifacts/LSP8CompatibleERC721.json +12 -2
- package/artifacts/LSP8CompatibleERC721InitAbstract.json +12 -2
- package/artifacts/LSP8CompatibleERC721Mintable.json +14 -4
- package/artifacts/LSP8CompatibleERC721MintableInit.json +14 -4
- package/artifacts/LSP8IdentifiableDigitalAsset.json +12 -2
- package/artifacts/LSP8IdentifiableDigitalAssetInitAbstract.json +12 -2
- package/artifacts/LSP8Mintable.json +14 -4
- package/artifacts/LSP8MintableInit.json +14 -4
- package/artifacts/LSP9Vault.json +29 -5
- package/artifacts/LSP9VaultInit.json +29 -5
- package/artifacts/UniversalProfile.json +51 -5
- package/artifacts/UniversalProfileInit.json +51 -5
- package/common/constants.d.ts +461 -0
- package/common/constants.js +789 -0
- package/contracts/LSP0ERC725Account/ILSP0ERC725Account.sol +27 -0
- package/contracts/LSP0ERC725Account/LSP0Constants.sol +1 -1
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +353 -145
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountInit.sol +1 -1
- package/contracts/LSP0ERC725Account/LSP0Utils.sol +50 -0
- package/contracts/LSP10ReceivedVaults/LSP10Utils.sol +48 -54
- package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecoveryCore.sol +5 -6
- package/contracts/LSP14Ownable2Step/ILSP14Ownable2Step.sol +27 -4
- package/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol +36 -77
- package/contracts/LSP16UniversalFactory/LSP16UniversalFactory.sol +8 -8
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol +50 -57
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol +18 -8
- package/contracts/LSP1UniversalReceiver/LSP1Utils.sol +12 -0
- package/contracts/LSP20CallVerification/ILSP20CallVerification.sol +30 -0
- package/contracts/LSP20CallVerification/LSP20CallVerification.sol +74 -0
- package/contracts/LSP20CallVerification/LSP20Errors.sol +15 -0
- package/contracts/LSP2ERC725YJSONSchema/LSP2Utils.sol +7 -7
- package/contracts/LSP5ReceivedAssets/LSP5Utils.sol +50 -56
- package/contracts/LSP6KeyManager/ILSP6KeyManager.sol +1 -1
- package/contracts/LSP6KeyManager/LSP6Constants.sol +8 -2
- package/contracts/LSP6KeyManager/LSP6Errors.sol +18 -1
- package/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol +126 -745
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6ExecuteModule.sol +407 -0
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6OwnershipModule.sol +25 -0
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6SetDataModule.sol +633 -0
- package/contracts/LSP6KeyManager/LSP6Utils.sol +60 -15
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +14 -23
- package/contracts/LSP7DigitalAsset/LSP7Errors.sol +5 -0
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Errors.sol +5 -0
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +19 -30
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol +1 -3
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol +1 -3
- package/contracts/LSP9Vault/ILSP9Vault.sol +19 -0
- package/contracts/LSP9Vault/LSP9Constants.sol +1 -1
- package/contracts/LSP9Vault/LSP9Vault.sol +11 -2
- package/contracts/LSP9Vault/LSP9VaultCore.sol +166 -83
- package/contracts/LSP9Vault/LSP9VaultInitAbstract.sol +11 -2
- package/module/constants.d.ts +461 -0
- package/module/constants.js +786 -0
- package/package.json +30 -6
- package/constants.js +0 -856
|
@@ -46,6 +46,7 @@ import {_LSP17_EXTENSION_PREFIX} from "../LSP17ContractExtension/LSP17Constants.
|
|
|
46
46
|
|
|
47
47
|
// errors
|
|
48
48
|
import "./LSP9Errors.sol";
|
|
49
|
+
import "../LSP17ContractExtension/LSP17Errors.sol";
|
|
49
50
|
|
|
50
51
|
/**
|
|
51
52
|
* @title Core Implementation of LSP9Vault built on top of ERC725, LSP1UniversalReceiver
|
|
@@ -74,12 +75,95 @@ contract LSP9VaultCore is
|
|
|
74
75
|
/**
|
|
75
76
|
* @dev Emits an event when receiving native tokens
|
|
76
77
|
*
|
|
77
|
-
* Executed
|
|
78
|
+
* Executed:
|
|
79
|
+
* - when receiving some native tokens without any additional data.
|
|
80
|
+
* - on empty calls to the contract.
|
|
78
81
|
*/
|
|
79
82
|
receive() external payable virtual {
|
|
80
83
|
if (msg.value > 0) emit ValueReceived(msg.sender, msg.value);
|
|
81
84
|
}
|
|
82
85
|
|
|
86
|
+
// solhint-disable no-complex-fallback
|
|
87
|
+
|
|
88
|
+
/**
|
|
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.
|
|
104
|
+
*/
|
|
105
|
+
fallback() external payable virtual {
|
|
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
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
83
167
|
/**
|
|
84
168
|
* @dev Returns the extension stored under the `_LSP17_EXTENSION_PREFIX` data key
|
|
85
169
|
* mapped to the functionSelector provided.
|
|
@@ -104,30 +188,6 @@ contract LSP9VaultCore is
|
|
|
104
188
|
return extension;
|
|
105
189
|
}
|
|
106
190
|
|
|
107
|
-
// solhint-disable no-complex-fallback
|
|
108
|
-
|
|
109
|
-
/**
|
|
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.
|
|
124
|
-
*/
|
|
125
|
-
fallback() external payable virtual {
|
|
126
|
-
if (msg.value != 0) emit ValueReceived(msg.sender, msg.value);
|
|
127
|
-
if (msg.data.length < 4 || msg.sig == bytes4(0)) return;
|
|
128
|
-
_fallbackLSP17Extendable();
|
|
129
|
-
}
|
|
130
|
-
|
|
131
191
|
/**
|
|
132
192
|
* @dev Returns true if this contract implements the interface defined by
|
|
133
193
|
* `interfaceId`.
|
|
@@ -151,6 +211,33 @@ contract LSP9VaultCore is
|
|
|
151
211
|
_supportsInterfaceInERC165Extension(interfaceId);
|
|
152
212
|
}
|
|
153
213
|
|
|
214
|
+
/**
|
|
215
|
+
* @dev Receives and executes a batch of function calls on this contract.
|
|
216
|
+
*/
|
|
217
|
+
function batchCalls(bytes[] calldata data) public returns (bytes[] memory results) {
|
|
218
|
+
results = new bytes[](data.length);
|
|
219
|
+
for (uint256 i; i < data.length; i = GasLib.uncheckedIncrement(i)) {
|
|
220
|
+
(bool success, bytes memory result) = address(this).delegatecall(data[i]);
|
|
221
|
+
|
|
222
|
+
if (!success) {
|
|
223
|
+
// Look for revert reason and bubble it up if present
|
|
224
|
+
if (result.length > 0) {
|
|
225
|
+
// The easiest way to bubble the revert reason is using memory via assembly
|
|
226
|
+
// solhint-disable no-inline-assembly
|
|
227
|
+
/// @solidity memory-safe-assembly
|
|
228
|
+
assembly {
|
|
229
|
+
let returndata_size := mload(result)
|
|
230
|
+
revert(add(32, result), returndata_size)
|
|
231
|
+
}
|
|
232
|
+
} else {
|
|
233
|
+
revert("LSP9: batchCalls reverted");
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
results[i] = result;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
154
241
|
/**
|
|
155
242
|
* @inheritdoc IERC725X
|
|
156
243
|
* @param operationType The operation to execute: CALL = 0 CREATE = 1 CREATE2 = 2 STATICCALL = 3
|
|
@@ -194,7 +281,9 @@ contract LSP9VaultCore is
|
|
|
194
281
|
*
|
|
195
282
|
* Emits a {DataChanged} event.
|
|
196
283
|
*/
|
|
197
|
-
function setData(bytes32 dataKey, bytes memory dataValue) public virtual override {
|
|
284
|
+
function setData(bytes32 dataKey, bytes memory dataValue) public payable virtual override {
|
|
285
|
+
if (msg.value != 0) revert ERC725Y_MsgValueDisallowed();
|
|
286
|
+
|
|
198
287
|
bool isURD = _validateAndIdentifyCaller();
|
|
199
288
|
if (isURD) {
|
|
200
289
|
if (
|
|
@@ -216,12 +305,19 @@ contract LSP9VaultCore is
|
|
|
216
305
|
*
|
|
217
306
|
* Emits a {DataChanged} event.
|
|
218
307
|
*/
|
|
219
|
-
function setData(bytes32[] memory dataKeys, bytes[] memory dataValues)
|
|
308
|
+
function setData(bytes32[] memory dataKeys, bytes[] memory dataValues)
|
|
309
|
+
public
|
|
310
|
+
payable
|
|
311
|
+
virtual
|
|
312
|
+
override
|
|
313
|
+
{
|
|
220
314
|
bool isURD = _validateAndIdentifyCaller();
|
|
221
315
|
if (dataKeys.length != dataValues.length) {
|
|
222
316
|
revert ERC725Y_DataKeysValuesLengthMismatch(dataKeys.length, dataValues.length);
|
|
223
317
|
}
|
|
224
318
|
|
|
319
|
+
if (msg.value != 0) revert ERC725Y_MsgValueDisallowed();
|
|
320
|
+
|
|
225
321
|
for (uint256 i = 0; i < dataKeys.length; i = GasLib.uncheckedIncrement(i)) {
|
|
226
322
|
if (isURD) {
|
|
227
323
|
if (
|
|
@@ -313,21 +409,59 @@ contract LSP9VaultCore is
|
|
|
313
409
|
}
|
|
314
410
|
|
|
315
411
|
/**
|
|
316
|
-
* @
|
|
412
|
+
* @inheritdoc LSP14Ownable2Step
|
|
317
413
|
*
|
|
318
|
-
* @
|
|
414
|
+
* @dev same as ILSP14.transferOwnership with the additional requirement:
|
|
415
|
+
*
|
|
416
|
+
* Requirements:
|
|
417
|
+
* - when notifying the new owner via LSP1, the typeId used MUST be keccak256('LSP9OwnershipTransferStarted')
|
|
319
418
|
*/
|
|
320
|
-
function transferOwnership(address
|
|
419
|
+
function transferOwnership(address newOwner)
|
|
321
420
|
public
|
|
322
421
|
virtual
|
|
323
422
|
override(LSP14Ownable2Step, OwnableUnset)
|
|
324
423
|
onlyOwner
|
|
325
424
|
{
|
|
326
|
-
LSP14Ownable2Step._transferOwnership(
|
|
425
|
+
LSP14Ownable2Step._transferOwnership(newOwner);
|
|
426
|
+
|
|
427
|
+
address currentOwner = owner();
|
|
428
|
+
emit OwnershipTransferStarted(currentOwner, newOwner);
|
|
429
|
+
|
|
430
|
+
newOwner.tryNotifyUniversalReceiver(_TYPEID_LSP9_OwnershipTransferStarted, "");
|
|
431
|
+
|
|
432
|
+
require(
|
|
433
|
+
currentOwner == owner(),
|
|
434
|
+
"LSP14: newOwner MUST accept ownership in a separate transaction"
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* @inheritdoc LSP14Ownable2Step
|
|
440
|
+
*
|
|
441
|
+
* @dev same as ILSP14.acceptOwnership with the additional requirement:
|
|
442
|
+
*
|
|
443
|
+
* Requirements:
|
|
444
|
+
* - when notifying the previous owner via LSP1, the typeId used MUST be keccak256('LSP9OwnershipTransferred_SenderNotification')
|
|
445
|
+
* - when notifying the new owner via LSP1, the typeId used MUST be keccak256('LSP9OwnershipTransferred_RecipientNotification')
|
|
446
|
+
*/
|
|
447
|
+
function acceptOwnership() public virtual override {
|
|
448
|
+
address previousOwner = owner();
|
|
449
|
+
|
|
450
|
+
_acceptOwnership();
|
|
451
|
+
|
|
452
|
+
previousOwner.tryNotifyUniversalReceiver(
|
|
453
|
+
_TYPEID_LSP9_OwnershipTransferred_SenderNotification,
|
|
454
|
+
""
|
|
455
|
+
);
|
|
456
|
+
|
|
457
|
+
msg.sender.tryNotifyUniversalReceiver(
|
|
458
|
+
_TYPEID_LSP9_OwnershipTransferred_RecipientNotification,
|
|
459
|
+
""
|
|
460
|
+
);
|
|
327
461
|
}
|
|
328
462
|
|
|
329
463
|
/**
|
|
330
|
-
* @
|
|
464
|
+
* @inheritdoc LSP14Ownable2Step
|
|
331
465
|
*/
|
|
332
466
|
function renounceOwnership()
|
|
333
467
|
public
|
|
@@ -385,55 +519,4 @@ contract LSP9VaultCore is
|
|
|
385
519
|
|
|
386
520
|
revert ERC725X_UnknownOperationType(operationType);
|
|
387
521
|
}
|
|
388
|
-
|
|
389
|
-
// --- LSP14 URD Hooks
|
|
390
|
-
|
|
391
|
-
/**
|
|
392
|
-
* @dev Calls the universalReceiver function of the sender when ownerhsip transfer starts
|
|
393
|
-
* if supports LSP1 InterfaceId
|
|
394
|
-
*/
|
|
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
|
-
);
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
522
|
}
|
|
@@ -9,12 +9,16 @@ import {OwnableUnset} from "@erc725/smart-contracts/contracts/custom/OwnableUnse
|
|
|
9
9
|
import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
|
|
10
10
|
import {LSP9VaultCore} from "./LSP9VaultCore.sol";
|
|
11
11
|
|
|
12
|
+
// libraries
|
|
13
|
+
import {LSP1Utils} from "../LSP1UniversalReceiver/LSP1Utils.sol";
|
|
14
|
+
|
|
12
15
|
// constants
|
|
13
16
|
import {_INTERFACEID_LSP1} from "../LSP1UniversalReceiver/LSP1Constants.sol";
|
|
14
17
|
import {
|
|
15
18
|
_INTERFACEID_LSP9,
|
|
16
19
|
_LSP9_SUPPORTED_STANDARDS_KEY,
|
|
17
|
-
_LSP9_SUPPORTED_STANDARDS_VALUE
|
|
20
|
+
_LSP9_SUPPORTED_STANDARDS_VALUE,
|
|
21
|
+
_TYPEID_LSP9_OwnershipTransferred_RecipientNotification
|
|
18
22
|
} from "../LSP9Vault/LSP9Constants.sol";
|
|
19
23
|
|
|
20
24
|
/**
|
|
@@ -23,6 +27,8 @@ import {
|
|
|
23
27
|
* @dev Could be owned by a UniversalProfile and able to register received asset with UniversalReceiverDelegateVault
|
|
24
28
|
*/
|
|
25
29
|
abstract contract LSP9VaultInitAbstract is Initializable, LSP9VaultCore {
|
|
30
|
+
using LSP1Utils for address;
|
|
31
|
+
|
|
26
32
|
function _initialize(address newOwner) internal virtual onlyInitializing {
|
|
27
33
|
if (msg.value != 0) emit ValueReceived(msg.sender, msg.value);
|
|
28
34
|
OwnableUnset._setOwner(newOwner);
|
|
@@ -30,6 +36,9 @@ abstract contract LSP9VaultInitAbstract is Initializable, LSP9VaultCore {
|
|
|
30
36
|
// set key SupportedStandards:LSP9Vault
|
|
31
37
|
_setData(_LSP9_SUPPORTED_STANDARDS_KEY, _LSP9_SUPPORTED_STANDARDS_VALUE);
|
|
32
38
|
|
|
33
|
-
|
|
39
|
+
newOwner.tryNotifyUniversalReceiver(
|
|
40
|
+
_TYPEID_LSP9_OwnershipTransferred_RecipientNotification,
|
|
41
|
+
""
|
|
42
|
+
);
|
|
34
43
|
}
|
|
35
44
|
}
|