@lukso/lsp-smart-contracts 0.7.0 → 0.8.1

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.
Files changed (172) hide show
  1. package/CONTRIBUTING.md +39 -0
  2. package/README.md +93 -40
  3. package/artifacts/Create2Factory.json +2 -2
  4. package/artifacts/LSP0ERC725Account.json +194 -15
  5. package/artifacts/LSP0ERC725AccountInit.json +194 -15
  6. package/artifacts/LSP11BasicSocialRecovery.json +493 -0
  7. package/artifacts/LSP11BasicSocialRecoveryInit.json +513 -0
  8. package/artifacts/LSP16UniversalFactory.json +236 -0
  9. package/artifacts/LSP1UniversalReceiverDelegateUP.json +134 -15
  10. package/artifacts/LSP1UniversalReceiverDelegateVault.json +80 -15
  11. package/artifacts/LSP4Compatibility.json +16 -0
  12. package/artifacts/LSP4DigitalAssetMetadata.json +16 -0
  13. package/artifacts/LSP4DigitalAssetMetadataInitAbstract.json +16 -0
  14. package/artifacts/LSP6KeyManager.json +177 -33
  15. package/artifacts/LSP6KeyManagerInit.json +177 -33
  16. package/artifacts/LSP7CappedSupply.json +26 -5
  17. package/artifacts/LSP7CappedSupplyInitAbstract.json +26 -5
  18. package/artifacts/LSP7CompatibleERC20.json +26 -5
  19. package/artifacts/LSP7CompatibleERC20InitAbstract.json +28 -7
  20. package/artifacts/LSP7CompatibleERC20Mintable.json +29 -8
  21. package/artifacts/LSP7CompatibleERC20MintableInit.json +29 -8
  22. package/artifacts/LSP7DigitalAsset.json +26 -5
  23. package/artifacts/LSP7DigitalAssetInitAbstract.json +26 -5
  24. package/artifacts/LSP7Mintable.json +29 -8
  25. package/artifacts/LSP7MintableInit.json +29 -8
  26. package/artifacts/LSP8CappedSupply.json +27 -6
  27. package/artifacts/LSP8CappedSupplyInitAbstract.json +27 -6
  28. package/artifacts/LSP8CompatibleERC721.json +28 -7
  29. package/artifacts/LSP8CompatibleERC721InitAbstract.json +30 -9
  30. package/artifacts/LSP8CompatibleERC721Mintable.json +31 -10
  31. package/artifacts/LSP8CompatibleERC721MintableInit.json +31 -10
  32. package/artifacts/LSP8IdentifiableDigitalAsset.json +27 -6
  33. package/artifacts/LSP8IdentifiableDigitalAssetInitAbstract.json +27 -6
  34. package/artifacts/LSP8Mintable.json +30 -9
  35. package/artifacts/LSP8MintableInit.json +30 -9
  36. package/artifacts/LSP9Vault.json +202 -17
  37. package/artifacts/LSP9VaultInit.json +202 -17
  38. package/artifacts/UniversalProfile.json +194 -15
  39. package/artifacts/UniversalProfileInit.json +194 -15
  40. package/artifacts/UniversalReceiverAddressStore.json +3 -3
  41. package/common/constants.d.ts +738 -0
  42. package/common/constants.js +785 -0
  43. package/contracts/Custom/EIP191Signer.sol +12 -0
  44. package/contracts/Factories/Create2Factory.sol +1 -3
  45. package/contracts/LSP0ERC725Account/LSP0Constants.sol +13 -2
  46. package/contracts/LSP0ERC725Account/LSP0ERC725Account.sol +2 -1
  47. package/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +320 -63
  48. package/contracts/LSP0ERC725Account/LSP0ERC725AccountInit.sol +2 -2
  49. package/contracts/LSP0ERC725Account/LSP0ERC725AccountInitAbstract.sol +2 -1
  50. package/contracts/LSP0ERC725Account/LSP0Utils.sol +50 -0
  51. package/contracts/LSP10ReceivedVaults/LSP10Constants.sol +2 -2
  52. package/contracts/LSP10ReceivedVaults/LSP10Utils.sol +212 -0
  53. package/contracts/LSP11BasicSocialRecovery/ILSP11BasicSocialRecovery.sol +177 -0
  54. package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol +23 -0
  55. package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecoveryCore.sol +258 -0
  56. package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecoveryInit.sol +26 -0
  57. package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecoveryInitAbstract.sol +19 -0
  58. package/contracts/LSP11BasicSocialRecovery/LSP11Constants.sol +6 -0
  59. package/contracts/LSP11BasicSocialRecovery/LSP11Errors.sol +60 -0
  60. package/contracts/LSP14Ownable2Step/ILSP14Ownable2Step.sol +53 -0
  61. package/contracts/LSP14Ownable2Step/LSP14Constants.sol +15 -0
  62. package/contracts/LSP14Ownable2Step/LSP14Errors.sol +12 -0
  63. package/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol +212 -0
  64. package/contracts/LSP16UniversalFactory/LSP16UniversalFactory.sol +246 -0
  65. package/contracts/LSP17ContractExtension/LSP17Constants.sol +17 -0
  66. package/contracts/LSP17ContractExtension/LSP17Errors.sol +7 -0
  67. package/contracts/LSP17ContractExtension/LSP17Extendable.sol +104 -0
  68. package/contracts/LSP17ContractExtension/LSP17Extension.sol +45 -0
  69. package/contracts/LSP17ContractExtension/LSP17Utils.sol +20 -0
  70. package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiver.sol +5 -5
  71. package/contracts/LSP1UniversalReceiver/LSP1Constants.sol +5 -3
  72. package/contracts/LSP1UniversalReceiver/LSP1Errors.sol +21 -0
  73. package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol +155 -37
  74. package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol +64 -31
  75. package/contracts/LSP1UniversalReceiver/LSP1Utils.sol +53 -40
  76. package/contracts/LSP2ERC725YJSONSchema/LSP2Utils.sol +45 -23
  77. package/contracts/LSP3UniversalProfile/LSP3Constants.sol +1 -1
  78. package/contracts/LSP4DigitalAssetMetadata/ILSP4Compatibility.sol +1 -1
  79. package/contracts/LSP4DigitalAssetMetadata/LSP4Compatibility.sol +1 -1
  80. package/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol +1 -1
  81. package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol +2 -2
  82. package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol +2 -2
  83. package/contracts/LSP4DigitalAssetMetadata/LSP4Errors.sol +3 -3
  84. package/contracts/LSP5ReceivedAssets/LSP5Constants.sol +2 -2
  85. package/contracts/LSP5ReceivedAssets/LSP5Utils.sol +102 -114
  86. package/contracts/LSP6KeyManager/ILSP6KeyManager.sol +25 -7
  87. package/contracts/LSP6KeyManager/LSP6Constants.sol +43 -38
  88. package/contracts/LSP6KeyManager/LSP6Errors.sol +90 -21
  89. package/contracts/LSP6KeyManager/LSP6KeyManager.sol +2 -1
  90. package/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol +224 -506
  91. package/contracts/LSP6KeyManager/LSP6KeyManagerInit.sol +1 -1
  92. package/contracts/LSP6KeyManager/LSP6KeyManagerInitAbstract.sol +3 -2
  93. package/contracts/LSP6KeyManager/LSP6Modules/LSP6ExecuteModule.sol +229 -0
  94. package/contracts/LSP6KeyManager/LSP6Modules/LSP6OwnershipModule.sol +25 -0
  95. package/contracts/LSP6KeyManager/LSP6Modules/LSP6SetDataModule.sol +606 -0
  96. package/contracts/LSP6KeyManager/LSP6Utils.sol +156 -35
  97. package/contracts/LSP7DigitalAsset/ILSP7DigitalAsset.sol +8 -8
  98. package/contracts/LSP7DigitalAsset/LSP7Constants.sol +6 -6
  99. package/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol +1 -1
  100. package/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +36 -36
  101. package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol +1 -1
  102. package/contracts/LSP7DigitalAsset/LSP7Errors.sol +33 -1
  103. package/contracts/LSP7DigitalAsset/extensions/ILSP7CompatibleERC20.sol +1 -1
  104. package/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol +24 -0
  105. package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol +28 -8
  106. package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyInitAbstract.sol +28 -11
  107. package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol +87 -20
  108. package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20InitAbstract.sol +97 -19
  109. package/contracts/LSP7DigitalAsset/presets/ILSP7Mintable.sol +3 -3
  110. package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol +3 -4
  111. package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInit.sol +2 -2
  112. package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInitAbstract.sol +3 -3
  113. package/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol +3 -5
  114. package/contracts/LSP7DigitalAsset/presets/LSP7MintableInit.sol +2 -2
  115. package/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol +3 -3
  116. package/contracts/LSP8IdentifiableDigitalAsset/ILSP8IdentifiableDigitalAsset.sol +7 -7
  117. package/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol +7 -7
  118. package/contracts/LSP8IdentifiableDigitalAsset/LSP8Errors.sol +45 -2
  119. package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol +2 -2
  120. package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +57 -60
  121. package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol +1 -1
  122. package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CompatibleERC721.sol +5 -2
  123. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol +20 -0
  124. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol +27 -7
  125. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInitAbstract.sol +27 -10
  126. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol +234 -30
  127. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol +238 -30
  128. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol +32 -4
  129. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableInitAbstract.sol +35 -8
  130. package/contracts/LSP8IdentifiableDigitalAsset/presets/ILSP8Mintable.sol +3 -3
  131. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol +3 -4
  132. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol +3 -3
  133. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.sol +3 -3
  134. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol +3 -4
  135. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInit.sol +2 -2
  136. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol +3 -3
  137. package/contracts/LSP9Vault/LSP9Constants.sol +10 -10
  138. package/contracts/LSP9Vault/LSP9Errors.sol +8 -0
  139. package/contracts/LSP9Vault/LSP9Vault.sol +6 -4
  140. package/contracts/LSP9Vault/LSP9VaultCore.sol +350 -127
  141. package/contracts/LSP9Vault/LSP9VaultInit.sol +2 -2
  142. package/contracts/LSP9Vault/LSP9VaultInitAbstract.sol +4 -3
  143. package/contracts/Legacy/Registries/AddressRegistry.sol +1 -1
  144. package/contracts/Legacy/Registries/AddressRegistryRequiresERC725.sol +1 -1
  145. package/contracts/Legacy/UniversalReceiverAddressStore.sol +4 -14
  146. package/contracts/UniversalProfile.sol +2 -2
  147. package/contracts/UniversalProfileInit.sol +2 -2
  148. package/contracts/UniversalProfileInitAbstract.sol +1 -1
  149. package/contracts/Utils/GasLib.sol +1 -1
  150. package/module/constants.d.ts +738 -0
  151. package/module/constants.js +782 -0
  152. package/package.json +42 -12
  153. package/artifacts/UniversalFactory.json +0 -127
  154. package/constants.js +0 -594
  155. package/contracts/Custom/ClaimOwnership.sol +0 -96
  156. package/contracts/Custom/ERC165Checker.sol +0 -130
  157. package/contracts/Custom/IClaimOwnership.sol +0 -12
  158. package/contracts/Factories/UniversalFactory.sol +0 -159
  159. package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiverDelegate.sol +0 -24
  160. package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/Handling/TokenAndVaultHandling.sol +0 -82
  161. package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/Handling/TokenHandling.sol +0 -73
  162. package/contracts/LSP2ERC725YJSONSchema/LSP2Errors.sol +0 -9
  163. package/contracts/LSP7DigitalAsset/extensions/ILSP7CappedSupply.sol +0 -17
  164. package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyCore.sol +0 -57
  165. package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20Core.sol +0 -111
  166. package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CappedSupply.sol +0 -17
  167. package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8Enumerable.sol +0 -17
  168. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyCore.sol +0 -58
  169. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleConstants.sol +0 -6
  170. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721Core.sol +0 -211
  171. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableCore.sol +0 -50
  172. package/contracts/Utils/UtilsLib.sol +0 -31
