@lukso/lsp-smart-contracts 0.13.0 → 0.15.0-rc.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 +2 -191
- package/artifacts/LSP0ERC725Account.json +3 -3
- package/artifacts/LSP0ERC725AccountInit.json +3 -3
- package/artifacts/LSP11BasicSocialRecovery.json +2 -2
- package/artifacts/LSP11BasicSocialRecoveryInit.json +2 -2
- package/artifacts/LSP1UniversalReceiverDelegateUP.json +3 -3
- package/artifacts/LSP1UniversalReceiverDelegateVault.json +3 -3
- package/artifacts/LSP23LinkedContractsFactory.json +3 -3
- package/artifacts/LSP4DigitalAssetMetadata.json +1 -1
- package/artifacts/LSP4DigitalAssetMetadataInitAbstract.json +1 -1
- package/artifacts/LSP6KeyManager.json +3 -3
- package/artifacts/LSP6KeyManagerInit.json +3 -3
- package/artifacts/LSP7CappedSupply.json +53 -6
- package/artifacts/LSP7CappedSupplyInitAbstract.json +53 -6
- package/artifacts/LSP7DigitalAsset.json +52 -5
- package/artifacts/LSP7DigitalAssetInitAbstract.json +52 -5
- package/artifacts/LSP7Mintable.json +54 -7
- package/artifacts/LSP7MintableInit.json +54 -7
- package/artifacts/LSP8CappedSupply.json +85 -48
- package/artifacts/LSP8CappedSupplyInitAbstract.json +85 -48
- package/artifacts/LSP8IdentifiableDigitalAsset.json +85 -48
- package/artifacts/LSP8IdentifiableDigitalAssetInitAbstract.json +85 -48
- package/artifacts/LSP8Mintable.json +88 -51
- package/artifacts/LSP8MintableInit.json +88 -51
- package/artifacts/LSP9Vault.json +3 -3
- package/artifacts/LSP9VaultInit.json +3 -3
- package/artifacts/UniversalProfile.json +3 -3
- package/artifacts/UniversalProfileInit.json +3 -3
- package/contracts/LSP0ERC725Account/ILSP0ERC725Account.sol +1 -17
- package/contracts/LSP0ERC725Account/LSP0Constants.sol +1 -23
- package/contracts/LSP0ERC725Account/LSP0ERC725Account.sol +1 -53
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +1 -873
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountInit.sol +1 -47
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountInitAbstract.sol +1 -49
- package/contracts/LSP10ReceivedVaults/LSP10Constants.sol +1 -7
- package/contracts/LSP10ReceivedVaults/LSP10Utils.sol +1 -208
- package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecoveryCore.sol +4 -2
- package/contracts/LSP12IssuedAssets/LSP12Constants.sol +4 -0
- package/contracts/LSP14Ownable2Step/ILSP14Ownable2Step.sol +1 -75
- package/contracts/LSP14Ownable2Step/LSP14Constants.sol +1 -12
- package/contracts/LSP14Ownable2Step/LSP14Errors.sol +1 -29
- package/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol +1 -212
- package/contracts/LSP16UniversalFactory/LSP16UniversalFactory.sol +1 -417
- package/contracts/LSP17ContractExtension/LSP17Constants.sol +1 -14
- package/contracts/LSP17ContractExtension/LSP17Errors.sol +1 -14
- package/contracts/LSP17ContractExtension/LSP17Extendable.sol +1 -117
- package/contracts/LSP17ContractExtension/LSP17Extension.sol +1 -55
- package/contracts/LSP17ContractExtension/LSP17Utils.sol +1 -16
- package/contracts/LSP17Extensions/Extension4337.sol +1 -123
- package/contracts/LSP17Extensions/OnERC721ReceivedExtension.sol +1 -13
- package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiver.sol +1 -37
- package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiverDelegate.sol +1 -21
- package/contracts/LSP1UniversalReceiver/LSP1Constants.sol +1 -11
- package/contracts/LSP1UniversalReceiver/LSP1Errors.sol +1 -7
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol +1 -292
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol +1 -217
- package/contracts/LSP1UniversalReceiver/LSP1Utils.sol +1 -84
- package/contracts/LSP20CallVerification/ILSP20CallVerifier.sol +1 -36
- package/contracts/LSP20CallVerification/LSP20CallVerification.sol +1 -117
- package/contracts/LSP20CallVerification/LSP20Constants.sol +1 -14
- package/contracts/LSP20CallVerification/LSP20Errors.sol +1 -18
- package/contracts/LSP23LinkedContractsFactory/ILSP23LinkedContractsFactory.sol +1 -189
- package/contracts/LSP23LinkedContractsFactory/IPostDeploymentModule.sol +1 -15
- package/contracts/LSP23LinkedContractsFactory/LSP23Errors.sol +1 -21
- package/contracts/LSP23LinkedContractsFactory/LSP23LinkedContractsFactory.sol +1 -393
- package/contracts/LSP23LinkedContractsFactory/modules/README.md +23 -0
- package/contracts/LSP23LinkedContractsFactory/modules/UniversalProfileInitPostDeploymentModule.sol +1 -60
- package/contracts/LSP23LinkedContractsFactory/modules/UniversalProfilePostDeploymentModule.sol +1 -58
- package/contracts/LSP25ExecuteRelayCall/ILSP25ExecuteRelayCall.sol +1 -65
- package/contracts/LSP25ExecuteRelayCall/LSP25Constants.sol +1 -5
- package/contracts/LSP25ExecuteRelayCall/LSP25Errors.sol +1 -14
- package/contracts/LSP25ExecuteRelayCall/LSP25MultiChannelNonce.sol +1 -141
- package/contracts/LSP2ERC725YJSONSchema/LSP2Utils.sol +1 -445
- package/contracts/LSP3ProfileMetadata/LSP3Constants.sol +1 -8
- package/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol +1 -31
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol +1 -59
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataCore.sol +1 -44
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol +1 -65
- package/contracts/LSP4DigitalAssetMetadata/LSP4Errors.sol +1 -20
- package/contracts/LSP5ReceivedAssets/LSP5Constants.sol +1 -7
- package/contracts/LSP5ReceivedAssets/LSP5Utils.sol +1 -206
- package/contracts/LSP6KeyManager/ILSP6KeyManager.sol +1 -60
- package/contracts/LSP6KeyManager/LSP6Constants.sol +1 -61
- package/contracts/LSP6KeyManager/LSP6Errors.sol +1 -222
- package/contracts/LSP6KeyManager/LSP6KeyManager.sol +1 -23
- package/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol +1 -694
- package/contracts/LSP6KeyManager/LSP6KeyManagerInit.sol +1 -29
- package/contracts/LSP6KeyManager/LSP6KeyManagerInitAbstract.sol +1 -21
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6ExecuteModule.sol +1 -411
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6ExecuteRelayCallModule.sol +1 -24
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6OwnershipModule.sol +1 -27
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6SetDataModule.sol +1 -848
- package/contracts/LSP6KeyManager/LSP6Utils.sol +1 -293
- package/contracts/LSP7DigitalAsset/ILSP7DigitalAsset.sol +1 -302
- package/contracts/LSP7DigitalAsset/LSP7Constants.sol +1 -13
- package/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol +1 -193
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +1 -728
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol +1 -189
- package/contracts/LSP7DigitalAsset/LSP7Errors.sol +1 -87
- package/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol +1 -23
- package/contracts/LSP7DigitalAsset/extensions/LSP7BurnableInitAbstract.sol +1 -24
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol +1 -80
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyInitAbstract.sol +1 -83
- package/contracts/LSP7DigitalAsset/presets/ILSP7Mintable.sol +1 -29
- package/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol +1 -50
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableInit.sol +1 -41
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol +1 -54
- package/contracts/LSP8IdentifiableDigitalAsset/ILSP8IdentifiableDigitalAsset.sol +1 -326
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol +1 -38
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Errors.sol +1 -102
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol +1 -236
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +1 -787
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol +1 -243
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol +2 -28
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8BurnableInitAbstract.sol +2 -22
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol +2 -84
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInitAbstract.sol +2 -87
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol +2 -68
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableInitAbstract.sol +2 -63
- package/contracts/LSP8IdentifiableDigitalAsset/presets/ILSP8Mintable.sol +1 -31
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol +2 -59
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInit.sol +2 -42
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol +2 -61
- package/contracts/LSP9Vault/ILSP9Vault.sol +1 -16
- package/contracts/LSP9Vault/LSP9Constants.sol +1 -26
- package/contracts/LSP9Vault/LSP9Errors.sol +1 -6
- package/contracts/LSP9Vault/LSP9Vault.sol +1 -63
- package/contracts/LSP9Vault/LSP9VaultCore.sol +1 -684
- package/contracts/LSP9Vault/LSP9VaultInit.sol +1 -33
- package/contracts/LSP9Vault/LSP9VaultInitAbstract.sol +1 -65
- package/contracts/UniversalProfile.sol +1 -37
- package/contracts/UniversalProfileInit.sol +1 -39
- package/contracts/UniversalProfileInitAbstract.sol +1 -44
- package/dist/constants.cjs +75 -0
- package/dist/constants.d.cts +121 -0
- package/dist/constants.d.mts +121 -0
- package/dist/constants.d.ts +107 -40105
- package/dist/constants.mjs +70 -0
- package/package.json +58 -116
- package/types/@lukso/lsp0-contracts/contracts/LSP0ERC725Account.ts +694 -0
- package/types/@lukso/lsp0-contracts/contracts/LSP0ERC725AccountInit.ts +740 -0
- package/types/@lukso/lsp1delegate-contracts/contracts/LSP1UniversalReceiverDelegateUP.ts +139 -0
- package/types/@lukso/lsp1delegate-contracts/contracts/LSP1UniversalReceiverDelegateVault.ts +139 -0
- package/types/@lukso/lsp23-contracts/contracts/LSP23LinkedContractsFactory.ts +448 -0
- package/types/@lukso/lsp4-contracts/contracts/LSP4DigitalAssetMetadata.ts +274 -0
- package/types/@lukso/lsp4-contracts/contracts/LSP4DigitalAssetMetadataInitAbstract.ts +309 -0
- package/types/@lukso/lsp6-contracts/contracts/LSP6KeyManager.ts +355 -0
- package/types/@lukso/lsp6-contracts/contracts/LSP6KeyManagerInit.ts +398 -0
- package/types/@lukso/lsp7-contracts/contracts/LSP7DigitalAsset.ts +698 -0
- package/types/@lukso/lsp7-contracts/contracts/LSP7DigitalAssetInitAbstract.ts +729 -0
- package/types/@lukso/lsp7-contracts/contracts/extensions/LSP7CappedSupply.ts +712 -0
- package/types/@lukso/lsp7-contracts/contracts/extensions/LSP7CappedSupplyInitAbstract.ts +743 -0
- package/types/@lukso/lsp7-contracts/contracts/presets/LSP7Mintable.ts +717 -0
- package/types/@lukso/lsp7-contracts/contracts/presets/LSP7MintableInit.ts +779 -0
- package/types/@lukso/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.ts +778 -0
- package/types/@lukso/lsp8-contracts/contracts/LSP8IdentifiableDigitalAssetInitAbstract.ts +813 -0
- package/types/@lukso/lsp8-contracts/contracts/extensions/LSP8CappedSupply.ts +792 -0
- package/types/@lukso/lsp8-contracts/contracts/extensions/LSP8CappedSupplyInitAbstract.ts +824 -0
- package/types/@lukso/lsp8-contracts/contracts/presets/LSP8Mintable.ts +797 -0
- package/types/@lukso/lsp8-contracts/contracts/presets/LSP8MintableInit.ts +860 -0
- package/types/@lukso/lsp9-contracts/contracts/LSP9Vault.ts +672 -0
- package/types/@lukso/lsp9-contracts/contracts/LSP9VaultInit.ts +714 -0
- package/types/@lukso/universalprofile-contracts/contracts/UniversalProfile.ts +694 -0
- package/types/@lukso/universalprofile-contracts/contracts/UniversalProfileInit.ts +740 -0
- package/types/LSP0ERC725Account.ts +694 -0
- package/types/LSP0ERC725AccountInit.ts +740 -0
- package/types/LSP11BasicSocialRecovery.ts +596 -0
- package/types/LSP11BasicSocialRecoveryInit.ts +646 -0
- package/types/LSP1UniversalReceiverDelegateUP.ts +139 -0
- package/types/LSP1UniversalReceiverDelegateVault.ts +139 -0
- package/types/LSP23LinkedContractsFactory.ts +448 -0
- package/types/LSP4DigitalAssetMetadata.ts +274 -0
- package/types/LSP4DigitalAssetMetadataInitAbstract.ts +309 -0
- package/types/LSP6KeyManager.ts +355 -0
- package/types/LSP6KeyManagerInit.ts +398 -0
- package/types/LSP7CappedSupply.ts +712 -0
- package/types/LSP7CappedSupplyInitAbstract.ts +743 -0
- package/types/LSP7DigitalAsset.ts +698 -0
- package/types/LSP7DigitalAssetInitAbstract.ts +729 -0
- package/types/LSP7Mintable.ts +717 -0
- package/types/LSP7MintableInit.ts +779 -0
- package/types/LSP8CappedSupply.ts +792 -0
- package/types/LSP8CappedSupplyInitAbstract.ts +824 -0
- package/types/LSP8IdentifiableDigitalAsset.ts +778 -0
- package/types/LSP8IdentifiableDigitalAssetInitAbstract.ts +813 -0
- package/types/LSP8Mintable.ts +797 -0
- package/types/LSP8MintableInit.ts +860 -0
- package/types/LSP9Vault.ts +672 -0
- package/types/LSP9VaultInit.ts +714 -0
- package/types/UniversalProfile.ts +694 -0
- package/types/UniversalProfileInit.ts +740 -0
- package/types/common.ts +131 -0
- package/types/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.ts +596 -0
- package/types/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecoveryInit.ts +646 -0
- package/types/index.ts +58 -0
- package/LICENSE +0 -201
- package/artifacts/Create2Factory.json +0 -107
- package/artifacts/LSP16UniversalFactory.json +0 -271
- package/artifacts/LSP7CompatibleERC20.json +0 -935
- package/artifacts/LSP7CompatibleERC20InitAbstract.json +0 -948
- package/artifacts/LSP7CompatibleERC20Mintable.json +0 -989
- package/artifacts/LSP7CompatibleERC20MintableInit.json +0 -1009
- package/artifacts/LSP8CompatibleERC721.json +0 -1191
- package/artifacts/LSP8CompatibleERC721InitAbstract.json +0 -1204
- package/artifacts/LSP8CompatibleERC721Mintable.json +0 -1261
- package/artifacts/LSP8CompatibleERC721MintableInit.json +0 -1281
- package/artifacts/UniversalReceiverAddressStore.json +0 -209
- package/contracts/Factories/Create2Factory.sol +0 -88
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol +0 -260
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20InitAbstract.sol +0 -273
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol +0 -37
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInit.sol +0 -44
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInitAbstract.sol +0 -43
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol +0 -512
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol +0 -514
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol +0 -54
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol +0 -47
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.sol +0 -52
- package/contracts/Legacy/Registries/AddressRegistry.sol +0 -52
- package/contracts/Legacy/Registries/AddressRegistryRequiresERC725.sol +0 -37
- package/contracts/Legacy/UniversalReceiverAddressStore.sol +0 -64
- package/contracts/Version.sol +0 -17
- package/devdocs/Create2Factory.json +0 -16
- package/devdocs/LSP0ERC725Account.json +0 -260
- package/devdocs/LSP0ERC725AccountInit.json +0 -263
- package/devdocs/LSP11BasicSocialRecovery.json +0 -159
- package/devdocs/LSP11BasicSocialRecoveryInit.json +0 -159
- package/devdocs/LSP16UniversalFactory.json +0 -116
- package/devdocs/LSP1UniversalReceiverDelegateUP.json +0 -34
- package/devdocs/LSP1UniversalReceiverDelegateVault.json +0 -33
- package/devdocs/LSP23LinkedContractsFactory.json +0 -81
- package/devdocs/LSP4DigitalAssetMetadata.json +0 -112
- package/devdocs/LSP4DigitalAssetMetadataInitAbstract.json +0 -104
- package/devdocs/LSP6KeyManager.json +0 -305
- package/devdocs/LSP6KeyManagerInit.json +0 -308
- package/devdocs/LSP7CappedSupply.json +0 -306
- package/devdocs/LSP7CappedSupplyInitAbstract.json +0 -299
- package/devdocs/LSP7CompatibleERC20.json +0 -346
- package/devdocs/LSP7CompatibleERC20InitAbstract.json +0 -338
- package/devdocs/LSP7CompatibleERC20Mintable.json +0 -349
- package/devdocs/LSP7CompatibleERC20MintableInit.json +0 -352
- package/devdocs/LSP7DigitalAsset.json +0 -294
- package/devdocs/LSP7DigitalAssetInitAbstract.json +0 -285
- package/devdocs/LSP7Mintable.json +0 -296
- package/devdocs/LSP7MintableInit.json +0 -298
- package/devdocs/LSP8CappedSupply.json +0 -356
- package/devdocs/LSP8CappedSupplyInitAbstract.json +0 -349
- package/devdocs/LSP8CompatibleERC721.json +0 -437
- package/devdocs/LSP8CompatibleERC721InitAbstract.json +0 -428
- package/devdocs/LSP8CompatibleERC721Mintable.json +0 -446
- package/devdocs/LSP8CompatibleERC721MintableInit.json +0 -449
- package/devdocs/LSP8IdentifiableDigitalAsset.json +0 -346
- package/devdocs/LSP8IdentifiableDigitalAssetInitAbstract.json +0 -335
- package/devdocs/LSP8Mintable.json +0 -356
- package/devdocs/LSP8MintableInit.json +0 -359
- package/devdocs/LSP9Vault.json +0 -236
- package/devdocs/LSP9VaultInit.json +0 -239
- package/devdocs/UniversalProfile.json +0 -260
- package/devdocs/UniversalProfileInit.json +0 -263
- package/devdocs/UniversalReceiverAddressStore.json +0 -9
- package/dist/constants.cjs.js +0 -40758
- package/dist/constants.es.js +0 -40737
- package/userdocs/Create2Factory.json +0 -5
- package/userdocs/LSP0ERC725Account.json +0 -91
- package/userdocs/LSP0ERC725AccountInit.json +0 -94
- package/userdocs/LSP11BasicSocialRecovery.json +0 -29
- package/userdocs/LSP11BasicSocialRecoveryInit.json +0 -29
- package/userdocs/LSP16UniversalFactory.json +0 -30
- package/userdocs/LSP1UniversalReceiverDelegateUP.json +0 -19
- package/userdocs/LSP1UniversalReceiverDelegateVault.json +0 -19
- package/userdocs/LSP23LinkedContractsFactory.json +0 -29
- package/userdocs/LSP4DigitalAssetMetadata.json +0 -26
- package/userdocs/LSP4DigitalAssetMetadataInitAbstract.json +0 -23
- package/userdocs/LSP6KeyManager.json +0 -154
- package/userdocs/LSP6KeyManagerInit.json +0 -157
- package/userdocs/LSP7CappedSupply.json +0 -60
- package/userdocs/LSP7CappedSupplyInitAbstract.json +0 -57
- package/userdocs/LSP7CompatibleERC20.json +0 -47
- package/userdocs/LSP7CompatibleERC20InitAbstract.json +0 -44
- package/userdocs/LSP7CompatibleERC20Mintable.json +0 -47
- package/userdocs/LSP7CompatibleERC20MintableInit.json +0 -47
- package/userdocs/LSP7DigitalAsset.json +0 -47
- package/userdocs/LSP7DigitalAssetInitAbstract.json +0 -44
- package/userdocs/LSP7Mintable.json +0 -47
- package/userdocs/LSP7MintableInit.json +0 -47
- package/userdocs/LSP8CappedSupply.json +0 -66
- package/userdocs/LSP8CappedSupplyInitAbstract.json +0 -63
- package/userdocs/LSP8CompatibleERC721.json +0 -80
- package/userdocs/LSP8CompatibleERC721InitAbstract.json +0 -77
- package/userdocs/LSP8CompatibleERC721Mintable.json +0 -83
- package/userdocs/LSP8CompatibleERC721MintableInit.json +0 -83
- package/userdocs/LSP8IdentifiableDigitalAsset.json +0 -53
- package/userdocs/LSP8IdentifiableDigitalAssetInitAbstract.json +0 -50
- package/userdocs/LSP8Mintable.json +0 -56
- package/userdocs/LSP8MintableInit.json +0 -56
- package/userdocs/LSP9Vault.json +0 -93
- package/userdocs/LSP9VaultInit.json +0 -93
- package/userdocs/UniversalProfile.json +0 -91
- package/userdocs/UniversalProfileInit.json +0 -94
- package/userdocs/UniversalReceiverAddressStore.json +0 -5
|
@@ -1,876 +1,4 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
pragma solidity ^0.8.4;
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";
|
|
6
|
-
import {ILSP0ERC725Account} from "./ILSP0ERC725Account.sol";
|
|
7
|
-
import {
|
|
8
|
-
ILSP1UniversalReceiver
|
|
9
|
-
} from "../LSP1UniversalReceiver/ILSP1UniversalReceiver.sol";
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
ILSP1UniversalReceiverDelegate as ILSP1Delegate
|
|
13
|
-
} from "../LSP1UniversalReceiver/ILSP1UniversalReceiverDelegate.sol";
|
|
14
|
-
|
|
15
|
-
// libraries
|
|
16
|
-
import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
|
|
17
|
-
import {
|
|
18
|
-
ERC165Checker
|
|
19
|
-
} from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
|
|
20
|
-
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
|
|
21
|
-
import {LSP1Utils} from "../LSP1UniversalReceiver/LSP1Utils.sol";
|
|
22
|
-
import {LSP2Utils} from "../LSP2ERC725YJSONSchema/LSP2Utils.sol";
|
|
23
|
-
|
|
24
|
-
// modules
|
|
25
|
-
import {ERC725YCore} from "@erc725/smart-contracts/contracts/ERC725YCore.sol";
|
|
26
|
-
import {ERC725XCore} from "@erc725/smart-contracts/contracts/ERC725XCore.sol";
|
|
27
|
-
import {
|
|
28
|
-
OwnableUnset
|
|
29
|
-
} from "@erc725/smart-contracts/contracts/custom/OwnableUnset.sol";
|
|
30
|
-
import {LSP14Ownable2Step} from "../LSP14Ownable2Step/LSP14Ownable2Step.sol";
|
|
31
|
-
import {LSP17Extendable} from "../LSP17ContractExtension/LSP17Extendable.sol";
|
|
32
|
-
import {
|
|
33
|
-
LSP20CallVerification
|
|
34
|
-
} from "../LSP20CallVerification/LSP20CallVerification.sol";
|
|
35
|
-
|
|
36
|
-
// constants
|
|
37
|
-
import {
|
|
38
|
-
_INTERFACEID_LSP0,
|
|
39
|
-
_INTERFACEID_ERC1271,
|
|
40
|
-
_ERC1271_SUCCESSVALUE,
|
|
41
|
-
_ERC1271_FAILVALUE,
|
|
42
|
-
_TYPEID_LSP0_VALUE_RECEIVED,
|
|
43
|
-
_TYPEID_LSP0_OwnershipTransferStarted,
|
|
44
|
-
_TYPEID_LSP0_OwnershipTransferred_SenderNotification,
|
|
45
|
-
_TYPEID_LSP0_OwnershipTransferred_RecipientNotification
|
|
46
|
-
} from "./LSP0Constants.sol";
|
|
47
|
-
import {
|
|
48
|
-
_INTERFACEID_LSP1,
|
|
49
|
-
_INTERFACEID_LSP1_DELEGATE,
|
|
50
|
-
_LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX,
|
|
51
|
-
_LSP1_UNIVERSAL_RECEIVER_DELEGATE_KEY
|
|
52
|
-
} from "../LSP1UniversalReceiver/LSP1Constants.sol";
|
|
53
|
-
import {_INTERFACEID_LSP14} from "../LSP14Ownable2Step/LSP14Constants.sol";
|
|
54
|
-
|
|
55
|
-
import {
|
|
56
|
-
_LSP17_EXTENSION_PREFIX
|
|
57
|
-
} from "../LSP17ContractExtension/LSP17Constants.sol";
|
|
58
|
-
import {
|
|
59
|
-
_INTERFACEID_LSP20_CALL_VERIFICATION
|
|
60
|
-
} from "../LSP20CallVerification/LSP20Constants.sol";
|
|
61
|
-
|
|
62
|
-
// errors
|
|
63
|
-
import {
|
|
64
|
-
ERC725Y_DataKeysValuesLengthMismatch,
|
|
65
|
-
ERC725Y_DataKeysValuesEmptyArray
|
|
66
|
-
} from "@erc725/smart-contracts/contracts/errors.sol";
|
|
67
|
-
import {
|
|
68
|
-
NoExtensionFoundForFunctionSelector
|
|
69
|
-
} from "../LSP17ContractExtension/LSP17Errors.sol";
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* @title The Core Implementation of [LSP-0-ERC725Account] Standard.
|
|
73
|
-
*
|
|
74
|
-
* @author Fabian Vogelsteller <fabian@lukso.network>, Jean Cavallera (CJ42)
|
|
75
|
-
*/
|
|
76
|
-
abstract contract LSP0ERC725AccountCore is
|
|
77
|
-
ERC725XCore,
|
|
78
|
-
ERC725YCore,
|
|
79
|
-
IERC1271,
|
|
80
|
-
ILSP0ERC725Account,
|
|
81
|
-
ILSP1UniversalReceiver,
|
|
82
|
-
LSP14Ownable2Step,
|
|
83
|
-
LSP17Extendable,
|
|
84
|
-
LSP20CallVerification
|
|
85
|
-
{
|
|
86
|
-
using ERC165Checker for address;
|
|
87
|
-
using LSP1Utils for address;
|
|
88
|
-
using Address for address;
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* @dev Executed:
|
|
92
|
-
* - When receiving some native tokens without any additional data.
|
|
93
|
-
* - On empty calls to the contract.
|
|
94
|
-
*
|
|
95
|
-
* @custom:info This function internally delegates the handling of native tokens to the {universalReceiver} function
|
|
96
|
-
* passing `_TYPEID_LSP0_VALUE_RECEIVED` as typeId and an empty bytes array as received data.
|
|
97
|
-
*
|
|
98
|
-
* @custom:events Emits a {UniversalReceiver} event when the `universalReceiver` logic is executed upon receiving native tokens.
|
|
99
|
-
*/
|
|
100
|
-
receive() external payable virtual {
|
|
101
|
-
if (msg.value != 0) {
|
|
102
|
-
universalReceiver(_TYPEID_LSP0_VALUE_RECEIVED, "");
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* @notice The `fallback` function was called with the following amount of native tokens: `msg.value`; and the following calldata: `callData`.
|
|
108
|
-
*
|
|
109
|
-
* @dev Achieves the goal of [LSP-17-ContractExtension] standard by extending the contract to handle calls of functions that do not exist natively,
|
|
110
|
-
* forwarding the function call to the extension address mapped to the function being called.
|
|
111
|
-
*
|
|
112
|
-
* This function is executed when:
|
|
113
|
-
* - Sending data of length less than 4 bytes to the contract.
|
|
114
|
-
* - The first 4 bytes of the calldata do not match any publicly callable functions from the contract ABI.
|
|
115
|
-
* - Receiving native tokens with some calldata.
|
|
116
|
-
*
|
|
117
|
-
* 1. If the data is equal or longer than 4 bytes, the [ERC-725Y] storage is queried with the following data key: [_LSP17_EXTENSION_PREFIX] + `bytes4(msg.sig)` (Check [LSP-2-ERC725YJSONSchema] for encoding the data key)
|
|
118
|
-
*
|
|
119
|
-
* - If there is no address stored under the following data key, revert with {NoExtensionFoundForFunctionSelector(bytes4)}. The data key relative to `bytes4(0)` is an exception, where no reverts occurs if there is no extension address stored under. This exception is made to allow users to send random data (graffiti) to the account and to be able to react on it.
|
|
120
|
-
*
|
|
121
|
-
* - If there is an address, forward the `msg.data` to the extension using the CALL opcode, appending 52 bytes (20 bytes of `msg.sender` and 32 bytes of `msg.value`). Return what the calls returns, or revert if the call failed.
|
|
122
|
-
*
|
|
123
|
-
* 2. If the data sent to this function is of length less than 4 bytes (not a function selector), return.
|
|
124
|
-
*
|
|
125
|
-
* @custom:info Whenever the call is associated with native tokens, the function will delegate the handling of native tokens internally to the {universalReceiver} function
|
|
126
|
-
* passing `_TYPEID_LSP0_VALUE_RECEIVED` as typeId and the calldata as received data, except when the native token will be sent directly to the extension.
|
|
127
|
-
*
|
|
128
|
-
* @custom:events {UniversalReceiver} event when receiving native tokens and extension function selector is not found or not payable.
|
|
129
|
-
*/
|
|
130
|
-
// solhint-disable-next-line no-complex-fallback
|
|
131
|
-
fallback(
|
|
132
|
-
bytes calldata callData
|
|
133
|
-
) external payable virtual returns (bytes memory) {
|
|
134
|
-
if (msg.data.length < 4) {
|
|
135
|
-
// if value is associated with the extension call, use the universalReceiver
|
|
136
|
-
if (msg.value != 0) {
|
|
137
|
-
universalReceiver(_TYPEID_LSP0_VALUE_RECEIVED, callData);
|
|
138
|
-
}
|
|
139
|
-
return "";
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
return _fallbackLSP17Extendable(callData);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* @inheritdoc ILSP0ERC725Account
|
|
147
|
-
*
|
|
148
|
-
* @custom:info It's not possible to send value along the functions call due to the use of `delegatecall`.
|
|
149
|
-
*/
|
|
150
|
-
function batchCalls(
|
|
151
|
-
bytes[] calldata data
|
|
152
|
-
) public virtual override returns (bytes[] memory results) {
|
|
153
|
-
results = new bytes[](data.length);
|
|
154
|
-
for (uint256 i; i < data.length; ) {
|
|
155
|
-
(bool success, bytes memory result) = address(this).delegatecall(
|
|
156
|
-
data[i]
|
|
157
|
-
);
|
|
158
|
-
|
|
159
|
-
if (!success) {
|
|
160
|
-
// Look for revert reason and bubble it up if present
|
|
161
|
-
if (result.length != 0) {
|
|
162
|
-
// The easiest way to bubble the revert reason is using memory via assembly
|
|
163
|
-
// solhint-disable no-inline-assembly
|
|
164
|
-
/// @solidity memory-safe-assembly
|
|
165
|
-
assembly {
|
|
166
|
-
let returndata_size := mload(result)
|
|
167
|
-
revert(add(32, result), returndata_size)
|
|
168
|
-
}
|
|
169
|
-
} else {
|
|
170
|
-
revert("LSP0: batchCalls reverted");
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
results[i] = result;
|
|
175
|
-
|
|
176
|
-
unchecked {
|
|
177
|
-
++i;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* @inheritdoc ERC725XCore
|
|
184
|
-
*
|
|
185
|
-
* @custom:requirements
|
|
186
|
-
* - Can be only called by the {owner} or by an authorised address that pass the verification check performed on the owner.
|
|
187
|
-
* - If a `value` is provided, the contract must have at least this amount in its balance to execute successfully.
|
|
188
|
-
* - If the operation type is `CREATE` (1) or `CREATE2` (2), `target` must be `address(0)`.
|
|
189
|
-
* - If the operation type is `STATICCALL` (3) or `DELEGATECALL` (4), `value` transfer is disallowed and must be 0.
|
|
190
|
-
*
|
|
191
|
-
* @custom:events
|
|
192
|
-
* - {Executed} event for each call that uses under `operationType`: `CALL` (0), `STATICCALL` (3) and `DELEGATECALL` (4).
|
|
193
|
-
* - {ContractCreated} event, when a contract is created under `operationType`: `CREATE` (1) and `CREATE2` (2).
|
|
194
|
-
* - {UniversalReceiver} event when receiving native tokens.
|
|
195
|
-
*/
|
|
196
|
-
function execute(
|
|
197
|
-
uint256 operationType,
|
|
198
|
-
address target,
|
|
199
|
-
uint256 value,
|
|
200
|
-
bytes memory data
|
|
201
|
-
) public payable virtual override returns (bytes memory) {
|
|
202
|
-
if (msg.value != 0) {
|
|
203
|
-
emit UniversalReceiver(
|
|
204
|
-
msg.sender,
|
|
205
|
-
msg.value,
|
|
206
|
-
_TYPEID_LSP0_VALUE_RECEIVED,
|
|
207
|
-
abi.encodePacked(msg.sig),
|
|
208
|
-
""
|
|
209
|
-
);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
address accountOwner = owner();
|
|
213
|
-
|
|
214
|
-
// If the caller is the owner perform execute directly
|
|
215
|
-
if (msg.sender == accountOwner) {
|
|
216
|
-
return ERC725XCore._execute(operationType, target, value, data);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
// If the caller is not the owner, call {lsp20VerifyCall} on the owner
|
|
220
|
-
// Depending on the returnedStatus, a second call is done after execution
|
|
221
|
-
bool verifyAfter = LSP20CallVerification._verifyCall(accountOwner);
|
|
222
|
-
|
|
223
|
-
// Perform the execution
|
|
224
|
-
bytes memory result = ERC725XCore._execute(
|
|
225
|
-
operationType,
|
|
226
|
-
target,
|
|
227
|
-
value,
|
|
228
|
-
data
|
|
229
|
-
);
|
|
230
|
-
|
|
231
|
-
// if verifyAfter is true, Call {lsp20VerifyCallResult} on the owner
|
|
232
|
-
if (verifyAfter) {
|
|
233
|
-
LSP20CallVerification._verifyCallResult(
|
|
234
|
-
accountOwner,
|
|
235
|
-
abi.encode(result)
|
|
236
|
-
);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
return result;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* @inheritdoc ERC725XCore
|
|
244
|
-
*
|
|
245
|
-
* @custom:requirements
|
|
246
|
-
* - The length of the parameters provided must be equal.
|
|
247
|
-
* - Can be only called by the {owner} or by an authorised address that pass the verification check performed on the owner.
|
|
248
|
-
* - If a `value` is provided, the contract must have at least this amount in its balance to execute successfully.
|
|
249
|
-
* - If the operation type is `CREATE` (1) or `CREATE2` (2), `target` must be `address(0)`.
|
|
250
|
-
* - If the operation type is `STATICCALL` (3) or `DELEGATECALL` (4), `value` transfer is disallowed and must be 0.
|
|
251
|
-
*
|
|
252
|
-
* @custom:warning
|
|
253
|
-
* - The `msg.value` should not be trusted for any method called within the batch with `operationType`: `DELEGATECALL` (4).
|
|
254
|
-
*
|
|
255
|
-
* @custom:events
|
|
256
|
-
* - {Executed} event for each call that uses under `operationType`: `CALL` (0), `STATICCALL` (3) and `DELEGATECALL` (4). (each iteration)
|
|
257
|
-
* - {ContractCreated} event, when a contract is created under `operationType`: `CREATE` (1) and `CREATE2` (2) (each iteration)
|
|
258
|
-
* - {UniversalReceiver} event when receiving native tokens.
|
|
259
|
-
*/
|
|
260
|
-
function executeBatch(
|
|
261
|
-
uint256[] memory operationsType,
|
|
262
|
-
address[] memory targets,
|
|
263
|
-
uint256[] memory values,
|
|
264
|
-
bytes[] memory datas
|
|
265
|
-
) public payable virtual override returns (bytes[] memory) {
|
|
266
|
-
if (msg.value != 0) {
|
|
267
|
-
emit UniversalReceiver(
|
|
268
|
-
msg.sender,
|
|
269
|
-
msg.value,
|
|
270
|
-
_TYPEID_LSP0_VALUE_RECEIVED,
|
|
271
|
-
abi.encodePacked(msg.sig),
|
|
272
|
-
""
|
|
273
|
-
);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
address accountOwner = owner();
|
|
277
|
-
|
|
278
|
-
// If the caller is the owner perform execute directly
|
|
279
|
-
if (msg.sender == accountOwner) {
|
|
280
|
-
return
|
|
281
|
-
ERC725XCore._executeBatch(
|
|
282
|
-
operationsType,
|
|
283
|
-
targets,
|
|
284
|
-
values,
|
|
285
|
-
datas
|
|
286
|
-
);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
// If the caller is not the owner, call {lsp20VerifyCall} on the owner
|
|
290
|
-
// Depending on the returnedStatus, a second call is done after execution
|
|
291
|
-
bool verifyAfter = LSP20CallVerification._verifyCall(accountOwner);
|
|
292
|
-
|
|
293
|
-
// Perform the execution
|
|
294
|
-
bytes[] memory results = ERC725XCore._executeBatch(
|
|
295
|
-
operationsType,
|
|
296
|
-
targets,
|
|
297
|
-
values,
|
|
298
|
-
datas
|
|
299
|
-
);
|
|
300
|
-
|
|
301
|
-
// if verifyAfter is true, Call {lsp20VerifyCallResult} on the owner
|
|
302
|
-
if (verifyAfter) {
|
|
303
|
-
LSP20CallVerification._verifyCallResult(
|
|
304
|
-
accountOwner,
|
|
305
|
-
abi.encode(results)
|
|
306
|
-
);
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
return results;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
* @inheritdoc ERC725YCore
|
|
314
|
-
*
|
|
315
|
-
* @custom:requirements Can be only called by the {owner} or by an authorised address that pass the verification check performed on the owner.
|
|
316
|
-
*
|
|
317
|
-
* @custom:events
|
|
318
|
-
* - {UniversalReceiver} event when receiving native tokens.
|
|
319
|
-
* - {DataChanged} event.
|
|
320
|
-
*/
|
|
321
|
-
function setData(
|
|
322
|
-
bytes32 dataKey,
|
|
323
|
-
bytes memory dataValue
|
|
324
|
-
) public payable virtual override {
|
|
325
|
-
if (msg.value != 0) {
|
|
326
|
-
emit UniversalReceiver(
|
|
327
|
-
msg.sender,
|
|
328
|
-
msg.value,
|
|
329
|
-
_TYPEID_LSP0_VALUE_RECEIVED,
|
|
330
|
-
abi.encodePacked(msg.sig),
|
|
331
|
-
""
|
|
332
|
-
);
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
address accountOwner = owner();
|
|
336
|
-
|
|
337
|
-
// If the caller is the owner perform setData directly
|
|
338
|
-
if (msg.sender == accountOwner) {
|
|
339
|
-
return _setData(dataKey, dataValue);
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
// If the caller is not the owner, call {lsp20VerifyCall} on the owner
|
|
343
|
-
// Depending on the returnedStatus, a second call is done after setting data
|
|
344
|
-
bool verifyAfter = _verifyCall(accountOwner);
|
|
345
|
-
|
|
346
|
-
_setData(dataKey, dataValue);
|
|
347
|
-
|
|
348
|
-
// If verifyAfter is true, Call {lsp20VerifyCallResult} on the owner
|
|
349
|
-
// The setData function does not return, second parameter of {_verifyCallResult} will be empty
|
|
350
|
-
if (verifyAfter) {
|
|
351
|
-
_verifyCallResult(accountOwner, "");
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
/**
|
|
356
|
-
* @inheritdoc ERC725YCore
|
|
357
|
-
*
|
|
358
|
-
* @custom:requirements Can be only called by the {owner} or by an authorised address that pass the verification check performed on the owner.
|
|
359
|
-
*
|
|
360
|
-
* @custom:events
|
|
361
|
-
* - {UniversalReceiver} event when receiving native tokens.
|
|
362
|
-
* - {DataChanged} event. (on each iteration of setting data)
|
|
363
|
-
*/
|
|
364
|
-
function setDataBatch(
|
|
365
|
-
bytes32[] memory dataKeys,
|
|
366
|
-
bytes[] memory dataValues
|
|
367
|
-
) public payable virtual override {
|
|
368
|
-
if (msg.value != 0) {
|
|
369
|
-
emit UniversalReceiver(
|
|
370
|
-
msg.sender,
|
|
371
|
-
msg.value,
|
|
372
|
-
_TYPEID_LSP0_VALUE_RECEIVED,
|
|
373
|
-
abi.encodePacked(msg.sig),
|
|
374
|
-
""
|
|
375
|
-
);
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
if (dataKeys.length != dataValues.length) {
|
|
379
|
-
revert ERC725Y_DataKeysValuesLengthMismatch();
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
if (dataKeys.length == 0) {
|
|
383
|
-
revert ERC725Y_DataKeysValuesEmptyArray();
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
address accountOwner = owner();
|
|
387
|
-
|
|
388
|
-
// If the caller is the owner perform setData directly
|
|
389
|
-
if (msg.sender == accountOwner) {
|
|
390
|
-
for (uint256 i; i < dataKeys.length; ) {
|
|
391
|
-
_setData(dataKeys[i], dataValues[i]);
|
|
392
|
-
|
|
393
|
-
unchecked {
|
|
394
|
-
++i;
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
return;
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
// If the caller is not the owner, call {lsp20VerifyCall} on the owner
|
|
402
|
-
// Depending on the returnedStatus, a second call is done after setting data
|
|
403
|
-
bool verifyAfter = _verifyCall(accountOwner);
|
|
404
|
-
|
|
405
|
-
for (uint256 i; i < dataKeys.length; ) {
|
|
406
|
-
_setData(dataKeys[i], dataValues[i]);
|
|
407
|
-
|
|
408
|
-
unchecked {
|
|
409
|
-
++i;
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
// If verifyAfter is true, Call {lsp20VerifyCallResult} on the owner
|
|
414
|
-
// The setData function does not return, second parameter of {_verifyCallResult} will be empty
|
|
415
|
-
if (verifyAfter) {
|
|
416
|
-
_verifyCallResult(accountOwner, "");
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
/**
|
|
421
|
-
* @notice Notifying the contract by calling its `universalReceiver` function with the following informations: typeId: `typeId`; data: `data`.
|
|
422
|
-
*
|
|
423
|
-
* @dev Achieves the goal of [LSP-1-UniversalReceiver] by allowing the account to be notified about incoming/outgoing transactions and enabling reactions to these actions.
|
|
424
|
-
* The reaction is achieved by having two external contracts ([LSP1UniversalReceiverDelegate]) that react on the whole transaction and on the specific typeId, respectively.
|
|
425
|
-
*
|
|
426
|
-
* The function performs the following steps:
|
|
427
|
-
*
|
|
428
|
-
* 1. Query the [ERC-725Y] storage with the data key [_LSP1_UNIVERSAL_RECEIVER_DELEGATE_KEY].
|
|
429
|
-
* - If there is an address stored under the data key, check if this address supports the LSP1 interfaceId.
|
|
430
|
-
*
|
|
431
|
-
* - If yes, call this address with the typeId and data (params), along with additional calldata consisting of 20 bytes of `msg.sender` and 32 bytes of `msg.value`. If not, continue the execution of the function.
|
|
432
|
-
*
|
|
433
|
-
*
|
|
434
|
-
* 2. Query the [ERC-725Y] storage with the data key [_LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX] + `bytes32(typeId)`.
|
|
435
|
-
* (Check [LSP-2-ERC725YJSONSchema] for encoding the data key)
|
|
436
|
-
*
|
|
437
|
-
* - If there is an address stored under the data key, check if this address supports the LSP1 interfaceId.
|
|
438
|
-
*
|
|
439
|
-
* - If yes, call this address with the typeId and data (params), along with additional calldata consisting of 20 bytes of `msg.sender` and 32 bytes of `msg.value`. If not, continue the execution of the function.
|
|
440
|
-
*
|
|
441
|
-
* This function delegates internally the handling of native tokens to the {universalReceiver} function itself passing `_TYPEID_LSP0_VALUE_RECEIVED` as typeId and the calldata as received data.
|
|
442
|
-
*
|
|
443
|
-
* @param typeId The type of call received.
|
|
444
|
-
* @param receivedData The data received.
|
|
445
|
-
*
|
|
446
|
-
* @return returnedValues The ABI encoded return value of the LSP1UniversalReceiverDelegate call and the LSP1TypeIdDelegate call.
|
|
447
|
-
*
|
|
448
|
-
* @custom:events
|
|
449
|
-
* - {UniversalReceiver} when receiving native tokens.
|
|
450
|
-
* - {UniversalReceiver} event with the function parameters, call options, and the response of the UniversalReceiverDelegates (URD) contract that was called.
|
|
451
|
-
*/
|
|
452
|
-
function universalReceiver(
|
|
453
|
-
bytes32 typeId,
|
|
454
|
-
bytes memory receivedData
|
|
455
|
-
) public payable virtual override returns (bytes memory returnedValues) {
|
|
456
|
-
if (msg.value != 0 && (typeId != _TYPEID_LSP0_VALUE_RECEIVED)) {
|
|
457
|
-
universalReceiver(_TYPEID_LSP0_VALUE_RECEIVED, msg.data);
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
// Query the ERC725Y storage with the data key {_LSP1_UNIVERSAL_RECEIVER_DELEGATE_KEY}
|
|
461
|
-
bytes memory lsp1DelegateValue = _getData(
|
|
462
|
-
_LSP1_UNIVERSAL_RECEIVER_DELEGATE_KEY
|
|
463
|
-
);
|
|
464
|
-
bytes memory resultDefaultDelegate;
|
|
465
|
-
|
|
466
|
-
if (lsp1DelegateValue.length >= 20) {
|
|
467
|
-
address lsp1Delegate = address(bytes20(lsp1DelegateValue));
|
|
468
|
-
|
|
469
|
-
// Checking LSP1 InterfaceId support
|
|
470
|
-
if (
|
|
471
|
-
lsp1Delegate.supportsERC165InterfaceUnchecked(
|
|
472
|
-
_INTERFACEID_LSP1_DELEGATE
|
|
473
|
-
)
|
|
474
|
-
) {
|
|
475
|
-
resultDefaultDelegate = ILSP1Delegate(lsp1Delegate)
|
|
476
|
-
.universalReceiverDelegate(
|
|
477
|
-
msg.sender,
|
|
478
|
-
msg.value,
|
|
479
|
-
typeId,
|
|
480
|
-
receivedData
|
|
481
|
-
);
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
// Generate the data key {_LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX + <bytes32 typeId>}
|
|
486
|
-
bytes32 lsp1typeIdDelegateKey = LSP2Utils.generateMappingKey(
|
|
487
|
-
_LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX,
|
|
488
|
-
bytes20(typeId)
|
|
489
|
-
);
|
|
490
|
-
|
|
491
|
-
// Query the ERC725Y storage with the data key {_LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX + <bytes32 typeId>}
|
|
492
|
-
bytes memory lsp1TypeIdDelegateValue = _getData(lsp1typeIdDelegateKey);
|
|
493
|
-
bytes memory resultTypeIdDelegate;
|
|
494
|
-
|
|
495
|
-
if (lsp1TypeIdDelegateValue.length >= 20) {
|
|
496
|
-
address lsp1Delegate = address(bytes20(lsp1TypeIdDelegateValue));
|
|
497
|
-
|
|
498
|
-
// Checking LSP1 InterfaceId support
|
|
499
|
-
if (
|
|
500
|
-
lsp1Delegate.supportsERC165InterfaceUnchecked(
|
|
501
|
-
_INTERFACEID_LSP1_DELEGATE
|
|
502
|
-
)
|
|
503
|
-
) {
|
|
504
|
-
resultTypeIdDelegate = ILSP1Delegate(lsp1Delegate)
|
|
505
|
-
.universalReceiverDelegate(
|
|
506
|
-
msg.sender,
|
|
507
|
-
msg.value,
|
|
508
|
-
typeId,
|
|
509
|
-
receivedData
|
|
510
|
-
);
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
returnedValues = abi.encode(
|
|
515
|
-
resultDefaultDelegate,
|
|
516
|
-
resultTypeIdDelegate
|
|
517
|
-
);
|
|
518
|
-
emit UniversalReceiver(
|
|
519
|
-
msg.sender,
|
|
520
|
-
msg.value,
|
|
521
|
-
typeId,
|
|
522
|
-
receivedData,
|
|
523
|
-
returnedValues
|
|
524
|
-
);
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
/**
|
|
528
|
-
* @inheritdoc LSP14Ownable2Step
|
|
529
|
-
*
|
|
530
|
-
* @custom:requirements
|
|
531
|
-
* - Can be only called by the {owner} or by an authorised address that pass the verification check performed on the owner.
|
|
532
|
-
* - When notifying the new owner via LSP1, the `typeId` used must be the `keccak256(...)` hash of [LSP0OwnershipTransferStarted].
|
|
533
|
-
* - Pending owner cannot accept ownership in the same tx via the LSP1 hook.
|
|
534
|
-
*/
|
|
535
|
-
function transferOwnership(
|
|
536
|
-
address pendingNewOwner
|
|
537
|
-
) public virtual override(LSP14Ownable2Step, OwnableUnset) {
|
|
538
|
-
address currentOwner = owner();
|
|
539
|
-
|
|
540
|
-
// If the caller is the owner perform transferOwnership directly
|
|
541
|
-
if (msg.sender == currentOwner) {
|
|
542
|
-
// set the transfer ownership lock
|
|
543
|
-
_inTransferOwnership = true;
|
|
544
|
-
|
|
545
|
-
// set the pending owner
|
|
546
|
-
LSP14Ownable2Step._transferOwnership(pendingNewOwner);
|
|
547
|
-
emit OwnershipTransferStarted(currentOwner, pendingNewOwner);
|
|
548
|
-
|
|
549
|
-
// notify the pending owner through LSP1
|
|
550
|
-
pendingNewOwner.notifyUniversalReceiver(
|
|
551
|
-
_TYPEID_LSP0_OwnershipTransferStarted,
|
|
552
|
-
abi.encode(currentOwner, pendingNewOwner)
|
|
553
|
-
);
|
|
554
|
-
|
|
555
|
-
// reset the transfer ownership lock
|
|
556
|
-
_inTransferOwnership = false;
|
|
557
|
-
} else {
|
|
558
|
-
// If the caller is not the owner, call {lsp20VerifyCall} on the owner
|
|
559
|
-
// Depending on the returnedStatus, a second call is done after transferring ownership
|
|
560
|
-
bool verifyAfter = _verifyCall(currentOwner);
|
|
561
|
-
|
|
562
|
-
// set the transfer ownership lock
|
|
563
|
-
_inTransferOwnership = true;
|
|
564
|
-
|
|
565
|
-
// Set the pending owner if the call is allowed
|
|
566
|
-
LSP14Ownable2Step._transferOwnership(pendingNewOwner);
|
|
567
|
-
emit OwnershipTransferStarted(currentOwner, pendingNewOwner);
|
|
568
|
-
|
|
569
|
-
// notify the pending owner through LSP1
|
|
570
|
-
pendingNewOwner.notifyUniversalReceiver(
|
|
571
|
-
_TYPEID_LSP0_OwnershipTransferStarted,
|
|
572
|
-
abi.encode(currentOwner, pendingNewOwner)
|
|
573
|
-
);
|
|
574
|
-
|
|
575
|
-
// reset the transfer ownership lock
|
|
576
|
-
_inTransferOwnership = false;
|
|
577
|
-
|
|
578
|
-
// If verifyAfter is true, Call {lsp20VerifyCallResult} on the owner
|
|
579
|
-
// The transferOwnership function does not return, second parameter of {_verifyCallResult} will be empty
|
|
580
|
-
if (verifyAfter) {
|
|
581
|
-
_verifyCallResult(currentOwner, "");
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
/**
|
|
587
|
-
* @inheritdoc LSP14Ownable2Step
|
|
588
|
-
*
|
|
589
|
-
* @custom:requirements
|
|
590
|
-
* - Only the {pendingOwner} can call this function.
|
|
591
|
-
* - When notifying the previous owner via LSP1, the typeId used must be the `keccak256(...)` hash of [LSP0OwnershipTransferred_SenderNotification].
|
|
592
|
-
* - When notifying the new owner via LSP1, the typeId used must be the `keccak256(...)` hash of [LSP0OwnershipTransferred_RecipientNotification].
|
|
593
|
-
*/
|
|
594
|
-
function acceptOwnership() public virtual override notInTransferOwnership {
|
|
595
|
-
address previousOwner = owner();
|
|
596
|
-
address pendingOwnerAddress = pendingOwner();
|
|
597
|
-
|
|
598
|
-
bool verifyAfter;
|
|
599
|
-
|
|
600
|
-
if (msg.sender != pendingOwnerAddress) {
|
|
601
|
-
// If the caller is not the owner, call {lsp20VerifyCall} on the pending owner
|
|
602
|
-
// Depending on the successStatus returned, a second call is done after transferring ownership
|
|
603
|
-
verifyAfter = _verifyCall(pendingOwnerAddress);
|
|
604
|
-
|
|
605
|
-
_setOwner(pendingOwnerAddress);
|
|
606
|
-
delete _pendingOwner;
|
|
607
|
-
delete _renounceOwnershipStartedAt;
|
|
608
|
-
} else {
|
|
609
|
-
_acceptOwnership();
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
// notify the previous owner if supports LSP1
|
|
613
|
-
previousOwner.notifyUniversalReceiver(
|
|
614
|
-
_TYPEID_LSP0_OwnershipTransferred_SenderNotification,
|
|
615
|
-
abi.encode(previousOwner, pendingOwnerAddress)
|
|
616
|
-
);
|
|
617
|
-
|
|
618
|
-
// notify the pending owner if supports LSP1
|
|
619
|
-
pendingOwnerAddress.notifyUniversalReceiver(
|
|
620
|
-
_TYPEID_LSP0_OwnershipTransferred_RecipientNotification,
|
|
621
|
-
abi.encode(previousOwner, pendingOwnerAddress)
|
|
622
|
-
);
|
|
623
|
-
|
|
624
|
-
// If msg.sender != pendingOwnerAddress & verifyAfter is true, Call {lsp20VerifyCallResult} on the new owner
|
|
625
|
-
// The transferOwnership function does not return, second parameter of {_verifyCallResult} will be empty
|
|
626
|
-
if (verifyAfter) {
|
|
627
|
-
_verifyCallResult(pendingOwnerAddress, "");
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
/**
|
|
632
|
-
* @inheritdoc LSP14Ownable2Step
|
|
633
|
-
*
|
|
634
|
-
* @custom:requirements Can be only called by the {owner} or by an authorised address that pass the verification check performed on the owner.
|
|
635
|
-
*
|
|
636
|
-
* @custom:danger Leaves the contract without an owner. Once ownership of the contract has been renounced, any functions that are restricted to be called by the owner or an address allowed by the owner will be permanently inaccessible, making these functions not callable anymore and unusable.
|
|
637
|
-
*
|
|
638
|
-
*/
|
|
639
|
-
function renounceOwnership()
|
|
640
|
-
public
|
|
641
|
-
virtual
|
|
642
|
-
override(LSP14Ownable2Step, OwnableUnset)
|
|
643
|
-
{
|
|
644
|
-
address accountOwner = owner();
|
|
645
|
-
|
|
646
|
-
// If the caller is the owner perform renounceOwnership directly
|
|
647
|
-
if (msg.sender == accountOwner) {
|
|
648
|
-
address previousOwner = owner();
|
|
649
|
-
LSP14Ownable2Step._renounceOwnership();
|
|
650
|
-
|
|
651
|
-
if (owner() == address(0)) {
|
|
652
|
-
previousOwner.notifyUniversalReceiver(
|
|
653
|
-
_TYPEID_LSP0_OwnershipTransferred_SenderNotification,
|
|
654
|
-
abi.encode(accountOwner, address(0))
|
|
655
|
-
);
|
|
656
|
-
}
|
|
657
|
-
} else {
|
|
658
|
-
// If the caller is not the owner, call {lsp20VerifyCall} on the owner
|
|
659
|
-
// Depending on the returnedStatus, a second call is done after transferring ownership
|
|
660
|
-
bool verifyAfter = _verifyCall(accountOwner);
|
|
661
|
-
|
|
662
|
-
address previousOwner = owner();
|
|
663
|
-
LSP14Ownable2Step._renounceOwnership();
|
|
664
|
-
|
|
665
|
-
if (owner() == address(0)) {
|
|
666
|
-
previousOwner.notifyUniversalReceiver(
|
|
667
|
-
_TYPEID_LSP0_OwnershipTransferred_SenderNotification,
|
|
668
|
-
abi.encode(accountOwner, address(0))
|
|
669
|
-
);
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
// If verifyAfter is true, Call {lsp20VerifyCallResult} on the owner
|
|
673
|
-
// The transferOwnership function does not return, second parameter of {_verifyCallResult} will be empty
|
|
674
|
-
if (verifyAfter) {
|
|
675
|
-
_verifyCallResult(accountOwner, "");
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
/**
|
|
681
|
-
* @notice Checking if this contract supports the interface defined by the `bytes4` interface ID `interfaceId`.
|
|
682
|
-
*
|
|
683
|
-
* @dev Achieves the goal of [ERC-165] to detect supported interfaces and [LSP-17-ContractExtension] by
|
|
684
|
-
* checking if the interfaceId being queried is supported on another linked extension.
|
|
685
|
-
*
|
|
686
|
-
* If the contract doesn't support the `interfaceId`, it forwards the call to the
|
|
687
|
-
* `supportsInterface` extension according to [LSP-17-ContractExtension], and checks if the extension
|
|
688
|
-
* implements the interface defined by `interfaceId`.
|
|
689
|
-
*
|
|
690
|
-
* @param interfaceId The interface ID to check if the contract supports it.
|
|
691
|
-
*
|
|
692
|
-
* @return `true` if this contract implements the interface defined by `interfaceId`, `false` otherwise.
|
|
693
|
-
*/
|
|
694
|
-
function supportsInterface(
|
|
695
|
-
bytes4 interfaceId
|
|
696
|
-
)
|
|
697
|
-
public
|
|
698
|
-
view
|
|
699
|
-
virtual
|
|
700
|
-
override(ERC725XCore, ERC725YCore, LSP17Extendable)
|
|
701
|
-
returns (bool)
|
|
702
|
-
{
|
|
703
|
-
return
|
|
704
|
-
interfaceId == _INTERFACEID_ERC1271 ||
|
|
705
|
-
interfaceId == _INTERFACEID_LSP0 ||
|
|
706
|
-
interfaceId == _INTERFACEID_LSP1 ||
|
|
707
|
-
interfaceId == _INTERFACEID_LSP14 ||
|
|
708
|
-
interfaceId == _INTERFACEID_LSP20_CALL_VERIFICATION ||
|
|
709
|
-
super.supportsInterface(interfaceId) ||
|
|
710
|
-
LSP17Extendable._supportsInterfaceInERC165Extension(interfaceId);
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
/**
|
|
714
|
-
* @notice Achieves the goal of [EIP-1271] by validating signatures of smart contracts
|
|
715
|
-
* according to their own logic.
|
|
716
|
-
*
|
|
717
|
-
* @dev Handles two cases:
|
|
718
|
-
*
|
|
719
|
-
* 1. If the owner is an EOA, recovers an address from the hash and the signature provided:
|
|
720
|
-
*
|
|
721
|
-
* - Returns the `_ERC1271_SUCCESSVALUE` if the address recovered is the same as the owner, indicating that it was a valid signature.
|
|
722
|
-
*
|
|
723
|
-
* - If the address is different, it returns the `_ERC1271_FAILVALUE` indicating that the signature is not valid.
|
|
724
|
-
*
|
|
725
|
-
* 2. If the owner is a smart contract, it forwards the call of {isValidSignature()} to the owner contract:
|
|
726
|
-
*
|
|
727
|
-
* - If the contract fails or returns the `_ERC1271_FAILVALUE`, the {isValidSignature()} on the account returns the `_ERC1271_FAILVALUE`, indicating that the signature is not valid.
|
|
728
|
-
*
|
|
729
|
-
* - If the {isValidSignature()} on the owner returned the `_ERC1271_SUCCESSVALUE`, the {isValidSignature()} on the account returns the `_ERC1271_SUCCESSVALUE`, indicating that it's a valid signature.
|
|
730
|
-
*
|
|
731
|
-
* @param dataHash The hash of the data to be validated.
|
|
732
|
-
* @param signature A signature that can validate the previous parameter (Hash).
|
|
733
|
-
*
|
|
734
|
-
* @return returnedStatus A `bytes4` value that indicates if the signature is valid or not.
|
|
735
|
-
*
|
|
736
|
-
* @custom:warning This function does not enforce by default the inclusion of the address of this contract in the signature digest.
|
|
737
|
-
* It is recommended that protocols or applications using this contract include the targeted address (= this contract) in the data to sign.
|
|
738
|
-
* To ensure that a signature is valid for a specific LSP0ERC725Account and prevent signatures from the same EOA to be replayed
|
|
739
|
-
* across different LSP0ERC725Accounts.
|
|
740
|
-
*/
|
|
741
|
-
function isValidSignature(
|
|
742
|
-
bytes32 dataHash,
|
|
743
|
-
bytes memory signature
|
|
744
|
-
) public view virtual override returns (bytes4 returnedStatus) {
|
|
745
|
-
address _owner = owner();
|
|
746
|
-
|
|
747
|
-
// If owner is a contract
|
|
748
|
-
if (_owner.code.length != 0) {
|
|
749
|
-
(bool success, bytes memory result) = _owner.staticcall(
|
|
750
|
-
abi.encodeWithSelector(
|
|
751
|
-
IERC1271.isValidSignature.selector,
|
|
752
|
-
dataHash,
|
|
753
|
-
signature
|
|
754
|
-
)
|
|
755
|
-
);
|
|
756
|
-
|
|
757
|
-
bool isValid = (success &&
|
|
758
|
-
result.length == 32 &&
|
|
759
|
-
abi.decode(result, (bytes32)) ==
|
|
760
|
-
bytes32(_ERC1271_SUCCESSVALUE));
|
|
761
|
-
|
|
762
|
-
return isValid ? _ERC1271_SUCCESSVALUE : _ERC1271_FAILVALUE;
|
|
763
|
-
}
|
|
764
|
-
// If owner is an EOA
|
|
765
|
-
else {
|
|
766
|
-
// if isValidSignature fail, the error is catched in returnedError
|
|
767
|
-
(address recoveredAddress, ECDSA.RecoverError returnedError) = ECDSA
|
|
768
|
-
.tryRecover(dataHash, signature);
|
|
769
|
-
|
|
770
|
-
// if recovering throws an error, return the fail value
|
|
771
|
-
if (returnedError != ECDSA.RecoverError.NoError)
|
|
772
|
-
return _ERC1271_FAILVALUE;
|
|
773
|
-
|
|
774
|
-
// if recovering is successful and the recovered address matches the owner's address,
|
|
775
|
-
// return the ERC1271 success value. Otherwise, return the ERC1271 fail value
|
|
776
|
-
// matches the address of the owner, otherwise return fail value
|
|
777
|
-
return
|
|
778
|
-
recoveredAddress == _owner
|
|
779
|
-
? _ERC1271_SUCCESSVALUE
|
|
780
|
-
: _ERC1271_FAILVALUE;
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
// Internal functions
|
|
785
|
-
|
|
786
|
-
/**
|
|
787
|
-
* @dev Forwards the call to an extension mapped to a function selector.
|
|
788
|
-
*
|
|
789
|
-
* Calls {_getExtensionAndForwardValue} to get the address of the extension mapped to the function selector being
|
|
790
|
-
* called on the account. If there is no extension, the `address(0)` will be returned.
|
|
791
|
-
* Forwards the value sent with the call to the extension if the function selector is mapped to a payable extension.
|
|
792
|
-
*
|
|
793
|
-
* Reverts if there is no extension for the function being called, except for the `bytes4(0)` function selector, which passes even if there is no extension for it.
|
|
794
|
-
*
|
|
795
|
-
* If there is an extension for the function selector being called, it calls the extension with the
|
|
796
|
-
* `CALL` opcode, passing the `msg.data` appended with the 20 bytes of the {msg.sender} and 32 bytes of the `msg.value`.
|
|
797
|
-
*
|
|
798
|
-
* @custom:hint If you would like to forward the `msg.value` to the extension contract, you should store an additional `0x01` byte after the address of the extension under the corresponding LSP17 data key.
|
|
799
|
-
*/
|
|
800
|
-
function _fallbackLSP17Extendable(
|
|
801
|
-
bytes calldata callData
|
|
802
|
-
) internal virtual override returns (bytes memory) {
|
|
803
|
-
// If there is a function selector
|
|
804
|
-
(
|
|
805
|
-
address extension,
|
|
806
|
-
bool isForwardingValue
|
|
807
|
-
) = _getExtensionAndForwardValue(msg.sig);
|
|
808
|
-
|
|
809
|
-
// if value is associated with the extension call and extension function selector is not payable, use the universalReceiver
|
|
810
|
-
if (msg.value != 0 && !isForwardingValue) {
|
|
811
|
-
universalReceiver(_TYPEID_LSP0_VALUE_RECEIVED, callData);
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
// if no extension was found for bytes4(0) return don't revert
|
|
815
|
-
if (msg.sig == bytes4(0) && extension == address(0)) return "";
|
|
816
|
-
|
|
817
|
-
// if no extension was found for other function selectors, revert
|
|
818
|
-
if (extension == address(0))
|
|
819
|
-
revert NoExtensionFoundForFunctionSelector(msg.sig);
|
|
820
|
-
|
|
821
|
-
(bool success, bytes memory result) = extension.call{
|
|
822
|
-
value: isForwardingValue ? msg.value : 0
|
|
823
|
-
}(abi.encodePacked(callData, msg.sender, msg.value));
|
|
824
|
-
|
|
825
|
-
if (success) {
|
|
826
|
-
return result;
|
|
827
|
-
} else {
|
|
828
|
-
// `mload(result)` -> offset in memory where `result.length` is located
|
|
829
|
-
// `add(result, 32)` -> offset in memory where `result` data starts
|
|
830
|
-
assembly {
|
|
831
|
-
let resultdata_size := mload(result)
|
|
832
|
-
revert(add(result, 32), resultdata_size)
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
/**
|
|
838
|
-
* @dev Returns the extension address and the boolean indicating whether to forward the value received to the extension, stored under the following data key:
|
|
839
|
-
* - {_LSP17_EXTENSION_PREFIX} + `<bytes4>` (Check [LSP2-ERC725YJSONSchema] for encoding the data key).
|
|
840
|
-
* - If no extension is stored, returns the address(0).
|
|
841
|
-
* - If the stored value is 20 bytes, return false for the boolean
|
|
842
|
-
*/
|
|
843
|
-
function _getExtensionAndForwardValue(
|
|
844
|
-
bytes4 functionSelector
|
|
845
|
-
) internal view virtual override returns (address, bool) {
|
|
846
|
-
// Generate the data key relevant for the functionSelector being called
|
|
847
|
-
bytes32 mappedExtensionDataKey = LSP2Utils.generateMappingKey(
|
|
848
|
-
_LSP17_EXTENSION_PREFIX,
|
|
849
|
-
functionSelector
|
|
850
|
-
);
|
|
851
|
-
|
|
852
|
-
bytes memory extensionData = ERC725YCore._getData(
|
|
853
|
-
mappedExtensionDataKey
|
|
854
|
-
);
|
|
855
|
-
|
|
856
|
-
// Prevent casting data shorter than 20 bytes to an address to avoid
|
|
857
|
-
// unintentionally calling a different extension, return address(0) instead.
|
|
858
|
-
if (extensionData.length < 20) {
|
|
859
|
-
return (address(0), false);
|
|
860
|
-
}
|
|
861
|
-
|
|
862
|
-
// CHECK if the `extensionData` is 21 bytes long
|
|
863
|
-
// - 20 bytes = extension's address
|
|
864
|
-
// - 1 byte `0x01` as a boolean indicating if the contract should forward the value to the extension or not
|
|
865
|
-
if (extensionData.length == 21) {
|
|
866
|
-
// If the last byte is set to `0x01` (`true`)
|
|
867
|
-
// this indicates that the contract should forward the value to the extension
|
|
868
|
-
if (extensionData[20] == 0x01) {
|
|
869
|
-
// Return the address of the extension
|
|
870
|
-
return (address(bytes20(extensionData)), true);
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
return (address(bytes20(extensionData)), false);
|
|
875
|
-
}
|
|
876
|
-
}
|
|
4
|
+
import "@lukso/lsp0-contracts/contracts/LSP0ERC725AccountCore.sol";
|