@lukso/lsp-smart-contracts 0.11.1 → 0.12.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 +10 -2
- package/artifacts/Create2Factory.json +2 -2
- package/artifacts/LSP0ERC725Account.json +68 -47
- package/artifacts/LSP0ERC725AccountInit.json +68 -47
- package/artifacts/LSP11BasicSocialRecovery.json +18 -2
- package/artifacts/LSP11BasicSocialRecoveryInit.json +18 -2
- package/artifacts/LSP16UniversalFactory.json +3 -3
- package/artifacts/LSP1UniversalReceiverDelegateUP.json +27 -46
- package/artifacts/LSP1UniversalReceiverDelegateVault.json +27 -46
- package/artifacts/LSP23LinkedContractsFactory.json +3 -3
- package/artifacts/LSP4DigitalAssetMetadata.json +16 -0
- package/artifacts/LSP4DigitalAssetMetadataInitAbstract.json +16 -0
- package/artifacts/LSP6KeyManager.json +34 -6
- package/artifacts/LSP6KeyManagerInit.json +34 -6
- package/artifacts/LSP7CappedSupply.json +64 -4
- package/artifacts/LSP7CappedSupplyInitAbstract.json +64 -4
- package/artifacts/LSP7CompatibleERC20.json +83 -23
- package/artifacts/LSP7CompatibleERC20InitAbstract.json +83 -23
- package/artifacts/LSP7CompatibleERC20Mintable.json +86 -26
- package/artifacts/LSP7CompatibleERC20MintableInit.json +86 -26
- package/artifacts/LSP7DigitalAsset.json +64 -4
- package/artifacts/LSP7DigitalAssetInitAbstract.json +64 -4
- package/artifacts/LSP7Mintable.json +67 -7
- package/artifacts/LSP7MintableInit.json +67 -7
- package/artifacts/LSP8CappedSupply.json +57 -3
- package/artifacts/LSP8CappedSupplyInitAbstract.json +57 -3
- package/artifacts/LSP8CompatibleERC721.json +79 -25
- package/artifacts/LSP8CompatibleERC721InitAbstract.json +79 -25
- package/artifacts/LSP8CompatibleERC721Mintable.json +87 -28
- package/artifacts/LSP8CompatibleERC721MintableInit.json +87 -28
- package/artifacts/LSP8IdentifiableDigitalAsset.json +57 -3
- package/artifacts/LSP8IdentifiableDigitalAssetInitAbstract.json +57 -3
- package/artifacts/LSP8Mintable.json +65 -6
- package/artifacts/LSP8MintableInit.json +65 -6
- package/artifacts/LSP9Vault.json +51 -35
- package/artifacts/LSP9VaultInit.json +51 -35
- package/artifacts/UniversalProfile.json +68 -47
- package/artifacts/UniversalProfileInit.json +68 -47
- package/contracts/Factories/Create2Factory.sol +1 -1
- package/contracts/LSP0ERC725Account/ILSP0ERC725Account.sol +0 -22
- package/contracts/LSP0ERC725Account/LSP0Constants.sol +6 -1
- package/contracts/LSP0ERC725Account/LSP0ERC725Account.sol +12 -2
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +196 -123
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountInit.sol +1 -1
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountInitAbstract.sol +11 -2
- package/contracts/LSP10ReceivedVaults/LSP10Utils.sol +5 -3
- package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecoveryCore.sol +54 -14
- package/contracts/LSP11BasicSocialRecovery/LSP11Constants.sol +1 -1
- package/contracts/LSP11BasicSocialRecovery/LSP11Errors.sol +1 -1
- package/contracts/LSP14Ownable2Step/ILSP14Ownable2Step.sol +2 -2
- package/contracts/LSP14Ownable2Step/LSP14Constants.sol +1 -1
- package/contracts/LSP14Ownable2Step/LSP14Errors.sol +9 -3
- package/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol +16 -12
- package/contracts/LSP16UniversalFactory/LSP16UniversalFactory.sol +65 -96
- package/contracts/LSP17ContractExtension/LSP17Errors.sol +1 -1
- package/contracts/LSP17ContractExtension/LSP17Extendable.sol +22 -15
- package/contracts/LSP17ContractExtension/LSP17Extension.sol +6 -5
- package/contracts/LSP17Extensions/Extension4337.sol +101 -0
- package/contracts/LSP17Extensions/OnERC721ReceivedExtension.sol +15 -0
- package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiver.sol +1 -2
- package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiverDelegate.sol +24 -0
- package/contracts/LSP1UniversalReceiver/LSP1Constants.sol +1 -0
- package/contracts/LSP1UniversalReceiver/LSP1Errors.sol +0 -6
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol +49 -33
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol +33 -27
- package/contracts/LSP1UniversalReceiver/LSP1Utils.sol +5 -48
- package/contracts/LSP20CallVerification/ILSP20CallVerifier.sol +13 -9
- package/contracts/LSP20CallVerification/LSP20CallVerification.sol +64 -45
- package/contracts/LSP20CallVerification/LSP20Constants.sol +6 -6
- package/contracts/LSP20CallVerification/LSP20Errors.sol +10 -4
- package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/ILSP23LinkedContractsFactory.sol +1 -1
- package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/IPostDeploymentModule.sol +1 -1
- package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/LSP23Errors.sol +1 -1
- package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/LSP23LinkedContractsFactory.sol +5 -1
- package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/modules/UniversalProfileInitPostDeploymentModule.sol +1 -1
- package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/modules/UniversalProfilePostDeploymentModule.sol +1 -1
- package/contracts/LSP25ExecuteRelayCall/LSP25Constants.sol +1 -1
- package/contracts/LSP25ExecuteRelayCall/LSP25MultiChannelNonce.sol +8 -3
- package/contracts/LSP2ERC725YJSONSchema/LSP2Utils.sol +1 -97
- package/contracts/LSP3ProfileMetadata/LSP3Constants.sol +1 -1
- package/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol +1 -1
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol +8 -3
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol +8 -3
- package/contracts/LSP5ReceivedAssets/LSP5Utils.sol +4 -3
- package/contracts/LSP6KeyManager/LSP6Constants.sol +4 -3
- package/contracts/LSP6KeyManager/LSP6Errors.sol +2 -23
- package/contracts/LSP6KeyManager/LSP6KeyManager.sol +0 -1
- package/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol +176 -101
- package/contracts/LSP6KeyManager/LSP6KeyManagerInitAbstract.sol +0 -1
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6ExecuteModule.sol +1 -2
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6ExecuteRelayCallModule.sol +27 -0
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6SetDataModule.sol +34 -28
- package/contracts/LSP6KeyManager/LSP6Utils.sol +29 -2
- package/contracts/LSP7DigitalAsset/ILSP7DigitalAsset.sol +70 -10
- package/contracts/LSP7DigitalAsset/LSP7Constants.sol +2 -2
- package/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol +29 -13
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +273 -265
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol +28 -12
- package/contracts/LSP7DigitalAsset/LSP7Errors.sol +17 -3
- package/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol +5 -1
- package/contracts/LSP7DigitalAsset/extensions/LSP7BurnableInitAbstract.sol +4 -1
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol +7 -7
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyInitAbstract.sol +3 -3
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol +128 -54
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20InitAbstract.sol +129 -54
- package/contracts/LSP7DigitalAsset/presets/ILSP7Mintable.sol +3 -3
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol +4 -4
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInit.sol +2 -2
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInitAbstract.sol +4 -4
- package/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol +4 -4
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableInit.sol +1 -1
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol +4 -4
- package/contracts/LSP8IdentifiableDigitalAsset/ILSP8IdentifiableDigitalAsset.sol +16 -11
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol +20 -6
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Errors.sol +32 -16
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol +67 -16
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +143 -137
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol +69 -15
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol +1 -1
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8BurnableInitAbstract.sol +1 -1
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol +7 -7
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInitAbstract.sol +3 -3
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol +172 -80
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol +178 -91
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol +7 -7
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableInitAbstract.sol +7 -7
- package/contracts/LSP8IdentifiableDigitalAsset/presets/ILSP8Mintable.sol +3 -3
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol +8 -7
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol +5 -3
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.sol +13 -7
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol +9 -8
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInit.sol +9 -3
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol +10 -8
- package/contracts/LSP9Vault/ILSP9Vault.sol +0 -21
- package/contracts/LSP9Vault/LSP9Constants.sol +6 -1
- package/contracts/LSP9Vault/LSP9Errors.sol +1 -1
- package/contracts/LSP9Vault/LSP9Vault.sol +11 -2
- package/contracts/LSP9Vault/LSP9VaultCore.sol +119 -66
- package/contracts/LSP9Vault/LSP9VaultInit.sol +1 -1
- package/contracts/LSP9Vault/LSP9VaultInitAbstract.sol +11 -2
- package/contracts/UniversalProfile.sol +1 -1
- package/contracts/UniversalProfileInit.sol +1 -1
- package/contracts/UniversalProfileInitAbstract.sol +1 -1
- package/contracts/Version.sol +16 -0
- package/devdocs/LSP0ERC725Account.json +86 -52
- package/devdocs/LSP0ERC725AccountInit.json +86 -52
- package/devdocs/LSP11BasicSocialRecovery.json +13 -0
- package/devdocs/LSP11BasicSocialRecoveryInit.json +13 -0
- package/devdocs/LSP16UniversalFactory.json +9 -9
- package/devdocs/LSP1UniversalReceiverDelegateUP.json +7 -6
- package/devdocs/LSP1UniversalReceiverDelegateVault.json +7 -6
- package/devdocs/LSP4DigitalAssetMetadata.json +32 -10
- package/devdocs/LSP4DigitalAssetMetadataInitAbstract.json +32 -10
- package/devdocs/LSP6KeyManager.json +27 -13
- package/devdocs/LSP6KeyManagerInit.json +27 -13
- package/devdocs/LSP7CappedSupply.json +61 -28
- package/devdocs/LSP7CappedSupplyInitAbstract.json +61 -28
- package/devdocs/LSP7CompatibleERC20.json +102 -32
- package/devdocs/LSP7CompatibleERC20InitAbstract.json +102 -32
- package/devdocs/LSP7CompatibleERC20Mintable.json +102 -32
- package/devdocs/LSP7CompatibleERC20MintableInit.json +102 -32
- package/devdocs/LSP7DigitalAsset.json +61 -28
- package/devdocs/LSP7DigitalAssetInitAbstract.json +61 -28
- package/devdocs/LSP7Mintable.json +61 -28
- package/devdocs/LSP7MintableInit.json +61 -28
- package/devdocs/LSP8CappedSupply.json +66 -27
- package/devdocs/LSP8CappedSupplyInitAbstract.json +66 -27
- package/devdocs/LSP8CompatibleERC721.json +93 -33
- package/devdocs/LSP8CompatibleERC721InitAbstract.json +93 -33
- package/devdocs/LSP8CompatibleERC721Mintable.json +95 -35
- package/devdocs/LSP8CompatibleERC721MintableInit.json +96 -36
- package/devdocs/LSP8IdentifiableDigitalAsset.json +70 -28
- package/devdocs/LSP8IdentifiableDigitalAssetInitAbstract.json +66 -27
- package/devdocs/LSP8Mintable.json +68 -29
- package/devdocs/LSP8MintableInit.json +69 -30
- package/devdocs/LSP9Vault.json +69 -41
- package/devdocs/LSP9VaultInit.json +69 -41
- package/devdocs/UniversalProfile.json +86 -52
- package/devdocs/UniversalProfileInit.json +86 -52
- package/dist/constants.cjs.js +5565 -2846
- package/dist/constants.d.ts +3996 -1182
- package/dist/constants.es.js +5564 -2846
- package/package.json +8 -8
- package/userdocs/LSP0ERC725Account.json +20 -11
- package/userdocs/LSP0ERC725AccountInit.json +20 -11
- package/userdocs/LSP16UniversalFactory.json +26 -1
- package/userdocs/LSP1UniversalReceiverDelegateUP.json +4 -11
- package/userdocs/LSP1UniversalReceiverDelegateVault.json +4 -11
- package/userdocs/LSP4DigitalAssetMetadata.json +7 -4
- package/userdocs/LSP4DigitalAssetMetadataInitAbstract.json +7 -4
- package/userdocs/LSP6KeyManager.json +3 -5
- package/userdocs/LSP6KeyManagerInit.json +3 -5
- package/userdocs/LSP7CappedSupply.json +17 -6
- package/userdocs/LSP7CappedSupplyInitAbstract.json +16 -5
- package/userdocs/LSP7CompatibleERC20.json +18 -5
- package/userdocs/LSP7CompatibleERC20InitAbstract.json +18 -5
- package/userdocs/LSP7CompatibleERC20Mintable.json +18 -5
- package/userdocs/LSP7CompatibleERC20MintableInit.json +18 -5
- package/userdocs/LSP7DigitalAsset.json +18 -5
- package/userdocs/LSP7DigitalAssetInitAbstract.json +18 -5
- package/userdocs/LSP7Mintable.json +18 -5
- package/userdocs/LSP7MintableInit.json +18 -5
- package/userdocs/LSP8CappedSupply.json +16 -5
- package/userdocs/LSP8CappedSupplyInitAbstract.json +15 -4
- package/userdocs/LSP8CompatibleERC721.json +30 -17
- package/userdocs/LSP8CompatibleERC721InitAbstract.json +30 -17
- package/userdocs/LSP8CompatibleERC721Mintable.json +31 -18
- package/userdocs/LSP8CompatibleERC721MintableInit.json +32 -19
- package/userdocs/LSP8IdentifiableDigitalAsset.json +18 -5
- package/userdocs/LSP8IdentifiableDigitalAssetInitAbstract.json +17 -4
- package/userdocs/LSP8Mintable.json +18 -5
- package/userdocs/LSP8MintableInit.json +19 -6
- package/userdocs/LSP9Vault.json +23 -14
- package/userdocs/LSP9VaultInit.json +23 -14
- package/userdocs/UniversalProfile.json +20 -11
- package/userdocs/UniversalProfileInit.json +20 -11
- package/CONTRIBUTING.md +0 -184
- package/artifacts/LSP4Compatibility.json +0 -216
- package/contracts/LSP4DigitalAssetMetadata/ILSP4Compatibility.sol +0 -25
- package/contracts/LSP4DigitalAssetMetadata/LSP4Compatibility.sol +0 -38
- package/contracts/LSP7DigitalAsset/extensions/ILSP7CompatibleERC20.sol +0 -83
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CompatibleERC721.sol +0 -175
- package/devdocs/LSP4Compatibility.json +0 -79
- package/userdocs/LSP4Compatibility.json +0 -20
|
@@ -38,7 +38,7 @@ contract LSP0ERC725AccountInit is LSP0ERC725AccountInitAbstract {
|
|
|
38
38
|
* @param initialOwner The owner of the contract.
|
|
39
39
|
*
|
|
40
40
|
* @custom:events
|
|
41
|
-
* - {
|
|
41
|
+
* - {UniversalReceiver} event when funding the contract on deployment.
|
|
42
42
|
* - {OwnershipTransferred} event when `initialOwner` is set as the contract {owner}.
|
|
43
43
|
*/
|
|
44
44
|
function initialize(
|
|
@@ -10,6 +10,9 @@ import {
|
|
|
10
10
|
OwnableUnset
|
|
11
11
|
} from "@erc725/smart-contracts/contracts/custom/OwnableUnset.sol";
|
|
12
12
|
|
|
13
|
+
// constants
|
|
14
|
+
import {_TYPEID_LSP0_VALUE_RECEIVED} from "./LSP0Constants.sol";
|
|
15
|
+
|
|
13
16
|
/**
|
|
14
17
|
* @title Inheritable Proxy Implementation of [LSP-0-ERC725Account] Standard.
|
|
15
18
|
*
|
|
@@ -27,14 +30,20 @@ abstract contract LSP0ERC725AccountInitAbstract is
|
|
|
27
30
|
* @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.
|
|
28
31
|
*
|
|
29
32
|
* @custom:events
|
|
30
|
-
* - {
|
|
33
|
+
* - {UniversalReceiver} event when funding the contract on deployment.
|
|
31
34
|
* - {OwnershipTransferred} event when `initialOwner` is set as the contract {owner}.
|
|
32
35
|
*/
|
|
33
36
|
function _initialize(
|
|
34
37
|
address initialOwner
|
|
35
38
|
) internal virtual onlyInitializing {
|
|
36
39
|
if (msg.value != 0) {
|
|
37
|
-
emit
|
|
40
|
+
emit UniversalReceiver(
|
|
41
|
+
msg.sender,
|
|
42
|
+
msg.value,
|
|
43
|
+
_TYPEID_LSP0_VALUE_RECEIVED,
|
|
44
|
+
"",
|
|
45
|
+
""
|
|
46
|
+
);
|
|
38
47
|
}
|
|
39
48
|
OwnableUnset._setOwner(initialOwner);
|
|
40
49
|
}
|
|
@@ -7,12 +7,14 @@ import {
|
|
|
7
7
|
} from "@erc725/smart-contracts/contracts/interfaces/IERC725Y.sol";
|
|
8
8
|
|
|
9
9
|
// libraries
|
|
10
|
-
import {BytesLib} from "solidity-bytes-utils/contracts/BytesLib.sol";
|
|
11
10
|
import {LSP2Utils} from "../LSP2ERC725YJSONSchema/LSP2Utils.sol";
|
|
12
11
|
|
|
13
12
|
// constants
|
|
14
|
-
import "../
|
|
15
|
-
import
|
|
13
|
+
import {_INTERFACEID_LSP9} from "../LSP9Vault/LSP9Constants.sol";
|
|
14
|
+
import {
|
|
15
|
+
_LSP10_VAULTS_MAP_KEY_PREFIX,
|
|
16
|
+
_LSP10_VAULTS_ARRAY_KEY
|
|
17
|
+
} from "../LSP10ReceivedVaults/LSP10Constants.sol";
|
|
16
18
|
|
|
17
19
|
/**
|
|
18
20
|
* @title LSP10 Utility library.
|
|
@@ -20,7 +20,17 @@ import {
|
|
|
20
20
|
// constants
|
|
21
21
|
import {ALL_REGULAR_PERMISSIONS} from "../LSP6KeyManager/LSP6Constants.sol";
|
|
22
22
|
import {_INTERFACEID_LSP11} from "./LSP11Constants.sol";
|
|
23
|
-
import
|
|
23
|
+
import {
|
|
24
|
+
CallerIsNotGuardian,
|
|
25
|
+
GuardianAlreadyExist,
|
|
26
|
+
GuardianDoNotExist,
|
|
27
|
+
GuardiansNumberCannotGoBelowThreshold,
|
|
28
|
+
ThresholdCannotBeHigherThanGuardiansNumber,
|
|
29
|
+
SecretHashCannotBeZero,
|
|
30
|
+
AddressZeroNotAllowed,
|
|
31
|
+
ThresholdNotReachedForRecoverer,
|
|
32
|
+
WrongPlainSecret
|
|
33
|
+
} from "./LSP11Errors.sol";
|
|
24
34
|
|
|
25
35
|
/**
|
|
26
36
|
* @title Core Implementation of LSP11-BasicSocialRecovery standard
|
|
@@ -75,42 +85,68 @@ abstract contract LSP11BasicSocialRecoveryCore is
|
|
|
75
85
|
/**
|
|
76
86
|
* @inheritdoc ILSP11BasicSocialRecovery
|
|
77
87
|
*/
|
|
78
|
-
function target() public view virtual returns (address) {
|
|
88
|
+
function target() public view virtual override returns (address) {
|
|
79
89
|
return _target;
|
|
80
90
|
}
|
|
81
91
|
|
|
82
92
|
/**
|
|
83
93
|
* @inheritdoc ILSP11BasicSocialRecovery
|
|
84
94
|
*/
|
|
85
|
-
function getRecoveryCounter()
|
|
95
|
+
function getRecoveryCounter()
|
|
96
|
+
public
|
|
97
|
+
view
|
|
98
|
+
virtual
|
|
99
|
+
override
|
|
100
|
+
returns (uint256)
|
|
101
|
+
{
|
|
86
102
|
return _recoveryCounter;
|
|
87
103
|
}
|
|
88
104
|
|
|
89
105
|
/**
|
|
90
106
|
* @inheritdoc ILSP11BasicSocialRecovery
|
|
91
107
|
*/
|
|
92
|
-
function getGuardians()
|
|
108
|
+
function getGuardians()
|
|
109
|
+
public
|
|
110
|
+
view
|
|
111
|
+
virtual
|
|
112
|
+
override
|
|
113
|
+
returns (address[] memory)
|
|
114
|
+
{
|
|
93
115
|
return _guardians.values();
|
|
94
116
|
}
|
|
95
117
|
|
|
96
118
|
/**
|
|
97
119
|
* @inheritdoc ILSP11BasicSocialRecovery
|
|
98
120
|
*/
|
|
99
|
-
function isGuardian(
|
|
121
|
+
function isGuardian(
|
|
122
|
+
address _address
|
|
123
|
+
) public view virtual override returns (bool) {
|
|
100
124
|
return _guardians.contains(_address);
|
|
101
125
|
}
|
|
102
126
|
|
|
103
127
|
/**
|
|
104
128
|
* @inheritdoc ILSP11BasicSocialRecovery
|
|
105
129
|
*/
|
|
106
|
-
function getGuardiansThreshold()
|
|
130
|
+
function getGuardiansThreshold()
|
|
131
|
+
public
|
|
132
|
+
view
|
|
133
|
+
virtual
|
|
134
|
+
override
|
|
135
|
+
returns (uint256)
|
|
136
|
+
{
|
|
107
137
|
return _guardiansThreshold;
|
|
108
138
|
}
|
|
109
139
|
|
|
110
140
|
/**
|
|
111
141
|
* @inheritdoc ILSP11BasicSocialRecovery
|
|
112
142
|
*/
|
|
113
|
-
function getRecoverySecretHash()
|
|
143
|
+
function getRecoverySecretHash()
|
|
144
|
+
public
|
|
145
|
+
view
|
|
146
|
+
virtual
|
|
147
|
+
override
|
|
148
|
+
returns (bytes32)
|
|
149
|
+
{
|
|
114
150
|
return _recoverySecretHash;
|
|
115
151
|
}
|
|
116
152
|
|
|
@@ -119,14 +155,16 @@ abstract contract LSP11BasicSocialRecoveryCore is
|
|
|
119
155
|
*/
|
|
120
156
|
function getGuardianChoice(
|
|
121
157
|
address guardian
|
|
122
|
-
) public view virtual returns (address) {
|
|
158
|
+
) public view virtual override returns (address) {
|
|
123
159
|
return _guardiansChoice[_recoveryCounter][guardian];
|
|
124
160
|
}
|
|
125
161
|
|
|
126
162
|
/**
|
|
127
163
|
* @inheritdoc ILSP11BasicSocialRecovery
|
|
128
164
|
*/
|
|
129
|
-
function addGuardian(
|
|
165
|
+
function addGuardian(
|
|
166
|
+
address newGuardian
|
|
167
|
+
) public virtual override onlyOwner {
|
|
130
168
|
if (_guardians.contains(newGuardian))
|
|
131
169
|
revert GuardianAlreadyExist(newGuardian);
|
|
132
170
|
|
|
@@ -137,7 +175,9 @@ abstract contract LSP11BasicSocialRecoveryCore is
|
|
|
137
175
|
/**
|
|
138
176
|
* @inheritdoc ILSP11BasicSocialRecovery
|
|
139
177
|
*/
|
|
140
|
-
function removeGuardian(
|
|
178
|
+
function removeGuardian(
|
|
179
|
+
address existingGuardian
|
|
180
|
+
) public virtual override onlyOwner {
|
|
141
181
|
if (!_guardians.contains(existingGuardian))
|
|
142
182
|
revert GuardianDoNotExist(existingGuardian);
|
|
143
183
|
if (_guardians.length() == _guardiansThreshold)
|
|
@@ -152,7 +192,7 @@ abstract contract LSP11BasicSocialRecoveryCore is
|
|
|
152
192
|
*/
|
|
153
193
|
function setGuardiansThreshold(
|
|
154
194
|
uint256 newThreshold
|
|
155
|
-
) public virtual onlyOwner {
|
|
195
|
+
) public virtual override onlyOwner {
|
|
156
196
|
if (newThreshold > _guardians.length())
|
|
157
197
|
revert ThresholdCannotBeHigherThanGuardiansNumber(
|
|
158
198
|
newThreshold,
|
|
@@ -169,7 +209,7 @@ abstract contract LSP11BasicSocialRecoveryCore is
|
|
|
169
209
|
*/
|
|
170
210
|
function setRecoverySecretHash(
|
|
171
211
|
bytes32 newRecoverSecretHash
|
|
172
|
-
) public virtual onlyOwner {
|
|
212
|
+
) public virtual override onlyOwner {
|
|
173
213
|
if (newRecoverSecretHash == bytes32(0)) revert SecretHashCannotBeZero();
|
|
174
214
|
|
|
175
215
|
_recoverySecretHash = newRecoverSecretHash;
|
|
@@ -181,7 +221,7 @@ abstract contract LSP11BasicSocialRecoveryCore is
|
|
|
181
221
|
*/
|
|
182
222
|
function selectNewController(
|
|
183
223
|
address addressSelected
|
|
184
|
-
) public virtual onlyGuardians {
|
|
224
|
+
) public virtual override onlyGuardians {
|
|
185
225
|
uint256 currentRecoveryCounter = _recoveryCounter;
|
|
186
226
|
|
|
187
227
|
_guardiansChoice[currentRecoveryCounter][msg.sender] = addressSelected;
|
|
@@ -199,7 +239,7 @@ abstract contract LSP11BasicSocialRecoveryCore is
|
|
|
199
239
|
address recoverer,
|
|
200
240
|
string memory plainSecret,
|
|
201
241
|
bytes32 newSecretHash
|
|
202
|
-
) public virtual {
|
|
242
|
+
) public virtual override {
|
|
203
243
|
// caching storage variables
|
|
204
244
|
uint256 currentRecoveryCounter = _recoveryCounter;
|
|
205
245
|
address[] memory guardians = _guardians.values();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
pragma solidity ^0.8.4;
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -59,7 +59,7 @@ interface ILSP14Ownable2Step {
|
|
|
59
59
|
* @dev Transfer ownership of the contract from the current {owner()} to the {pendingOwner()}.
|
|
60
60
|
*
|
|
61
61
|
* Once this function is called:
|
|
62
|
-
* - The current {owner()} will
|
|
62
|
+
* - The current {owner()} will lose access to the functions restricted to the {owner()} only.
|
|
63
63
|
* - The {pendingOwner()} will gain access to the functions restricted to the {owner()} only.
|
|
64
64
|
*
|
|
65
65
|
* @notice `msg.sender` is accepting ownership of contract: `address(this)`.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
pragma solidity ^0.8.4;
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -8,7 +8,7 @@ pragma solidity ^0.8.4;
|
|
|
8
8
|
* @param renounceOwnershipStart The start timestamp when one can confirm the renouncement of ownership.
|
|
9
9
|
* @param renounceOwnershipEnd The end timestamp when one can confirm the renouncement of ownership.
|
|
10
10
|
*/
|
|
11
|
-
error
|
|
11
|
+
error LSP14NotInRenounceOwnershipInterval(
|
|
12
12
|
uint256 renounceOwnershipStart,
|
|
13
13
|
uint256 renounceOwnershipEnd
|
|
14
14
|
);
|
|
@@ -17,10 +17,16 @@ error NotInRenounceOwnershipInterval(
|
|
|
17
17
|
* @dev Reverts when trying to transfer ownership to the `address(this)`.
|
|
18
18
|
* @notice Cannot transfer ownership to the address of the contract itself.
|
|
19
19
|
*/
|
|
20
|
-
error
|
|
20
|
+
error LSP14CannotTransferOwnershipToSelf();
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* @dev Reverts when pending owner accept ownership in the same transaction of transferring ownership.
|
|
24
24
|
* @notice Cannot accept ownership in the same transaction with {transferOwnership(...)}.
|
|
25
25
|
*/
|
|
26
26
|
error LSP14MustAcceptOwnershipInSeparateTransaction();
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @dev Reverts when the `caller` that is trying to accept ownership of the contract is not the pending owner.
|
|
30
|
+
* @param caller The address that tried to accept ownership.
|
|
31
|
+
*/
|
|
32
|
+
error LSP14CallerNotPendingOwner(address caller);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
pragma solidity ^0.8.4;
|
|
3
3
|
|
|
4
4
|
// interfaces
|
|
@@ -13,7 +13,12 @@ import {
|
|
|
13
13
|
import {LSP1Utils} from "../LSP1UniversalReceiver/LSP1Utils.sol";
|
|
14
14
|
|
|
15
15
|
// errors
|
|
16
|
-
import
|
|
16
|
+
import {
|
|
17
|
+
LSP14CallerNotPendingOwner,
|
|
18
|
+
LSP14MustAcceptOwnershipInSeparateTransaction,
|
|
19
|
+
LSP14CannotTransferOwnershipToSelf,
|
|
20
|
+
LSP14NotInRenounceOwnershipInterval
|
|
21
|
+
} from "./LSP14Errors.sol";
|
|
17
22
|
|
|
18
23
|
// constants
|
|
19
24
|
import {
|
|
@@ -45,12 +50,12 @@ abstract contract LSP14Ownable2Step is ILSP14Ownable2Step, OwnableUnset {
|
|
|
45
50
|
/**
|
|
46
51
|
* @dev The block number saved when initiating the process of renouncing ownerhsip.
|
|
47
52
|
*/
|
|
48
|
-
uint256
|
|
53
|
+
uint256 internal _renounceOwnershipStartedAt;
|
|
49
54
|
|
|
50
55
|
/**
|
|
51
56
|
* @dev see {pendingOwner()}
|
|
52
57
|
*/
|
|
53
|
-
address
|
|
58
|
+
address internal _pendingOwner;
|
|
54
59
|
|
|
55
60
|
/**
|
|
56
61
|
* @dev The boolean that indicates whether the contract is in an active ownership transfer phase
|
|
@@ -72,7 +77,7 @@ abstract contract LSP14Ownable2Step is ILSP14Ownable2Step, OwnableUnset {
|
|
|
72
77
|
*
|
|
73
78
|
* @custom:info If no ownership transfer is in progress, the pendingOwner will be `address(0).`.
|
|
74
79
|
*/
|
|
75
|
-
function pendingOwner() public view virtual returns (address) {
|
|
80
|
+
function pendingOwner() public view virtual override returns (address) {
|
|
76
81
|
return _pendingOwner;
|
|
77
82
|
}
|
|
78
83
|
|
|
@@ -106,7 +111,7 @@ abstract contract LSP14Ownable2Step is ILSP14Ownable2Step, OwnableUnset {
|
|
|
106
111
|
*
|
|
107
112
|
* @custom:requirements This function can only be called by the {pendingOwner()}.
|
|
108
113
|
*/
|
|
109
|
-
function acceptOwnership() public virtual NotInTransferOwnership {
|
|
114
|
+
function acceptOwnership() public virtual override NotInTransferOwnership {
|
|
110
115
|
address previousOwner = owner();
|
|
111
116
|
|
|
112
117
|
_acceptOwnership();
|
|
@@ -154,7 +159,8 @@ abstract contract LSP14Ownable2Step is ILSP14Ownable2Step, OwnableUnset {
|
|
|
154
159
|
* @custom:requirements `newOwner` cannot be the address of the contract itself.
|
|
155
160
|
*/
|
|
156
161
|
function _transferOwnership(address newOwner) internal virtual {
|
|
157
|
-
if (newOwner == address(this))
|
|
162
|
+
if (newOwner == address(this))
|
|
163
|
+
revert LSP14CannotTransferOwnershipToSelf();
|
|
158
164
|
|
|
159
165
|
_pendingOwner = newOwner;
|
|
160
166
|
delete _renounceOwnershipStartedAt;
|
|
@@ -164,10 +170,8 @@ abstract contract LSP14Ownable2Step is ILSP14Ownable2Step, OwnableUnset {
|
|
|
164
170
|
* @dev Set the pending owner of the contract as the new owner.
|
|
165
171
|
*/
|
|
166
172
|
function _acceptOwnership() internal virtual {
|
|
167
|
-
|
|
168
|
-
msg.sender
|
|
169
|
-
"LSP14: caller is not the pendingOwner"
|
|
170
|
-
);
|
|
173
|
+
if (msg.sender != pendingOwner())
|
|
174
|
+
revert LSP14CallerNotPendingOwner(msg.sender);
|
|
171
175
|
|
|
172
176
|
_setOwner(msg.sender);
|
|
173
177
|
delete _pendingOwner;
|
|
@@ -196,7 +200,7 @@ abstract contract LSP14Ownable2Step is ILSP14Ownable2Step, OwnableUnset {
|
|
|
196
200
|
}
|
|
197
201
|
|
|
198
202
|
if (currentBlock < confirmationPeriodStart) {
|
|
199
|
-
revert
|
|
203
|
+
revert LSP14NotInRenounceOwnershipInterval(
|
|
200
204
|
confirmationPeriodStart,
|
|
201
205
|
confirmationPeriodEnd
|
|
202
206
|
);
|