@lukso/lsp-smart-contracts 0.8.1 → 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/README.md +14 -1
- 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 +7 -2
- package/artifacts/LSP7CappedSupplyInitAbstract.json +7 -2
- package/artifacts/LSP7CompatibleERC20.json +7 -2
- package/artifacts/LSP7CompatibleERC20InitAbstract.json +7 -2
- package/artifacts/LSP7CompatibleERC20Mintable.json +9 -4
- package/artifacts/LSP7CompatibleERC20MintableInit.json +9 -4
- package/artifacts/LSP7DigitalAsset.json +7 -2
- package/artifacts/LSP7DigitalAssetInitAbstract.json +7 -2
- package/artifacts/LSP7Mintable.json +9 -4
- package/artifacts/LSP7MintableInit.json +9 -4
- package/artifacts/LSP8CappedSupply.json +7 -2
- package/artifacts/LSP8CappedSupplyInitAbstract.json +7 -2
- package/artifacts/LSP8CompatibleERC721.json +7 -2
- package/artifacts/LSP8CompatibleERC721InitAbstract.json +7 -2
- package/artifacts/LSP8CompatibleERC721Mintable.json +9 -4
- package/artifacts/LSP8CompatibleERC721MintableInit.json +9 -4
- package/artifacts/LSP8IdentifiableDigitalAsset.json +7 -2
- package/artifacts/LSP8IdentifiableDigitalAssetInitAbstract.json +7 -2
- package/artifacts/LSP8Mintable.json +9 -4
- package/artifacts/LSP8MintableInit.json +9 -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 +50 -327
- package/common/constants.js +21 -17
- package/contracts/LSP0ERC725Account/ILSP0ERC725Account.sol +27 -0
- package/contracts/LSP0ERC725Account/LSP0Constants.sol +1 -1
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +344 -195
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountInit.sol +1 -1
- package/contracts/LSP10ReceivedVaults/LSP10Utils.sol +47 -51
- 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 -55
- 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/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 +83 -12
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6ExecuteModule.sol +277 -99
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6SetDataModule.sol +36 -9
- package/contracts/LSP6KeyManager/LSP6Utils.sol +30 -15
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +12 -17
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +12 -17
- 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 +81 -58
- package/contracts/LSP9Vault/LSP9VaultInitAbstract.sol +11 -2
- package/module/constants.d.ts +50 -327
- package/module/constants.js +20 -16
- package/package.json +6 -4
|
@@ -226,7 +226,8 @@ abstract contract LSP7DigitalAssetCore is ILSP7DigitalAsset {
|
|
|
226
226
|
|
|
227
227
|
emit Transfer(operator, address(0), to, amount, allowNonLSP1Recipient, data);
|
|
228
228
|
|
|
229
|
-
|
|
229
|
+
bytes memory lsp1Data = abi.encodePacked(address(0), to, amount, data);
|
|
230
|
+
_notifyTokenReceiver(to, allowNonLSP1Recipient, lsp1Data);
|
|
230
231
|
}
|
|
231
232
|
|
|
232
233
|
/**
|
|
@@ -273,7 +274,8 @@ abstract contract LSP7DigitalAssetCore is ILSP7DigitalAsset {
|
|
|
273
274
|
|
|
274
275
|
emit Transfer(operator, from, address(0), amount, false, data);
|
|
275
276
|
|
|
276
|
-
|
|
277
|
+
bytes memory lsp1Data = abi.encodePacked(from, address(0), amount, data);
|
|
278
|
+
_notifyTokenSender(from, lsp1Data);
|
|
277
279
|
}
|
|
278
280
|
|
|
279
281
|
/**
|
|
@@ -314,8 +316,10 @@ abstract contract LSP7DigitalAssetCore is ILSP7DigitalAsset {
|
|
|
314
316
|
|
|
315
317
|
emit Transfer(operator, from, to, amount, allowNonLSP1Recipient, data);
|
|
316
318
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
+
bytes memory lsp1Data = abi.encodePacked(from, to, amount, data);
|
|
320
|
+
|
|
321
|
+
_notifyTokenSender(from, lsp1Data);
|
|
322
|
+
_notifyTokenReceiver(to, allowNonLSP1Recipient, lsp1Data);
|
|
319
323
|
}
|
|
320
324
|
|
|
321
325
|
/**
|
|
@@ -340,15 +344,9 @@ abstract contract LSP7DigitalAssetCore is ILSP7DigitalAsset {
|
|
|
340
344
|
* @dev An attempt is made to notify the token sender about the `amount` tokens changing owners using
|
|
341
345
|
* LSP1 interface.
|
|
342
346
|
*/
|
|
343
|
-
function _notifyTokenSender(
|
|
344
|
-
address from,
|
|
345
|
-
address to,
|
|
346
|
-
uint256 amount,
|
|
347
|
-
bytes memory data
|
|
348
|
-
) internal virtual {
|
|
347
|
+
function _notifyTokenSender(address from, bytes memory lsp1Data) internal virtual {
|
|
349
348
|
if (ERC165Checker.supportsERC165InterfaceUnchecked(from, _INTERFACEID_LSP1)) {
|
|
350
|
-
|
|
351
|
-
ILSP1UniversalReceiver(from).universalReceiver(_TYPEID_LSP7_TOKENSSENDER, packedData);
|
|
349
|
+
ILSP1UniversalReceiver(from).universalReceiver(_TYPEID_LSP7_TOKENSSENDER, lsp1Data);
|
|
352
350
|
}
|
|
353
351
|
}
|
|
354
352
|
|
|
@@ -359,15 +357,12 @@ abstract contract LSP7DigitalAssetCore is ILSP7DigitalAsset {
|
|
|
359
357
|
* The receiver may revert when the token being sent is not wanted.
|
|
360
358
|
*/
|
|
361
359
|
function _notifyTokenReceiver(
|
|
362
|
-
address from,
|
|
363
360
|
address to,
|
|
364
|
-
uint256 amount,
|
|
365
361
|
bool allowNonLSP1Recipient,
|
|
366
|
-
bytes memory
|
|
362
|
+
bytes memory lsp1Data
|
|
367
363
|
) internal virtual {
|
|
368
364
|
if (ERC165Checker.supportsERC165InterfaceUnchecked(to, _INTERFACEID_LSP1)) {
|
|
369
|
-
|
|
370
|
-
ILSP1UniversalReceiver(to).universalReceiver(_TYPEID_LSP7_TOKENSRECIPIENT, packedData);
|
|
365
|
+
ILSP1UniversalReceiver(to).universalReceiver(_TYPEID_LSP7_TOKENSRECIPIENT, lsp1Data);
|
|
371
366
|
} else if (!allowNonLSP1Recipient) {
|
|
372
367
|
if (to.code.length > 0) {
|
|
373
368
|
revert LSP7NotifyTokenReceiverContractMissingLSP1Interface(to);
|
|
@@ -297,7 +297,8 @@ abstract contract LSP8IdentifiableDigitalAssetCore is ILSP8IdentifiableDigitalAs
|
|
|
297
297
|
|
|
298
298
|
emit Transfer(operator, address(0), to, tokenId, allowNonLSP1Recipient, data);
|
|
299
299
|
|
|
300
|
-
|
|
300
|
+
bytes memory lsp1Data = abi.encodePacked(address(0), to, tokenId, data);
|
|
301
|
+
_notifyTokenReceiver(to, allowNonLSP1Recipient, lsp1Data);
|
|
301
302
|
}
|
|
302
303
|
|
|
303
304
|
/**
|
|
@@ -325,7 +326,8 @@ abstract contract LSP8IdentifiableDigitalAssetCore is ILSP8IdentifiableDigitalAs
|
|
|
325
326
|
|
|
326
327
|
emit Transfer(operator, tokenOwner, address(0), tokenId, false, data);
|
|
327
328
|
|
|
328
|
-
|
|
329
|
+
bytes memory lsp1Data = abi.encodePacked(tokenOwner, address(0), tokenId, data);
|
|
330
|
+
_notifyTokenSender(tokenOwner, lsp1Data);
|
|
329
331
|
}
|
|
330
332
|
|
|
331
333
|
/**
|
|
@@ -370,8 +372,10 @@ abstract contract LSP8IdentifiableDigitalAssetCore is ILSP8IdentifiableDigitalAs
|
|
|
370
372
|
|
|
371
373
|
emit Transfer(operator, from, to, tokenId, allowNonLSP1Recipient, data);
|
|
372
374
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
+
bytes memory lsp1Data = abi.encodePacked(from, to, tokenId, data);
|
|
376
|
+
|
|
377
|
+
_notifyTokenSender(from, lsp1Data);
|
|
378
|
+
_notifyTokenReceiver(to, allowNonLSP1Recipient, lsp1Data);
|
|
375
379
|
}
|
|
376
380
|
|
|
377
381
|
/**
|
|
@@ -396,15 +400,9 @@ abstract contract LSP8IdentifiableDigitalAssetCore is ILSP8IdentifiableDigitalAs
|
|
|
396
400
|
* @dev An attempt is made to notify the token sender about the `tokenId` changing owners using
|
|
397
401
|
* LSP1 interface.
|
|
398
402
|
*/
|
|
399
|
-
function _notifyTokenSender(
|
|
400
|
-
address from,
|
|
401
|
-
address to,
|
|
402
|
-
bytes32 tokenId,
|
|
403
|
-
bytes memory data
|
|
404
|
-
) internal virtual {
|
|
403
|
+
function _notifyTokenSender(address from, bytes memory lsp1Data) internal virtual {
|
|
405
404
|
if (ERC165Checker.supportsERC165InterfaceUnchecked(from, _INTERFACEID_LSP1)) {
|
|
406
|
-
|
|
407
|
-
ILSP1UniversalReceiver(from).universalReceiver(_TYPEID_LSP8_TOKENSSENDER, packedData);
|
|
405
|
+
ILSP1UniversalReceiver(from).universalReceiver(_TYPEID_LSP8_TOKENSSENDER, lsp1Data);
|
|
408
406
|
}
|
|
409
407
|
}
|
|
410
408
|
|
|
@@ -415,15 +413,12 @@ abstract contract LSP8IdentifiableDigitalAssetCore is ILSP8IdentifiableDigitalAs
|
|
|
415
413
|
* The receiver may revert when the token being sent is not wanted.
|
|
416
414
|
*/
|
|
417
415
|
function _notifyTokenReceiver(
|
|
418
|
-
address from,
|
|
419
416
|
address to,
|
|
420
|
-
bytes32 tokenId,
|
|
421
417
|
bool allowNonLSP1Recipient,
|
|
422
|
-
bytes memory
|
|
418
|
+
bytes memory lsp1Data
|
|
423
419
|
) internal virtual {
|
|
424
420
|
if (ERC165Checker.supportsERC165InterfaceUnchecked(to, _INTERFACEID_LSP1)) {
|
|
425
|
-
|
|
426
|
-
ILSP1UniversalReceiver(to).universalReceiver(_TYPEID_LSP8_TOKENSRECIPIENT, packedData);
|
|
421
|
+
ILSP1UniversalReceiver(to).universalReceiver(_TYPEID_LSP8_TOKENSRECIPIENT, lsp1Data);
|
|
427
422
|
} else if (!allowNonLSP1Recipient) {
|
|
428
423
|
if (to.code.length > 0) {
|
|
429
424
|
revert LSP8NotifyTokenReceiverContractMissingLSP1Interface(to);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
pragma solidity ^0.8.4;
|
|
3
|
+
|
|
4
|
+
// interfaces
|
|
5
|
+
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
|
6
|
+
import {IERC725X} from "@erc725/smart-contracts/contracts/interfaces/IERC725X.sol";
|
|
7
|
+
import {IERC725Y} from "@erc725/smart-contracts/contracts/interfaces/IERC725Y.sol";
|
|
8
|
+
import {ILSP1UniversalReceiver} from "../LSP1UniversalReceiver/ILSP1UniversalReceiver.sol";
|
|
9
|
+
import {ILSP14Ownable2Step} from "../LSP14Ownable2Step/ILSP14Ownable2Step.sol";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @title Interface of LSP9Vault built on top of ERC725, LSP1UniversalReceiver
|
|
13
|
+
*/
|
|
14
|
+
interface ILSP9Vault is IERC165, IERC725X, IERC725Y, ILSP1UniversalReceiver, ILSP14Ownable2Step {
|
|
15
|
+
/**
|
|
16
|
+
* @dev Receives and executes a batch of function calls on this contract.
|
|
17
|
+
*/
|
|
18
|
+
function batchCalls(bytes[] calldata data) external returns (bytes[] memory results);
|
|
19
|
+
}
|
|
@@ -9,12 +9,16 @@ import {OwnableUnset} from "@erc725/smart-contracts/contracts/custom/OwnableUnse
|
|
|
9
9
|
import {ERC725} from "@erc725/smart-contracts/contracts/ERC725.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
|
contract LSP9Vault is LSP9VaultCore {
|
|
30
|
+
using LSP1Utils for address;
|
|
31
|
+
|
|
26
32
|
/**
|
|
27
33
|
* @notice Sets the owner of the contract and sets the SupportedStandards:LSP9Vault key
|
|
28
34
|
* @param newOwner the owner of the contract
|
|
@@ -35,6 +41,9 @@ contract LSP9Vault is LSP9VaultCore {
|
|
|
35
41
|
// set key SupportedStandards:LSP9Vault
|
|
36
42
|
_setData(_LSP9_SUPPORTED_STANDARDS_KEY, _LSP9_SUPPORTED_STANDARDS_VALUE);
|
|
37
43
|
|
|
38
|
-
|
|
44
|
+
newOwner.tryNotifyUniversalReceiver(
|
|
45
|
+
_TYPEID_LSP9_OwnershipTransferred_RecipientNotification,
|
|
46
|
+
""
|
|
47
|
+
);
|
|
39
48
|
}
|
|
40
49
|
}
|
|
@@ -211,6 +211,33 @@ contract LSP9VaultCore is
|
|
|
211
211
|
_supportsInterfaceInERC165Extension(interfaceId);
|
|
212
212
|
}
|
|
213
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
|
+
|
|
214
241
|
/**
|
|
215
242
|
* @inheritdoc IERC725X
|
|
216
243
|
* @param operationType The operation to execute: CALL = 0 CREATE = 1 CREATE2 = 2 STATICCALL = 3
|
|
@@ -254,7 +281,9 @@ contract LSP9VaultCore is
|
|
|
254
281
|
*
|
|
255
282
|
* Emits a {DataChanged} event.
|
|
256
283
|
*/
|
|
257
|
-
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
|
+
|
|
258
287
|
bool isURD = _validateAndIdentifyCaller();
|
|
259
288
|
if (isURD) {
|
|
260
289
|
if (
|
|
@@ -276,12 +305,19 @@ contract LSP9VaultCore is
|
|
|
276
305
|
*
|
|
277
306
|
* Emits a {DataChanged} event.
|
|
278
307
|
*/
|
|
279
|
-
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
|
+
{
|
|
280
314
|
bool isURD = _validateAndIdentifyCaller();
|
|
281
315
|
if (dataKeys.length != dataValues.length) {
|
|
282
316
|
revert ERC725Y_DataKeysValuesLengthMismatch(dataKeys.length, dataValues.length);
|
|
283
317
|
}
|
|
284
318
|
|
|
319
|
+
if (msg.value != 0) revert ERC725Y_MsgValueDisallowed();
|
|
320
|
+
|
|
285
321
|
for (uint256 i = 0; i < dataKeys.length; i = GasLib.uncheckedIncrement(i)) {
|
|
286
322
|
if (isURD) {
|
|
287
323
|
if (
|
|
@@ -373,21 +409,59 @@ contract LSP9VaultCore is
|
|
|
373
409
|
}
|
|
374
410
|
|
|
375
411
|
/**
|
|
376
|
-
* @
|
|
412
|
+
* @inheritdoc LSP14Ownable2Step
|
|
413
|
+
*
|
|
414
|
+
* @dev same as ILSP14.transferOwnership with the additional requirement:
|
|
377
415
|
*
|
|
378
|
-
*
|
|
416
|
+
* Requirements:
|
|
417
|
+
* - when notifying the new owner via LSP1, the typeId used MUST be keccak256('LSP9OwnershipTransferStarted')
|
|
379
418
|
*/
|
|
380
|
-
function transferOwnership(address
|
|
419
|
+
function transferOwnership(address newOwner)
|
|
381
420
|
public
|
|
382
421
|
virtual
|
|
383
422
|
override(LSP14Ownable2Step, OwnableUnset)
|
|
384
423
|
onlyOwner
|
|
385
424
|
{
|
|
386
|
-
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
|
+
);
|
|
387
461
|
}
|
|
388
462
|
|
|
389
463
|
/**
|
|
390
|
-
* @
|
|
464
|
+
* @inheritdoc LSP14Ownable2Step
|
|
391
465
|
*/
|
|
392
466
|
function renounceOwnership()
|
|
393
467
|
public
|
|
@@ -445,55 +519,4 @@ contract LSP9VaultCore is
|
|
|
445
519
|
|
|
446
520
|
revert ERC725X_UnknownOperationType(operationType);
|
|
447
521
|
}
|
|
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
|
|
454
|
-
*/
|
|
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
|
-
);
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
/**
|
|
469
|
-
* @dev Calls the universalReceiver function of the sender when ownerhsip transfer is complete
|
|
470
|
-
* if supports LSP1 InterfaceId
|
|
471
|
-
*/
|
|
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
|
-
);
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
/**
|
|
485
|
-
* @dev Calls the universalReceiver function of the recipient when ownerhsip transfer is complete
|
|
486
|
-
* if supports LSP1 InterfaceId
|
|
487
|
-
*/
|
|
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
|
|
496
|
-
);
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
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
|
}
|