@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.
Files changed (300) hide show
  1. package/README.md +2 -191
  2. package/artifacts/LSP0ERC725Account.json +3 -3
  3. package/artifacts/LSP0ERC725AccountInit.json +3 -3
  4. package/artifacts/LSP11BasicSocialRecovery.json +2 -2
  5. package/artifacts/LSP11BasicSocialRecoveryInit.json +2 -2
  6. package/artifacts/LSP1UniversalReceiverDelegateUP.json +3 -3
  7. package/artifacts/LSP1UniversalReceiverDelegateVault.json +3 -3
  8. package/artifacts/LSP23LinkedContractsFactory.json +3 -3
  9. package/artifacts/LSP4DigitalAssetMetadata.json +1 -1
  10. package/artifacts/LSP4DigitalAssetMetadataInitAbstract.json +1 -1
  11. package/artifacts/LSP6KeyManager.json +3 -3
  12. package/artifacts/LSP6KeyManagerInit.json +3 -3
  13. package/artifacts/LSP7CappedSupply.json +53 -6
  14. package/artifacts/LSP7CappedSupplyInitAbstract.json +53 -6
  15. package/artifacts/LSP7DigitalAsset.json +52 -5
  16. package/artifacts/LSP7DigitalAssetInitAbstract.json +52 -5
  17. package/artifacts/LSP7Mintable.json +54 -7
  18. package/artifacts/LSP7MintableInit.json +54 -7
  19. package/artifacts/LSP8CappedSupply.json +85 -48
  20. package/artifacts/LSP8CappedSupplyInitAbstract.json +85 -48
  21. package/artifacts/LSP8IdentifiableDigitalAsset.json +85 -48
  22. package/artifacts/LSP8IdentifiableDigitalAssetInitAbstract.json +85 -48
  23. package/artifacts/LSP8Mintable.json +88 -51
  24. package/artifacts/LSP8MintableInit.json +88 -51
  25. package/artifacts/LSP9Vault.json +3 -3
  26. package/artifacts/LSP9VaultInit.json +3 -3
  27. package/artifacts/UniversalProfile.json +3 -3
  28. package/artifacts/UniversalProfileInit.json +3 -3
  29. package/contracts/LSP0ERC725Account/ILSP0ERC725Account.sol +1 -17
  30. package/contracts/LSP0ERC725Account/LSP0Constants.sol +1 -23
  31. package/contracts/LSP0ERC725Account/LSP0ERC725Account.sol +1 -53
  32. package/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +1 -873
  33. package/contracts/LSP0ERC725Account/LSP0ERC725AccountInit.sol +1 -47
  34. package/contracts/LSP0ERC725Account/LSP0ERC725AccountInitAbstract.sol +1 -49
  35. package/contracts/LSP10ReceivedVaults/LSP10Constants.sol +1 -7
  36. package/contracts/LSP10ReceivedVaults/LSP10Utils.sol +1 -208
  37. package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecoveryCore.sol +4 -2
  38. package/contracts/LSP12IssuedAssets/LSP12Constants.sol +4 -0
  39. package/contracts/LSP14Ownable2Step/ILSP14Ownable2Step.sol +1 -75
  40. package/contracts/LSP14Ownable2Step/LSP14Constants.sol +1 -12
  41. package/contracts/LSP14Ownable2Step/LSP14Errors.sol +1 -29
  42. package/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol +1 -212
  43. package/contracts/LSP16UniversalFactory/LSP16UniversalFactory.sol +1 -417
  44. package/contracts/LSP17ContractExtension/LSP17Constants.sol +1 -14
  45. package/contracts/LSP17ContractExtension/LSP17Errors.sol +1 -14
  46. package/contracts/LSP17ContractExtension/LSP17Extendable.sol +1 -117
  47. package/contracts/LSP17ContractExtension/LSP17Extension.sol +1 -55
  48. package/contracts/LSP17ContractExtension/LSP17Utils.sol +1 -16
  49. package/contracts/LSP17Extensions/Extension4337.sol +1 -123
  50. package/contracts/LSP17Extensions/OnERC721ReceivedExtension.sol +1 -13
  51. package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiver.sol +1 -37
  52. package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiverDelegate.sol +1 -21
  53. package/contracts/LSP1UniversalReceiver/LSP1Constants.sol +1 -11
  54. package/contracts/LSP1UniversalReceiver/LSP1Errors.sol +1 -7
  55. package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol +1 -292
  56. package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol +1 -217
  57. package/contracts/LSP1UniversalReceiver/LSP1Utils.sol +1 -84
  58. package/contracts/LSP20CallVerification/ILSP20CallVerifier.sol +1 -36
  59. package/contracts/LSP20CallVerification/LSP20CallVerification.sol +1 -117
  60. package/contracts/LSP20CallVerification/LSP20Constants.sol +1 -14
  61. package/contracts/LSP20CallVerification/LSP20Errors.sol +1 -18
  62. package/contracts/LSP23LinkedContractsFactory/ILSP23LinkedContractsFactory.sol +1 -189
  63. package/contracts/LSP23LinkedContractsFactory/IPostDeploymentModule.sol +1 -15
  64. package/contracts/LSP23LinkedContractsFactory/LSP23Errors.sol +1 -21
  65. package/contracts/LSP23LinkedContractsFactory/LSP23LinkedContractsFactory.sol +1 -393
  66. package/contracts/LSP23LinkedContractsFactory/modules/README.md +23 -0
  67. package/contracts/LSP23LinkedContractsFactory/modules/UniversalProfileInitPostDeploymentModule.sol +1 -60
  68. package/contracts/LSP23LinkedContractsFactory/modules/UniversalProfilePostDeploymentModule.sol +1 -58
  69. package/contracts/LSP25ExecuteRelayCall/ILSP25ExecuteRelayCall.sol +1 -65
  70. package/contracts/LSP25ExecuteRelayCall/LSP25Constants.sol +1 -5
  71. package/contracts/LSP25ExecuteRelayCall/LSP25Errors.sol +1 -14
  72. package/contracts/LSP25ExecuteRelayCall/LSP25MultiChannelNonce.sol +1 -141
  73. package/contracts/LSP2ERC725YJSONSchema/LSP2Utils.sol +1 -445
  74. package/contracts/LSP3ProfileMetadata/LSP3Constants.sol +1 -8
  75. package/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol +1 -31
  76. package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol +1 -59
  77. package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataCore.sol +1 -44
  78. package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol +1 -65
  79. package/contracts/LSP4DigitalAssetMetadata/LSP4Errors.sol +1 -20
  80. package/contracts/LSP5ReceivedAssets/LSP5Constants.sol +1 -7
  81. package/contracts/LSP5ReceivedAssets/LSP5Utils.sol +1 -206
  82. package/contracts/LSP6KeyManager/ILSP6KeyManager.sol +1 -60
  83. package/contracts/LSP6KeyManager/LSP6Constants.sol +1 -61
  84. package/contracts/LSP6KeyManager/LSP6Errors.sol +1 -222
  85. package/contracts/LSP6KeyManager/LSP6KeyManager.sol +1 -23
  86. package/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol +1 -694
  87. package/contracts/LSP6KeyManager/LSP6KeyManagerInit.sol +1 -29
  88. package/contracts/LSP6KeyManager/LSP6KeyManagerInitAbstract.sol +1 -21
  89. package/contracts/LSP6KeyManager/LSP6Modules/LSP6ExecuteModule.sol +1 -411
  90. package/contracts/LSP6KeyManager/LSP6Modules/LSP6ExecuteRelayCallModule.sol +1 -24
  91. package/contracts/LSP6KeyManager/LSP6Modules/LSP6OwnershipModule.sol +1 -27
  92. package/contracts/LSP6KeyManager/LSP6Modules/LSP6SetDataModule.sol +1 -848
  93. package/contracts/LSP6KeyManager/LSP6Utils.sol +1 -293
  94. package/contracts/LSP7DigitalAsset/ILSP7DigitalAsset.sol +1 -302
  95. package/contracts/LSP7DigitalAsset/LSP7Constants.sol +1 -13
  96. package/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol +1 -193
  97. package/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +1 -728
  98. package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol +1 -189
  99. package/contracts/LSP7DigitalAsset/LSP7Errors.sol +1 -87
  100. package/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol +1 -23
  101. package/contracts/LSP7DigitalAsset/extensions/LSP7BurnableInitAbstract.sol +1 -24
  102. package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol +1 -80
  103. package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyInitAbstract.sol +1 -83
  104. package/contracts/LSP7DigitalAsset/presets/ILSP7Mintable.sol +1 -29
  105. package/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol +1 -50
  106. package/contracts/LSP7DigitalAsset/presets/LSP7MintableInit.sol +1 -41
  107. package/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol +1 -54
  108. package/contracts/LSP8IdentifiableDigitalAsset/ILSP8IdentifiableDigitalAsset.sol +1 -326
  109. package/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol +1 -38
  110. package/contracts/LSP8IdentifiableDigitalAsset/LSP8Errors.sol +1 -102
  111. package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol +1 -236
  112. package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +1 -787
  113. package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol +1 -243
  114. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol +2 -28
  115. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8BurnableInitAbstract.sol +2 -22
  116. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol +2 -84
  117. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInitAbstract.sol +2 -87
  118. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol +2 -68
  119. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableInitAbstract.sol +2 -63
  120. package/contracts/LSP8IdentifiableDigitalAsset/presets/ILSP8Mintable.sol +1 -31
  121. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol +2 -59
  122. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInit.sol +2 -42
  123. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol +2 -61
  124. package/contracts/LSP9Vault/ILSP9Vault.sol +1 -16
  125. package/contracts/LSP9Vault/LSP9Constants.sol +1 -26
  126. package/contracts/LSP9Vault/LSP9Errors.sol +1 -6
  127. package/contracts/LSP9Vault/LSP9Vault.sol +1 -63
  128. package/contracts/LSP9Vault/LSP9VaultCore.sol +1 -684
  129. package/contracts/LSP9Vault/LSP9VaultInit.sol +1 -33
  130. package/contracts/LSP9Vault/LSP9VaultInitAbstract.sol +1 -65
  131. package/contracts/UniversalProfile.sol +1 -37
  132. package/contracts/UniversalProfileInit.sol +1 -39
  133. package/contracts/UniversalProfileInitAbstract.sol +1 -44
  134. package/dist/constants.cjs +75 -0
  135. package/dist/constants.d.cts +121 -0
  136. package/dist/constants.d.mts +121 -0
  137. package/dist/constants.d.ts +107 -40105
  138. package/dist/constants.mjs +70 -0
  139. package/package.json +58 -116
  140. package/types/@lukso/lsp0-contracts/contracts/LSP0ERC725Account.ts +694 -0
  141. package/types/@lukso/lsp0-contracts/contracts/LSP0ERC725AccountInit.ts +740 -0
  142. package/types/@lukso/lsp1delegate-contracts/contracts/LSP1UniversalReceiverDelegateUP.ts +139 -0
  143. package/types/@lukso/lsp1delegate-contracts/contracts/LSP1UniversalReceiverDelegateVault.ts +139 -0
  144. package/types/@lukso/lsp23-contracts/contracts/LSP23LinkedContractsFactory.ts +448 -0
  145. package/types/@lukso/lsp4-contracts/contracts/LSP4DigitalAssetMetadata.ts +274 -0
  146. package/types/@lukso/lsp4-contracts/contracts/LSP4DigitalAssetMetadataInitAbstract.ts +309 -0
  147. package/types/@lukso/lsp6-contracts/contracts/LSP6KeyManager.ts +355 -0
  148. package/types/@lukso/lsp6-contracts/contracts/LSP6KeyManagerInit.ts +398 -0
  149. package/types/@lukso/lsp7-contracts/contracts/LSP7DigitalAsset.ts +698 -0
  150. package/types/@lukso/lsp7-contracts/contracts/LSP7DigitalAssetInitAbstract.ts +729 -0
  151. package/types/@lukso/lsp7-contracts/contracts/extensions/LSP7CappedSupply.ts +712 -0
  152. package/types/@lukso/lsp7-contracts/contracts/extensions/LSP7CappedSupplyInitAbstract.ts +743 -0
  153. package/types/@lukso/lsp7-contracts/contracts/presets/LSP7Mintable.ts +717 -0
  154. package/types/@lukso/lsp7-contracts/contracts/presets/LSP7MintableInit.ts +779 -0
  155. package/types/@lukso/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.ts +778 -0
  156. package/types/@lukso/lsp8-contracts/contracts/LSP8IdentifiableDigitalAssetInitAbstract.ts +813 -0
  157. package/types/@lukso/lsp8-contracts/contracts/extensions/LSP8CappedSupply.ts +792 -0
  158. package/types/@lukso/lsp8-contracts/contracts/extensions/LSP8CappedSupplyInitAbstract.ts +824 -0
  159. package/types/@lukso/lsp8-contracts/contracts/presets/LSP8Mintable.ts +797 -0
  160. package/types/@lukso/lsp8-contracts/contracts/presets/LSP8MintableInit.ts +860 -0
  161. package/types/@lukso/lsp9-contracts/contracts/LSP9Vault.ts +672 -0
  162. package/types/@lukso/lsp9-contracts/contracts/LSP9VaultInit.ts +714 -0
  163. package/types/@lukso/universalprofile-contracts/contracts/UniversalProfile.ts +694 -0
  164. package/types/@lukso/universalprofile-contracts/contracts/UniversalProfileInit.ts +740 -0
  165. package/types/LSP0ERC725Account.ts +694 -0
  166. package/types/LSP0ERC725AccountInit.ts +740 -0
  167. package/types/LSP11BasicSocialRecovery.ts +596 -0
  168. package/types/LSP11BasicSocialRecoveryInit.ts +646 -0
  169. package/types/LSP1UniversalReceiverDelegateUP.ts +139 -0
  170. package/types/LSP1UniversalReceiverDelegateVault.ts +139 -0
  171. package/types/LSP23LinkedContractsFactory.ts +448 -0
  172. package/types/LSP4DigitalAssetMetadata.ts +274 -0
  173. package/types/LSP4DigitalAssetMetadataInitAbstract.ts +309 -0
  174. package/types/LSP6KeyManager.ts +355 -0
  175. package/types/LSP6KeyManagerInit.ts +398 -0
  176. package/types/LSP7CappedSupply.ts +712 -0
  177. package/types/LSP7CappedSupplyInitAbstract.ts +743 -0
  178. package/types/LSP7DigitalAsset.ts +698 -0
  179. package/types/LSP7DigitalAssetInitAbstract.ts +729 -0
  180. package/types/LSP7Mintable.ts +717 -0
  181. package/types/LSP7MintableInit.ts +779 -0
  182. package/types/LSP8CappedSupply.ts +792 -0
  183. package/types/LSP8CappedSupplyInitAbstract.ts +824 -0
  184. package/types/LSP8IdentifiableDigitalAsset.ts +778 -0
  185. package/types/LSP8IdentifiableDigitalAssetInitAbstract.ts +813 -0
  186. package/types/LSP8Mintable.ts +797 -0
  187. package/types/LSP8MintableInit.ts +860 -0
  188. package/types/LSP9Vault.ts +672 -0
  189. package/types/LSP9VaultInit.ts +714 -0
  190. package/types/UniversalProfile.ts +694 -0
  191. package/types/UniversalProfileInit.ts +740 -0
  192. package/types/common.ts +131 -0
  193. package/types/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.ts +596 -0
  194. package/types/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecoveryInit.ts +646 -0
  195. package/types/index.ts +58 -0
  196. package/LICENSE +0 -201
  197. package/artifacts/Create2Factory.json +0 -107
  198. package/artifacts/LSP16UniversalFactory.json +0 -271
  199. package/artifacts/LSP7CompatibleERC20.json +0 -935
  200. package/artifacts/LSP7CompatibleERC20InitAbstract.json +0 -948
  201. package/artifacts/LSP7CompatibleERC20Mintable.json +0 -989
  202. package/artifacts/LSP7CompatibleERC20MintableInit.json +0 -1009
  203. package/artifacts/LSP8CompatibleERC721.json +0 -1191
  204. package/artifacts/LSP8CompatibleERC721InitAbstract.json +0 -1204
  205. package/artifacts/LSP8CompatibleERC721Mintable.json +0 -1261
  206. package/artifacts/LSP8CompatibleERC721MintableInit.json +0 -1281
  207. package/artifacts/UniversalReceiverAddressStore.json +0 -209
  208. package/contracts/Factories/Create2Factory.sol +0 -88
  209. package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol +0 -260
  210. package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20InitAbstract.sol +0 -273
  211. package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol +0 -37
  212. package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInit.sol +0 -44
  213. package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInitAbstract.sol +0 -43
  214. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol +0 -512
  215. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol +0 -514
  216. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol +0 -54
  217. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol +0 -47
  218. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.sol +0 -52
  219. package/contracts/Legacy/Registries/AddressRegistry.sol +0 -52
  220. package/contracts/Legacy/Registries/AddressRegistryRequiresERC725.sol +0 -37
  221. package/contracts/Legacy/UniversalReceiverAddressStore.sol +0 -64
  222. package/contracts/Version.sol +0 -17
  223. package/devdocs/Create2Factory.json +0 -16
  224. package/devdocs/LSP0ERC725Account.json +0 -260
  225. package/devdocs/LSP0ERC725AccountInit.json +0 -263
  226. package/devdocs/LSP11BasicSocialRecovery.json +0 -159
  227. package/devdocs/LSP11BasicSocialRecoveryInit.json +0 -159
  228. package/devdocs/LSP16UniversalFactory.json +0 -116
  229. package/devdocs/LSP1UniversalReceiverDelegateUP.json +0 -34
  230. package/devdocs/LSP1UniversalReceiverDelegateVault.json +0 -33
  231. package/devdocs/LSP23LinkedContractsFactory.json +0 -81
  232. package/devdocs/LSP4DigitalAssetMetadata.json +0 -112
  233. package/devdocs/LSP4DigitalAssetMetadataInitAbstract.json +0 -104
  234. package/devdocs/LSP6KeyManager.json +0 -305
  235. package/devdocs/LSP6KeyManagerInit.json +0 -308
  236. package/devdocs/LSP7CappedSupply.json +0 -306
  237. package/devdocs/LSP7CappedSupplyInitAbstract.json +0 -299
  238. package/devdocs/LSP7CompatibleERC20.json +0 -346
  239. package/devdocs/LSP7CompatibleERC20InitAbstract.json +0 -338
  240. package/devdocs/LSP7CompatibleERC20Mintable.json +0 -349
  241. package/devdocs/LSP7CompatibleERC20MintableInit.json +0 -352
  242. package/devdocs/LSP7DigitalAsset.json +0 -294
  243. package/devdocs/LSP7DigitalAssetInitAbstract.json +0 -285
  244. package/devdocs/LSP7Mintable.json +0 -296
  245. package/devdocs/LSP7MintableInit.json +0 -298
  246. package/devdocs/LSP8CappedSupply.json +0 -356
  247. package/devdocs/LSP8CappedSupplyInitAbstract.json +0 -349
  248. package/devdocs/LSP8CompatibleERC721.json +0 -437
  249. package/devdocs/LSP8CompatibleERC721InitAbstract.json +0 -428
  250. package/devdocs/LSP8CompatibleERC721Mintable.json +0 -446
  251. package/devdocs/LSP8CompatibleERC721MintableInit.json +0 -449
  252. package/devdocs/LSP8IdentifiableDigitalAsset.json +0 -346
  253. package/devdocs/LSP8IdentifiableDigitalAssetInitAbstract.json +0 -335
  254. package/devdocs/LSP8Mintable.json +0 -356
  255. package/devdocs/LSP8MintableInit.json +0 -359
  256. package/devdocs/LSP9Vault.json +0 -236
  257. package/devdocs/LSP9VaultInit.json +0 -239
  258. package/devdocs/UniversalProfile.json +0 -260
  259. package/devdocs/UniversalProfileInit.json +0 -263
  260. package/devdocs/UniversalReceiverAddressStore.json +0 -9
  261. package/dist/constants.cjs.js +0 -40758
  262. package/dist/constants.es.js +0 -40737
  263. package/userdocs/Create2Factory.json +0 -5
  264. package/userdocs/LSP0ERC725Account.json +0 -91
  265. package/userdocs/LSP0ERC725AccountInit.json +0 -94
  266. package/userdocs/LSP11BasicSocialRecovery.json +0 -29
  267. package/userdocs/LSP11BasicSocialRecoveryInit.json +0 -29
  268. package/userdocs/LSP16UniversalFactory.json +0 -30
  269. package/userdocs/LSP1UniversalReceiverDelegateUP.json +0 -19
  270. package/userdocs/LSP1UniversalReceiverDelegateVault.json +0 -19
  271. package/userdocs/LSP23LinkedContractsFactory.json +0 -29
  272. package/userdocs/LSP4DigitalAssetMetadata.json +0 -26
  273. package/userdocs/LSP4DigitalAssetMetadataInitAbstract.json +0 -23
  274. package/userdocs/LSP6KeyManager.json +0 -154
  275. package/userdocs/LSP6KeyManagerInit.json +0 -157
  276. package/userdocs/LSP7CappedSupply.json +0 -60
  277. package/userdocs/LSP7CappedSupplyInitAbstract.json +0 -57
  278. package/userdocs/LSP7CompatibleERC20.json +0 -47
  279. package/userdocs/LSP7CompatibleERC20InitAbstract.json +0 -44
  280. package/userdocs/LSP7CompatibleERC20Mintable.json +0 -47
  281. package/userdocs/LSP7CompatibleERC20MintableInit.json +0 -47
  282. package/userdocs/LSP7DigitalAsset.json +0 -47
  283. package/userdocs/LSP7DigitalAssetInitAbstract.json +0 -44
  284. package/userdocs/LSP7Mintable.json +0 -47
  285. package/userdocs/LSP7MintableInit.json +0 -47
  286. package/userdocs/LSP8CappedSupply.json +0 -66
  287. package/userdocs/LSP8CappedSupplyInitAbstract.json +0 -63
  288. package/userdocs/LSP8CompatibleERC721.json +0 -80
  289. package/userdocs/LSP8CompatibleERC721InitAbstract.json +0 -77
  290. package/userdocs/LSP8CompatibleERC721Mintable.json +0 -83
  291. package/userdocs/LSP8CompatibleERC721MintableInit.json +0 -83
  292. package/userdocs/LSP8IdentifiableDigitalAsset.json +0 -53
  293. package/userdocs/LSP8IdentifiableDigitalAssetInitAbstract.json +0 -50
  294. package/userdocs/LSP8Mintable.json +0 -56
  295. package/userdocs/LSP8MintableInit.json +0 -56
  296. package/userdocs/LSP9Vault.json +0 -93
  297. package/userdocs/LSP9VaultInit.json +0 -93
  298. package/userdocs/UniversalProfile.json +0 -91
  299. package/userdocs/UniversalProfileInit.json +0 -94
  300. package/userdocs/UniversalReceiverAddressStore.json +0 -5
