@lukso/lsp-smart-contracts 0.8.2 → 0.10.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 +29 -8
- package/artifacts/LSP0ERC725Account.json +90 -50
- package/artifacts/LSP0ERC725AccountInit.json +90 -50
- 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 +39 -40
- package/artifacts/LSP4DigitalAssetMetadata.json +39 -40
- package/artifacts/LSP4DigitalAssetMetadataInitAbstract.json +39 -40
- package/artifacts/LSP6KeyManager.json +107 -8
- package/artifacts/LSP6KeyManagerInit.json +119 -20
- package/artifacts/LSP7CappedSupply.json +78 -38
- package/artifacts/LSP7CappedSupplyInitAbstract.json +78 -38
- package/artifacts/LSP7CompatibleERC20.json +78 -38
- package/artifacts/LSP7CompatibleERC20InitAbstract.json +78 -38
- package/artifacts/LSP7CompatibleERC20Mintable.json +80 -40
- package/artifacts/LSP7CompatibleERC20MintableInit.json +80 -40
- package/artifacts/LSP7DigitalAsset.json +78 -38
- package/artifacts/LSP7DigitalAssetInitAbstract.json +78 -38
- package/artifacts/LSP7Mintable.json +80 -40
- package/artifacts/LSP7MintableInit.json +80 -40
- package/artifacts/LSP8CappedSupply.json +39 -40
- package/artifacts/LSP8CappedSupplyInitAbstract.json +39 -40
- package/artifacts/LSP8CompatibleERC721.json +42 -43
- package/artifacts/LSP8CompatibleERC721InitAbstract.json +42 -43
- package/artifacts/LSP8CompatibleERC721Mintable.json +44 -45
- package/artifacts/LSP8CompatibleERC721MintableInit.json +44 -45
- package/artifacts/LSP8IdentifiableDigitalAsset.json +39 -40
- package/artifacts/LSP8IdentifiableDigitalAssetInitAbstract.json +39 -40
- package/artifacts/LSP8Mintable.json +41 -42
- package/artifacts/LSP8MintableInit.json +41 -42
- package/artifacts/LSP9Vault.json +73 -55
- package/artifacts/LSP9VaultInit.json +73 -55
- package/artifacts/UniversalProfile.json +90 -50
- package/artifacts/UniversalProfileInit.json +90 -50
- package/contracts/LSP0ERC725Account/ILSP0ERC725Account.sol +62 -0
- package/contracts/LSP0ERC725Account/LSP0Constants.sol +1 -1
- package/contracts/LSP0ERC725Account/LSP0ERC725Account.sol +36 -6
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +605 -219
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountInit.sol +31 -5
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountInitAbstract.sol +37 -3
- package/contracts/LSP0ERC725Account/LSP0Utils.sol +0 -1
- package/contracts/LSP10ReceivedVaults/LSP10Utils.sol +71 -60
- package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecoveryCore.sol +5 -7
- package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecoveryInit.sol +0 -1
- package/contracts/LSP14Ownable2Step/ILSP14Ownable2Step.sol +27 -4
- package/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol +41 -84
- package/contracts/LSP16UniversalFactory/LSP16UniversalFactory.sol +8 -8
- package/contracts/LSP17ContractExtension/LSP17Extendable.sol +10 -5
- package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiver.sol +0 -4
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol +129 -77
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol +45 -16
- package/contracts/LSP1UniversalReceiver/LSP1Utils.sol +12 -0
- package/contracts/LSP20CallVerification/ILSP20CallVerification.sol +30 -0
- package/contracts/LSP20CallVerification/LSP20CallVerification.sol +83 -0
- package/contracts/LSP20CallVerification/LSP20Constants.sol +17 -0
- package/contracts/LSP20CallVerification/LSP20Errors.sol +15 -0
- package/contracts/LSP2ERC725YJSONSchema/LSP2Utils.sol +26 -12
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol +0 -1
- package/contracts/LSP5ReceivedAssets/LSP5Utils.sol +76 -66
- package/contracts/LSP6KeyManager/ILSP6KeyManager.sol +12 -3
- package/contracts/LSP6KeyManager/LSP6Constants.sol +9 -3
- package/contracts/LSP6KeyManager/LSP6Errors.sol +22 -1
- package/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol +172 -29
- package/contracts/LSP6KeyManager/LSP6KeyManagerInitAbstract.sol +0 -1
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6ExecuteModule.sol +270 -100
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6SetDataModule.sol +187 -67
- package/contracts/LSP6KeyManager/LSP6Utils.sol +31 -20
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +79 -30
- package/contracts/LSP7DigitalAsset/LSP7Errors.sol +5 -0
- package/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol +2 -2
- package/contracts/LSP7DigitalAsset/extensions/LSP7BurnableInitAbstract.sol +24 -0
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol +1 -2
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyInitAbstract.sol +1 -2
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol +3 -5
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20InitAbstract.sol +3 -5
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +27 -29
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CompatibleERC721.sol +1 -1
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol +1 -2
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInitAbstract.sol +1 -2
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol +5 -5
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol +6 -6
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol +2 -2
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableInitAbstract.sol +2 -2
- package/contracts/LSP9Vault/ILSP9Vault.sol +27 -0
- package/contracts/LSP9Vault/LSP9Constants.sol +1 -1
- package/contracts/LSP9Vault/LSP9Vault.sol +11 -8
- package/contracts/LSP9Vault/LSP9VaultCore.sol +96 -71
- package/contracts/LSP9Vault/LSP9VaultInit.sol +2 -1
- package/contracts/LSP9Vault/LSP9VaultInitAbstract.sol +19 -7
- package/contracts/UniversalProfileInitAbstract.sol +5 -0
- package/devdocs/Create2Factory.json +16 -0
- package/devdocs/LSP0ERC725Account.json +200 -0
- package/devdocs/LSP0ERC725AccountInit.json +203 -0
- package/devdocs/LSP11BasicSocialRecovery.json +146 -0
- package/devdocs/LSP11BasicSocialRecoveryInit.json +146 -0
- package/devdocs/LSP16UniversalFactory.json +51 -0
- package/devdocs/LSP1UniversalReceiverDelegateUP.json +80 -0
- package/devdocs/LSP1UniversalReceiverDelegateVault.json +62 -0
- package/devdocs/LSP4Compatibility.json +79 -0
- package/devdocs/LSP4DigitalAssetMetadata.json +84 -0
- package/devdocs/LSP4DigitalAssetMetadataInitAbstract.json +77 -0
- package/devdocs/LSP6KeyManager.json +257 -0
- package/devdocs/LSP6KeyManagerInit.json +260 -0
- package/devdocs/LSP7CappedSupply.json +211 -0
- package/devdocs/LSP7CappedSupplyInitAbstract.json +206 -0
- package/devdocs/LSP7CompatibleERC20.json +225 -0
- package/devdocs/LSP7CompatibleERC20InitAbstract.json +218 -0
- package/devdocs/LSP7CompatibleERC20Mintable.json +217 -0
- package/devdocs/LSP7CompatibleERC20MintableInit.json +227 -0
- package/devdocs/LSP7DigitalAsset.json +210 -0
- package/devdocs/LSP7DigitalAssetInitAbstract.json +202 -0
- package/devdocs/LSP7Mintable.json +219 -0
- package/devdocs/LSP7MintableInit.json +220 -0
- package/devdocs/LSP8CappedSupply.json +232 -0
- package/devdocs/LSP8CappedSupplyInitAbstract.json +227 -0
- package/devdocs/LSP8CompatibleERC721.json +298 -0
- package/devdocs/LSP8CompatibleERC721InitAbstract.json +291 -0
- package/devdocs/LSP8CompatibleERC721Mintable.json +290 -0
- package/devdocs/LSP8CompatibleERC721MintableInit.json +300 -0
- package/devdocs/LSP8IdentifiableDigitalAsset.json +230 -0
- package/devdocs/LSP8IdentifiableDigitalAssetInitAbstract.json +223 -0
- package/devdocs/LSP8Mintable.json +242 -0
- package/devdocs/LSP8MintableInit.json +245 -0
- package/devdocs/LSP9Vault.json +171 -0
- package/devdocs/LSP9VaultInit.json +175 -0
- package/devdocs/UniversalProfile.json +199 -0
- package/devdocs/UniversalProfileInit.json +202 -0
- package/devdocs/UniversalReceiverAddressStore.json +9 -0
- package/dist/constants.cjs.js +31569 -0
- package/dist/constants.d.ts +31681 -0
- package/dist/constants.es.js +31550 -0
- package/package.json +70 -52
- package/userdocs/Create2Factory.json +5 -0
- package/userdocs/LSP0ERC725Account.json +47 -0
- package/userdocs/LSP0ERC725AccountInit.json +47 -0
- package/userdocs/LSP11BasicSocialRecovery.json +29 -0
- package/userdocs/LSP11BasicSocialRecoveryInit.json +29 -0
- package/userdocs/LSP16UniversalFactory.json +5 -0
- package/userdocs/LSP1UniversalReceiverDelegateUP.json +10 -0
- package/userdocs/LSP1UniversalReceiverDelegateVault.json +10 -0
- package/userdocs/LSP4Compatibility.json +20 -0
- package/userdocs/LSP4DigitalAssetMetadata.json +23 -0
- package/userdocs/LSP4DigitalAssetMetadataInitAbstract.json +20 -0
- package/userdocs/LSP6KeyManager.json +18 -0
- package/userdocs/LSP6KeyManagerInit.json +18 -0
- package/userdocs/LSP7CappedSupply.json +29 -0
- package/userdocs/LSP7CappedSupplyInitAbstract.json +26 -0
- package/userdocs/LSP7CompatibleERC20.json +35 -0
- package/userdocs/LSP7CompatibleERC20InitAbstract.json +32 -0
- package/userdocs/LSP7CompatibleERC20Mintable.json +32 -0
- package/userdocs/LSP7CompatibleERC20MintableInit.json +35 -0
- package/userdocs/LSP7DigitalAsset.json +29 -0
- package/userdocs/LSP7DigitalAssetInitAbstract.json +26 -0
- package/userdocs/LSP7Mintable.json +29 -0
- package/userdocs/LSP7MintableInit.json +29 -0
- package/userdocs/LSP8CappedSupply.json +23 -0
- package/userdocs/LSP8CappedSupplyInitAbstract.json +20 -0
- package/userdocs/LSP8CompatibleERC721.json +29 -0
- package/userdocs/LSP8CompatibleERC721InitAbstract.json +26 -0
- package/userdocs/LSP8CompatibleERC721Mintable.json +26 -0
- package/userdocs/LSP8CompatibleERC721MintableInit.json +29 -0
- package/userdocs/LSP8IdentifiableDigitalAsset.json +23 -0
- package/userdocs/LSP8IdentifiableDigitalAssetInitAbstract.json +20 -0
- package/userdocs/LSP8Mintable.json +23 -0
- package/userdocs/LSP8MintableInit.json +23 -0
- package/userdocs/LSP9Vault.json +38 -0
- package/userdocs/LSP9VaultInit.json +38 -0
- package/userdocs/UniversalProfile.json +50 -0
- package/userdocs/UniversalProfileInit.json +50 -0
- package/userdocs/UniversalReceiverAddressStore.json +5 -0
- package/CONTRIBUTING.md +0 -57
- package/common/constants.d.ts +0 -738
- package/common/constants.js +0 -785
- package/contracts/Utils/GasLib.sol +0 -17
- package/module/constants.d.ts +0 -738
- package/module/constants.js +0 -782
|
@@ -5,20 +5,46 @@ pragma solidity ^0.8.4;
|
|
|
5
5
|
import {LSP0ERC725AccountInitAbstract} from "./LSP0ERC725AccountInitAbstract.sol";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* @title Deployable Proxy Implementation of ERC725Account
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* @title Deployable Proxy Implementation of LSP0-ERC725Account Standard
|
|
9
|
+
* https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md
|
|
10
|
+
*
|
|
11
|
+
* @author Fabian Vogelsteller <fabian@lukso.network>, Jean Cavallera (CJ42)
|
|
12
|
+
* @dev A smart contract account including basic functionalities such as:
|
|
13
|
+
*
|
|
14
|
+
* - Detecting supported standards using ERC165
|
|
15
|
+
* https://eips.ethereum.org/EIPS/eip-165
|
|
16
|
+
*
|
|
17
|
+
* - Executing several operation on other addresses including creating contracts using ERC725X
|
|
18
|
+
* https://github.com/ERC725Alliance/ERC725/blob/develop/docs/ERC-725.md
|
|
19
|
+
*
|
|
20
|
+
* - Storing data in a generic way using ERC725Y
|
|
21
|
+
* https://github.com/ERC725Alliance/ERC725/blob/develop/docs/ERC-725.md
|
|
22
|
+
*
|
|
23
|
+
* - Validating signatures using ERC1271
|
|
24
|
+
* https://eips.ethereum.org/EIPS/eip-1271
|
|
25
|
+
*
|
|
26
|
+
* - Receiving notification and react on them using LSP1
|
|
27
|
+
* https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-1-UniversalReceiver.md
|
|
28
|
+
*
|
|
29
|
+
* - Secure ownership management using LSP14
|
|
30
|
+
* https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-14-Ownable2Step.md
|
|
31
|
+
*
|
|
32
|
+
* - Extending the account with new functions and interfaceIds of future standards using LSP17
|
|
33
|
+
* https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-17-ContractExtension.md
|
|
34
|
+
*
|
|
35
|
+
* - Verifying calls on the owner to allow unified and standard interaction with the account using LSP20
|
|
36
|
+
* https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-20-CallVerification.md
|
|
11
37
|
*/
|
|
12
38
|
contract LSP0ERC725AccountInit is LSP0ERC725AccountInitAbstract {
|
|
13
39
|
/**
|
|
14
|
-
* @dev
|
|
40
|
+
* @dev initialize (= lock) base implementation contract on deployment
|
|
15
41
|
*/
|
|
16
42
|
constructor() {
|
|
17
43
|
_disableInitializers();
|
|
18
44
|
}
|
|
19
45
|
|
|
20
46
|
/**
|
|
21
|
-
* @
|
|
47
|
+
* @dev Sets the owner of the contract
|
|
22
48
|
* @param newOwner the owner of the contract
|
|
23
49
|
*/
|
|
24
50
|
function initialize(address newOwner) external payable virtual initializer {
|
|
@@ -7,11 +7,45 @@ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Ini
|
|
|
7
7
|
import {OwnableUnset} from "@erc725/smart-contracts/contracts/custom/OwnableUnset.sol";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* @title Inheritable Proxy Implementation of ERC725Account
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* @title Inheritable Proxy Implementation of LSP0-ERC725Account Standard
|
|
11
|
+
* https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md
|
|
12
|
+
*
|
|
13
|
+
* @author Fabian Vogelsteller <fabian@lukso.network>, Jean Cavallera (CJ42)
|
|
14
|
+
* @dev A smart contract account including basic functionalities such as:
|
|
15
|
+
*
|
|
16
|
+
* - Detecting supported standards using ERC165
|
|
17
|
+
* https://eips.ethereum.org/EIPS/eip-165
|
|
18
|
+
*
|
|
19
|
+
* - Executing several operation on other addresses including creating contracts using ERC725X
|
|
20
|
+
* https://github.com/ERC725Alliance/ERC725/blob/develop/docs/ERC-725.md
|
|
21
|
+
*
|
|
22
|
+
* - Storing data in a generic way using ERC725Y
|
|
23
|
+
* https://github.com/ERC725Alliance/ERC725/blob/develop/docs/ERC-725.md
|
|
24
|
+
*
|
|
25
|
+
* - Validating signatures using ERC1271
|
|
26
|
+
* https://eips.ethereum.org/EIPS/eip-1271
|
|
27
|
+
*
|
|
28
|
+
* - Receiving notification and react on them using LSP1
|
|
29
|
+
* https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-1-UniversalReceiver.md
|
|
30
|
+
*
|
|
31
|
+
* - Secure ownership management using LSP14
|
|
32
|
+
* https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-14-Ownable2Step.md
|
|
33
|
+
*
|
|
34
|
+
* - Extending the account with new functions and interfaceIds of future standards using LSP17
|
|
35
|
+
* https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-17-ContractExtension.md
|
|
36
|
+
*
|
|
37
|
+
* - Verifying calls on the owner to allow unified and standard interaction with the account using LSP20
|
|
38
|
+
* https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-20-CallVerification.md
|
|
13
39
|
*/
|
|
14
40
|
abstract contract LSP0ERC725AccountInitAbstract is Initializable, LSP0ERC725AccountCore {
|
|
41
|
+
/**
|
|
42
|
+
* @notice Initializing the contract owner to: `newOwner`
|
|
43
|
+
* @dev Sets the owner of the contract. ERC725X & ERC725Y parent contracts
|
|
44
|
+
* are not initialised as they don't have non-zero initial state.
|
|
45
|
+
* If you decide to add non-zero initial state to any of those
|
|
46
|
+
* contracts, you MUST initialize them here
|
|
47
|
+
* @param newOwner the owner of the contract
|
|
48
|
+
*/
|
|
15
49
|
function _initialize(address newOwner) internal virtual onlyInitializing {
|
|
16
50
|
if (msg.value != 0) emit ValueReceived(msg.sender, msg.value);
|
|
17
51
|
OwnableUnset._setOwner(newOwner);
|
|
@@ -14,25 +14,25 @@ import "../LSP9Vault/LSP9Constants.sol";
|
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* @dev reverts when the value stored under the 'LSP10ReceivedVaults[]' data key is not valid.
|
|
17
|
-
* The value stored under this data key should be exactly
|
|
17
|
+
* The value stored under this data key should be exactly 16 bytes long.
|
|
18
18
|
*
|
|
19
19
|
* Only possible valid values are:
|
|
20
|
-
* - any valid
|
|
21
|
-
* i.e.
|
|
22
|
-
* i.e.
|
|
20
|
+
* - any valid uint128 values
|
|
21
|
+
* i.e. 0x00000000000000000000000000000000 (zero), meaning empty array, no vaults received.
|
|
22
|
+
* i.e. 0x00000000000000000000000000000005 (non-zero), meaning 5 array elements, 5 vaults received.
|
|
23
23
|
*
|
|
24
24
|
* - 0x (nothing stored under this data key, equivalent to empty array)
|
|
25
25
|
*
|
|
26
|
-
* @param
|
|
27
|
-
* @param invalidValueLength the invalid number of bytes stored under the LSP10ReceivedVaults[] data key (MUST be
|
|
26
|
+
* @param invalidValueStored the invalid value stored under the LSP10ReceivedVaults[] data key
|
|
27
|
+
* @param invalidValueLength the invalid number of bytes stored under the LSP10ReceivedVaults[] data key (MUST be 16 bytes long)
|
|
28
28
|
*/
|
|
29
|
-
error InvalidLSP10ReceivedVaultsArrayLength(bytes
|
|
29
|
+
error InvalidLSP10ReceivedVaultsArrayLength(bytes invalidValueStored, uint256 invalidValueLength);
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
|
-
* @dev reverts when the
|
|
33
|
-
* @param
|
|
32
|
+
* @dev reverts when the `LSP10Vaults[]` array reaches its maximum limit (max(uint128))
|
|
33
|
+
* @param notRegisteredVault the address of the vault that could not be registered
|
|
34
34
|
*/
|
|
35
|
-
error
|
|
35
|
+
error MaxLSP10VaultsCountReached(address notRegisteredVault);
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* @dev reverts when the vault index is superior to uint128
|
|
@@ -66,43 +66,35 @@ library LSP10Utils {
|
|
|
66
66
|
IERC725Y account = IERC725Y(receiver);
|
|
67
67
|
bytes memory encodedArrayLength = getLSP10ReceivedVaultsCount(account);
|
|
68
68
|
|
|
69
|
-
//
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
// CHECK it's either the first vault received,
|
|
70
|
+
// or the storage is already set with a valid `uint128` value
|
|
71
|
+
if (encodedArrayLength.length != 0 && encodedArrayLength.length != 16) {
|
|
72
|
+
revert InvalidLSP10ReceivedVaultsArrayLength({
|
|
73
|
+
invalidValueStored: encodedArrayLength,
|
|
74
|
+
invalidValueLength: encodedArrayLength.length
|
|
75
|
+
});
|
|
76
|
+
}
|
|
73
77
|
|
|
74
|
-
|
|
75
|
-
values[1] = bytes.concat(bytes20(vault));
|
|
78
|
+
uint128 oldArrayLength = uint128(bytes16(encodedArrayLength));
|
|
76
79
|
|
|
77
|
-
|
|
78
|
-
|
|
80
|
+
if (oldArrayLength == type(uint128).max) {
|
|
81
|
+
revert MaxLSP10VaultsCountReached({notRegisteredVault: vault});
|
|
82
|
+
}
|
|
79
83
|
|
|
80
|
-
|
|
81
|
-
} else if (encodedArrayLength.length == 32) {
|
|
82
|
-
uint256 oldArrayLength = uint256(bytes32(encodedArrayLength));
|
|
83
|
-
uint256 newArrayLength = oldArrayLength + 1;
|
|
84
|
+
uint128 newArrayLength = oldArrayLength + 1;
|
|
84
85
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
// store the number of received vaults incremented by 1
|
|
87
|
+
keys[0] = _LSP10_VAULTS_ARRAY_KEY;
|
|
88
|
+
values[0] = bytes.concat(bytes16(newArrayLength));
|
|
88
89
|
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
// store the address of the vault under the element key in the array
|
|
91
|
+
keys[1] = LSP2Utils.generateArrayElementKeyAtIndex(_LSP10_VAULTS_ARRAY_KEY, oldArrayLength);
|
|
92
|
+
values[1] = bytes.concat(bytes20(vault));
|
|
91
93
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
values[1] = bytes.concat(bytes20(vault));
|
|
97
|
-
|
|
98
|
-
keys[2] = vaultMapKey;
|
|
99
|
-
values[2] = bytes.concat(_INTERFACEID_LSP9, bytes8(uint64(oldArrayLength)));
|
|
100
|
-
} else {
|
|
101
|
-
revert InvalidLSP10ReceivedVaultsArrayLength(
|
|
102
|
-
encodedArrayLength,
|
|
103
|
-
encodedArrayLength.length
|
|
104
|
-
);
|
|
105
|
-
}
|
|
94
|
+
// store the interfaceId and the location in the array of the asset
|
|
95
|
+
// under the LSP5ReceivedAssetMap key
|
|
96
|
+
keys[2] = vaultMapKey;
|
|
97
|
+
values[2] = bytes.concat(_INTERFACEID_LSP9, bytes16(oldArrayLength));
|
|
106
98
|
}
|
|
107
99
|
|
|
108
100
|
/**
|
|
@@ -110,31 +102,41 @@ library LSP10Utils {
|
|
|
110
102
|
* @param sender The address sending the vault and where the Keys should be updated
|
|
111
103
|
* @param vaultMapKey The map key of the vault being sent containing the interfaceId of the
|
|
112
104
|
* vault and the index in the array
|
|
113
|
-
* @param
|
|
105
|
+
* @param vaultIndex The index where the vault address is stored under `LSP10Vaults[]` Array
|
|
114
106
|
*/
|
|
115
107
|
function generateSentVaultKeys(
|
|
116
108
|
address sender,
|
|
117
109
|
bytes32 vaultMapKey,
|
|
118
|
-
|
|
110
|
+
uint128 vaultIndex
|
|
119
111
|
) internal view returns (bytes32[] memory keys, bytes[] memory values) {
|
|
120
112
|
IERC725Y account = IERC725Y(sender);
|
|
113
|
+
bytes memory lsp10VaultsCountValue = getLSP10ReceivedVaultsCount(account);
|
|
114
|
+
|
|
115
|
+
if (lsp10VaultsCountValue.length != 16) {
|
|
116
|
+
revert InvalidLSP10ReceivedVaultsArrayLength({
|
|
117
|
+
invalidValueStored: lsp10VaultsCountValue,
|
|
118
|
+
invalidValueLength: lsp10VaultsCountValue.length
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
121
|
|
|
122
122
|
// Updating the number of the received vaults
|
|
123
|
-
|
|
123
|
+
uint128 oldArrayLength = uint128(bytes16(lsp10VaultsCountValue));
|
|
124
124
|
|
|
125
125
|
if (oldArrayLength > type(uint128).max) {
|
|
126
126
|
revert VaultIndexSuperiorToUint128(oldArrayLength);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
// Updating the number of the received vaults (decrementing by 1
|
|
130
|
+
uint128 newArrayLength = oldArrayLength - 1;
|
|
130
131
|
|
|
131
|
-
|
|
132
|
+
// Generate the element key in the array of the vault
|
|
132
133
|
bytes32 vaultInArrayKey = LSP2Utils.generateArrayElementKeyAtIndex(
|
|
133
134
|
_LSP10_VAULTS_ARRAY_KEY,
|
|
134
|
-
|
|
135
|
+
vaultIndex
|
|
135
136
|
);
|
|
136
137
|
|
|
137
|
-
|
|
138
|
+
// If the asset to remove is the last element in the array
|
|
139
|
+
if (vaultIndex == newArrayLength) {
|
|
138
140
|
/**
|
|
139
141
|
* We will be updating/removing 3 keys:
|
|
140
142
|
* - Keys[0]: [Update] The arrayLengthKey to contain the new number of the received vaults
|
|
@@ -144,18 +146,21 @@ library LSP10Utils {
|
|
|
144
146
|
keys = new bytes32[](3);
|
|
145
147
|
values = new bytes[](3);
|
|
146
148
|
|
|
149
|
+
// store the number of received vaults decremented by 1
|
|
147
150
|
keys[0] = _LSP10_VAULTS_ARRAY_KEY;
|
|
148
|
-
values[0] = bytes.concat(
|
|
151
|
+
values[0] = bytes.concat(bytes16(newArrayLength));
|
|
149
152
|
|
|
153
|
+
// remove the address of the vault from the element key
|
|
150
154
|
keys[1] = vaultInArrayKey;
|
|
151
155
|
values[1] = "";
|
|
152
156
|
|
|
157
|
+
// remove the interfaceId and the location in the array of the vault
|
|
153
158
|
keys[2] = vaultMapKey;
|
|
154
159
|
values[2] = "";
|
|
155
160
|
|
|
156
161
|
// Swapping last element in ArrayKey with the element in ArrayKey to remove || {Swap and pop} method;
|
|
157
162
|
// check https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/structs/EnumerableSet.sol#L80
|
|
158
|
-
} else {
|
|
163
|
+
} else if (vaultIndex < newArrayLength) {
|
|
159
164
|
/**
|
|
160
165
|
* We will be updating/removing 5 keys:
|
|
161
166
|
* - Keys[0]: [Update] The arrayLengthKey to contain the new number of the received vaults
|
|
@@ -167,46 +172,52 @@ library LSP10Utils {
|
|
|
167
172
|
keys = new bytes32[](5);
|
|
168
173
|
values = new bytes[](5);
|
|
169
174
|
|
|
175
|
+
// store the number of received vaults decremented by 1
|
|
170
176
|
keys[0] = _LSP10_VAULTS_ARRAY_KEY;
|
|
171
|
-
values[0] = bytes.concat(
|
|
177
|
+
values[0] = bytes.concat(bytes16(newArrayLength));
|
|
172
178
|
|
|
179
|
+
// remove the interfaceId and the location in the array of the vault
|
|
173
180
|
keys[1] = vaultMapKey;
|
|
174
181
|
values[1] = "";
|
|
175
182
|
|
|
176
183
|
// Generate all data Keys/values of the last element in Array to swap
|
|
177
184
|
// with data Keys/values of the vault to remove
|
|
185
|
+
|
|
186
|
+
// Generate the element key of the last vault in the array
|
|
178
187
|
bytes32 lastVaultInArrayKey = LSP2Utils.generateArrayElementKeyAtIndex(
|
|
179
188
|
_LSP10_VAULTS_ARRAY_KEY,
|
|
180
189
|
newArrayLength
|
|
181
190
|
);
|
|
182
191
|
|
|
192
|
+
// Get the address of the vault from the element key of the last vault in the array
|
|
183
193
|
bytes20 lastVaultInArrayAddress = bytes20(account.getData(lastVaultInArrayKey));
|
|
184
194
|
|
|
195
|
+
// Generate the map key of the last vault in the array
|
|
185
196
|
bytes32 lastVaultInArrayMapKey = LSP2Utils.generateMappingKey(
|
|
186
197
|
_LSP10_VAULTS_MAP_KEY_PREFIX,
|
|
187
198
|
lastVaultInArrayAddress
|
|
188
199
|
);
|
|
189
200
|
|
|
201
|
+
// Set the address of the last vault instead of the asset to be sent
|
|
202
|
+
// under the element data key in the array
|
|
190
203
|
keys[2] = vaultInArrayKey;
|
|
191
204
|
values[2] = bytes.concat(lastVaultInArrayAddress);
|
|
192
205
|
|
|
206
|
+
// Remove the address swapped (last vault in the array) from the last element data key in the array
|
|
193
207
|
keys[3] = lastVaultInArrayKey;
|
|
194
208
|
values[3] = "";
|
|
195
209
|
|
|
210
|
+
// Update the index and the interfaceId of the address swapped (last vault in the array)
|
|
211
|
+
// to point to the new location in the LSP10Vaults array
|
|
196
212
|
keys[4] = lastVaultInArrayMapKey;
|
|
197
|
-
values[4] = bytes.concat(_INTERFACEID_LSP9,
|
|
213
|
+
values[4] = bytes.concat(_INTERFACEID_LSP9, bytes16(vaultIndex));
|
|
214
|
+
} else {
|
|
215
|
+
// If index is bigger than the array length, out of bounds
|
|
216
|
+
return (keys, values);
|
|
198
217
|
}
|
|
199
218
|
}
|
|
200
219
|
|
|
201
220
|
function getLSP10ReceivedVaultsCount(IERC725Y account) internal view returns (bytes memory) {
|
|
202
221
|
return account.getData(_LSP10_VAULTS_ARRAY_KEY);
|
|
203
222
|
}
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* @dev returns the index from a maping
|
|
207
|
-
*/
|
|
208
|
-
function extractIndexFromMap(bytes memory mapValue) internal pure returns (uint64) {
|
|
209
|
-
bytes memory val = BytesLib.slice(mapValue, 4, 8);
|
|
210
|
-
return BytesLib.toUint64(val, 0);
|
|
211
|
-
}
|
|
212
223
|
}
|
|
@@ -12,7 +12,6 @@ import {ERC725} from "@erc725/smart-contracts/contracts/ERC725.sol";
|
|
|
12
12
|
import {OwnableUnset} from "@erc725/smart-contracts/contracts/custom/OwnableUnset.sol";
|
|
13
13
|
import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
|
|
14
14
|
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
|
|
15
|
-
import {LSP6KeyManager} from "../LSP6KeyManager/LSP6KeyManager.sol";
|
|
16
15
|
|
|
17
16
|
// constants
|
|
18
17
|
import {ALL_REGULAR_PERMISSIONS} from "../LSP6KeyManager/LSP6Constants.sol";
|
|
@@ -191,12 +190,11 @@ abstract contract LSP11BasicSocialRecoveryCore is OwnableUnset, ERC165, ILSP11Ba
|
|
|
191
190
|
address keyManager = ERC725(target_).owner();
|
|
192
191
|
|
|
193
192
|
// Setting permissions for `recoverer`
|
|
194
|
-
(bytes32[] memory keys, bytes[] memory values) = LSP6Utils
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
);
|
|
193
|
+
(bytes32[] memory keys, bytes[] memory values) = LSP6Utils.generateNewPermissionsKeys(
|
|
194
|
+
ERC725(target_),
|
|
195
|
+
recoverer,
|
|
196
|
+
ALL_REGULAR_PERMISSIONS
|
|
197
|
+
);
|
|
200
198
|
|
|
201
199
|
LSP6Utils.setDataViaKeyManager(keyManager, keys, values);
|
|
202
200
|
|
|
@@ -32,22 +32,45 @@ interface ILSP14Ownable2Step {
|
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
|
-
* @dev
|
|
35
|
+
* @dev The address that ownership of the contract is transferred to.
|
|
36
|
+
* This address may use `acceptOwnership()` to gain ownership of the contract.
|
|
36
37
|
*/
|
|
37
38
|
function pendingOwner() external view returns (address);
|
|
38
39
|
|
|
39
40
|
/**
|
|
40
|
-
* @dev Initiate the process of transferring ownership of the contract by setting the pending owner.
|
|
41
|
+
* @dev Initiate the process of transferring ownership of the contract by setting the new owner as the pending owner.
|
|
42
|
+
*
|
|
43
|
+
* If the new owner is a contract that supports + implements LSP1, this will also attempt to notify the new owner that
|
|
44
|
+
* ownership has been transferred to them by calling the `universalReceiver(...)` function on the `newOwner` contract.
|
|
45
|
+
*
|
|
46
|
+
* @param newOwner the address of the new owner.
|
|
47
|
+
*
|
|
48
|
+
* Requirements:
|
|
49
|
+
* - `newOwner` MUST NOT accept ownership of the contract in the same transaction.
|
|
41
50
|
*/
|
|
42
51
|
function transferOwnership(address newOwner) external;
|
|
43
52
|
|
|
44
53
|
/**
|
|
45
|
-
* @dev
|
|
54
|
+
* @dev Transfer ownership of the contract from the current `owner()` to the `pendingOwner()`.
|
|
55
|
+
*
|
|
56
|
+
* Once this function is called:
|
|
57
|
+
* - the current `owner()` will loose access to the functions restricted to the `owner()` only.
|
|
58
|
+
* - the `pendingOwner()` will gain access to the functions restricted to the `owner()` only.
|
|
59
|
+
*
|
|
60
|
+
* Requirements:
|
|
61
|
+
* - MUST be called by the pendingOwner.
|
|
46
62
|
*/
|
|
47
63
|
function acceptOwnership() external;
|
|
48
64
|
|
|
49
65
|
/**
|
|
50
|
-
* @dev
|
|
66
|
+
* @dev Renounce ownership of the contract in a 2-step process.
|
|
67
|
+
*
|
|
68
|
+
* 1. the first call will initiate the process of renouncing ownership.
|
|
69
|
+
* 2. the second is used as a confirmation and will leave the contract without an owner.
|
|
70
|
+
*
|
|
71
|
+
* WARNING: once ownership of the contract has been renounced, any functions
|
|
72
|
+
* that are restricted to be called by the owner will be permanently inaccessible,
|
|
73
|
+
* making these functions not callable anymore and unusable.
|
|
51
74
|
*/
|
|
52
75
|
function renounceOwnership() external;
|
|
53
76
|
}
|
|
@@ -3,11 +3,12 @@ pragma solidity ^0.8.4;
|
|
|
3
3
|
|
|
4
4
|
// interfaces
|
|
5
5
|
import {ILSP14Ownable2Step} from "./ILSP14Ownable2Step.sol";
|
|
6
|
-
import {ILSP1UniversalReceiver} from "../LSP1UniversalReceiver/ILSP1UniversalReceiver.sol";
|
|
7
6
|
|
|
8
7
|
// modules
|
|
9
8
|
import {OwnableUnset} from "@erc725/smart-contracts/contracts/custom/OwnableUnset.sol";
|
|
10
|
-
|
|
9
|
+
|
|
10
|
+
// libraries
|
|
11
|
+
import {LSP1Utils} from "../LSP1UniversalReceiver/LSP1Utils.sol";
|
|
11
12
|
|
|
12
13
|
// errors
|
|
13
14
|
import "./LSP14Errors.sol";
|
|
@@ -18,7 +19,6 @@ import {
|
|
|
18
19
|
_TYPEID_LSP14_OwnershipTransferred_SenderNotification,
|
|
19
20
|
_TYPEID_LSP14_OwnershipTransferred_RecipientNotification
|
|
20
21
|
} from "./LSP14Constants.sol";
|
|
21
|
-
import {_INTERFACEID_LSP1} from "../LSP1UniversalReceiver/LSP1Constants.sol";
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* @title LSP14Ownable2Step
|
|
@@ -28,33 +28,29 @@ import {_INTERFACEID_LSP1} from "../LSP1UniversalReceiver/LSP1Constants.sol";
|
|
|
28
28
|
* transferring ownership of the contract, where the control of the contract could be lost forever.
|
|
29
29
|
*/
|
|
30
30
|
abstract contract LSP14Ownable2Step is ILSP14Ownable2Step, OwnableUnset {
|
|
31
|
+
using LSP1Utils for address;
|
|
32
|
+
|
|
31
33
|
/**
|
|
32
34
|
* @dev The number of block that MUST pass before one is able to
|
|
33
35
|
* confirm renouncing ownership
|
|
34
36
|
*/
|
|
35
|
-
uint256 public constant RENOUNCE_OWNERSHIP_CONFIRMATION_DELAY =
|
|
37
|
+
uint256 public constant RENOUNCE_OWNERSHIP_CONFIRMATION_DELAY = 200;
|
|
36
38
|
|
|
37
39
|
/**
|
|
38
40
|
* @dev The number of blocks during which one can renounce ownership
|
|
39
41
|
*/
|
|
40
|
-
uint256 public constant RENOUNCE_OWNERSHIP_CONFIRMATION_PERIOD =
|
|
42
|
+
uint256 public constant RENOUNCE_OWNERSHIP_CONFIRMATION_PERIOD = 200;
|
|
41
43
|
|
|
42
44
|
/**
|
|
43
|
-
* @dev The block number saved when initiating the process of
|
|
44
|
-
* renouncing ownerhsip
|
|
45
|
+
* @dev The block number saved when initiating the process of renouncing ownerhsip
|
|
45
46
|
*/
|
|
46
47
|
uint256 private _renounceOwnershipStartedAt;
|
|
47
48
|
|
|
48
49
|
/**
|
|
49
|
-
* @dev
|
|
50
|
-
* This address may use `acceptOwnership()` to gain ownership of the contract.
|
|
51
|
-
* Meaning that the current owner will lose access to the methods marked as
|
|
52
|
-
* `onlyOwner` in favor to the `_pendingOwner`.
|
|
50
|
+
* @dev see `pendingOwner()`
|
|
53
51
|
*/
|
|
54
52
|
address private _pendingOwner;
|
|
55
53
|
|
|
56
|
-
// --- General Methods
|
|
57
|
-
|
|
58
54
|
/**
|
|
59
55
|
* @inheritdoc ILSP14Ownable2Step
|
|
60
56
|
*/
|
|
@@ -72,13 +68,34 @@ abstract contract LSP14Ownable2Step is ILSP14Ownable2Step, OwnableUnset {
|
|
|
72
68
|
onlyOwner
|
|
73
69
|
{
|
|
74
70
|
_transferOwnership(newOwner);
|
|
71
|
+
|
|
72
|
+
address currentOwner = owner();
|
|
73
|
+
emit OwnershipTransferStarted(currentOwner, newOwner);
|
|
74
|
+
|
|
75
|
+
newOwner.tryNotifyUniversalReceiver(_TYPEID_LSP14_OwnershipTransferStarted, "");
|
|
76
|
+
require(
|
|
77
|
+
currentOwner == owner(),
|
|
78
|
+
"LSP14: newOwner MUST accept ownership in a separate transaction"
|
|
79
|
+
);
|
|
75
80
|
}
|
|
76
81
|
|
|
77
82
|
/**
|
|
78
83
|
* @inheritdoc ILSP14Ownable2Step
|
|
79
84
|
*/
|
|
80
85
|
function acceptOwnership() public virtual {
|
|
86
|
+
address previousOwner = owner();
|
|
87
|
+
|
|
81
88
|
_acceptOwnership();
|
|
89
|
+
|
|
90
|
+
previousOwner.tryNotifyUniversalReceiver(
|
|
91
|
+
_TYPEID_LSP14_OwnershipTransferred_SenderNotification,
|
|
92
|
+
""
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
msg.sender.tryNotifyUniversalReceiver(
|
|
96
|
+
_TYPEID_LSP14_OwnershipTransferred_RecipientNotification,
|
|
97
|
+
""
|
|
98
|
+
);
|
|
82
99
|
}
|
|
83
100
|
|
|
84
101
|
/**
|
|
@@ -96,45 +113,34 @@ abstract contract LSP14Ownable2Step is ILSP14Ownable2Step, OwnableUnset {
|
|
|
96
113
|
// --- Internal methods
|
|
97
114
|
|
|
98
115
|
/**
|
|
99
|
-
* @dev
|
|
100
|
-
*
|
|
116
|
+
* @dev set the pending owner of the contract and cancel any renounce ownership
|
|
117
|
+
* process that was previously started.
|
|
118
|
+
*
|
|
119
|
+
* @param newOwner The address of the new pending owner.
|
|
101
120
|
*
|
|
102
121
|
* Requirements:
|
|
103
|
-
* - `newOwner`
|
|
122
|
+
* - `newOwner` cannot be the address of the contract itself.
|
|
104
123
|
*/
|
|
105
124
|
function _transferOwnership(address newOwner) internal virtual {
|
|
106
125
|
if (newOwner == address(this)) revert CannotTransferOwnershipToSelf();
|
|
107
126
|
|
|
108
127
|
_pendingOwner = newOwner;
|
|
109
128
|
delete _renounceOwnershipStartedAt;
|
|
110
|
-
address currentOwner = owner();
|
|
111
|
-
emit OwnershipTransferStarted(currentOwner, newOwner);
|
|
112
|
-
|
|
113
|
-
_notifyLSP1SenderOnOwnershipTransferStart(newOwner, "");
|
|
114
|
-
require(
|
|
115
|
-
currentOwner == owner(),
|
|
116
|
-
"LSP14: newOwner MUST accept ownership in a separate transaction"
|
|
117
|
-
);
|
|
118
129
|
}
|
|
119
130
|
|
|
120
131
|
/**
|
|
121
|
-
* @dev
|
|
122
|
-
* previous owner and the new owner that ownership has been transferred.
|
|
132
|
+
* @dev set the pending owner of the contract as the new owner.
|
|
123
133
|
*/
|
|
124
134
|
function _acceptOwnership() internal virtual {
|
|
125
135
|
require(msg.sender == pendingOwner(), "LSP14: caller is not the pendingOwner");
|
|
126
136
|
|
|
127
|
-
address previousOwner = owner();
|
|
128
137
|
_setOwner(msg.sender);
|
|
129
138
|
delete _pendingOwner;
|
|
130
|
-
|
|
131
|
-
_notifyLSP1SenderOnOwnershipTransferCompletion(previousOwner, "");
|
|
132
|
-
_notifyLSP1RecipientOnOwnershipTransferCompletion(msg.sender, "");
|
|
133
139
|
}
|
|
134
140
|
|
|
135
141
|
/**
|
|
136
|
-
* @dev initiate or confirm the process of renouncing ownership
|
|
137
|
-
*
|
|
142
|
+
* @dev initiate or confirm the process of renouncing ownership
|
|
143
|
+
* after a specific delay of blocks have passed.
|
|
138
144
|
*/
|
|
139
145
|
function _renounceOwnership() internal virtual {
|
|
140
146
|
uint256 currentBlock = block.number;
|
|
@@ -143,7 +149,9 @@ abstract contract LSP14Ownable2Step is ILSP14Ownable2Step, OwnableUnset {
|
|
|
143
149
|
uint256 confirmationPeriodEnd = confirmationPeriodStart +
|
|
144
150
|
RENOUNCE_OWNERSHIP_CONFIRMATION_PERIOD;
|
|
145
151
|
|
|
146
|
-
|
|
152
|
+
// On the creation of a new network, `currentBlock` will be smaller than `confirmationPeriodEnd`,
|
|
153
|
+
// `_renounceOwnershipStartedAt == 0` will indicate that a renounceOwnership call is happening for the first time
|
|
154
|
+
if (currentBlock > confirmationPeriodEnd || _renounceOwnershipStartedAt == 0) {
|
|
147
155
|
_renounceOwnershipStartedAt = currentBlock;
|
|
148
156
|
delete _pendingOwner;
|
|
149
157
|
emit RenounceOwnershipStarted();
|
|
@@ -156,57 +164,6 @@ abstract contract LSP14Ownable2Step is ILSP14Ownable2Step, OwnableUnset {
|
|
|
156
164
|
|
|
157
165
|
_setOwner(address(0));
|
|
158
166
|
delete _renounceOwnershipStartedAt;
|
|
159
|
-
delete _pendingOwner;
|
|
160
167
|
emit OwnershipRenounced();
|
|
161
168
|
}
|
|
162
|
-
|
|
163
|
-
// --- URD Hooks
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* @dev Calls the universalReceiver function of the sender when ownership transfer starts
|
|
167
|
-
* if supports LSP1 InterfaceId
|
|
168
|
-
*/
|
|
169
|
-
function _notifyLSP1SenderOnOwnershipTransferStart(address notifiedContract, bytes memory data)
|
|
170
|
-
internal
|
|
171
|
-
virtual
|
|
172
|
-
{
|
|
173
|
-
if (ERC165Checker.supportsERC165InterfaceUnchecked(notifiedContract, _INTERFACEID_LSP1)) {
|
|
174
|
-
ILSP1UniversalReceiver(notifiedContract).universalReceiver(
|
|
175
|
-
_TYPEID_LSP14_OwnershipTransferStarted,
|
|
176
|
-
data
|
|
177
|
-
);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* @dev Calls the universalReceiver function of the sender when ownerhsip transfer is complete
|
|
183
|
-
* if supports LSP1 InterfaceId
|
|
184
|
-
*/
|
|
185
|
-
function _notifyLSP1SenderOnOwnershipTransferCompletion(
|
|
186
|
-
address notifiedContract,
|
|
187
|
-
bytes memory data
|
|
188
|
-
) internal virtual {
|
|
189
|
-
if (ERC165Checker.supportsERC165InterfaceUnchecked(notifiedContract, _INTERFACEID_LSP1)) {
|
|
190
|
-
ILSP1UniversalReceiver(notifiedContract).universalReceiver(
|
|
191
|
-
_TYPEID_LSP14_OwnershipTransferred_SenderNotification,
|
|
192
|
-
data
|
|
193
|
-
);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* @dev Calls the universalReceiver function of the recipient when ownerhsip transfer is complete
|
|
199
|
-
* if supports LSP1 InterfaceId
|
|
200
|
-
*/
|
|
201
|
-
function _notifyLSP1RecipientOnOwnershipTransferCompletion(
|
|
202
|
-
address notifiedContract,
|
|
203
|
-
bytes memory data
|
|
204
|
-
) internal virtual {
|
|
205
|
-
if (ERC165Checker.supportsERC165InterfaceUnchecked(notifiedContract, _INTERFACEID_LSP1)) {
|
|
206
|
-
ILSP1UniversalReceiver(notifiedContract).universalReceiver(
|
|
207
|
-
_TYPEID_LSP14_OwnershipTransferred_RecipientNotification,
|
|
208
|
-
data
|
|
209
|
-
);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
169
|
}
|