@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,296 +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 {ILSP6KeyManager} from "./ILSP6KeyManager.sol";
|
|
9
|
-
|
|
10
|
-
// libraries
|
|
11
|
-
import {LSP2Utils} from "../LSP2ERC725YJSONSchema/LSP2Utils.sol";
|
|
12
|
-
|
|
13
|
-
// constants
|
|
14
|
-
import {
|
|
15
|
-
_LSP6KEY_ADDRESSPERMISSIONS_PERMISSIONS_PREFIX,
|
|
16
|
-
_LSP6KEY_ADDRESSPERMISSIONS_ALLOWEDCALLS_PREFIX,
|
|
17
|
-
_LSP6KEY_ADDRESSPERMISSIONS_AllowedERC725YDataKeys_PREFIX,
|
|
18
|
-
_LSP6KEY_ADDRESSPERMISSIONS_ARRAY,
|
|
19
|
-
_PERMISSION_CHANGEOWNER,
|
|
20
|
-
_PERMISSION_EDITPERMISSIONS,
|
|
21
|
-
_PERMISSION_ADDCONTROLLER,
|
|
22
|
-
_PERMISSION_ADDEXTENSIONS,
|
|
23
|
-
_PERMISSION_CHANGEEXTENSIONS,
|
|
24
|
-
_PERMISSION_ADDUNIVERSALRECEIVERDELEGATE,
|
|
25
|
-
_PERMISSION_CHANGEUNIVERSALRECEIVERDELEGATE,
|
|
26
|
-
_PERMISSION_REENTRANCY,
|
|
27
|
-
_PERMISSION_SETDATA,
|
|
28
|
-
_PERMISSION_CALL,
|
|
29
|
-
_PERMISSION_STATICCALL,
|
|
30
|
-
_PERMISSION_DELEGATECALL,
|
|
31
|
-
_PERMISSION_DEPLOY,
|
|
32
|
-
_PERMISSION_TRANSFERVALUE,
|
|
33
|
-
_PERMISSION_SIGN
|
|
34
|
-
} from "./LSP6Constants.sol";
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @title LSP6 Utility library.
|
|
38
|
-
* @author Yamen Merhi <YamenMerhi>, Jean Cavallera <CJ42>, Maxime Viard <SkimaHarvey>
|
|
39
|
-
* @dev LSP6Utils is a library of utility functions that can be used to retrieve, check and set LSP6 permissions stored under the ERC725Y storage
|
|
40
|
-
* of a smart contract.
|
|
41
|
-
* Based on the LSP6 Key Manager standard.
|
|
42
|
-
*/
|
|
43
|
-
library LSP6Utils {
|
|
44
|
-
using LSP2Utils for bytes12;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* @dev Read the permissions of a `caller` on an ERC725Y `target` contract.
|
|
48
|
-
*
|
|
49
|
-
* @param target An `IERC725Y` contract where to read the permissions.
|
|
50
|
-
* @param caller The controller address to read the permissions from.
|
|
51
|
-
*
|
|
52
|
-
* @return A `bytes32` BitArray containing the permissions of a controller address.
|
|
53
|
-
*
|
|
54
|
-
* @custom:info If the raw value fetched from the ERC725Y storage of `target` is not 32 bytes long, this is considered
|
|
55
|
-
* like _"no permissions are set"_ and will return 32 x `0x00` bytes as `bytes32(0)`.
|
|
56
|
-
*/
|
|
57
|
-
function getPermissionsFor(
|
|
58
|
-
IERC725Y target,
|
|
59
|
-
address caller
|
|
60
|
-
) internal view returns (bytes32) {
|
|
61
|
-
bytes memory permissions = target.getData(
|
|
62
|
-
LSP2Utils.generateMappingWithGroupingKey(
|
|
63
|
-
_LSP6KEY_ADDRESSPERMISSIONS_PERMISSIONS_PREFIX,
|
|
64
|
-
bytes20(caller)
|
|
65
|
-
)
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
if (permissions.length != 32) {
|
|
69
|
-
return bytes32(0);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return bytes32(permissions);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function getAllowedCallsFor(
|
|
76
|
-
IERC725Y target,
|
|
77
|
-
address from
|
|
78
|
-
) internal view returns (bytes memory) {
|
|
79
|
-
return
|
|
80
|
-
target.getData(
|
|
81
|
-
LSP2Utils.generateMappingWithGroupingKey(
|
|
82
|
-
_LSP6KEY_ADDRESSPERMISSIONS_ALLOWEDCALLS_PREFIX,
|
|
83
|
-
bytes20(from)
|
|
84
|
-
)
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* @dev Read the Allowed ERC725Y data keys of a `caller` on an ERC725Y `target` contract.
|
|
90
|
-
*
|
|
91
|
-
* @param target An `IERC725Y` contract where to read the permissions.
|
|
92
|
-
* @param caller The controller address to read the permissions from.
|
|
93
|
-
*
|
|
94
|
-
* @return An abi-encoded array of allowed ERC725 data keys that the controller address is allowed to interact with.
|
|
95
|
-
*/
|
|
96
|
-
function getAllowedERC725YDataKeysFor(
|
|
97
|
-
IERC725Y target,
|
|
98
|
-
address caller
|
|
99
|
-
) internal view returns (bytes memory) {
|
|
100
|
-
return
|
|
101
|
-
target.getData(
|
|
102
|
-
LSP2Utils.generateMappingWithGroupingKey(
|
|
103
|
-
_LSP6KEY_ADDRESSPERMISSIONS_AllowedERC725YDataKeys_PREFIX,
|
|
104
|
-
bytes20(caller)
|
|
105
|
-
)
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* @dev Compare the permissions `controllerPermissions` of a controller address to check if they includes the permissions `permissionToCheck`.
|
|
111
|
-
*
|
|
112
|
-
* @param controllerPermissions The permissions of an address.
|
|
113
|
-
* @param permissionToCheck The permissions to check if the controller has under its `controllerPermissions`.
|
|
114
|
-
*
|
|
115
|
-
* @return `true` if `controllerPermissions` includes `permissionToCheck`, `false` otherwise.
|
|
116
|
-
*/
|
|
117
|
-
function hasPermission(
|
|
118
|
-
bytes32 controllerPermissions,
|
|
119
|
-
bytes32 permissionToCheck
|
|
120
|
-
) internal pure returns (bool) {
|
|
121
|
-
return (controllerPermissions & permissionToCheck) == permissionToCheck;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* @dev Same as `LSP2Utils.isCompactBytesArray` with the additional requirement that each element must be 32 bytes long.
|
|
126
|
-
*
|
|
127
|
-
* @param allowedCallsCompacted A compact bytes array of tuples `(bytes4,address,bytes4,bytes4)` to check (defined as `(bytes4,address,bytes4,bytes4)[CompactBytesArray]` in LSP6).
|
|
128
|
-
*
|
|
129
|
-
* @return `true` if the value passed is a valid compact bytes array of bytes32 AllowedCalls elements, `false` otherwise.
|
|
130
|
-
*/
|
|
131
|
-
function isCompactBytesArrayOfAllowedCalls(
|
|
132
|
-
bytes memory allowedCallsCompacted
|
|
133
|
-
) internal pure returns (bool) {
|
|
134
|
-
uint256 pointer = 0;
|
|
135
|
-
|
|
136
|
-
while (pointer < allowedCallsCompacted.length) {
|
|
137
|
-
if (pointer + 1 >= allowedCallsCompacted.length) return false;
|
|
138
|
-
uint256 elementLength = uint16(
|
|
139
|
-
bytes2(
|
|
140
|
-
abi.encodePacked(
|
|
141
|
-
allowedCallsCompacted[pointer],
|
|
142
|
-
allowedCallsCompacted[pointer + 1]
|
|
143
|
-
)
|
|
144
|
-
)
|
|
145
|
-
);
|
|
146
|
-
// each entries in the allowedCalls (compact) array must be 32 bytes long
|
|
147
|
-
if (elementLength != 32) return false;
|
|
148
|
-
pointer += elementLength + 2;
|
|
149
|
-
}
|
|
150
|
-
if (pointer == allowedCallsCompacted.length) return true;
|
|
151
|
-
return false;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* @dev Same as `LSP2Utils.isCompactBytesArray` with the additional requirement that each element must be from 1 to 32 bytes long.
|
|
156
|
-
*
|
|
157
|
-
* @param allowedERC725YDataKeysCompacted a compact bytes array of ERC725Y data Keys (full bytes32 data keys or bytesN prefix) to check (defined as `bytes[CompactBytesArray]`).
|
|
158
|
-
*
|
|
159
|
-
* @return `true` if the value passed is a valid compact bytes array of bytes32 Allowed ERC725Y data keys, `false` otherwise.
|
|
160
|
-
*/
|
|
161
|
-
function isCompactBytesArrayOfAllowedERC725YDataKeys(
|
|
162
|
-
bytes memory allowedERC725YDataKeysCompacted
|
|
163
|
-
) internal pure returns (bool) {
|
|
164
|
-
uint256 pointer = 0;
|
|
165
|
-
|
|
166
|
-
while (pointer < allowedERC725YDataKeysCompacted.length) {
|
|
167
|
-
if (pointer + 1 >= allowedERC725YDataKeysCompacted.length)
|
|
168
|
-
return false;
|
|
169
|
-
uint256 elementLength = uint16(
|
|
170
|
-
bytes2(
|
|
171
|
-
abi.encodePacked(
|
|
172
|
-
allowedERC725YDataKeysCompacted[pointer],
|
|
173
|
-
allowedERC725YDataKeysCompacted[pointer + 1]
|
|
174
|
-
)
|
|
175
|
-
)
|
|
176
|
-
);
|
|
177
|
-
// the length of the allowed data key must be not under 33 bytes and not 0
|
|
178
|
-
if (elementLength == 0 || elementLength > 32) return false;
|
|
179
|
-
pointer += elementLength + 2;
|
|
180
|
-
}
|
|
181
|
-
if (pointer == allowedERC725YDataKeysCompacted.length) return true;
|
|
182
|
-
return false;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* @dev Use the `setData(bytes32[],bytes[])` function via the KeyManager on the target contract.
|
|
187
|
-
*
|
|
188
|
-
* @param keyManagerAddress The address of the KeyManager.
|
|
189
|
-
* @param keys The array of `bytes32[]` data keys.
|
|
190
|
-
* @param values The array of `bytes[]` data values.
|
|
191
|
-
*/
|
|
192
|
-
function setDataViaKeyManager(
|
|
193
|
-
address keyManagerAddress,
|
|
194
|
-
bytes32[] memory keys,
|
|
195
|
-
bytes[] memory values
|
|
196
|
-
) internal returns (bytes memory result) {
|
|
197
|
-
bytes memory payload = abi.encodeWithSelector(
|
|
198
|
-
IERC725Y.setDataBatch.selector,
|
|
199
|
-
keys,
|
|
200
|
-
values
|
|
201
|
-
);
|
|
202
|
-
result = ILSP6KeyManager(keyManagerAddress).execute(payload);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* @dev Combine multiple permissions into a single `bytes32`.
|
|
207
|
-
* Make sure that the sum of the values of the input array is less than `2^256-1 to avoid overflow.
|
|
208
|
-
*
|
|
209
|
-
* @param permissions The array of permissions to combine.
|
|
210
|
-
* @return A `bytes32` value containing the combined permissions.
|
|
211
|
-
*/
|
|
212
|
-
function combinePermissions(
|
|
213
|
-
bytes32[] memory permissions
|
|
214
|
-
) internal pure returns (bytes32) {
|
|
215
|
-
bytes32 result;
|
|
216
|
-
for (uint256 i; i < permissions.length; i++) {
|
|
217
|
-
result |= permissions[i];
|
|
218
|
-
}
|
|
219
|
-
return result;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* @dev Generate a new set of 3 x LSP6 permission data keys to add a new `controller` on `account`.
|
|
224
|
-
* @param account The ERC725Y contract to add the controller into (used to fetch the `LSP6Permissions[]` length).
|
|
225
|
-
* @param controller The address of the controller to grant permissions to.
|
|
226
|
-
* @param permissions The `BitArray` of permissions to grant to the controller.
|
|
227
|
-
* @return keys An array of 3 x data keys containing:
|
|
228
|
-
* - `keys[0] = AddressPermissions[]` (array length).
|
|
229
|
-
* - `keys[1] = AddressPermissions[index]` (where to store the controller address).
|
|
230
|
-
* - `keys[2] = AddressPermissions:Permissions:<controller>`.
|
|
231
|
-
*
|
|
232
|
-
* @return values An array of 3 x data values containing:
|
|
233
|
-
* - `values[0] =` the new array length of `AddressPermissions[]`
|
|
234
|
-
* - `values[1] =` the address of the controller
|
|
235
|
-
* - `values[2] =` the `permissions` passed as param
|
|
236
|
-
*/
|
|
237
|
-
function generateNewPermissionsKeys(
|
|
238
|
-
IERC725Y account,
|
|
239
|
-
address controller,
|
|
240
|
-
bytes32 permissions
|
|
241
|
-
) internal view returns (bytes32[] memory keys, bytes[] memory values) {
|
|
242
|
-
keys = new bytes32[](3);
|
|
243
|
-
values = new bytes[](3);
|
|
244
|
-
|
|
245
|
-
uint128 arrayLength = uint128(
|
|
246
|
-
bytes16(account.getData(_LSP6KEY_ADDRESSPERMISSIONS_ARRAY))
|
|
247
|
-
);
|
|
248
|
-
uint128 newArrayLength = arrayLength + 1;
|
|
249
|
-
|
|
250
|
-
keys[0] = _LSP6KEY_ADDRESSPERMISSIONS_ARRAY;
|
|
251
|
-
values[0] = abi.encodePacked(newArrayLength);
|
|
252
|
-
|
|
253
|
-
keys[1] = LSP2Utils.generateArrayElementKeyAtIndex(
|
|
254
|
-
_LSP6KEY_ADDRESSPERMISSIONS_ARRAY,
|
|
255
|
-
arrayLength
|
|
256
|
-
);
|
|
257
|
-
values[1] = abi.encodePacked(controller);
|
|
258
|
-
|
|
259
|
-
keys[2] = LSP2Utils.generateMappingWithGroupingKey(
|
|
260
|
-
_LSP6KEY_ADDRESSPERMISSIONS_PERMISSIONS_PREFIX,
|
|
261
|
-
bytes20(controller)
|
|
262
|
-
);
|
|
263
|
-
values[2] = abi.encodePacked(permissions);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* @dev Returns the name of the permission as a string.
|
|
268
|
-
*
|
|
269
|
-
* @param permission The low-level `bytes32` permission as a `BitArray` to get the permission name from.
|
|
270
|
-
*
|
|
271
|
-
* @return The string name of the `bytes32` permission value.
|
|
272
|
-
*/
|
|
273
|
-
function getPermissionName(
|
|
274
|
-
bytes32 permission
|
|
275
|
-
) internal pure returns (string memory) {
|
|
276
|
-
if (permission == _PERMISSION_CHANGEOWNER) return "TRANSFEROWNERSHIP";
|
|
277
|
-
if (permission == _PERMISSION_EDITPERMISSIONS) return "EDITPERMISSIONS";
|
|
278
|
-
if (permission == _PERMISSION_ADDCONTROLLER) return "ADDCONTROLLER";
|
|
279
|
-
if (permission == _PERMISSION_ADDEXTENSIONS) return "ADDEXTENSIONS";
|
|
280
|
-
if (permission == _PERMISSION_CHANGEEXTENSIONS)
|
|
281
|
-
return "CHANGEEXTENSIONS";
|
|
282
|
-
if (permission == _PERMISSION_ADDUNIVERSALRECEIVERDELEGATE)
|
|
283
|
-
return "ADDUNIVERSALRECEIVERDELEGATE";
|
|
284
|
-
if (permission == _PERMISSION_CHANGEUNIVERSALRECEIVERDELEGATE)
|
|
285
|
-
return "CHANGEUNIVERSALRECEIVERDELEGATE";
|
|
286
|
-
if (permission == _PERMISSION_REENTRANCY) return "REENTRANCY";
|
|
287
|
-
if (permission == _PERMISSION_SETDATA) return "SETDATA";
|
|
288
|
-
if (permission == _PERMISSION_CALL) return "CALL";
|
|
289
|
-
if (permission == _PERMISSION_STATICCALL) return "STATICCALL";
|
|
290
|
-
if (permission == _PERMISSION_DELEGATECALL) return "DELEGATECALL";
|
|
291
|
-
if (permission == _PERMISSION_DEPLOY) return "DEPLOY";
|
|
292
|
-
if (permission == _PERMISSION_TRANSFERVALUE) return "TRANSFERVALUE";
|
|
293
|
-
if (permission == _PERMISSION_SIGN) return "SIGN";
|
|
294
|
-
return "";
|
|
295
|
-
}
|
|
296
|
-
}
|
|
4
|
+
import "@lukso/lsp6-contracts/contracts/LSP6Utils.sol";
|
|
@@ -1,305 +1,4 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
|
|
3
2
|
pragma solidity ^0.8.4;
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
|
|
7
|
-
import {
|
|
8
|
-
IERC725Y
|
|
9
|
-
} from "@erc725/smart-contracts/contracts/interfaces/IERC725Y.sol";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @title Interface of the LSP7 - Digital Asset standard, a fungible digital asset.
|
|
13
|
-
*/
|
|
14
|
-
interface ILSP7DigitalAsset is IERC165, IERC725Y {
|
|
15
|
-
// --- Events
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @dev Emitted when the `from` transferred successfully `amount` of tokens to `to`.
|
|
19
|
-
* @param operator The address of the operator that executed the transfer.
|
|
20
|
-
* @param from The address which tokens were sent from (balance decreased by `-amount`).
|
|
21
|
-
* @param to The address that received the tokens (balance increased by `+amount`).
|
|
22
|
-
* @param amount The amount of tokens transferred.
|
|
23
|
-
* @param force if the transferred enforced the `to` recipient address to be a contract that implements the LSP1 standard or not.
|
|
24
|
-
* @param data Any additional data included by the caller during the transfer, and sent in the LSP1 hooks to the `from` and `to` addresses.
|
|
25
|
-
*/
|
|
26
|
-
event Transfer(
|
|
27
|
-
address indexed operator,
|
|
28
|
-
address indexed from,
|
|
29
|
-
address indexed to,
|
|
30
|
-
uint256 amount,
|
|
31
|
-
bool force,
|
|
32
|
-
bytes data
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* @dev Emitted when `tokenOwner` enables `operator` for `amount` tokens.
|
|
37
|
-
* @param operator The address authorized as an operator
|
|
38
|
-
* @param tokenOwner The token owner
|
|
39
|
-
* @param amount The amount of tokens `operator` address has access to from `tokenOwner`
|
|
40
|
-
* @param operatorNotificationData The data to notify the operator about via LSP1.
|
|
41
|
-
*/
|
|
42
|
-
event OperatorAuthorizationChanged(
|
|
43
|
-
address indexed operator,
|
|
44
|
-
address indexed tokenOwner,
|
|
45
|
-
uint256 indexed amount,
|
|
46
|
-
bytes operatorNotificationData
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* @dev Emitted when `tokenOwner` disables `operator` for `amount` tokens and set its {`authorizedAmountFor(...)`} to `0`.
|
|
51
|
-
* @param operator The address revoked from operating
|
|
52
|
-
* @param tokenOwner The token owner
|
|
53
|
-
* @param notified Bool indicating whether the operator has been notified or not
|
|
54
|
-
* @param operatorNotificationData The data to notify the operator about via LSP1.
|
|
55
|
-
*/
|
|
56
|
-
event OperatorRevoked(
|
|
57
|
-
address indexed operator,
|
|
58
|
-
address indexed tokenOwner,
|
|
59
|
-
bool indexed notified,
|
|
60
|
-
bytes operatorNotificationData
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
// --- Token queries
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* @dev Returns the number of decimals used to get its user representation.
|
|
67
|
-
* If the asset contract has been set to be non-divisible via the `isNonDivisible_` parameter in
|
|
68
|
-
* the `constructor`, the decimals returned wiil be `0`. Otherwise `18` is the common value.
|
|
69
|
-
*
|
|
70
|
-
* @custom:notice This information is only used for _display_ purposes: it in
|
|
71
|
-
* no way affects any of the arithmetic of the contract, including
|
|
72
|
-
* {balanceOf} and {transfer}.
|
|
73
|
-
*
|
|
74
|
-
* @return the number of decimals. If `0` is returned, the asset is non-divisible.
|
|
75
|
-
*/
|
|
76
|
-
function decimals() external view returns (uint8);
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* @dev Returns the number of existing tokens that have been minted in this contract.
|
|
80
|
-
* @return The number of existing tokens.
|
|
81
|
-
*/
|
|
82
|
-
function totalSupply() external view returns (uint256);
|
|
83
|
-
|
|
84
|
-
// --- Token owner queries
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* @dev Get the number of tokens owned by `tokenOwner`.
|
|
88
|
-
* If the token is divisible (the {decimals} function returns `18`), the amount returned should be divided
|
|
89
|
-
* by 1e18 to get a better picture of the actual balance of the `tokenOwner`.
|
|
90
|
-
*
|
|
91
|
-
* _Example:_
|
|
92
|
-
*
|
|
93
|
-
* ```
|
|
94
|
-
* balanceOf(someAddress) -> 42_000_000_000_000_000_000 / 1e18 = 42 tokens
|
|
95
|
-
* ```
|
|
96
|
-
*
|
|
97
|
-
* @param tokenOwner The address of the token holder to query the balance for.
|
|
98
|
-
* @return The amount of tokens owned by `tokenOwner`.
|
|
99
|
-
*/
|
|
100
|
-
function balanceOf(address tokenOwner) external view returns (uint256);
|
|
101
|
-
|
|
102
|
-
// --- Operator functionality
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* @dev Sets an `amount` of tokens that an `operator` has access from the caller's balance (allowance). See {authorizedAmountFor}.
|
|
106
|
-
* Notify the operator based on the LSP1-UniversalReceiver standard
|
|
107
|
-
*
|
|
108
|
-
* @param operator The address to authorize as an operator.
|
|
109
|
-
* @param amount The allowance amount of tokens operator has access to.
|
|
110
|
-
* @param operatorNotificationData The data to notify the operator about via LSP1.
|
|
111
|
-
*
|
|
112
|
-
* @custom:requirements
|
|
113
|
-
* - `operator` cannot be the zero address.
|
|
114
|
-
*
|
|
115
|
-
* @custom:events {OperatorAuthorizationChanged} when allowance is given to a new operator or
|
|
116
|
-
* an existing operator's allowance is updated.
|
|
117
|
-
*/
|
|
118
|
-
function authorizeOperator(
|
|
119
|
-
address operator,
|
|
120
|
-
uint256 amount,
|
|
121
|
-
bytes memory operatorNotificationData
|
|
122
|
-
) external;
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* @dev Removes the `operator` address as an operator of callers tokens, disallowing it to send any amount of tokens
|
|
126
|
-
* on behalf of the token owner (the caller of the function `msg.sender`). See also {authorizedAmountFor}.
|
|
127
|
-
*
|
|
128
|
-
* @param operator The address to revoke as an operator.
|
|
129
|
-
* @param notify Boolean indicating whether to notify the operator or not.
|
|
130
|
-
* @param operatorNotificationData The data to notify the operator about via LSP1.
|
|
131
|
-
*
|
|
132
|
-
* @custom:requirements
|
|
133
|
-
* - `operator` cannot be calling address.
|
|
134
|
-
* - `operator` cannot be the zero address.
|
|
135
|
-
*
|
|
136
|
-
* @custom:events {OperatorRevoked} event with address of the operator being revoked for the caller (token holder).
|
|
137
|
-
*/
|
|
138
|
-
function revokeOperator(
|
|
139
|
-
address operator,
|
|
140
|
-
bool notify,
|
|
141
|
-
bytes memory operatorNotificationData
|
|
142
|
-
) external;
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* @custom:info This function in the LSP7 contract can be used as a prevention mechanism
|
|
146
|
-
* against double spending allowance vulnerability.
|
|
147
|
-
*
|
|
148
|
-
* @notice Increase the allowance of `operator` by +`addedAmount`
|
|
149
|
-
*
|
|
150
|
-
* @dev Atomically increases the allowance granted to `operator` by the caller.
|
|
151
|
-
* This is an alternative approach to {authorizeOperator} that can be used as a mitigation
|
|
152
|
-
* for the double spending allowance problem.
|
|
153
|
-
* Notify the operator based on the LSP1-UniversalReceiver standard
|
|
154
|
-
*
|
|
155
|
-
* @param operator The operator to increase the allowance for `msg.sender`
|
|
156
|
-
* @param addedAmount The additional amount to add on top of the current operator's allowance
|
|
157
|
-
*
|
|
158
|
-
* @custom:requirements
|
|
159
|
-
* - `operator` cannot be the same address as `msg.sender`
|
|
160
|
-
* - `operator` cannot be the zero address.
|
|
161
|
-
*
|
|
162
|
-
* @custom:events {OperatorAuthorizationChanged} indicating the updated allowance
|
|
163
|
-
*/
|
|
164
|
-
function increaseAllowance(
|
|
165
|
-
address operator,
|
|
166
|
-
uint256 addedAmount,
|
|
167
|
-
bytes memory operatorNotificationData
|
|
168
|
-
) external;
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* @custom:info This function in the LSP7 contract can be used as a prevention mechanism
|
|
172
|
-
* against the double spending allowance vulnerability.
|
|
173
|
-
*
|
|
174
|
-
* @notice Decrease the allowance of `operator` by -`subtractedAmount`
|
|
175
|
-
*
|
|
176
|
-
* @dev Atomically decreases the allowance granted to `operator` by the caller.
|
|
177
|
-
* This is an alternative approach to {authorizeOperator} that can be used as a mitigation
|
|
178
|
-
* for the double spending allowance problem.
|
|
179
|
-
* Notify the operator based on the LSP1-UniversalReceiver standard
|
|
180
|
-
*
|
|
181
|
-
* @custom:events
|
|
182
|
-
* - {OperatorAuthorizationChanged} event indicating the updated allowance after decreasing it.
|
|
183
|
-
* - {OperatorRevoked} event if `subtractedAmount` is the full allowance,
|
|
184
|
-
* indicating `operator` does not have any alauthorizedAmountForlowance left for `msg.sender`.
|
|
185
|
-
*
|
|
186
|
-
* @param operator The operator to decrease allowance for `msg.sender`
|
|
187
|
-
* @param subtractedAmount The amount to decrease by in the operator's allowance.
|
|
188
|
-
*
|
|
189
|
-
* @custom:requirements
|
|
190
|
-
* - `operator` cannot be the zero address.
|
|
191
|
-
* - `operator` must have allowance for the caller of at least `subtractedAmount`.
|
|
192
|
-
*/
|
|
193
|
-
function decreaseAllowance(
|
|
194
|
-
address operator,
|
|
195
|
-
uint256 subtractedAmount,
|
|
196
|
-
bytes memory operatorNotificationData
|
|
197
|
-
) external;
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* @dev Get the amount of tokens `operator` address has access to from `tokenOwner`.
|
|
201
|
-
* Operators can send and burn tokens on behalf of their owners.
|
|
202
|
-
*
|
|
203
|
-
* @param operator The operator's address to query the authorized amount for.
|
|
204
|
-
* @param tokenOwner The token owner that `operator` has allowance on.
|
|
205
|
-
*
|
|
206
|
-
* @return The amount of tokens the `operator`'s address has access on the `tokenOwner`'s balance.
|
|
207
|
-
*
|
|
208
|
-
* @custom:info If this function is called with the same address for `operator` and `tokenOwner`, it will simply read the `tokenOwner`'s balance
|
|
209
|
-
* (since a tokenOwner is its own operator).
|
|
210
|
-
*/
|
|
211
|
-
function authorizedAmountFor(
|
|
212
|
-
address operator,
|
|
213
|
-
address tokenOwner
|
|
214
|
-
) external view returns (uint256);
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* @dev Returns all `operator` addresses that are allowed to transfer or burn on behalf of `tokenOwner`.
|
|
218
|
-
*
|
|
219
|
-
* @param tokenOwner The token owner to get the operators for.
|
|
220
|
-
* @return An array of operators allowed to transfer or burn tokens on behalf of `tokenOwner`.
|
|
221
|
-
*/
|
|
222
|
-
function getOperatorsOf(
|
|
223
|
-
address tokenOwner
|
|
224
|
-
) external view returns (address[] memory);
|
|
225
|
-
|
|
226
|
-
// --- Transfer functionality
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* @dev Transfers an `amount` of tokens from the `from` address to the `to` address and notify both sender and recipients via the LSP1 {`universalReceiver(...)`} function.
|
|
230
|
-
* If the tokens are transferred by an operator on behalf of a token holder, the allowance for the operator will be decreased by `amount` once the token transfer
|
|
231
|
-
* has been completed (See {authorizedAmountFor}).
|
|
232
|
-
*
|
|
233
|
-
* @param from The sender address.
|
|
234
|
-
* @param to The recipient address.
|
|
235
|
-
* @param amount The amount of tokens to transfer.
|
|
236
|
-
* @param force When set to `true`, the `to` address CAN be any address. When set to `false`, the `to` address MUST be a contract that supports the LSP1 UniversalReceiver standard.
|
|
237
|
-
* @param data Any additional data the caller wants included in the emitted event, and sent in the hooks of the `from` and `to` addresses.
|
|
238
|
-
*
|
|
239
|
-
* @custom:requirements
|
|
240
|
-
* - `from` cannot be the zero address.
|
|
241
|
-
* - `to` cannot be the zero address.
|
|
242
|
-
* - `from` and `to` cannot be the same address (`from` cannot send tokens to itself).
|
|
243
|
-
* - `from` MUST have a balance of at least `amount` tokens.
|
|
244
|
-
* - If the caller is not `from`, it must be an operator for `from` with an allowance of at least `amount` of tokens.
|
|
245
|
-
*
|
|
246
|
-
* @custom:events
|
|
247
|
-
* - {Transfer} event when tokens get successfully transferred.
|
|
248
|
-
* - if the transfer is triggered by an operator, either the {OperatorAuthorizationChanged} event will be emitted with the updated allowance or the {OperatorRevoked}
|
|
249
|
-
* event will be emitted if the operator has no more allowance left.
|
|
250
|
-
*
|
|
251
|
-
* @custom:hint The `force` parameter **MUST be set to `true`** to transfer tokens to Externally Owned Accounts (EOAs)
|
|
252
|
-
* or contracts that do not implement the LSP1 Universal Receiver Standard. Otherwise the function will revert making the transfer fail.
|
|
253
|
-
*
|
|
254
|
-
* @custom:info if the `to` address is a contract that implements LSP1, it will always be notified via its `universalReceiver(...)` function, regardless if `force` is set to `true` or `false`.
|
|
255
|
-
*
|
|
256
|
-
* @custom:warning Be aware that when either the sender or the recipient can have logic that revert in their `universalReceiver(...)` function when being notified.
|
|
257
|
-
* This even if the `force` was set to `true`.
|
|
258
|
-
*/
|
|
259
|
-
function transfer(
|
|
260
|
-
address from,
|
|
261
|
-
address to,
|
|
262
|
-
uint256 amount,
|
|
263
|
-
bool force,
|
|
264
|
-
bytes memory data
|
|
265
|
-
) external;
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* @dev Same as {`transfer(...)`} but transfer multiple tokens based on the arrays of `from`, `to`, `amount`.
|
|
269
|
-
*
|
|
270
|
-
* @custom:info If any transfer in the batch fail or revert, the whole call will revert.
|
|
271
|
-
*
|
|
272
|
-
* @param from An array of sending addresses.
|
|
273
|
-
* @param to An array of receiving addresses.
|
|
274
|
-
* @param amount An array of amount of tokens to transfer for each `from -> to` transfer.
|
|
275
|
-
* @param force For each transfer, when set to `true`, the `to` address CAN be any address. When set to `false`, the `to` address MUST be a contract that supports the LSP1 UniversalReceiver standard.
|
|
276
|
-
* @param data An array of additional data the caller wants included in the emitted event, and sent in the hooks to `from` and `to` addresses.
|
|
277
|
-
*
|
|
278
|
-
* @custom:requirements
|
|
279
|
-
* - `from`, `to`, `amount` lists MUST be of the same length.
|
|
280
|
-
* - no values in `from` can be the zero address.
|
|
281
|
-
* - no values in `to` can be the zero address.
|
|
282
|
-
* - each `amount` tokens MUST be owned by `from`.
|
|
283
|
-
* - for each transfer, if the caller is not `from`, it MUST be an operator for `from` with access to at least `amount` tokens.
|
|
284
|
-
*
|
|
285
|
-
* @custom:events {Transfer} event **for each token transfer**.
|
|
286
|
-
*/
|
|
287
|
-
function transferBatch(
|
|
288
|
-
address[] memory from,
|
|
289
|
-
address[] memory to,
|
|
290
|
-
uint256[] memory amount,
|
|
291
|
-
bool[] memory force,
|
|
292
|
-
bytes[] memory data
|
|
293
|
-
) external;
|
|
294
|
-
|
|
295
|
-
/**
|
|
296
|
-
* @notice Executing the following batch of abi-encoded function calls on the contract: `data`.
|
|
297
|
-
*
|
|
298
|
-
* @dev Allows a caller to batch different function calls in one call. Perform a `delegatecall` on self, to call different functions with preserving the context.
|
|
299
|
-
* @param data An array of ABI encoded function calls to be called on the contract.
|
|
300
|
-
* @return results An array of abi-encoded data returned by the functions executed.
|
|
301
|
-
*/
|
|
302
|
-
function batchCalls(
|
|
303
|
-
bytes[] calldata data
|
|
304
|
-
) external returns (bytes[] memory results);
|
|
305
|
-
}
|
|
4
|
+
import "@lukso/lsp7-contracts/contracts/ILSP7DigitalAsset.sol";
|
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
pragma solidity ^0.8.4;
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
bytes4 constant _INTERFACEID_LSP7 = 0xb3c4928f;
|
|
6
|
-
|
|
7
|
-
// --- Token Hooks
|
|
8
|
-
|
|
9
|
-
// keccak256('LSP7Tokens_SenderNotification')
|
|
10
|
-
bytes32 constant _TYPEID_LSP7_TOKENSSENDER = 0x429ac7a06903dbc9c13dfcb3c9d11df8194581fa047c96d7a4171fc7402958ea;
|
|
11
|
-
|
|
12
|
-
// keccak256('LSP7Tokens_RecipientNotification')
|
|
13
|
-
bytes32 constant _TYPEID_LSP7_TOKENSRECIPIENT = 0x20804611b3e2ea21c480dc465142210acf4a2485947541770ec1fb87dee4a55c;
|
|
14
|
-
|
|
15
|
-
// keccak256('LSP7Tokens_OperatorNotification')
|
|
16
|
-
bytes32 constant _TYPEID_LSP7_TOKENOPERATOR = 0x386072cc5a58e61263b434c722725f21031cd06e7c552cfaa06db5de8a320dbc;
|
|
4
|
+
import "@lukso/lsp7-contracts/contracts/LSP7Constants.sol";
|