@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,295 +1,4 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
pragma solidity ^0.8.4;
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
IERC725Y
|
|
7
|
-
} from "@erc725/smart-contracts/contracts/interfaces/IERC725Y.sol";
|
|
8
|
-
import {
|
|
9
|
-
ILSP1UniversalReceiverDelegate
|
|
10
|
-
} from "../ILSP1UniversalReceiverDelegate.sol";
|
|
11
|
-
import {ILSP7DigitalAsset} from "../../LSP7DigitalAsset/ILSP7DigitalAsset.sol";
|
|
12
|
-
|
|
13
|
-
// modules
|
|
14
|
-
import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
|
|
15
|
-
import {Version} from "../../Version.sol";
|
|
16
|
-
|
|
17
|
-
// libraries
|
|
18
|
-
import {
|
|
19
|
-
ERC165Checker
|
|
20
|
-
} from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
|
|
21
|
-
import {LSP5Utils} from "../../LSP5ReceivedAssets/LSP5Utils.sol";
|
|
22
|
-
import {LSP10Utils} from "../../LSP10ReceivedVaults/LSP10Utils.sol";
|
|
23
|
-
|
|
24
|
-
// constants
|
|
25
|
-
import {_INTERFACEID_LSP1_DELEGATE} from "../LSP1Constants.sol";
|
|
26
|
-
import {
|
|
27
|
-
_TYPEID_LSP7_TOKENSSENDER,
|
|
28
|
-
_TYPEID_LSP7_TOKENSRECIPIENT,
|
|
29
|
-
_INTERFACEID_LSP7
|
|
30
|
-
} from "../../LSP7DigitalAsset/LSP7Constants.sol";
|
|
31
|
-
import {
|
|
32
|
-
_TYPEID_LSP8_TOKENSSENDER,
|
|
33
|
-
_TYPEID_LSP8_TOKENSRECIPIENT,
|
|
34
|
-
_INTERFACEID_LSP8
|
|
35
|
-
} from "../../LSP8IdentifiableDigitalAsset/LSP8Constants.sol";
|
|
36
|
-
import {
|
|
37
|
-
_TYPEID_LSP9_OwnershipTransferred_SenderNotification,
|
|
38
|
-
_TYPEID_LSP9_OwnershipTransferred_RecipientNotification
|
|
39
|
-
} from "../../LSP9Vault/LSP9Constants.sol";
|
|
40
|
-
|
|
41
|
-
// errors
|
|
42
|
-
import {CannotRegisterEOAsAsAssets} from "../LSP1Errors.sol";
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* @title Implementation of a UniversalReceiverDelegate for the [LSP-0-ERC725Account]
|
|
46
|
-
* @author Fabian Vogelsteller, Yamen Merhi, Jean Cavallera
|
|
47
|
-
* @dev The {LSP1UniversalReceiverDelegateUP} follows the [LSP-1-UniversalReceiver] standard and is designed
|
|
48
|
-
* for [LSP-0-ERC725Account] contracts.
|
|
49
|
-
*
|
|
50
|
-
* The {LSP1UniversalReceiverDelegateUP} is a contract called by the {universalReceiver(...)} function of the [LSP-0-ERC725Account] contract that:
|
|
51
|
-
*
|
|
52
|
-
* - Writes the data keys representing assets received from type [LSP-7-DigitalAsset] and [LSP-8-IdentifiableDigitalAsset] into the account storage, and removes them when the balance is zero according to the [LSP-5-ReceivedAssets] Standard.
|
|
53
|
-
* - Writes the data keys representing the owned vaults from type [LSP-9-Vault] into your account storage, and removes them when transferring ownership to other accounts according to the [LSP-10-ReceivedVaults] Standard.
|
|
54
|
-
*
|
|
55
|
-
*/
|
|
56
|
-
contract LSP1UniversalReceiverDelegateUP is
|
|
57
|
-
ERC165,
|
|
58
|
-
Version,
|
|
59
|
-
ILSP1UniversalReceiverDelegate
|
|
60
|
-
{
|
|
61
|
-
using ERC165Checker for address;
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* @dev When receiving notifications about:
|
|
65
|
-
* - LSP7 Tokens sent or received
|
|
66
|
-
* - LSP8 Tokens sent or received
|
|
67
|
-
* - LSP9 Vaults sent or received
|
|
68
|
-
* The notifier should be either the LSP7 or LSP8 or LSP9 contract.
|
|
69
|
-
*
|
|
70
|
-
* We revert to avoid registering the EOA as asset (spam protection)
|
|
71
|
-
* if we received a typeId associated with tokens or vaults transfers.
|
|
72
|
-
*
|
|
73
|
-
* @param notifier The address that notified.
|
|
74
|
-
*/
|
|
75
|
-
modifier notEOA(address notifier) {
|
|
76
|
-
// solhint-disable-next-line avoid-tx-origin
|
|
77
|
-
if (notifier == tx.origin) {
|
|
78
|
-
revert CannotRegisterEOAsAsAssets(notifier);
|
|
79
|
-
}
|
|
80
|
-
_;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* @dev
|
|
85
|
-
* 1. Writes the data keys of the received [LSP-7-DigitalAsset], [LSP-8-IdentifiableDigitalAsset] and [LSP-9-Vault] contract addresses into the account storage according to the [LSP-5-ReceivedAssets] and [LSP-10-ReceivedVaults] Standard.
|
|
86
|
-
* 2. The data keys representing an asset/vault are cleared when the asset/vault is no longer owned by the account.
|
|
87
|
-
*
|
|
88
|
-
* @notice Reacted on received notification with `typeId`.
|
|
89
|
-
*
|
|
90
|
-
* @custom:warning When the data stored in the ERC725Y storage of the LSP0 contract is corrupted (_e.g: ([LSP-5-ReceivedAssets]'s Array length not 16 bytes long, the token received is already registered in `LSP5ReceivetAssets[]`, the token being sent is not sent as full balance, etc...), the function call will still pass and return (**not revert!**) and not modify any data key on the storage of the [LSP-0-ERC725Account].
|
|
91
|
-
*
|
|
92
|
-
* @custom:requirements
|
|
93
|
-
* - This contract should be allowed to use the {setDataBatch(...)} function in order to update the LSP5 and LSP10 Data Keys.
|
|
94
|
-
* - Cannot accept native tokens
|
|
95
|
-
*
|
|
96
|
-
* @custom:info
|
|
97
|
-
* - If some issues occured with generating the `dataKeys` or `dataValues` the `returnedMessage` will be an error message, otherwise it will be empty.
|
|
98
|
-
* - If an error occured when trying to use `setDataBatch(dataKeys,dataValues)`, it will return the raw error data back to the caller.
|
|
99
|
-
*
|
|
100
|
-
* @param typeId Unique identifier for a specific notification.
|
|
101
|
-
* @return The result of the reaction for `typeId`.
|
|
102
|
-
*/
|
|
103
|
-
function universalReceiverDelegate(
|
|
104
|
-
address notifier,
|
|
105
|
-
uint256 /*value*/,
|
|
106
|
-
bytes32 typeId,
|
|
107
|
-
bytes memory /* data */
|
|
108
|
-
) public virtual override returns (bytes memory) {
|
|
109
|
-
if (typeId == _TYPEID_LSP7_TOKENSSENDER) {
|
|
110
|
-
return _tokenSender(notifier);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (typeId == _TYPEID_LSP7_TOKENSRECIPIENT) {
|
|
114
|
-
return _tokenRecipient(notifier, _INTERFACEID_LSP7);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
if (typeId == _TYPEID_LSP8_TOKENSSENDER) {
|
|
118
|
-
return _tokenSender(notifier);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
if (typeId == _TYPEID_LSP8_TOKENSRECIPIENT) {
|
|
122
|
-
return _tokenRecipient(notifier, _INTERFACEID_LSP8);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if (typeId == _TYPEID_LSP9_OwnershipTransferred_SenderNotification) {
|
|
126
|
-
return _vaultSender(notifier);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
if (typeId == _TYPEID_LSP9_OwnershipTransferred_RecipientNotification) {
|
|
130
|
-
return _vaultRecipient(notifier);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
return "LSP1: typeId out of scope";
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* @dev Handler for LSP7 and LSP8 token sender type id.
|
|
138
|
-
*
|
|
139
|
-
* @custom:info
|
|
140
|
-
* - Tries to generate LSP5 data key/value pairs for removing asset from the ERC725Y storage.
|
|
141
|
-
* - Tries to use `setDataBatch(bytes32[],bytes[])` if generated proper LSP5 data key/value pairs.
|
|
142
|
-
* - Does not revert. But returns an error message. Use off-chain lib to get even more info.
|
|
143
|
-
*
|
|
144
|
-
* @param notifier The LSP7 or LSP8 token address.
|
|
145
|
-
*/
|
|
146
|
-
function _tokenSender(
|
|
147
|
-
address notifier
|
|
148
|
-
) internal notEOA(notifier) returns (bytes memory) {
|
|
149
|
-
// if the amount sent is not the full balance, then do not update the keys
|
|
150
|
-
try ILSP7DigitalAsset(notifier).balanceOf(msg.sender) returns (
|
|
151
|
-
uint256 balance
|
|
152
|
-
) {
|
|
153
|
-
if (balance != 0) {
|
|
154
|
-
return "LSP1: full balance is not sent";
|
|
155
|
-
}
|
|
156
|
-
} catch {
|
|
157
|
-
return "LSP1: `balanceOf(address)` function not found";
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
(bytes32[] memory dataKeys, bytes[] memory dataValues) = LSP5Utils
|
|
161
|
-
.generateSentAssetKeys(msg.sender, notifier);
|
|
162
|
-
|
|
163
|
-
// `generateSentAssetKeys(...)` returns empty arrays when encountering errors
|
|
164
|
-
if (dataKeys.length == 0 && dataValues.length == 0) {
|
|
165
|
-
return "LSP5: Error generating data key/value pairs";
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
// Set the LSP5 generated data keys on the account
|
|
169
|
-
return _setDataBatchWithoutReverting(dataKeys, dataValues);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* @dev Handler for LSP7 and LSP8 token recipient type id.
|
|
174
|
-
*
|
|
175
|
-
* @custom:info
|
|
176
|
-
* - Tries to generate LSP5 data key/value pairs for adding asset to the ERC725Y storage.
|
|
177
|
-
* - Tries to use `setDataBatch(bytes32[],bytes[])` if generated proper LSP5 data key/value pairs.
|
|
178
|
-
* - Does not revert. But returns an error message. Use off-chain lib to get even more info.
|
|
179
|
-
*
|
|
180
|
-
* @param notifier The LSP7 or LSP8 token address.
|
|
181
|
-
* @param interfaceId The LSP7 or LSP8 interface id.
|
|
182
|
-
*/
|
|
183
|
-
function _tokenRecipient(
|
|
184
|
-
address notifier,
|
|
185
|
-
bytes4 interfaceId
|
|
186
|
-
) internal notEOA(notifier) returns (bytes memory) {
|
|
187
|
-
// CHECK balance only when the Token contract is already deployed,
|
|
188
|
-
// not when tokens are being transferred on deployment through the `constructor`
|
|
189
|
-
if (notifier.code.length != 0) {
|
|
190
|
-
// if the amount sent is 0, then do not update the keys
|
|
191
|
-
try ILSP7DigitalAsset(notifier).balanceOf(msg.sender) returns (
|
|
192
|
-
uint256 balance
|
|
193
|
-
) {
|
|
194
|
-
if (balance == 0) {
|
|
195
|
-
return "LSP1: balance is zero";
|
|
196
|
-
}
|
|
197
|
-
} catch {
|
|
198
|
-
return "LSP1: `balanceOf(address)` function not found";
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
(bytes32[] memory dataKeys, bytes[] memory dataValues) = LSP5Utils
|
|
203
|
-
.generateReceivedAssetKeys(msg.sender, notifier, interfaceId);
|
|
204
|
-
|
|
205
|
-
// `generateReceivedAssetKeys(...)` returns empty arrays when encountering errors
|
|
206
|
-
if (dataKeys.length == 0 && dataValues.length == 0) {
|
|
207
|
-
return "LSP5: Error generating data key/value pairs";
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// Set the LSP5 generated data keys on the account
|
|
211
|
-
return _setDataBatchWithoutReverting(dataKeys, dataValues);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* @dev Handler for LSP9 vault sender type id.
|
|
216
|
-
*
|
|
217
|
-
* @custom:info
|
|
218
|
-
* - Tries to generate LSP10 data key/value pairs for removing vault from the ERC725Y storage.
|
|
219
|
-
* - Tries to use `setDataBatch(bytes32[],bytes[])` if generated proper LSP10 data key/value pairs.
|
|
220
|
-
* - Does not revert. But returns an error message. Use off-chain lib to get even more info.
|
|
221
|
-
*
|
|
222
|
-
* @param notifier The LSP9 vault address.
|
|
223
|
-
*/
|
|
224
|
-
function _vaultSender(
|
|
225
|
-
address notifier
|
|
226
|
-
) internal notEOA(notifier) returns (bytes memory) {
|
|
227
|
-
(bytes32[] memory dataKeys, bytes[] memory dataValues) = LSP10Utils
|
|
228
|
-
.generateSentVaultKeys(msg.sender, notifier);
|
|
229
|
-
|
|
230
|
-
// `generateSentVaultKeys(...)` returns empty arrays when encountering errors
|
|
231
|
-
if (dataKeys.length == 0 && dataValues.length == 0) {
|
|
232
|
-
return "LSP10: Error generating data key/value pairs";
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
// Set the LSP10 generated data keys on the account
|
|
236
|
-
return _setDataBatchWithoutReverting(dataKeys, dataValues);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* @dev Handler for LSP9 vault recipient type id.
|
|
241
|
-
*
|
|
242
|
-
* @custom:info
|
|
243
|
-
* - Tries to generate LSP5 data key/value pairs for adding vault to the ERC725Y storage.
|
|
244
|
-
* - Tries to use `setDataBatch(bytes32[],bytes[])` if generated proper LSP5 data key/value pairs.
|
|
245
|
-
* - Does not revert. But returns an error message. Use off-chain lib to get even more info.
|
|
246
|
-
*
|
|
247
|
-
* @param notifier The LSP9 vault address.
|
|
248
|
-
*/
|
|
249
|
-
function _vaultRecipient(
|
|
250
|
-
address notifier
|
|
251
|
-
) internal notEOA(notifier) returns (bytes memory) {
|
|
252
|
-
(bytes32[] memory dataKeys, bytes[] memory dataValues) = LSP10Utils
|
|
253
|
-
.generateReceivedVaultKeys(msg.sender, notifier);
|
|
254
|
-
|
|
255
|
-
// `generateReceivedVaultKeys(...)` returns empty arrays when encountering errors
|
|
256
|
-
if (dataKeys.length == 0 && dataValues.length == 0) {
|
|
257
|
-
return "LSP10: Error generating data key/value pairs";
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
// Set the LSP10 generated data keys on the account
|
|
261
|
-
return _setDataBatchWithoutReverting(dataKeys, dataValues);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* @dev Calls `bytes4(keccak256(setDataBatch(bytes32[],bytes[])))` without checking for `bool success`, but it returns all the data back.
|
|
266
|
-
*
|
|
267
|
-
* @custom:info If an the low-level transaction revert, the returned data will be forwarded. Th contract that uses this function can use the `Address` library to revert with the revert reason.
|
|
268
|
-
*
|
|
269
|
-
* @param dataKeys Data Keys to be set.
|
|
270
|
-
* @param dataValues Data Values to be set.
|
|
271
|
-
*/
|
|
272
|
-
function _setDataBatchWithoutReverting(
|
|
273
|
-
bytes32[] memory dataKeys,
|
|
274
|
-
bytes[] memory dataValues
|
|
275
|
-
) internal returns (bytes memory) {
|
|
276
|
-
try IERC725Y(msg.sender).setDataBatch(dataKeys, dataValues) {
|
|
277
|
-
return "";
|
|
278
|
-
} catch (bytes memory errorData) {
|
|
279
|
-
return errorData;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
// --- Overrides
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* @inheritdoc ERC165
|
|
287
|
-
*/
|
|
288
|
-
function supportsInterface(
|
|
289
|
-
bytes4 interfaceId
|
|
290
|
-
) public view virtual override returns (bool) {
|
|
291
|
-
return
|
|
292
|
-
interfaceId == _INTERFACEID_LSP1_DELEGATE ||
|
|
293
|
-
super.supportsInterface(interfaceId);
|
|
294
|
-
}
|
|
295
|
-
}
|
|
4
|
+
import "@lukso/lsp1delegate-contracts/contracts/LSP1UniversalReceiverDelegateUP.sol";
|
|
@@ -1,220 +1,4 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
pragma solidity ^0.8.4;
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
IERC725Y
|
|
7
|
-
} from "@erc725/smart-contracts/contracts/interfaces/IERC725Y.sol";
|
|
8
|
-
import {
|
|
9
|
-
ILSP1UniversalReceiverDelegate
|
|
10
|
-
} from "../ILSP1UniversalReceiverDelegate.sol";
|
|
11
|
-
import {ILSP7DigitalAsset} from "../../LSP7DigitalAsset/ILSP7DigitalAsset.sol";
|
|
12
|
-
|
|
13
|
-
// modules
|
|
14
|
-
import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
|
|
15
|
-
import {Version} from "../../Version.sol";
|
|
16
|
-
|
|
17
|
-
// libraries
|
|
18
|
-
import {LSP5Utils} from "../../LSP5ReceivedAssets/LSP5Utils.sol";
|
|
19
|
-
|
|
20
|
-
// constants
|
|
21
|
-
import {_INTERFACEID_LSP1_DELEGATE} from "../LSP1Constants.sol";
|
|
22
|
-
import {
|
|
23
|
-
_TYPEID_LSP7_TOKENSSENDER,
|
|
24
|
-
_TYPEID_LSP7_TOKENSRECIPIENT,
|
|
25
|
-
_INTERFACEID_LSP7
|
|
26
|
-
} from "../../LSP7DigitalAsset/LSP7Constants.sol";
|
|
27
|
-
import {
|
|
28
|
-
_TYPEID_LSP8_TOKENSSENDER,
|
|
29
|
-
_TYPEID_LSP8_TOKENSRECIPIENT,
|
|
30
|
-
_INTERFACEID_LSP8
|
|
31
|
-
} from "../../LSP8IdentifiableDigitalAsset/LSP8Constants.sol";
|
|
32
|
-
|
|
33
|
-
// errors
|
|
34
|
-
import {CannotRegisterEOAsAsAssets} from "../LSP1Errors.sol";
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @title Implementation of a UniversalReceiverDelegate for the [LSP9Vault]
|
|
38
|
-
* @author Fabian Vogelsteller, Yamen Merhi, Jean Cavallera
|
|
39
|
-
* @dev The {LSP1UniversalReceiverDelegateVault} follows the [LSP-1-UniversalReceiver] standard and is designed
|
|
40
|
-
* for [LSP9Vault] contracts.
|
|
41
|
-
*
|
|
42
|
-
* The {LSP1UniversalReceiverDelegateVault} is a contract called by the {universalReceiver(...)} function of the [LSP-9-Vault] contract that:
|
|
43
|
-
*
|
|
44
|
-
* - Writes the data keys representing assets received from type [LSP-7-DigitalAsset] and [LSP-8-IdentifiableDigitalAsset] into the account storage, and removes them when the balance is zero according to the [LSP-5-ReceivedAssets] Standard.
|
|
45
|
-
*/
|
|
46
|
-
contract LSP1UniversalReceiverDelegateVault is
|
|
47
|
-
ERC165,
|
|
48
|
-
Version,
|
|
49
|
-
ILSP1UniversalReceiverDelegate
|
|
50
|
-
{
|
|
51
|
-
/**
|
|
52
|
-
* @dev When receiving notifications about:
|
|
53
|
-
* - LSP7 Tokens sent or received
|
|
54
|
-
* - LSP8 Tokens sent or received
|
|
55
|
-
* The notifier should be either the LSP7 or LSP8 contract.
|
|
56
|
-
*
|
|
57
|
-
* We revert to avoid registering the EOA as asset (spam protection)
|
|
58
|
-
* if we received a typeId associated with tokens transfers.
|
|
59
|
-
*
|
|
60
|
-
* @param notifier The address that notified.
|
|
61
|
-
*/
|
|
62
|
-
modifier notEOA(address notifier) {
|
|
63
|
-
// solhint-disable-next-line avoid-tx-origin
|
|
64
|
-
if (notifier == tx.origin) {
|
|
65
|
-
revert CannotRegisterEOAsAsAssets(notifier);
|
|
66
|
-
}
|
|
67
|
-
_;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* @inheritdoc ILSP1UniversalReceiverDelegate
|
|
72
|
-
* @dev Handles two cases:
|
|
73
|
-
*
|
|
74
|
-
* Writes the received [LSP-7-DigitalAsset] or [LSP-8-IdentifiableDigitalAsset] assets into the vault storage according to the [LSP-5-ReceivedAssets] standard.
|
|
75
|
-
*
|
|
76
|
-
* @notice Reacted on received notification with `typeId`.
|
|
77
|
-
*
|
|
78
|
-
* @custom:requirements Cannot accept native tokens.
|
|
79
|
-
* @custom:info
|
|
80
|
-
* - If some issues occured with generating the `dataKeys` or `dataValues` the `returnedMessage` will be an error message, otherwise it will be empty.
|
|
81
|
-
* - If an error occured when trying to use `setDataBatch(dataKeys,dataValues)`, it will return the raw error data back to the caller.
|
|
82
|
-
*
|
|
83
|
-
* @param typeId Unique identifier for a specific notification.
|
|
84
|
-
* @return The result of the reaction for `typeId`.
|
|
85
|
-
*/
|
|
86
|
-
function universalReceiverDelegate(
|
|
87
|
-
address notifier,
|
|
88
|
-
uint256 /*value*/,
|
|
89
|
-
bytes32 typeId,
|
|
90
|
-
bytes memory /* data */
|
|
91
|
-
) public virtual override returns (bytes memory) {
|
|
92
|
-
if (typeId == _TYPEID_LSP7_TOKENSSENDER) {
|
|
93
|
-
return _tokenSender(notifier);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if (typeId == _TYPEID_LSP7_TOKENSRECIPIENT) {
|
|
97
|
-
return _tokenRecipient(notifier, _INTERFACEID_LSP7);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (typeId == _TYPEID_LSP8_TOKENSSENDER) {
|
|
101
|
-
return _tokenSender(notifier);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (typeId == _TYPEID_LSP8_TOKENSRECIPIENT) {
|
|
105
|
-
return _tokenRecipient(notifier, _INTERFACEID_LSP8);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return "LSP1: typeId out of scope";
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* @dev Handler for LSP7 and LSP8 token sender type id.
|
|
113
|
-
*
|
|
114
|
-
* @custom:info
|
|
115
|
-
* - Tries to generate LSP5 data key/value pairs for removing asset from the ERC725Y storage.
|
|
116
|
-
* - Tries to use `setDataBatch(bytes32[],bytes[])` if generated proper LSP5 data key/value pairs.
|
|
117
|
-
* - Does not revert. But returns an error message. Use off-chain lib to get even more info.
|
|
118
|
-
*
|
|
119
|
-
* @param notifier The LSP7 or LSP8 token address.
|
|
120
|
-
*/
|
|
121
|
-
function _tokenSender(
|
|
122
|
-
address notifier
|
|
123
|
-
) internal notEOA(notifier) returns (bytes memory) {
|
|
124
|
-
// if the amount sent is not the full balance, then do not update the keys
|
|
125
|
-
try ILSP7DigitalAsset(notifier).balanceOf(msg.sender) returns (
|
|
126
|
-
uint256 balance
|
|
127
|
-
) {
|
|
128
|
-
if (balance != 0) {
|
|
129
|
-
return "LSP1: full balance is not sent";
|
|
130
|
-
}
|
|
131
|
-
} catch {
|
|
132
|
-
return "LSP1: `balanceOf(address)` function not found";
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
(bytes32[] memory dataKeys, bytes[] memory dataValues) = LSP5Utils
|
|
136
|
-
.generateSentAssetKeys(msg.sender, notifier);
|
|
137
|
-
|
|
138
|
-
// `generateSentAssetKeys(...)` returns empty arrays when encountering errors
|
|
139
|
-
if (dataKeys.length == 0 && dataValues.length == 0) {
|
|
140
|
-
return "LSP5: Error generating data key/value pairs";
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// Set the LSP5 generated data keys on the account
|
|
144
|
-
return _setDataBatchWithoutReverting(dataKeys, dataValues);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* @dev Handler for LSP7 and LSP8 token recipient type id.
|
|
149
|
-
*
|
|
150
|
-
* @custom:info
|
|
151
|
-
* - Tries to generate LSP5 data key/value pairs for adding asset to the ERC725Y storage.
|
|
152
|
-
* - Tries to use `setDataBatch(bytes32[],bytes[])` if generated proper LSP5 data key/value pairs.
|
|
153
|
-
* - Does not revert. But returns an error message. Use off-chain lib to get even more info.
|
|
154
|
-
*
|
|
155
|
-
* @param notifier The LSP7 or LSP8 token address.
|
|
156
|
-
* @param interfaceId The LSP7 or LSP8 interface id.
|
|
157
|
-
*/
|
|
158
|
-
function _tokenRecipient(
|
|
159
|
-
address notifier,
|
|
160
|
-
bytes4 interfaceId
|
|
161
|
-
) internal notEOA(notifier) returns (bytes memory) {
|
|
162
|
-
// CHECK balance only when the Token contract is already deployed,
|
|
163
|
-
// not when tokens are being transferred on deployment through the `constructor`
|
|
164
|
-
if (notifier.code.length != 0) {
|
|
165
|
-
// if the amount sent is 0, then do not update the keys
|
|
166
|
-
try ILSP7DigitalAsset(notifier).balanceOf(msg.sender) returns (
|
|
167
|
-
uint256 balance
|
|
168
|
-
) {
|
|
169
|
-
if (balance == 0) {
|
|
170
|
-
return "LSP1: balance is zero";
|
|
171
|
-
}
|
|
172
|
-
} catch {
|
|
173
|
-
return "LSP1: `balanceOf(address)` function not found";
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
(bytes32[] memory dataKeys, bytes[] memory dataValues) = LSP5Utils
|
|
178
|
-
.generateReceivedAssetKeys(msg.sender, notifier, interfaceId);
|
|
179
|
-
|
|
180
|
-
// `generateReceivedAssetKeys(...)` returns empty arrays when encountering errors
|
|
181
|
-
if (dataKeys.length == 0 && dataValues.length == 0) {
|
|
182
|
-
return "LSP5: Error generating data key/value pairs";
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
// Set the LSP5 generated data keys on the account
|
|
186
|
-
return _setDataBatchWithoutReverting(dataKeys, dataValues);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* @dev Calls `bytes4(keccak256(setDataBatch(bytes32[],bytes[])))` without checking for `bool succes`, but it returns all the data back.
|
|
191
|
-
*
|
|
192
|
-
* @custom:info If an the low-level transaction revert, the returned data will be forwarded. Th contract that uses this function can use the `Address` library to revert with the revert reason.
|
|
193
|
-
*
|
|
194
|
-
* @param dataKeys Data Keys to be set.
|
|
195
|
-
* @param dataValues Data Values to be set.
|
|
196
|
-
*/
|
|
197
|
-
function _setDataBatchWithoutReverting(
|
|
198
|
-
bytes32[] memory dataKeys,
|
|
199
|
-
bytes[] memory dataValues
|
|
200
|
-
) internal returns (bytes memory) {
|
|
201
|
-
try IERC725Y(msg.sender).setDataBatch(dataKeys, dataValues) {
|
|
202
|
-
return "";
|
|
203
|
-
} catch (bytes memory errorData) {
|
|
204
|
-
return errorData;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
// --- Overrides
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* @inheritdoc ERC165
|
|
212
|
-
*/
|
|
213
|
-
function supportsInterface(
|
|
214
|
-
bytes4 interfaceId
|
|
215
|
-
) public view virtual override returns (bool) {
|
|
216
|
-
return
|
|
217
|
-
interfaceId == _INTERFACEID_LSP1_DELEGATE ||
|
|
218
|
-
super.supportsInterface(interfaceId);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
4
|
+
import "@lukso/lsp1delegate-contracts/contracts/LSP1UniversalReceiverDelegateVault.sol";
|
|
@@ -1,87 +1,4 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
pragma solidity ^0.8.4;
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
ERC165Checker
|
|
7
|
-
} from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
|
|
8
|
-
import {LSP2Utils} from "../LSP2ERC725YJSONSchema/LSP2Utils.sol";
|
|
9
|
-
|
|
10
|
-
// constants
|
|
11
|
-
import {ILSP1UniversalReceiver as ILSP1} from "./ILSP1UniversalReceiver.sol";
|
|
12
|
-
|
|
13
|
-
// constants
|
|
14
|
-
import {
|
|
15
|
-
_INTERFACEID_LSP1,
|
|
16
|
-
_LSP1_UNIVERSAL_RECEIVER_DELEGATE_KEY,
|
|
17
|
-
_LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX
|
|
18
|
-
} from "../LSP1UniversalReceiver/LSP1Constants.sol";
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @title LSP1 Utility library.
|
|
22
|
-
* @author Jean Cavallera <CJ42>, Yamen Merhi <YamenMerhi>, Daniel Afteni <B00ste>
|
|
23
|
-
* @dev LSP1Utils is a library of utility functions that can be used to notify the `universalReceiver` function of a contract
|
|
24
|
-
* that implements LSP1 and retrieve informations related to LSP1 `typeId`.
|
|
25
|
-
* Based on LSP1 Universal Receiver standard.
|
|
26
|
-
*/
|
|
27
|
-
library LSP1Utils {
|
|
28
|
-
using ERC165Checker for address;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @dev Notify a contract at `lsp1Implementation` address by calling its `universalReceiver` function if this contract
|
|
32
|
-
* supports the LSP1 interface.
|
|
33
|
-
*
|
|
34
|
-
* @param lsp1Implementation The address of the contract to notify.
|
|
35
|
-
* @param typeId A `bytes32` typeId.
|
|
36
|
-
* @param data Any optional data to send to the `universalReceiver` function to the `lsp1Implementation` address.
|
|
37
|
-
*/
|
|
38
|
-
function notifyUniversalReceiver(
|
|
39
|
-
address lsp1Implementation,
|
|
40
|
-
bytes32 typeId,
|
|
41
|
-
bytes memory data
|
|
42
|
-
) internal {
|
|
43
|
-
if (
|
|
44
|
-
lsp1Implementation.supportsERC165InterfaceUnchecked(
|
|
45
|
-
_INTERFACEID_LSP1
|
|
46
|
-
)
|
|
47
|
-
) {
|
|
48
|
-
ILSP1(lsp1Implementation).universalReceiver(typeId, data);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* @notice Retrieving the value stored under the ERC725Y data key `LSP1UniversalReceiverDelegate`.
|
|
54
|
-
*
|
|
55
|
-
* @dev Query internally the ERC725Y storage of a `ERC725Y` smart contract to retrieve
|
|
56
|
-
* the value set under the `LSP1UniversalReceiverDelegate` data key.
|
|
57
|
-
*
|
|
58
|
-
* @param erc725YStorage A reference to the ERC725Y storage mapping of the contract.
|
|
59
|
-
* @return The bytes value stored under the `LSP1UniversalReceiverDelegate` data key.
|
|
60
|
-
*/
|
|
61
|
-
function getLSP1DelegateValue(
|
|
62
|
-
mapping(bytes32 => bytes) storage erc725YStorage
|
|
63
|
-
) internal view returns (bytes memory) {
|
|
64
|
-
return erc725YStorage[_LSP1_UNIVERSAL_RECEIVER_DELEGATE_KEY];
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* @notice Retrieving the value stored under the ERC725Y data key `LSP1UniversalReceiverDelegate:<type-id>` for a specific `typeId`.
|
|
69
|
-
*
|
|
70
|
-
* @dev Query internally the ERC725Y storage of a `ERC725Y` smart contract to retrieve
|
|
71
|
-
* the value set under the `LSP1UniversalReceiverDelegate:<bytes32>` data key for a specific LSP1 `typeId`.
|
|
72
|
-
*
|
|
73
|
-
* @param erc725YStorage A reference to the ERC725Y storage mapping of the contract.
|
|
74
|
-
* @param typeId A bytes32 LSP1 `typeId`;
|
|
75
|
-
* @return The bytes value stored under the `LSP1UniversalReceiverDelegate:<bytes32>` data key.
|
|
76
|
-
*/
|
|
77
|
-
function getLSP1DelegateValueForTypeId(
|
|
78
|
-
mapping(bytes32 => bytes) storage erc725YStorage,
|
|
79
|
-
bytes32 typeId
|
|
80
|
-
) internal view returns (bytes memory) {
|
|
81
|
-
bytes32 lsp1TypeIdDataKey = LSP2Utils.generateMappingKey(
|
|
82
|
-
_LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX,
|
|
83
|
-
bytes20(typeId)
|
|
84
|
-
);
|
|
85
|
-
return erc725YStorage[lsp1TypeIdDataKey];
|
|
86
|
-
}
|
|
87
|
-
}
|
|
4
|
+
import "@lukso/lsp1-contracts/contracts/LSP1Utils.sol";
|
|
@@ -1,39 +1,4 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
pragma solidity ^0.8.4;
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
* @title Interface for the LSP20 Call Verification standard, a set of functions intended to perform verifications on behalf of another contract.
|
|
6
|
-
*
|
|
7
|
-
* @dev Interface to be inherited for contract supporting LSP20-CallVerification
|
|
8
|
-
*/
|
|
9
|
-
interface ILSP20CallVerifier {
|
|
10
|
-
/**
|
|
11
|
-
* @return returnedStatus MUST return the first 3 bytes of `lsp20VerifyCall(address,uint256,bytes)` function selector if the call to
|
|
12
|
-
* the function is allowed, concatened with a byte that determines if the lsp20VerifyCallResult function should
|
|
13
|
-
* be called after the original function call. The byte that invoke the lsp20VerifyCallResult function is strictly `0x01`.
|
|
14
|
-
*
|
|
15
|
-
* @param requestor The address that requested to make the call to `target`.
|
|
16
|
-
* @param target The address of the contract that implements the `LSP20CallVerification` interface.
|
|
17
|
-
* @param caller The address who called the function on the `target` contract.
|
|
18
|
-
* @param value The value sent by the caller to the function called on the msg.sender
|
|
19
|
-
* @param callData The calldata sent by the caller to the msg.sender
|
|
20
|
-
*/
|
|
21
|
-
function lsp20VerifyCall(
|
|
22
|
-
address requestor,
|
|
23
|
-
address target,
|
|
24
|
-
address caller,
|
|
25
|
-
uint256 value,
|
|
26
|
-
bytes memory callData
|
|
27
|
-
) external returns (bytes4 returnedStatus);
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @return MUST return the lsp20VerifyCallResult function selector if the call to the function is allowed
|
|
31
|
-
*
|
|
32
|
-
* @param callHash The keccak256 hash of the parameters of {lsp20VerifyCall} concatenated
|
|
33
|
-
* @param callResult The value result of the function called on the msg.sender
|
|
34
|
-
*/
|
|
35
|
-
function lsp20VerifyCallResult(
|
|
36
|
-
bytes32 callHash,
|
|
37
|
-
bytes memory callResult
|
|
38
|
-
) external returns (bytes4);
|
|
39
|
-
}
|
|
4
|
+
import "@lukso/lsp20-contracts/contracts/ILSP20CallVerifier.sol";
|