@@ -1,687 +1,4 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.4;
3
3
 
4
- // interfaces
5
- import {
6
- ILSP1UniversalReceiver
7
- } from "../LSP1UniversalReceiver/ILSP1UniversalReceiver.sol";
8
-
9
- import {
10
- ILSP1UniversalReceiverDelegate
11
- } from "../LSP1UniversalReceiver/ILSP1UniversalReceiverDelegate.sol";
12
- import {ILSP9Vault} from "./ILSP9Vault.sol";
13
-
14
- // libraries
15
- import {
16
- ERC165Checker
17
- } from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
18
- import {LSP1Utils} from "../LSP1UniversalReceiver/LSP1Utils.sol";
19
- import {LSP2Utils} from "../LSP2ERC725YJSONSchema/LSP2Utils.sol";
20
-
21
- // modules
22
- import {ERC725XCore} from "@erc725/smart-contracts/contracts/ERC725XCore.sol";
23
- import {ERC725YCore} from "@erc725/smart-contracts/contracts/ERC725YCore.sol";
24
- import {
25
- OwnableUnset
26
- } from "@erc725/smart-contracts/contracts/custom/OwnableUnset.sol";
27
- import {LSP14Ownable2Step} from "../LSP14Ownable2Step/LSP14Ownable2Step.sol";
28
- import {LSP17Extendable} from "../LSP17ContractExtension/LSP17Extendable.sol";
29
-
30
- // constants
31
- import {
32
- ERC725Y_MsgValueDisallowed,
33
- ERC725Y_DataKeysValuesLengthMismatch,
34
- ERC725X_CreateOperationsRequireEmptyRecipientAddress,
35
- ERC725X_CreateOperationsRequireEmptyRecipientAddress,
36
- ERC725X_MsgValueDisallowedInStaticCall,
37
- ERC725X_UnknownOperationType
38
- } from "@erc725/smart-contracts/contracts/errors.sol";
39
- import {
40
- OPERATION_0_CALL,
41
- OPERATION_1_CREATE,
42
- OPERATION_2_CREATE2,
43
- OPERATION_3_STATICCALL
44
- } from "@erc725/smart-contracts/contracts/constants.sol";
45
- import {
46
- _INTERFACEID_LSP1,
47
- _INTERFACEID_LSP1_DELEGATE,
48
- _LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX,
49
- _LSP1_UNIVERSAL_RECEIVER_DELEGATE_KEY
50
- } from "../LSP1UniversalReceiver/LSP1Constants.sol";
51
-
52
- import {
53
- _LSP6KEY_ADDRESSPERMISSIONS_PREFIX
54
- } from "../LSP6KeyManager/LSP6Constants.sol";
55
- import {
56
- _INTERFACEID_LSP9,
57
- _TYPEID_LSP9_VALUE_RECEIVED,
58
- _TYPEID_LSP9_OwnershipTransferStarted,
59
- _TYPEID_LSP9_OwnershipTransferred_SenderNotification,
60
- _TYPEID_LSP9_OwnershipTransferred_RecipientNotification
61
- } from "./LSP9Constants.sol";
62
- import {_INTERFACEID_LSP14} from "../LSP14Ownable2Step/LSP14Constants.sol";
63
- import {
64
- _LSP17_EXTENSION_PREFIX
65
- } from "../LSP17ContractExtension/LSP17Constants.sol";
66
-
67
- // errors
68
- import {LSP1DelegateNotAllowedToSetDataKey} from "./LSP9Errors.sol";
69
-
70
- import {
71
- NoExtensionFoundForFunctionSelector
72
- } from "../LSP17ContractExtension/LSP17Errors.sol";
73
-
74
- /**
75
- * @title Core Implementation of LSP9Vault built on top of [ERC725], [LSP1UniversalReceiver]
76
- * @author Fabian Vogelsteller, Yamen Merhi, Jean Cavallera
77
- * @dev Could be owned by an EOA or by a contract and is able to receive and send assets. Also allows for registering received assets by leveraging the key-value storage.
78
- */
79
- contract LSP9VaultCore is
80
- ERC725XCore,
81
- ERC725YCore,
82
- LSP14Ownable2Step,
83
- LSP17Extendable,
84
- ILSP1UniversalReceiver,
85
- ILSP9Vault
86
- {
87
- using ERC165Checker for address;
88
- using LSP1Utils for address;
89
-
90
- address private _reentrantDelegate;
91
-
92
- /**
93
- * @dev Executed:
94
- * - When receiving some native tokens without any additional data.
95
- * - On empty calls to the contract.
96
- *
97
- * @custom:events {UniversalReceiver} when receiving native tokens.
98
- */
99
- receive() external payable virtual {
100
- if (msg.value != 0) {
101
- universalReceiver(_TYPEID_LSP9_VALUE_RECEIVED, "");
102
- }
103
- }
104
-
105
- /**
106
- * @notice The `fallback` function was called with the following amount of native tokens: `msg.value`; and the following calldata: `callData`.
107
- *
108
- * @dev Achieves the goal of [LSP-17-ContractExtension] standard by extending the contract to handle calls of functions that do not exist natively,
109
- * forwarding the function call to the extension address mapped to the function being called.
110
- *
111
- * This function is executed when:
112
- * - Sending data of length less than 4 bytes to the contract.
113
- * - The first 4 bytes of the calldata do not match any publicly callable functions from the contract ABI.
114
- * - Receiving native tokens with some calldata.
115
- *
116
- * 1. If the data is equal or longer than 4 bytes, the [ERC-725Y] storage is queried with the following data key: [_LSP17_EXTENSION_PREFIX] + `bytes4(msg.sig)` (Check [LSP-2-ERC725YJSONSchema] for encoding the data key)
117
- *
118
- * - If there is no address stored under the following data key, revert with {NoExtensionFoundForFunctionSelector(bytes4)}. The data key relative to `bytes4(0)` is an exception, where no reverts occurs if there is no extension address stored under. This exception is made to allow users to send random data (graffiti) to the account and to be able to react on it.
119
- *
120
- * - If there is an address, forward the `msg.data` to the extension using the CALL opcode, appending 52 bytes (20 bytes of `msg.sender` and 32 bytes of `msg.value`). Return what the calls returns, or revert if the call failed.
121
- *
122
- * 2. If the data sent to this function is of length less than 4 bytes (not a function selector), return.
123
- *
124
- * @custom:events {UniversalReceiver} event when receiving native tokens and extension function selector is not found or not payable.
125
- */
126
- // solhint-disable-next-line no-complex-fallback
127
- fallback(
128
- bytes calldata callData
129
- ) external payable virtual returns (bytes memory) {
130
- if (msg.data.length < 4) {
131
- // if value is associated with the extension call, use the universalReceiver
132
- if (msg.value != 0)
133
- universalReceiver(_TYPEID_LSP9_VALUE_RECEIVED, callData);
134
- return "";
135
- }
136
-
137
- return _fallbackLSP17Extendable(callData);
138
- }
139
-
140
- /**
141
- * @inheritdoc ILSP9Vault
142
- *
143
- * @custom:info It's not possible to send value along the functions call due to the use of `delegatecall`.
144
- */
145
- function batchCalls(
146
- bytes[] calldata data
147
- ) public virtual override returns (bytes[] memory results) {
148
- results = new bytes[](data.length);
149
- for (uint256 i; i < data.length; ) {
150
- (bool success, bytes memory result) = address(this).delegatecall(
151
- data[i]
152
- );
153
-
154
- if (!success) {
155
- // Look for revert reason and bubble it up if present
156
- if (result.length != 0) {
157
- // The easiest way to bubble the revert reason is using memory via assembly
158
- // solhint-disable no-inline-assembly
159
- /// @solidity memory-safe-assembly
160
- assembly {
161
- let returndata_size := mload(result)
162
- revert(add(32, result), returndata_size)
163
- }
164
- } else {
165
- revert("LSP9: batchCalls reverted");
166
- }
167
- }
168
-
169
- results[i] = result;
170
-
171
- unchecked {
172
- ++i;
173
- }
174
- }
175
- }
176
-
177
- /**
178
- * @inheritdoc ERC725XCore
179
- *
180
- * @custom:requirements
181
- * - Can be only called by the {owner} or by an authorised address that pass the verification check performed on the owner.
182
- * - If a `value` is provided, the contract must have at least this amount in its balance to execute successfully.
183
- * - If the operation type is `CREATE` (1) or `CREATE2` (2), `target` must be `address(0)`.
184
- * - If the operation type is `STATICCALL` (3), `value` transfer is disallowed and must be 0.
185
- *
186
- * @custom:events
187
- * - {Executed} event for each call that uses under `operationType`: `CALL` (0) and `STATICCALL` (3).
188
- * - {ContractCreated} event, when a contract is created under `operationType`: `CREATE` (1) and `CREATE2` (2).
189
- * - {UniversalReceiver} event when receiving native tokens.
190
- *
191
- * @custom:info The `operationType` 4 `DELEGATECALL` is disabled by default in the LSP9 Vault.
192
- */
193
- function execute(
194
- uint256 operationType,
195
- address target,
196
- uint256 value,
197
- bytes memory data
198
- ) public payable virtual override onlyOwner returns (bytes memory) {
199
- if (msg.value != 0) {
200
- emit UniversalReceiver(
201
- msg.sender,
202
- msg.value,
203
- _TYPEID_LSP9_VALUE_RECEIVED,
204
- abi.encodePacked(msg.sig),
205
- ""
206
- );
207
- }
208
- return _execute(operationType, target, value, data);
209
- }
210
-
211
- /**
212
- * @inheritdoc ERC725XCore
213
- *
214
- * @custom:requirements
215
- * - The length of the parameters provided must be equal.
216
- * - Can be only called by the {owner} or by an authorised address that pass the verification check performed on the owner.
217
- * - If a `value` is provided, the contract must have at least this amount in its balance to execute successfully.
218
- * - If the operation type is `CREATE` (1) or `CREATE2` (2), `target` must be `address(0)`.
219
- * - If the operation type is `STATICCALL` (3), `value` transfer is disallowed and must be 0.
220
- *
221
- * @custom:events
222
- * - {Executed} event for each call that uses under `operationType`: `CALL` (0) and `STATICCALL` (3). (each iteration)
223
- * - {ContractCreated} event, when a contract is created under `operationType`: `CREATE` (1) and `CREATE2` (2). (each iteration)
224
- * - {UniversalReceiver} event when receiving native tokens.
225
- *
226
- * @custom:info The `operationType` 4 `DELEGATECALL` is disabled by default in the LSP9 Vault.
227
- */
228
- function executeBatch(
229
- uint256[] memory operationsType,
230
- address[] memory targets,
231
- uint256[] memory values,
232
- bytes[] memory datas
233
- ) public payable virtual override onlyOwner returns (bytes[] memory) {
234
- if (msg.value != 0) {
235
- emit UniversalReceiver(
236
- msg.sender,
237
- msg.value,
238
- _TYPEID_LSP9_VALUE_RECEIVED,
239
- abi.encodePacked(msg.sig),
240
- ""
241
- );
242
- }
243
- return _executeBatch(operationsType, targets, values, datas);
244
- }
245
-
246
- /**
247
- * @inheritdoc ERC725YCore
248
- *
249
- * @custom:requirements Can be only called by the {owner} or by an authorised address that pass the verification check performed on the owner.
250
- *
251
- * @custom:events
252
- * - {DataChanged} event.
253
- */
254
- function setData(
255
- bytes32 dataKey,
256
- bytes memory dataValue
257
- ) public payable virtual override {
258
- if (msg.value != 0) revert ERC725Y_MsgValueDisallowed();
259
-
260
- bool isURD = _validateAndIdentifyCaller();
261
- if (isURD) {
262
- if (
263
- bytes12(dataKey) == _LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX ||
264
- bytes6(dataKey) == _LSP6KEY_ADDRESSPERMISSIONS_PREFIX ||
265
- bytes12(dataKey) == _LSP17_EXTENSION_PREFIX
266
- ) {
267
- revert LSP1DelegateNotAllowedToSetDataKey(dataKey);
268
- }
269
- }
270
- _setData(dataKey, dataValue);
271
- }
272
-
273
- /**
274
- * @inheritdoc ERC725YCore
275
- *
276
- * @custom:requirements Can be only called by the {owner} or by an authorised address that pass the verification check performed on the owner.
277
- *
278
- * @custom:events
279
- * - {DataChanged} event. (on each iteration of setting data)
280
- */
281
- function setDataBatch(
282
- bytes32[] memory dataKeys,
283
- bytes[] memory dataValues
284
- ) public payable virtual override {
285
- bool isURD = _validateAndIdentifyCaller();
286
- if (dataKeys.length != dataValues.length) {
287
- revert ERC725Y_DataKeysValuesLengthMismatch();
288
- }
289
-
290
- if (msg.value != 0) revert ERC725Y_MsgValueDisallowed();
291
-
292
- for (uint256 i = 0; i < dataKeys.length; ) {
293
- if (isURD) {
294
- if (
295
- bytes12(dataKeys[i]) ==
296
- _LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX ||
297
- bytes6(dataKeys[i]) == _LSP6KEY_ADDRESSPERMISSIONS_PREFIX ||
298
- bytes12(dataKeys[i]) == _LSP17_EXTENSION_PREFIX
299
- ) {
300
- revert LSP1DelegateNotAllowedToSetDataKey(dataKeys[i]);
301
- }
302
- }
303
- _setData(dataKeys[i], dataValues[i]);
304
-
305
- unchecked {
306
- ++i;
307
- }
308
- }
309
- }
310
-
311
- /**
312
- * @notice Notifying the contract by calling its `universalReceiver` function with the following informations: typeId: `typeId`; data: `data`.
313
- *
314
- * @dev Achieves the goal of [LSP-1-UniversalReceiver] by allowing the account to be notified about incoming/outgoing transactions and enabling reactions to these actions.
315
- * The reaction is achieved by having two external contracts ([LSP1UniversalReceiverDelegate]) that react on the whole transaction and on the specific typeId, respectively.
316
- *
317
- * The function performs the following steps:
318
- *
319
- * 1. Query the [ERC-725Y] storage with the data key [_LSP1_UNIVERSAL_RECEIVER_DELEGATE_KEY].
320
- * - If there is an address stored under the data key, check if this address supports the LSP1 interfaceId.
321
- *
322
- * - If yes, call this address with the typeId and data (params), along with additional calldata consisting of 20 bytes of `msg.sender` and 32 bytes of `msg.value`. If not, continue the execution of the function.
323
- *
324
- *
325
- * 2. Query the [ERC-725Y] storage with the data key [_LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX] + `bytes32(typeId)`.
326
- * (Check [LSP-2-ERC725YJSONSchema] for encoding the data key)
327
- *
328
- * - If there is an address stored under the data key, check if this address supports the LSP1 interfaceId.
329
- *
330
- * - If yes, call this address with the typeId and data (params), along with additional calldata consisting of 20 bytes of `msg.sender` and 32 bytes of `msg.value`. If not, continue the execution of the function.
331
- *
332
- * @param typeId The type of call received.
333
- * @param receivedData The data received.
334
- *
335
- * @return returnedValues The ABI encoded return value of the LSP1UniversalReceiverDelegate call and the LSP1TypeIdDelegate call.
336
- *
337
- * @custom:events
338
- * - {UniversalReceiver} event with the function parameters, call options, and the response of the UniversalReceiverDelegates (URD) contract that was called.
339
- */
340
- function universalReceiver(
341
- bytes32 typeId,
342
- bytes memory receivedData
343
- ) public payable virtual override returns (bytes memory returnedValues) {
344
- if (msg.value != 0 && (typeId != _TYPEID_LSP9_VALUE_RECEIVED)) {
345
- universalReceiver(_TYPEID_LSP9_VALUE_RECEIVED, msg.data);
346
- }
347
-
348
- bytes memory lsp1DelegateValue = _getData(
349
- _LSP1_UNIVERSAL_RECEIVER_DELEGATE_KEY
350
- );
351
- bytes memory resultDefaultDelegate;
352
-
353
- if (lsp1DelegateValue.length >= 20) {
354
- address universalReceiverDelegate = address(
355
- bytes20(lsp1DelegateValue)
356
- );
357
-
358
- if (
359
- universalReceiverDelegate.supportsERC165InterfaceUnchecked(
360
- _INTERFACEID_LSP1_DELEGATE
361
- )
362
- ) {
363
- _reentrantDelegate = universalReceiverDelegate;
364
- resultDefaultDelegate = ILSP1UniversalReceiverDelegate(
365
- universalReceiverDelegate
366
- ).universalReceiverDelegate(
367
- msg.sender,
368
- msg.value,
369
- typeId,
370
- receivedData
371
- );
372
- }
373
- }
374
-
375
- bytes32 lsp1typeIdDelegateKey = LSP2Utils.generateMappingKey(
376
- _LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX,
377
- bytes20(typeId)
378
- );
379
-
380
- bytes memory lsp1TypeIdDelegateValue = _getData(lsp1typeIdDelegateKey);
381
- bytes memory resultTypeIdDelegate;
382
-
383
- if (lsp1TypeIdDelegateValue.length >= 20) {
384
- address universalReceiverDelegate = address(
385
- bytes20(lsp1TypeIdDelegateValue)
386
- );
387
-
388
- if (
389
- universalReceiverDelegate.supportsERC165InterfaceUnchecked(
390
- _INTERFACEID_LSP1_DELEGATE
391
- )
392
- ) {
393
- _reentrantDelegate = universalReceiverDelegate;
394
- resultTypeIdDelegate = ILSP1UniversalReceiverDelegate(
395
- universalReceiverDelegate
396
- ).universalReceiverDelegate(
397
- msg.sender,
398
- msg.value,
399
- typeId,
400
- receivedData
401
- );
402
- }
403
- }
404
-
405
- delete _reentrantDelegate;
406
- returnedValues = abi.encode(
407
- resultDefaultDelegate,
408
- resultTypeIdDelegate
409
- );
410
- emit UniversalReceiver(
411
- msg.sender,
412
- msg.value,
413
- typeId,
414
- receivedData,
415
- returnedValues
416
- );
417
- }
418
-
419
- /**
420
- * @inheritdoc LSP14Ownable2Step
421
- *
422
- * @custom:requirements
423
- * - Can be only called by the {owner} or by an authorised address that pass the verification check performed on the owner.
424
- * - When notifying the new owner via LSP1, the `typeId` used must be the `keccak256(...)` hash of [LSP0OwnershipTransferStarted].
425
- * - Pending owner cannot accept ownership in the same tx via the LSP1 hook.
426
- */
427
- function transferOwnership(
428
- address newOwner
429
- ) public virtual override(LSP14Ownable2Step, OwnableUnset) onlyOwner {
430
- // set the transfer ownership lock
431
- _inTransferOwnership = true;
432
-
433
- LSP14Ownable2Step._transferOwnership(newOwner);
434
-
435
- address currentOwner = owner();
436
- emit OwnershipTransferStarted(currentOwner, newOwner);
437
-
438
- newOwner.notifyUniversalReceiver(
439
- _TYPEID_LSP9_OwnershipTransferStarted,
440
- abi.encode(currentOwner, newOwner)
441
- );
442
-
443
- // reset the transfer ownership lock
444
- _inTransferOwnership = false;
445
- }
446
-
447
- /**
448
- * @inheritdoc LSP14Ownable2Step
449
- *
450
- * @custom:requirements
451
- * - Only the {pendingOwner} can call this function.
452
- * - When notifying the previous owner via LSP1, the typeId used must be the `keccak256(...)` hash of [LSP0OwnershipTransferred_SenderNotification].
453
- * - When notifying the new owner via LSP1, the typeId used must be the `keccak256(...)` hash of [LSP0OwnershipTransferred_RecipientNotification].
454
- */
455
- function acceptOwnership() public virtual override notInTransferOwnership {
456
- address previousOwner = owner();
457
-
458
- _acceptOwnership();
459
-
460
- previousOwner.notifyUniversalReceiver(
461
- _TYPEID_LSP9_OwnershipTransferred_SenderNotification,
462
- abi.encode(previousOwner, msg.sender)
463
- );
464
-
465
- msg.sender.notifyUniversalReceiver(
466
- _TYPEID_LSP9_OwnershipTransferred_RecipientNotification,
467
- abi.encode(previousOwner, msg.sender)
468
- );
469
- }
470
-
471
- /**
472
- * @inheritdoc LSP14Ownable2Step
473
- *
474
- * @custom:requirements Can be only called by the {owner} or by an authorised address that pass the verification check performed on the owner.
475
- *
476
- * @custom:danger Leaves the contract without an owner. Once ownership of the contract has been renounced, any functions that are restricted to be called by the owner will be permanently inaccessible, making these functions not callable anymore and unusable.
477
- */
478
- function renounceOwnership()
479
- public
480
- virtual
481
- override(LSP14Ownable2Step, OwnableUnset)
482
- onlyOwner
483
- {
484
- address previousOwner = owner();
485
- LSP14Ownable2Step._renounceOwnership();
486
-
487
- if (owner() == address(0)) {
488
- previousOwner.notifyUniversalReceiver(
489
- _TYPEID_LSP9_OwnershipTransferred_SenderNotification,
490
- abi.encode(previousOwner, address(0))
491
- );
492
- }
493
- }
494
-
495
- /**
496
- * @notice Checking if this contract supports the interface defined by the `bytes4` interface ID `interfaceId`.
497
- *
498
- * @dev Achieves the goal of [ERC-165] to detect supported interfaces and [LSP-17-ContractExtension] by
499
- * checking if the interfaceId being queried is supported on another linked extension.
500
- *
501
- * If the contract doesn't support the `interfaceId`, it forwards the call to the
502
- * `supportsInterface` extension according to [LSP-17-ContractExtension], and checks if the extension
503
- * implements the interface defined by `interfaceId`.
504
- *
505
- * @param interfaceId The interface ID to check if the contract supports it.
506
- *
507
- * @return `true` if this contract implements the interface defined by `interfaceId`, `false` otherwise.
508
- */
509
- function supportsInterface(
510
- bytes4 interfaceId
511
- )
512
- public
513
- view
514
- virtual
515
- override(ERC725XCore, ERC725YCore, LSP17Extendable)
516
- returns (bool)
517
- {
518
- return
519
- interfaceId == _INTERFACEID_LSP9 ||
520
- interfaceId == _INTERFACEID_LSP1 ||
521
- interfaceId == _INTERFACEID_LSP14 ||
522
- super.supportsInterface(interfaceId) ||
523
- _supportsInterfaceInERC165Extension(interfaceId);
524
- }
525
-
526
- /**
527
- * @dev Forwards the call to an extension mapped to a function selector.
528
- *
529
- * Calls {_getExtensionAndForwardValue} to get the address of the extension mapped to the function selector being
530
- * called on the account. If there is no extension, the `address(0)` will be returned.
531
- * Forwards the value if the extension is payable.
532
- *
533
- * Reverts if there is no extension for the function being called, except for the `bytes4(0)` function selector, which passes even if there is no extension for it.
534
- *
535
- * If there is an extension for the function selector being called, it calls the extension with the
536
- * `CALL` opcode, passing the `msg.data` appended with the 20 bytes of the {msg.sender} and 32 bytes of the `msg.value`.
537
- *
538
- * @custom:hint This function does not forward to the extension contract the `msg.value` received by the contract that inherits `LSP17Extendable`.
539
- * If you would like to forward the `msg.value` to the extension contract, you can override the code of this internal function as follow:
540
- *
541
- * ```solidity
542
- * (bool success, bytes memory result) = extension.call{value: msg.value}(
543
- * abi.encodePacked(callData, msg.sender, msg.value)
544
- * );
545
- * ```
546
- */
547
- function _fallbackLSP17Extendable(
548
- bytes calldata callData
549
- ) internal virtual override returns (bytes memory) {
550
- // If there is a function selector
551
- (
552
- address extension,
553
- bool isForwardingValue
554
- ) = _getExtensionAndForwardValue(msg.sig);
555
-
556
- // if value is associated with the extension call and function selector is not payable, use the universalReceiver
557
- if (msg.value != 0 && !isForwardingValue)
558
- universalReceiver(_TYPEID_LSP9_VALUE_RECEIVED, callData);
559
-
560
- // if no extension was found for bytes4(0) return don't revert
561
- if (msg.sig == bytes4(0) && extension == address(0)) return "";
562
-
563
- // if no extension was found for other function selectors, revert
564
- if (extension == address(0))
565
- revert NoExtensionFoundForFunctionSelector(msg.sig);
566
-
567
- (bool success, bytes memory result) = extension.call{
568
- value: isForwardingValue ? msg.value : 0
569
- }(abi.encodePacked(callData, msg.sender, msg.value));
570
-
571
- if (success) {
572
- return result;
573
- } else {
574
- // `mload(result)` -> offset in memory where `result.length` is located
575
- // `add(result, 32)` -> offset in memory where `result` data starts
576
- // solhint-disable no-inline-assembly
577
- /// @solidity memory-safe-assembly
578
- assembly {
579
- let resultdata_size := mload(result)
580
- revert(add(result, 32), resultdata_size)
581
- }
582
- }
583
- }
584
-
585
- /**
586
- * @dev Returns the extension address stored under the following data key:
587
- * - {_LSP17_EXTENSION_PREFIX} + `<bytes4>` (Check [LSP2-ERC725YJSONSchema] for encoding the data key).
588
- * - If no extension is stored, returns the address(0).
589
- */
590
- function _getExtensionAndForwardValue(
591
- bytes4 functionSelector
592
- ) internal view virtual override returns (address, bool) {
593
- // Generate the data key relevant for the functionSelector being called
594
- bytes32 mappedExtensionDataKey = LSP2Utils.generateMappingKey(
595
- _LSP17_EXTENSION_PREFIX,
596
- functionSelector
597
- );
598
-
599
- bytes memory extensionData = ERC725YCore._getData(
600
- mappedExtensionDataKey
601
- );
602
-
603
- // Prevent casting data shorter than 20 bytes to an address to avoid
604
- // unintentionally calling a different extension, return address(0) instead.
605
- if (extensionData.length < 20) {
606
- return (address(0), false);
607
- }
608
-
609
- // CHECK if the `extensionData` is 21 bytes long
610
- // - 20 bytes = extension's address
611
- // - 1 byte `0x01` as a boolean indicating if the contract should forward the value to the extension or not
612
- if (extensionData.length == 21) {
613
- // If the last byte is set to `0x01` (`true`)
614
- // this indicates that the contract should forward the value to the extension
615
- if (extensionData[20] == 0x01) {
616
- // Return the address of the extension
617
- return (address(bytes20(extensionData)), true);
618
- }
619
- }
620
-
621
- return (address(bytes20(extensionData)), false);
622
- }
623
-
624
- /**
625
- * @dev Internal method restricting the call to the owner of the contract and the UniversalReceiverDelegate
626
- */
627
- function _validateAndIdentifyCaller()
628
- internal
629
- view
630
- virtual
631
- returns (bool isURD)
632
- {
633
- if (msg.sender != owner()) {
634
- require(
635
- msg.sender == _reentrantDelegate,
636
- "Only Owner or reentered Universal Receiver Delegate allowed"
637
- );
638
- isURD = true;
639
- }
640
- }
641
-
642
- /**
643
- * @dev This function overrides the {ERC725XCore} internal {_execute} function to disable operation type DELEGATECALL (4).
644
- *
645
- * @custom:warning Providing operation type DELEGATECALL (4) as argument will result in custom error {ERC725X_UnknownOperationType(4)}
646
- *
647
- * @param operationType The operation type used: CALL = 0; CREATE = 1; CREATE2 = 2; STATICCALL = 3.
648
- * @param target The address of the EOA or smart contract. (unused if a contract is created via operation type 1 or 2).
649
- * @param value The amount of native tokens to transfer (in Wei).
650
- * @param data The call data, or the creation bytecode of the contract to deploy if `operationType` is `1` or `2`.
651
- */
652
- function _execute(
653
- uint256 operationType,
654
- address target,
655
- uint256 value,
656
- bytes memory data
657
- ) internal virtual override returns (bytes memory) {
658
- // CALL
659
- if (operationType == OPERATION_0_CALL) {
660
- return _executeCall(target, value, data);
661
- }
662
-
663
- // Deploy with CREATE
664
- if (operationType == uint256(OPERATION_1_CREATE)) {
665
- if (target != address(0)) {
666
- revert ERC725X_CreateOperationsRequireEmptyRecipientAddress();
667
- }
668
- return _deployCreate(value, data);
669
- }
670
-
671
- // Deploy with CREATE2
672
- if (operationType == uint256(OPERATION_2_CREATE2)) {
673
- if (target != address(0)) {
674
- revert ERC725X_CreateOperationsRequireEmptyRecipientAddress();
675
- }
676
- return _deployCreate2(value, data);
677
- }
678
-
679
- // STATICCALL
680
- if (operationType == uint256(OPERATION_3_STATICCALL)) {
681
- if (value != 0) revert ERC725X_MsgValueDisallowedInStaticCall();
682
- return _executeStaticCall(target, data);
683
- }
684
-
685
- revert ERC725X_UnknownOperationType(operationType);
686
- }
687
- }
4
+ import "@lukso/lsp9-contracts/contracts/LSP9VaultCore.sol";