@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,790 +1,4 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.12;
3
3
 
4
- // interfaces
5
- import {
6
- ILSP1UniversalReceiver as ILSP1
7
- } from "../LSP1UniversalReceiver/ILSP1UniversalReceiver.sol";
8
- import {
9
- ILSP8IdentifiableDigitalAsset
10
- } from "./ILSP8IdentifiableDigitalAsset.sol";
11
-
12
- // modules
13
-
14
- import {
15
- LSP4DigitalAssetMetadataCore
16
- } from "../LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataCore.sol";
17
-
18
- // libraries
19
- import {
20
- EnumerableSet
21
- } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
22
- import {
23
- ERC165Checker
24
- } from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
25
- import {LSP1Utils} from "../LSP1UniversalReceiver/LSP1Utils.sol";
26
-
27
- // errors
28
- import {
29
- LSP8NonExistentTokenId,
30
- LSP8NotTokenOwner,
31
- LSP8CannotUseAddressZeroAsOperator,
32
- LSP8TokenOwnerCannotBeOperator,
33
- LSP8OperatorAlreadyAuthorized,
34
- LSP8NotTokenOperator,
35
- LSP8InvalidTransferBatch,
36
- LSP8NonExistingOperator,
37
- LSP8CannotSendToAddressZero,
38
- LSP8TokenIdAlreadyMinted,
39
- LSP8CannotSendToSelf,
40
- LSP8NotifyTokenReceiverContractMissingLSP1Interface,
41
- LSP8NotifyTokenReceiverIsEOA,
42
- LSP8TokenIdsDataLengthMismatch,
43
- LSP8TokenIdsDataEmptyArray,
44
- LSP8BatchCallFailed
45
- } from "./LSP8Errors.sol";
46
-
47
- // constants
48
- import {_INTERFACEID_LSP1} from "../LSP1UniversalReceiver/LSP1Constants.sol";
49
- import {
50
- _TYPEID_LSP8_TOKENOPERATOR,
51
- _TYPEID_LSP8_TOKENSSENDER,
52
- _TYPEID_LSP8_TOKENSRECIPIENT
53
- } from "./LSP8Constants.sol";
54
-
55
- /**
56
- * @title LSP8IdentifiableDigitalAsset contract
57
- * @author Matthew Stevens
58
- * @dev Core Implementation of a LSP8 compliant contract.
59
- */
60
- abstract contract LSP8IdentifiableDigitalAssetCore is
61
- LSP4DigitalAssetMetadataCore,
62
- ILSP8IdentifiableDigitalAsset
63
- {
64
- using EnumerableSet for EnumerableSet.AddressSet;
65
- using EnumerableSet for EnumerableSet.Bytes32Set;
66
-
67
- // --- Storage
68
-
69
- uint256 internal _existingTokens;
70
-
71
- // Mapping from `tokenId` to `tokenOwner`
72
- mapping(bytes32 => address) internal _tokenOwners;
73
-
74
- // Mapping `tokenOwner` to owned tokenIds
75
- mapping(address => EnumerableSet.Bytes32Set) internal _ownedTokens;
76
-
77
- // Mapping a `tokenId` to its authorized operator addresses.
78
- mapping(bytes32 => EnumerableSet.AddressSet) internal _operators;
79
-
80
- mapping(address => EnumerableSet.Bytes32Set) internal _tokenIdsForOperator;
81
-
82
- // --- Token queries
83
-
84
- /**
85
- * @inheritdoc ILSP8IdentifiableDigitalAsset
86
- */
87
- function totalSupply() public view virtual override returns (uint256) {
88
- return _existingTokens;
89
- }
90
-
91
- // --- Token owner queries
92
-
93
- /**
94
- * @inheritdoc ILSP8IdentifiableDigitalAsset
95
- */
96
- function balanceOf(
97
- address tokenOwner
98
- ) public view virtual override returns (uint256) {
99
- return _ownedTokens[tokenOwner].length();
100
- }
101
-
102
- /**
103
- * @inheritdoc ILSP8IdentifiableDigitalAsset
104
- */
105
- function tokenOwnerOf(
106
- bytes32 tokenId
107
- ) public view virtual override returns (address) {
108
- address tokenOwner = _tokenOwners[tokenId];
109
-
110
- if (tokenOwner == address(0)) {
111
- revert LSP8NonExistentTokenId(tokenId);
112
- }
113
-
114
- return tokenOwner;
115
- }
116
-
117
- /**
118
- * @inheritdoc ILSP8IdentifiableDigitalAsset
119
- */
120
- function tokenIdsOf(
121
- address tokenOwner
122
- ) public view virtual override returns (bytes32[] memory) {
123
- return _ownedTokens[tokenOwner].values();
124
- }
125
-
126
- // --- TokenId Metadata functionality
127
-
128
- /**
129
- * @inheritdoc ILSP8IdentifiableDigitalAsset
130
- */
131
- function setTokenIdData(
132
- bytes32 tokenId,
133
- bytes32 dataKey,
134
- bytes memory dataValue
135
- ) public virtual override onlyOwner {
136
- _setTokenIdData(tokenId, dataKey, dataValue);
137
- }
138
-
139
- /**
140
- * @inheritdoc ILSP8IdentifiableDigitalAsset
141
- */
142
- function setTokenIdDataBatch(
143
- bytes32[] memory tokenIds,
144
- bytes32[] memory dataKeys,
145
- bytes[] memory dataValues
146
- ) public virtual override onlyOwner {
147
- if (
148
- tokenIds.length != dataKeys.length ||
149
- dataKeys.length != dataValues.length
150
- ) {
151
- revert LSP8TokenIdsDataLengthMismatch();
152
- }
153
-
154
- if (tokenIds.length == 0) {
155
- revert LSP8TokenIdsDataEmptyArray();
156
- }
157
-
158
- for (uint256 i; i < tokenIds.length; ) {
159
- _setTokenIdData(tokenIds[i], dataKeys[i], dataValues[i]);
160
-
161
- // Increment the iterator in unchecked block to save gas
162
- unchecked {
163
- ++i;
164
- }
165
- }
166
- }
167
-
168
- // --- General functionality
169
-
170
- /**
171
- * @inheritdoc ILSP8IdentifiableDigitalAsset
172
- *
173
- * @custom:info It's not possible to send value along the functions call due to the use of `delegatecall`.
174
- */
175
- function batchCalls(
176
- bytes[] calldata data
177
- ) public virtual override returns (bytes[] memory results) {
178
- results = new bytes[](data.length);
179
- for (uint256 i; i < data.length; ) {
180
- (bool success, bytes memory result) = address(this).delegatecall(
181
- data[i]
182
- );
183
-
184
- if (!success) {
185
- // Look for revert reason and bubble it up if present
186
- if (result.length != 0) {
187
- // The easiest way to bubble the revert reason is using memory via assembly
188
- // solhint-disable no-inline-assembly
189
- /// @solidity memory-safe-assembly
190
- assembly {
191
- let returndata_size := mload(result)
192
- revert(add(32, result), returndata_size)
193
- }
194
- } else {
195
- revert LSP8BatchCallFailed({callIndex: i});
196
- }
197
- }
198
-
199
- results[i] = result;
200
-
201
- unchecked {
202
- ++i;
203
- }
204
- }
205
- }
206
-
207
- /**
208
- * @inheritdoc ILSP8IdentifiableDigitalAsset
209
- */
210
- function getTokenIdData(
211
- bytes32 tokenId,
212
- bytes32 dataKey
213
- ) public view virtual override returns (bytes memory dataValues) {
214
- return _getTokenIdData(tokenId, dataKey);
215
- }
216
-
217
- /**
218
- * @inheritdoc ILSP8IdentifiableDigitalAsset
219
- */
220
- function getTokenIdDataBatch(
221
- bytes32[] memory tokenIds,
222
- bytes32[] memory dataKeys
223
- ) public view virtual override returns (bytes[] memory dataValues) {
224
- dataValues = new bytes[](tokenIds.length);
225
-
226
- for (uint256 i; i < tokenIds.length; ) {
227
- dataValues[i] = _getTokenIdData(tokenIds[i], dataKeys[i]);
228
-
229
- // Increment the iterator in unchecked block to save gas
230
- unchecked {
231
- ++i;
232
- }
233
- }
234
-
235
- return dataValues;
236
- }
237
-
238
- // --- Operator functionality
239
-
240
- /**
241
- * @inheritdoc ILSP8IdentifiableDigitalAsset
242
- */
243
- function authorizeOperator(
244
- address operator,
245
- bytes32 tokenId,
246
- bytes memory operatorNotificationData
247
- ) public virtual override {
248
- address tokenOwner = tokenOwnerOf(tokenId);
249
-
250
- if (tokenOwner != msg.sender) {
251
- revert LSP8NotTokenOwner(tokenOwner, tokenId, msg.sender);
252
- }
253
-
254
- if (operator == address(0)) {
255
- revert LSP8CannotUseAddressZeroAsOperator();
256
- }
257
-
258
- if (tokenOwner == operator) {
259
- revert LSP8TokenOwnerCannotBeOperator();
260
- }
261
-
262
- bool isAdded = _operators[tokenId].add(operator);
263
- if (!isAdded) revert LSP8OperatorAlreadyAuthorized(operator, tokenId);
264
-
265
- emit OperatorAuthorizationChanged(
266
- operator,
267
- tokenOwner,
268
- tokenId,
269
- operatorNotificationData
270
- );
271
-
272
- bytes memory lsp1Data = abi.encode(
273
- msg.sender,
274
- tokenId,
275
- true, // authorized
276
- operatorNotificationData
277
- );
278
-
279
- _notifyTokenOperator(operator, lsp1Data);
280
- }
281
-
282
- /**
283
- * @inheritdoc ILSP8IdentifiableDigitalAsset
284
- */
285
- function revokeOperator(
286
- address operator,
287
- bytes32 tokenId,
288
- bool notify,
289
- bytes memory operatorNotificationData
290
- ) public virtual override {
291
- address tokenOwner = tokenOwnerOf(tokenId);
292
-
293
- if (tokenOwner != msg.sender) {
294
- revert LSP8NotTokenOwner(tokenOwner, tokenId, msg.sender);
295
- }
296
-
297
- if (operator == address(0)) {
298
- revert LSP8CannotUseAddressZeroAsOperator();
299
- }
300
-
301
- if (tokenOwner == operator) {
302
- revert LSP8TokenOwnerCannotBeOperator();
303
- }
304
-
305
- _revokeOperator(
306
- operator,
307
- tokenOwner,
308
- tokenId,
309
- notify,
310
- operatorNotificationData
311
- );
312
-
313
- if (notify) {
314
- bytes memory lsp1Data = abi.encode(
315
- msg.sender,
316
- tokenId,
317
- false, // unauthorized
318
- operatorNotificationData
319
- );
320
-
321
- _notifyTokenOperator(operator, lsp1Data);
322
- }
323
- }
324
-
325
- /**
326
- * @inheritdoc ILSP8IdentifiableDigitalAsset
327
- */
328
- function isOperatorFor(
329
- address operator,
330
- bytes32 tokenId
331
- ) public view virtual override returns (bool) {
332
- _existsOrError(tokenId);
333
-
334
- return _isOperatorOrOwner(operator, tokenId);
335
- }
336
-
337
- /**
338
- * @inheritdoc ILSP8IdentifiableDigitalAsset
339
- */
340
- function getOperatorsOf(
341
- bytes32 tokenId
342
- ) public view virtual override returns (address[] memory) {
343
- _existsOrError(tokenId);
344
-
345
- return _operators[tokenId].values();
346
- }
347
-
348
- /**
349
- * @dev verifies if the `caller` is operator or owner for the `tokenId`
350
- * @return true if `caller` is either operator or owner
351
- */
352
- function _isOperatorOrOwner(
353
- address caller,
354
- bytes32 tokenId
355
- ) internal view virtual returns (bool) {
356
- return (caller == tokenOwnerOf(tokenId) ||
357
- _operators[tokenId].contains(caller));
358
- }
359
-
360
- // --- Transfer functionality
361
-
362
- /**
363
- * @inheritdoc ILSP8IdentifiableDigitalAsset
364
- */
365
- function transfer(
366
- address from,
367
- address to,
368
- bytes32 tokenId,
369
- bool force,
370
- bytes memory data
371
- ) public virtual override {
372
- if (!_isOperatorOrOwner(msg.sender, tokenId)) {
373
- revert LSP8NotTokenOperator(tokenId, msg.sender);
374
- }
375
-
376
- _transfer(from, to, tokenId, force, data);
377
- }
378
-
379
- /**
380
- * @inheritdoc ILSP8IdentifiableDigitalAsset
381
- */
382
- function transferBatch(
383
- address[] memory from,
384
- address[] memory to,
385
- bytes32[] memory tokenId,
386
- bool[] memory force,
387
- bytes[] memory data
388
- ) public virtual override {
389
- uint256 fromLength = from.length;
390
- if (
391
- fromLength != to.length ||
392
- fromLength != tokenId.length ||
393
- fromLength != force.length ||
394
- fromLength != data.length
395
- ) {
396
- revert LSP8InvalidTransferBatch();
397
- }
398
-
399
- for (uint256 i; i < fromLength; ) {
400
- transfer(from[i], to[i], tokenId[i], force[i], data[i]);
401
-
402
- unchecked {
403
- ++i;
404
- }
405
- }
406
- }
407
-
408
- /**
409
- * @dev removes `operator` from the list of operators for the `tokenId`
410
- */
411
- function _revokeOperator(
412
- address operator,
413
- address tokenOwner,
414
- bytes32 tokenId,
415
- bool notified,
416
- bytes memory operatorNotificationData
417
- ) internal virtual {
418
- bool isRemoved = _operators[tokenId].remove(operator);
419
- if (!isRemoved) revert LSP8NonExistingOperator(operator, tokenId);
420
-
421
- emit OperatorRevoked(
422
- operator,
423
- tokenOwner,
424
- tokenId,
425
- notified,
426
- operatorNotificationData
427
- );
428
- }
429
-
430
- /**
431
- * @dev revoke all the current operators for a specific `tokenId` token which belongs to `tokenOwner`.
432
- *
433
- * @param tokenOwner The address that is the owner of the `tokenId`.
434
- * @param tokenId The token to remove the associated operators for.
435
- */
436
- function _clearOperators(
437
- address tokenOwner,
438
- bytes32 tokenId
439
- ) internal virtual {
440
- // here is a good example of why having multiple operators will be expensive.. we
441
- // need to clear them on token transfer
442
- //
443
- // NOTE: this may cause a tx to fail if there is too many operators to clear, in which case
444
- // the tokenOwner needs to call `revokeOperator` until there is less operators to clear and
445
- // the desired `transfer` or `burn` call can succeed.
446
- EnumerableSet.AddressSet storage operatorsForTokenId = _operators[
447
- tokenId
448
- ];
449
-
450
- uint256 operatorListLength = operatorsForTokenId.length();
451
- address operator;
452
- for (uint256 i; i < operatorListLength; ) {
453
- // we are emptying the list, always remove from index 0
454
- operator = operatorsForTokenId.at(0);
455
- _revokeOperator(operator, tokenOwner, tokenId, false, "");
456
-
457
- unchecked {
458
- ++i;
459
- }
460
- }
461
- }
462
-
463
- /**
464
- * @dev Returns whether `tokenId` exists.
465
- *
466
- * Tokens start existing when they are minted ({_mint}), and stop existing when they are burned ({_burn}).
467
- */
468
- function _exists(bytes32 tokenId) internal view virtual returns (bool) {
469
- return _tokenOwners[tokenId] != address(0);
470
- }
471
-
472
- /**
473
- * @dev When `tokenId` does not exist then revert with an error.
474
- */
475
- function _existsOrError(bytes32 tokenId) internal view virtual {
476
- if (!_exists(tokenId)) {
477
- revert LSP8NonExistentTokenId(tokenId);
478
- }
479
- }
480
-
481
- /**
482
- * @dev Create `tokenId` by minting it and transfers it to `to`.
483
- *
484
- * @custom:info Any logic in the:
485
- * - {_beforeTokenTransfer} function will run before updating the balances and ownership of `tokenId`s.
486
- * - {_afterTokenTransfer} function will run after updating the balances and ownership of `tokenId`s, **but before notifying the recipient via LSP1**.
487
- *
488
- * @param to The address that will receive the minted `tokenId`.
489
- * @param tokenId The token ID to create (= mint).
490
- * @param force When set to `true`, `to` may be any address. When set to `false`, `to` must be a contract that supports the LSP1 standard.
491
- * @param data Any additional data the caller wants included in the emitted event, and sent in the hook of the `to` address.
492
- *
493
- * @custom:requirements
494
- * - `tokenId` must not exist and not have been already minted.
495
- * - `to` cannot be the zero address.
496
-
497
- * @custom:events {Transfer} event with `address(0)` as `from` address.
498
- */
499
- function _mint(
500
- address to,
501
- bytes32 tokenId,
502
- bool force,
503
- bytes memory data
504
- ) internal virtual {
505
- if (to == address(0)) {
506
- revert LSP8CannotSendToAddressZero();
507
- }
508
-
509
- _beforeTokenTransfer(address(0), to, tokenId, data);
510
-
511
- // Check that `tokenId` was not minted inside the `_beforeTokenTransfer` hook
512
- if (_exists(tokenId)) {
513
- revert LSP8TokenIdAlreadyMinted(tokenId);
514
- }
515
-
516
- // token being minted
517
- ++_existingTokens;
518
-
519
- _ownedTokens[to].add(tokenId);
520
- _tokenOwners[tokenId] = to;
521
-
522
- emit Transfer(msg.sender, address(0), to, tokenId, force, data);
523
-
524
- _afterTokenTransfer(address(0), to, tokenId, data);
525
-
526
- bytes memory lsp1Data = abi.encode(
527
- msg.sender,
528
- address(0),
529
- to,
530
- tokenId,
531
- data
532
- );
533
- _notifyTokenReceiver(to, force, lsp1Data);
534
- }
535
-
536
- /**
537
- * @dev Burn a specific `tokenId`, removing the `tokenId` from the {tokenIdsOf} the caller and decreasing its {balanceOf} by -1.
538
- * This will also clear all the operators allowed to transfer the `tokenId`.
539
- *
540
- * The owner of the `tokenId` will be notified about the `tokenId` being transferred through its LSP1 {universalReceiver}
541
- * function, if it is a contract that supports the LSP1 interface. Its {universalReceiver} function will receive
542
- * all the parameters in the calldata packed encoded.
543
- *
544
- * @custom:info Any logic in the:
545
- * - {_beforeTokenTransfer} function will run before updating the balances and ownership of `tokenId`s.
546
- * - {_afterTokenTransfer} function will run after updating the balances and ownership of `tokenId`s, **but before notifying the sender via LSP1**.
547
- *
548
- * @param tokenId The token to burn.
549
- * @param data Any additional data the caller wants included in the emitted event, and sent in the LSP1 hook on the token owner's address.
550
- *
551
- * @custom:hint In dApps, you can know which addresses are burning tokens by listening for the `Transfer` event and filter with the zero address as `to`.
552
- *
553
- * @custom:requirements
554
- * - `tokenId` must exist.
555
- *
556
- * @custom:events {Transfer} event with `address(0)` as the `to` address.
557
- */
558
- function _burn(bytes32 tokenId, bytes memory data) internal virtual {
559
- address tokenOwner = tokenOwnerOf(tokenId);
560
-
561
- _beforeTokenTransfer(tokenOwner, address(0), tokenId, data);
562
-
563
- // Re-fetch and update `tokenOwner` in case `tokenId`
564
- // was transferred inside the `_beforeTokenTransfer` hook
565
- tokenOwner = tokenOwnerOf(tokenId);
566
-
567
- // token being burned
568
- --_existingTokens;
569
-
570
- _clearOperators(tokenOwner, tokenId);
571
-
572
- _ownedTokens[tokenOwner].remove(tokenId);
573
- delete _tokenOwners[tokenId];
574
-
575
- emit Transfer(msg.sender, tokenOwner, address(0), tokenId, false, data);
576
-
577
- _afterTokenTransfer(tokenOwner, address(0), tokenId, data);
578
-
579
- bytes memory lsp1Data = abi.encode(
580
- msg.sender,
581
- tokenOwner,
582
- address(0),
583
- tokenId,
584
- data
585
- );
586
-
587
- _notifyTokenSender(tokenOwner, lsp1Data);
588
- }
589
-
590
- /**
591
- * @dev Change the owner of the `tokenId` from `from` to `to`.
592
- *
593
- * Both the sender and recipient will be notified of the `tokenId` being transferred through their LSP1 {universalReceiver}
594
- * function, if they are contracts that support the LSP1 interface. Their `universalReceiver` function will receive
595
- * all the parameters in the calldata packed encoded.
596
- *
597
- * @custom:info Any logic in the:
598
- * - {_beforeTokenTransfer} function will run before updating the balances and ownership of `tokenId`s.
599
- * - {_afterTokenTransfer} function will run after updating the balances and ownership of `tokenId`s, **but before notifying the sender/recipient via LSP1**.
600
- *
601
- * @param from The sender address.
602
- * @param to The recipient address.
603
- * @param tokenId The token to transfer.
604
- * @param force When set to `true`, `to` may be any address. When set to `false`, `to` must be a contract that supports the LSP1 standard.
605
- * @param data Additional data the caller wants included in the emitted event, and sent in the hooks to `from` and `to` addresses.
606
- *
607
- * @custom:requirements
608
- * - `to` cannot be the zero address.
609
- * - `tokenId` token must be owned by `from`.
610
- *
611
- * @custom:events {Transfer} event.
612
- *
613
- * @custom:danger This internal function does not check if the sender is authorized or not to operate on the `tokenId`.
614
- */
615
- function _transfer(
616
- address from,
617
- address to,
618
- bytes32 tokenId,
619
- bool force,
620
- bytes memory data
621
- ) internal virtual {
622
- if (from == to) {
623
- revert LSP8CannotSendToSelf();
624
- }
625
-
626
- address tokenOwner = tokenOwnerOf(tokenId);
627
- if (tokenOwner != from) {
628
- revert LSP8NotTokenOwner(tokenOwner, tokenId, from);
629
- }
630
-
631
- if (to == address(0)) {
632
- revert LSP8CannotSendToAddressZero();
633
- }
634
-
635
- _beforeTokenTransfer(from, to, tokenId, data);
636
-
637
- // Re-fetch and update `tokenOwner` in case `tokenId`
638
- // was transferred inside the `_beforeTokenTransfer` hook
639
- tokenOwner = tokenOwnerOf(tokenId);
640
-
641
- _clearOperators(from, tokenId);
642
-
643
- _ownedTokens[from].remove(tokenId);
644
- _ownedTokens[to].add(tokenId);
645
- _tokenOwners[tokenId] = to;
646
-
647
- emit Transfer(msg.sender, from, to, tokenId, force, data);
648
-
649
- _afterTokenTransfer(from, to, tokenId, data);
650
-
651
- bytes memory lsp1Data = abi.encode(msg.sender, from, to, tokenId, data);
652
-
653
- _notifyTokenSender(from, lsp1Data);
654
- _notifyTokenReceiver(to, force, lsp1Data);
655
- }
656
-
657
- /**
658
- * @dev Sets data for a specific `tokenId` and `dataKey` in the ERC725Y storage
659
- * The ERC725Y data key is the hash of the `tokenId` and `dataKey` concatenated
660
- * @param tokenId The unique identifier for a token.
661
- * @param dataKey The key for the data to set.
662
- * @param dataValue The value to set for the given data key.
663
- * @custom:events {TokenIdDataChanged} event.
664
- */
665
- function _setTokenIdData(
666
- bytes32 tokenId,
667
- bytes32 dataKey,
668
- bytes memory dataValue
669
- ) internal virtual {
670
- _store[keccak256(bytes.concat(tokenId, dataKey))] = dataValue;
671
- emit TokenIdDataChanged(tokenId, dataKey, dataValue);
672
- }
673
-
674
- /**
675
- * @dev Retrieves data for a specific `tokenId` and `dataKey` from the ERC725Y storage
676
- * The ERC725Y data key is the hash of the `tokenId` and `dataKey` concatenated
677
- * @param tokenId The unique identifier for a token.
678
- * @param dataKey The key for the data to retrieve.
679
- * @return dataValues The data value associated with the given `tokenId` and `dataKey`.
680
- */
681
- function _getTokenIdData(
682
- bytes32 tokenId,
683
- bytes32 dataKey
684
- ) internal view virtual returns (bytes memory dataValues) {
685
- return _store[keccak256(bytes.concat(tokenId, dataKey))];
686
- }
687
-
688
- /**
689
- * @dev Hook that is called before any token transfer, including minting and burning.
690
- * Allows to run custom logic before updating balances and notifiying sender/recipient by overriding this function.
691
- *
692
- * @param from The sender address
693
- * @param to The recipient address
694
- * @param tokenId The tokenId to transfer
695
- * @param data The data sent alongside the transfer
696
- */
697
- function _beforeTokenTransfer(
698
- address from,
699
- address to,
700
- bytes32 tokenId,
701
- bytes memory data // solhint-disable-next-line no-empty-blocks
702
- ) internal virtual {}
703
-
704
- /**
705
- * @dev Hook that is called after any token transfer, including minting and burning.
706
- * Allows to run custom logic after updating balances, but **before notifiying sender/recipient via LSP1** by overriding this function.
707
- *
708
- * @param from The sender address
709
- * @param to The recipient address
710
- * @param tokenId The tokenId to transfer
711
- * @param data The data sent alongside the transfer
712
- */
713
- function _afterTokenTransfer(
714
- address from,
715
- address to,
716
- bytes32 tokenId,
717
- bytes memory data // solhint-disable-next-line no-empty-blocks
718
- ) internal virtual {}
719
-
720
- /**
721
- * @dev Attempt to notify the operator `operator` about the `tokenId` being authorized.
722
- * This is done by calling its {universalReceiver} function with the `_TYPEID_LSP8_TOKENOPERATOR` as typeId, if `operator` is a contract that supports the LSP1 interface.
723
- * If `operator` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent.
724
-
725
- * @param operator The address to call the {universalReceiver} function on.
726
- * @param lsp1Data the data to be sent to the `operator` address in the `universalReceiver` call.
727
- */
728
- function _notifyTokenOperator(
729
- address operator,
730
- bytes memory lsp1Data
731
- ) internal virtual {
732
- LSP1Utils.notifyUniversalReceiver(
733
- operator,
734
- _TYPEID_LSP8_TOKENOPERATOR,
735
- lsp1Data
736
- );
737
- }
738
-
739
- /**
740
- * @dev Attempt to notify the token sender `from` about the `tokenId` being transferred.
741
- * This is done by calling its {universalReceiver} function with the `_TYPEID_LSP8_TOKENSSENDER` as typeId, if `from` is a contract that supports the LSP1 interface.
742
- * If `from` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent.
743
-
744
- * @param from The address to call the {universalReceiver} function on.
745
- * @param lsp1Data the data to be sent to the `from` address in the `universalReceiver` call.
746
- */
747
- function _notifyTokenSender(
748
- address from,
749
- bytes memory lsp1Data
750
- ) internal virtual {
751
- LSP1Utils.notifyUniversalReceiver(
752
- from,
753
- _TYPEID_LSP8_TOKENSSENDER,
754
- lsp1Data
755
- );
756
- }
757
-
758
- /**
759
- * @dev Attempt to notify the token receiver `to` about the `tokenId` being received.
760
- * This is done by calling its {universalReceiver} function with the `_TYPEID_LSP8_TOKENSRECIPIENT` as typeId, if `to` is a contract that supports the LSP1 interface.
761
- *
762
- * If `to` is is an EOA or a contract that does not support the LSP1 interface, the behaviour will depend on the `force` boolean flag.
763
- * - if `force` is set to `true`, nothing will happen and no notification will be sent.
764
- * - if `force` is set to `false, the transaction will revert.
765
- *
766
- * @param to The address to call the {universalReceiver} function on.
767
- * @param force A boolean that describe if transfer to a `to` address that does not support LSP1 is allowed or not.
768
- * @param lsp1Data The data to be sent to the `to` address in the `universalReceiver(...)` call.
769
- */
770
- function _notifyTokenReceiver(
771
- address to,
772
- bool force,
773
- bytes memory lsp1Data
774
- ) internal virtual {
775
- if (
776
- ERC165Checker.supportsERC165InterfaceUnchecked(
777
- to,
778
- _INTERFACEID_LSP1
779
- )
780
- ) {
781
- ILSP1(to).universalReceiver(_TYPEID_LSP8_TOKENSRECIPIENT, lsp1Data);
782
- } else if (!force) {
783
- if (to.code.length != 0) {
784
- revert LSP8NotifyTokenReceiverContractMissingLSP1Interface(to);
785
- } else {
786
- revert LSP8NotifyTokenReceiverIsEOA(to);
787
- }
788
- }
789
- }
790
- }
4
+ import "@lukso/lsp8-contracts/contracts/LSP8IdentifiableDigitalAssetCore.sol";