package/constants.js DELETED
@@ -1,594 +0,0 @@
1
- /**
2
- * Set of constants values as defined in each LUKSO Standards Proposals (LSPs).
3
- * @see https://github.com/lukso-network/LIPs/tree/main/LSPs
4
- */
5
-
6
- // ERC165
7
- // ----------
8
-
9
- const INTERFACE_IDS = {
10
- ERC165: '0x01ffc9a7',
11
- ERC1271: '0x1626ba7e',
12
- ERC20: '0x36372b07',
13
- ERC223: '0x87d43052',
14
- ERC721: '0x80ac58cd',
15
- ERC721Metadata: '0x5b5e139f',
16
- ERC777: '0xe58e113c',
17
- ERC1155: '0xd9b67a26',
18
- ERC725X: '0x44c028fe',
19
- ERC725Y: '0x714df77c',
20
- LSP0ERC725Account: '0xeb6be62e',
21
- LSP1UniversalReceiver: '0x6bb56a14',
22
- LSP1UniversalReceiverDelegate: '0xa245bbda',
23
- LSP6KeyManager: '0xc403d48f',
24
- LSP7DigitalAsset: '0x5fcaac27',
25
- LSP8IdentifiableDigitalAsset: '0x49399145',
26
- LSP9Vault: '0xfd4d5c50',
27
- ClaimOwnership: '0xa375e9c6',
28
- };
29
-
30
- // ERC1271
31
- // ----------
32
-
33
- const ERC1271_VALUES = {
34
- MAGIC_VALUE: '0x1626ba7e',
35
- FAIL_VALUE: '0xffffffff',
36
- };
37
-
38
- // ERC725X
39
- // ----------
40
-
41
- const OPERATION_TYPES = {
42
- CALL: 0,
43
- CREATE: 1,
44
- CREATE2: 2,
45
- STATICCALL: 3,
46
- DELEGATECALL: 4,
47
- };
48
-
49
- // ERC725Y
50
- // ----------
51
-
52
- const SupportedStandards = {
53
- LSP3UniversalProfile: {
54
- key: '0xeafec4d89fa9619884b60000abe425d64acd861a49b8ddf5c0b6962110481f38',
55
- value: '0xabe425d6',
56
- },
57
- LSP4DigitalAsset: {
58
- key: '0xeafec4d89fa9619884b60000a4d96624a38f7ac2d8d9a604ecf07c12c77e480c',
59
- value: '0xa4d96624',
60
- },
61
- LSP9Vault: {
62
- key: '0xeafec4d89fa9619884b600007c0334a14085fefa8b51ae5a40895018882bdb90',
63
- value: '0x7c0334a1',
64
- },
65
- };
66
-
67
- /**
68
- * For more infos on the type of each keys
69
- * @see https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-2-ERC725YJSONSchema.md
70
- */
71
- const ERC725YKeys = {
72
- LSP1: {
73
- // keccak256('LSP1UniversalReceiverDelegate')
74
- LSP1UniversalReceiverDelegate:
75
- '0x0cfc51aec37c55a4d0b1a65c6255c4bf2fbdf6277f3cc0730c45b828b6db8b47',
76
- },
77
- LSP3: {
78
- SupportedStandards_LSP3: SupportedStandards.LSP3UniversalProfile,
79
- // keccak256('LSP3Profile')
80
- LSP3Profile: '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5',
81
- },
82
- LSP4: {
83
- SupportedStandards_LSP4: SupportedStandards.LSP4DigitalAsset,
84
- // keccak256('LSP4TokenName')
85
- LSP4TokenName: '0xdeba1e292f8ba88238e10ab3c7f88bd4be4fac56cad5194b6ecceaf653468af1',
86
- // keccak256('LSP4TokenSymbol')
87
- LSP4TokenSymbol: '0x2f0a68ab07768e01943a599e73362a0e17a63a72e94dd2e384d2c1d4db932756',
88
- // keccak256('LSP4Metadata')
89
- LSP4Metadata: '0x9afb95cacc9f95858ec44aa8c3b685511002e30ae54415823f406128b85b238e',
90
- // LSP4CreatorsMap:<address>
91
- LSP4CreatorsMap: '0x6de85eaf5d982b4e5da00000',
92
- // keccak256('"LSP4Creators[]')
93
- 'LSP4Creators[]': {
94
- // use this key to get the number of elements in the array
95
- length: '0x114bd03b3a46d48759680d81ebb2b414fda7d030a7105a851867accf1c2352e7',
96
- // use this key + bytes16(index) to access an index in the array
97
- index: '0x114bd03b3a46d48759680d81ebb2b414',
98
- },
99
- },
100
- LSP5: {
101
- // LSP5ReceivedAssetsMap:<address>
102
- LSP5ReceivedAssetsMap: '0x812c4334633eb816c80d0000',
103
- // keccak256('LSP5ReceivedAssets[]')
104
- 'LSP5ReceivedAssets[]': {
105
- length: '0x6460ee3c0aac563ccbf76d6e1d07bada78e3a9514e6382b736ed3f478ab7b90b',
106
- index: '0x6460ee3c0aac563ccbf76d6e1d07bada',
107
- },
108
- },
109
- LSP6: {
110
- // keccak256('AddressPermissions[]')
111
- 'AddressPermissions[]': {
112
- length: '0xdf30dba06db6a30e65354d9a64c609861f089545ca58c6b4dbe31a5f338cb0e3',
113
- index: '0xdf30dba06db6a30e65354d9a64c60986',
114
- },
115
- // AddressPermissions:Permissions:<address>
116
- 'AddressPermissions:Permissions': '0x4b80742de2bf82acb3630000',
117
- // AddressPermissions:AllowedAddresses:<address>
118
- 'AddressPermissions:AllowedAddresses': '0x4b80742de2bfc6dd6b3c0000',
119
- // AddressPermissions:AllowedFunctions:<address>
120
- 'AddressPermissions:AllowedFunctions': '0x4b80742de2bf8efea1e80000',
121
- // AddressPermissions:AllowedStandards:<address>
122
- 'AddressPermissions:AllowedStandards': '0x4b80742de2bf3efa94a30000',
123
- // AddressPermissions:AllowedERC725YKeys:<address>
124
- 'AddressPermissions:AllowedERC725YKeys': '0x4b80742de2bf90b8b4850000',
125
- },
126
- LSP9: {
127
- SupportedStandards_LSP9: SupportedStandards.LSP9Vault,
128
- },
129
- LSP10: {
130
- // keccak256('LSP10VaultsMap')
131
- LSP10VaultsMap: '0x192448c3c0f88c7f238c0000',
132
- // keccak256('LSP10Vaults[]')
133
- 'LSP10Vaults[]': {
134
- length: '0x55482936e01da86729a45d2b87a6b1d3bc582bea0ec00e38bdb340e3af6f9f06',
135
- index: '0x55482936e01da86729a45d2b87a6b1d3',
136
- },
137
- },
138
- LSP12: {
139
- // LSP12IssuedAssetsMap:<address>
140
- LSP12IssuedAssetsMap: '0x74ac2555c10b9349e78f0000',
141
- // keccak256('LSP12IssuedAssets[]')
142
- 'LSP12IssuedAssets[]': {
143
- length: '0x7c8c3416d6cda87cd42c71ea1843df28ac4850354f988d55ee2eaa47b6dc05cd',
144
- index: '0x7c8c3416d6cda87cd42c71ea1843df28',
145
- },
146
- },
147
- };
148
-
149
- const BasicUPSetup_Schema = [
150
- {
151
- name: 'LSP3Profile',
152
- key: ERC725YKeys.LSP3['LSP3Profile'],
153
- keyType: 'Singleton',
154
- valueContent: 'JSONURL',
155
- valueType: 'bytes',
156
- },
157
- {
158
- name: 'LSP1UniversalReceiverDelegate',
159
- key: ERC725YKeys.LSP1.LSP1UniversalReceiverDelegate,
160
- keyType: 'Singleton',
161
- valueContent: 'Address',
162
- valueType: 'address',
163
- },
164
- {
165
- name: 'LSP12IssuedAssets[]',
166
- key: ERC725YKeys.LSP12['LSP12IssuedAssets[]'].length,
167
- keyType: 'Array',
168
- valueContent: 'Number',
169
- valueType: 'uint256',
170
- },
171
- ];
172
-
173
- // LSP6
174
- // ----------
175
-
176
- // All Permissions currently exclude DELEGATECALL for security
177
- const ALL_PERMISSIONS = '0x0000000000000000000000000000000000000000000000000000000000007fbf';
178
-
179
- // prettier-ignore
180
- const PERMISSIONS = {
181
- CHANGEOWNER: "0x0000000000000000000000000000000000000000000000000000000000000001", // .... .... .... 0001
182
- CHANGEPERMISSIONS: "0x0000000000000000000000000000000000000000000000000000000000000002", // .... .... .... 0010
183
- ADDPERMISSIONS: "0x0000000000000000000000000000000000000000000000000000000000000004", // .... .... .... 0100
184
- SETDATA: "0x0000000000000000000000000000000000000000000000000000000000000008", // .... .... .... 1000
185
- CALL: "0x0000000000000000000000000000000000000000000000000000000000000010", // .... .... 0001 ....
186
- STATICCALL: "0x0000000000000000000000000000000000000000000000000000000000000020", // .... .... 0010 ....
187
- DELEGATECALL: "0x0000000000000000000000000000000000000000000000000000000000000040", // .... .... 0100 ....
188
- DEPLOY: "0x0000000000000000000000000000000000000000000000000000000000000080", // .... .... 1000 ....
189
- TRANSFERVALUE: "0x0000000000000000000000000000000000000000000000000000000000000100", // .... 0001 .... ....
190
- SIGN: "0x0000000000000000000000000000000000000000000000000000000000000200", // .... 0010 .... ....
191
- ENCRYPT: "0x0000000000000000000000000000000000000000000000000000000000000400", // .... 0100 .... ....
192
- SUPER_SETDATA: "0x0000000000000000000000000000000000000000000000000000000000000800", // .... 1000 .... ....
193
- SUPER_TRANSFERVALUE: "0x0000000000000000000000000000000000000000000000000000000000001000", // 0001 .... .... ....
194
- SUPER_CALL: "0x0000000000000000000000000000000000000000000000000000000000002000", // 0010 .... .... ....
195
- SUPER_STATICCALL: "0x0000000000000000000000000000000000000000000000000000000000004000", // 0100 .... .... ....
196
- SUPER_DELEGATECALL: "0x0000000000000000000000000000000000000000000000000000000000008000", // 1000 .... .... ....
197
- }
198
-
199
- const LSP1_TYPE_IDS = {
200
- // keccak256('LSP7TokensSender')
201
- LSP7_TOKENSENDER: '0x40b8bec57d7b5ff0dbd9e9acd0a47dfeb0101e1a203766f5ccab00445fbf39e9',
202
- // keccak256('LSP7TokensRecipient')
203
- LSP7_TOKENRECIPIENT: '0xdbe2c314e1aee2970c72666f2ebe8933a8575263ea71e5ff6a9178e95d47a26f',
204
- // keccak256('LSP8TokensSender')
205
- LSP8_TOKENSENDER: '0x3724c94f0815e936299cca424da4140752198e0beb7931a6e0925d11bc97544c',
206
- // keccak256('LSP8TokensRecipient')
207
- LSP8_TOKENRECIPIENT: '0xc7a120a42b6057a0cbed111fbbfbd52fcd96748c04394f77fc2c3adbe0391e01',
208
- // keccak256("LSP9VaultSender")
209
- LSP9_VAULTSENDER: '0x3ca9f769340018257ac15b3a00e502e8fb730d66086f774210f84d0205af31e7',
210
- // keccak256("LSP9VaultRecipient")
211
- LSP9_VAULTRECIPIENT: '0x09aaf55960715d8d86b57af40be36b0bfd469c9a3643445d8c65d39e27b4c56f',
212
- // keccak256("LSP9VaultPendingOwner")
213
- LSP9_VAULTPENDINGOWNER: '0x50d401f7017708f51f2a7a1c24146f786926c831079107140037b8ebef9fd326',
214
- };
215
-
216
- // ----------
217
-
218
- const Errors = {
219
- ClaimOwnership: {
220
- '0x8b9bf507': {
221
- error: 'NotInRenounceOwnershipInterval(uint256,uint256)',
222
- message: 'ClaimOwnership: Second renounce ownership call available after 100 block delay from the first call',
223
- },
224
- '0x43b248cd': {
225
- error: 'CannotTransferOwnershipToSelf()',
226
- message: 'ClaimOwnership: Cannot transfer ownership to address(this)',
227
- },
228
- },
229
- LSP2: {
230
- '0xb614e91e': {
231
- error: 'InvalidABIEncodedArray(bytes,string)',
232
- message: 'LSP2Utils: Invalid ABI encoded array',
233
- },
234
- },
235
- LSP4: {
236
- '0x85c169bd': {
237
- error: 'LSP4TokenNameNotEditable()',
238
- message: 'LSP4: Token name cannot be edited',
239
- },
240
- '0x76755b38': {
241
- error: 'LSP4TokenSymbolNotEditable()',
242
- message: 'LSP4: Token symbol cannot be edited',
243
- },
244
- },
245
- LSP5: {
246
- '0xecba7af8': {
247
- error: 'InvalidLSP5ReceivedAssetsArrayLength(bytes,uint256)',
248
- message: 'LSP5: Invalid value for `LSP5ReceivedAssets[]` (array length)',
249
- },
250
- },
251
- LSP6: {
252
- '0xf292052a': {
253
- error: 'NoPermissionsSet(address)',
254
- message: 'LSP6: No permissions are set for this address.',
255
- },
256
- '0x3bdad6e6': {
257
- error: 'NotAuthorised(address,string)',
258
- message: 'LSP6: Not authorized (missing permission).',
259
- },
260
- '0x2879b128': {
261
- error: 'NotAllowedAddress(address,address)',
262
- message: 'LSP6: not allowed to interact with address.',
263
- },
264
- '0x42013ee4': {
265
- error: 'NotAllowedStandard(address,address)',
266
- message:
267
- 'LSP6: cannot interact with a contract that does not implement an allowed standard.',
268
- },
269
- '0x84135110': {
270
- error: 'NotAllowedFunction(address,bytes4)',
271
- message: 'LSP6: not allowed to run the function.',
272
- },
273
- '0x3003e7ae': {
274
- error: 'NotAllowedERC725YKey(address,bytes32)',
275
- message: 'LSP6: not allowed to set the ERC725Y data key.',
276
- },
277
- '0x0f7d735b': {
278
- error: 'NotRecognisedPermissionKey(bytes32)',
279
- message: 'LSP6: could not recognise the permission data key being set.',
280
- },
281
- '0xfc854579': {
282
- error: 'InvalidLSP6Target()',
283
- message: 'LSP6: cannot linked the Key Manager to address(0).',
284
- },
285
- '0xc9bd9eb9': {
286
- error: 'InvalidRelayNonce(address,uint256,bytes)',
287
- message: 'LSP6: invalid nonce provided for signer address',
288
- },
289
- '0x2ba8851c': {
290
- error: 'InvalidERC725Function(bytes4)',
291
- message: 'LSP6: unknown or invalid ERC725 function selector',
292
- },
293
- },
294
- LSP7: {
295
- '0xc5e194ab': {
296
- error: 'LSP7AmountExceedsBalance(address,address,uint256)',
297
- message: "LSP7: token amount exceeds sender's balance.",
298
- },
299
- '0xf3a6b691': {
300
- error: 'LSP7AmountExceedsAuthorizedAmount(address,uint256,address,uint256)',
301
- message: "LSP7: token amount exceeds operator's allowance.",
302
- },
303
- '0x6355e766': {
304
- error: 'LSP7CannotUseAddressZeroAsOperator()',
305
- message: 'LSP7: cannot authorize address(0) as operator for LSP7 token.',
306
- },
307
- '0xd2d5ec30': {
308
- error: 'LSP7CannotSendWithAddressZero()',
309
- message: 'LSP7: cannot send token with address(0).',
310
- },
311
- '0xb9afb000': {
312
- error: 'LSP7CannotSendToSelf()',
313
- message: 'LSP7: `from` and `to` address cannot be the same',
314
- },
315
- '0x263eee8d': {
316
- error: 'LSP7InvalidTransferBatch()',
317
- message: 'LSP7: invalid transfer batch.',
318
- },
319
- '0xa608fbb6': {
320
- error: 'LSP7NotifyTokenReceiverContractMissingLSP1Interface(address)',
321
- message: 'LSP7: token recipient does not implement LSP1 standard.',
322
- },
323
- '0x26c247f4': {
324
- error: 'LSP7NotifyTokenReceiverIsEOA(address)',
325
- message: 'LSP7: token recipient is an Externally Owned Account.',
326
- },
327
- },
328
- LSP7CappedSupply: {
329
- '0xacf1d8c5': {
330
- error: 'LSP7CappedSupplyRequired()',
331
- message: 'LSP7CappedSupply: cap supply number required',
332
- },
333
- '0xeacbf0d1': {
334
- error: 'LSP7CappedSupplyCannotMintOverCap()',
335
- message: 'LSP7CappedSupply: cannot mint over the max cap supply',
336
- },
337
- },
338
- LSP8: {
339
- '0xae8f9a36': {
340
- error: 'LSP8NonExistentTokenId(bytes32)',
341
- message: 'LSP8: token id does not exist.',
342
- },
343
- '0x5b271ea2': {
344
- error: 'LSP8NotTokenOwner(address,bytes32,address)',
345
- message: 'LSP8: tokenOwner given as parameter does not own this token id.',
346
- },
347
- '0x1294d2a9': {
348
- error: 'LSP8NotTokenOperator(bytes32,address)',
349
- message: 'LSP8: caller is not an operator for this token id.',
350
- },
351
- '0x9577b8b3': {
352
- error: 'LSP8CannotUseAddressZeroAsOperator()',
353
- message: 'LSP8: cannot use address(0) as an operator for token id.',
354
- },
355
- '0x24ecef4d': {
356
- error: 'LSP8CannotSendToAddressZero()',
357
- message: 'LSP8: cannot send to address(0).',
358
- },
359
- '0x5d67d6c1': {
360
- error: 'LSP8CannotSendToSelf()',
361
- message: 'LSP8: the `from` and `to` address cannot be the same on transfer.',
362
- },
363
- '0x34c7b511': {
364
- error: 'LSP8TokenIdAlreadyMinted(bytes32)',
365
- message: 'LSP8: tokenId already exist (= already minted).',
366
- },
367
- '0x93a83119': {
368
- error: 'LSP8InvalidTransferBatch()',
369
- message: 'LSP8: invalid transfer batch.',
370
- },
371
- '0x4349776d': {
372
- error: 'LSP8NotifyTokenReceiverContractMissingLSP1Interface(address)',
373
- message: 'LSP8: token recipient does not implement LSP1 standard.',
374
- },
375
- '0x03173137': {
376
- error: 'LSP8NotifyTokenReceiverIsEOA(address)',
377
- message: 'LSP8: token recipient is an Externally Owned Account.',
378
- },
379
- },
380
- LSP8CappedSupply: {
381
- '0x38d9fc30': {
382
- error: 'LSP8CappedSupplyRequired()',
383
- message: 'LSP8CappedSupply: cap supply number required',
384
- },
385
- '0xe8ba2291': {
386
- error: 'LSP8CappedSupplyCannotMintOverCap()',
387
- message: 'LSP8CappedSupply: cannot mint over the max cap supply',
388
- },
389
- },
390
- };
391
-
392
- // ----------
393
-
394
- const EventSignatures = {
395
- ERC173: {
396
- /**
397
- * event OwnershipTransferred(
398
- * address indexed previousOwner,
399
- * address indexed newOwner,
400
- * );
401
- *
402
- * signature = keccak256('OwnershipTransferred(address,address)')
403
- */
404
- OwnershipTransfered: '0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0',
405
- },
406
- ClaimOwnership: {
407
- /**
408
- * event RenounceOwnershipInitiated();
409
- *
410
- * signature = keccak256('RenounceOwnershipInitiated()')
411
- */
412
- RenounceOwnershipInitiated:
413
- '0X56272768d104766ae5e663c58927d0a9e47effb40b9a8f6644ac5dfbc9e56f84',
414
- },
415
- ERC725X: {
416
- /**
417
- * event ContractCreated(
418
- * uint256 indexed _operation,
419
- * address indexed _contractAddress,
420
- * uint256 indexed _value
421
- * );
422
- *
423
- * signature = keccak256('ContractCreated(uint256,address,uint256)')
424
- */
425
- ContractCreated: '0x01c42bd7e97a66166063b02fce6924e6656b6c2c61966630165095c4fb0b7b2f',
426
- /**
427
- * event Executed(
428
- * uint256 indexed _operation,
429
- * address indexed _to,
430
- * uint256 indexed _value,
431
- * bytes4 _data
432
- * );
433
- *
434
- * signature = keccak256('Executed(uint256,address,uint256,bytes4)')
435
- */
436
- Executed: '0x4810874456b8e6487bd861375cf6abd8e1c8bb5858c8ce36a86a04dabfac199e',
437
- },
438
- ERC725Y: {
439
- /**
440
- * event DataChanged(
441
- * bytes32 indexed dataKey,
442
- * bytes dataValue
443
- * );
444
- *
445
- * signature = keccak256('DataChanged(bytes32,bytes)')
446
- */
447
- DataChanged: '0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2',
448
- },
449
- // ERC725Account
450
- LSP0: {
451
- /**
452
- * event ValueReceived(
453
- * address indexed sender,
454
- * uint256 indexed value
455
- * );
456
- *
457
- * signature = keccak256('ValueReceived(address,uint256)')
458
- */
459
- ValueReceived: '0x7e71433ddf847725166244795048ecf3e3f9f35628254ecbf736056664233493',
460
- },
461
- LSP1: {
462
- /**
463
- * event UniversalReceiver(
464
- * address indexed from,
465
- * uint256 value,
466
- * bytes32 indexed typeId,
467
- * bytes indexed returnedValue,
468
- * bytes receivedData
469
- * );
470
- *
471
- * signature = keccak256('UniversalReceiver(address,uint256,bytes32,bytes,bytes)')
472
- */
473
- UniversalReceiver: '0x9c3ba68eb5742b8e3961aea0afc7371a71bf433c8a67a831803b64c064a178c2',
474
- },
475
- LSP6: {
476
- /**
477
- * event Executed(
478
- * uint256 indexed _value,
479
- * bytes4 _data
480
- * );
481
- *
482
- * signature = keccak256('Executed(uint256,bytes4)')
483
- */
484
- Executed: '0x6b9340454526f665e369d7ac17353d0b73774a4a80f746b959ece8130e0f1d72',
485
- },
486
- LSP7: {
487
- /**
488
- * event Transfer(
489
- * address indexed operator,
490
- * address indexed from,
491
- * address indexed to,
492
- * uint256 amount,
493
- * bool force,
494
- * bytes data
495
- * );
496
- *
497
- * signature = keccak256('Transfer(address,address,address,uint256,bool,bytes)')
498
- */
499
- Transfer: '0x3997e418d2cef0b3b0e907b1e39605c3f7d32dbd061e82ea5b4a770d46a160a6',
500
- /**
501
- * event AuthorizedOperator(
502
- * address indexed operator,
503
- * address indexed tokenOwner,
504
- * uint256 indexed amount
505
- * );
506
- *
507
- * signature = keccak256('AuthorizedOperator(address,address,uint256)')
508
- */
509
- AuthorizedOperator: '0xd66aff874162a96578e919097b6f6d153dfd89a5cec41bb331fdb0c4aec16e2c',
510
- /**
511
- * event RevokedOperator(
512
- * address indexed operator,
513
- * address indexed tokenOwner
514
- * );
515
- *
516
- * signature = keccak256('RevokedOperator(address,address)')
517
- */
518
- RevokedOperator: '0x50546e66e5f44d728365dc3908c63bc5cfeeab470722c1677e3073a6ac294aa1',
519
- },
520
- LSP8: {
521
- /**
522
- * event Transfer(
523
- * address operator,
524
- * address indexed from,
525
- * address indexed to,
526
- * bytes32 indexed tokenId,
527
- * bool force,
528
- * bytes data
529
- * );
530
- *
531
- * signature = keccak256('Transfer(address,address,address,bytes32,bool,bytes)')
532
- */
533
- Transfer: 'b333c813a7426a7a11e2b190cad52c44119421594b47f6f32ace6d8c7207b2bf',
534
- /**
535
- * event AuthorizedOperator(
536
- * address indexed operator,
537
- * address indexed tokenOwner,
538
- * bytes32 indexed tokenId
539
- * );
540
- *
541
- * signature = keccak256('AuthorizedOperator(address,address,bytes32)')
542
- */
543
- AuthorizedOperator: '34b797fc5a526f7bf1d2b5de25f6564fd85ae364e3ee939aee7c1ac27871a988',
544
- /**
545
- * event RevokedOperator(
546
- * address indexed operator,
547
- * address indexed tokenOwner,
548
- * bytes32 indexed tokenId
549
- * );
550
- *
551
- * signature = keccak256('RevokedOperator(address,address,bytes32)')
552
- */
553
- RevokedOperator: '17d5389f6ab6adb2647dfa0aa365c323d37adacc30b33a65310b6158ce1373d5',
554
- },
555
- LSP9: {
556
- /**
557
- * event ValueReceived(
558
- * address indexed sender,
559
- * uint256 indexed value
560
- * );
561
- *
562
- * signature = keccak256('ValueReceived(address,uint256)')
563
- */
564
- ValueReceived: '0x7e71433ddf847725166244795048ecf3e3f9f35628254ecbf736056664233493',
565
- },
566
- Helpers: {
567
- /**
568
- * event ReceivedERC777(
569
- * address indexed token,
570
- * address indexed _operator,
571
- * address indexed _from,
572
- * address _to,
573
- * uint256 _amount
574
- * );
575
- *
576
- * signature = keccak256('ReceivedERC777(address,address,address,address,uint256)')
577
- */
578
- ReceivedERC777: '0xdc38539587ea4d67f9f649ad9269646bab26927bad175bdcdfdab5dd297d5e1c',
579
- },
580
- };
581
-
582
- module.exports = {
583
- INTERFACE_IDS,
584
- ERC1271_VALUES,
585
- OPERATION_TYPES,
586
- SupportedStandards,
587
- ERC725YKeys,
588
- BasicUPSetup_Schema,
589
- ALL_PERMISSIONS,
590
- PERMISSIONS,
591
- LSP1_TYPE_IDS,
592
- Errors,
593
- EventSignatures,
594
- };
@@ -1,96 +0,0 @@
1
- // SPDX-License-Identifier: MIT
2
- pragma solidity ^0.8.0;
3
-
4
- // interfaces
5
- import {IClaimOwnership} from "./IClaimOwnership.sol";
6
-
7
- // modules
8
- import {OwnableUnset} from "@erc725/smart-contracts/contracts/custom/OwnableUnset.sol";
9
-
10
- /**
11
- * @dev reverts when trying to renounce ownership before the initial confirmation delay
12
- */
13
- error NotInRenounceOwnershipInterval(uint256 renounceOwnershipStart, uint256 renounceOwnershipEnd);
14
-
15
- /**
16
- * @dev reverts when trying to transfer ownership to the address(this)
17
- */
18
- error CannotTransferOwnershipToSelf();
19
-
20
- /**
21
- * @title ClaimOwnership
22
- * @author Fabian Vogelsteller <fabian@lukso.network>, Jean Cavallera (CJ42), Yamen Merhi (YamenMerhi), Daniel Afteni (B00ste)
23
- * @dev This contract is a modified version of the OwnableUnset implementation, where transferring and renouncing ownership
24
- * works as a 2 steps process. This can be used as a confirmation mechanism to prevent potential mistakes when
25
- * transferring ownership of the contract, where the control of the contract could be lost forever.
26
- */
27
- abstract contract ClaimOwnership is IClaimOwnership, OwnableUnset {
28
-
29
- /**
30
- * @dev The number of block that need to pass before one is able to
31
- * confirm renouncing ownership
32
- */
33
- uint256 private constant _RENOUNCE_OWNERSHIP_CONFIRMATION_DELAY = 100;
34
-
35
- /**
36
- * @dev The number of blocks during which one can renounce ownership
37
- */
38
- uint256 private constant _RENOUNCE_OWNERSHIP_CONFIRMATION_PERIOD = 100;
39
-
40
- /**
41
- * @dev The block number saved when initiating the process of
42
- * renouncing ownerhsip
43
- */
44
- uint256 private _renounceOwnershipStartedAt;
45
-
46
- /**
47
- * @dev The address that may use `claimOwnership()`
48
- */
49
- address public override pendingOwner;
50
-
51
- function claimOwnership() public virtual override {
52
- _claimOwnership();
53
- }
54
-
55
- function transferOwnership(address newOwner) public virtual override onlyOwner {
56
- _transferOwnership(newOwner);
57
- }
58
-
59
- function renounceOwnership() public virtual override onlyOwner {
60
- _renounceOwnership();
61
- }
62
-
63
- function _claimOwnership() internal virtual {
64
- require(msg.sender == pendingOwner, "ClaimOwnership: caller is not the pendingOwner");
65
- _setOwner(pendingOwner);
66
- pendingOwner = address(0);
67
- }
68
-
69
- function _transferOwnership(address newOwner) internal virtual {
70
- if (newOwner == address(this)) revert CannotTransferOwnershipToSelf();
71
- pendingOwner = newOwner;
72
- }
73
-
74
- /**
75
- * @dev This method is used to initiate or confirm the process of
76
- * renouncing ownership.
77
- */
78
- function _renounceOwnership() internal virtual {
79
- uint256 currentBlock = block.number;
80
- uint256 confirmationPeriodStart = _renounceOwnershipStartedAt + _RENOUNCE_OWNERSHIP_CONFIRMATION_DELAY;
81
- uint256 confirmationPeriodEnd = confirmationPeriodStart + _RENOUNCE_OWNERSHIP_CONFIRMATION_PERIOD;
82
-
83
- if (currentBlock > confirmationPeriodEnd) {
84
- _renounceOwnershipStartedAt = currentBlock;
85
- emit RenounceOwnershipInitiated();
86
- return;
87
- }
88
-
89
- if (currentBlock < confirmationPeriodStart) {
90
- revert NotInRenounceOwnershipInterval(confirmationPeriodStart, confirmationPeriodEnd);
91
- }
92
-
93
- _setOwner(address(0));
94
- delete _renounceOwnershipStartedAt;
95
- }
96
- }