@lukso/lsp-smart-contracts 0.11.0-rc.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. package/README.md +1 -0
  2. package/artifacts/LSP0ERC725Account.json +7 -2
  3. package/artifacts/LSP0ERC725AccountInit.json +7 -2
  4. package/artifacts/LSP11BasicSocialRecovery.json +2 -2
  5. package/artifacts/LSP11BasicSocialRecoveryInit.json +2 -2
  6. package/artifacts/LSP1UniversalReceiverDelegateUP.json +3 -79
  7. package/artifacts/LSP1UniversalReceiverDelegateVault.json +3 -41
  8. package/artifacts/LSP23LinkedContractsFactory.json +544 -0
  9. package/artifacts/LSP6KeyManager.json +24 -19
  10. package/artifacts/LSP6KeyManagerInit.json +24 -19
  11. package/artifacts/LSP7CappedSupply.json +88 -0
  12. package/artifacts/LSP7CappedSupplyInitAbstract.json +88 -0
  13. package/artifacts/LSP7CompatibleERC20.json +88 -0
  14. package/artifacts/LSP7CompatibleERC20InitAbstract.json +88 -0
  15. package/artifacts/LSP7CompatibleERC20Mintable.json +90 -2
  16. package/artifacts/LSP7CompatibleERC20MintableInit.json +90 -2
  17. package/artifacts/LSP7DigitalAsset.json +88 -0
  18. package/artifacts/LSP7DigitalAssetInitAbstract.json +88 -0
  19. package/artifacts/LSP7Mintable.json +90 -2
  20. package/artifacts/LSP7MintableInit.json +90 -2
  21. package/artifacts/LSP8CappedSupply.json +59 -0
  22. package/artifacts/LSP8CappedSupplyInitAbstract.json +59 -0
  23. package/artifacts/LSP8CompatibleERC721.json +60 -1
  24. package/artifacts/LSP8CompatibleERC721InitAbstract.json +60 -1
  25. package/artifacts/LSP8CompatibleERC721Mintable.json +62 -3
  26. package/artifacts/LSP8CompatibleERC721MintableInit.json +62 -3
  27. package/artifacts/LSP8IdentifiableDigitalAsset.json +59 -0
  28. package/artifacts/LSP8IdentifiableDigitalAssetInitAbstract.json +59 -0
  29. package/artifacts/LSP8Mintable.json +61 -2
  30. package/artifacts/LSP8MintableInit.json +61 -2
  31. package/artifacts/LSP9Vault.json +7 -2
  32. package/artifacts/LSP9VaultInit.json +7 -2
  33. package/artifacts/UniversalProfile.json +7 -2
  34. package/artifacts/UniversalProfileInit.json +7 -2
  35. package/contracts/LSP0ERC725Account/ILSP0ERC725Account.sol +8 -36
  36. package/contracts/LSP0ERC725Account/LSP0Constants.sol +1 -1
  37. package/contracts/LSP0ERC725Account/LSP0ERC725Account.sol +15 -30
  38. package/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +122 -206
  39. package/contracts/LSP0ERC725Account/LSP0ERC725AccountInit.sol +18 -36
  40. package/contracts/LSP0ERC725Account/LSP0ERC725AccountInitAbstract.sol +8 -34
  41. package/contracts/LSP10ReceivedVaults/LSP10Utils.sol +148 -177
  42. package/contracts/LSP14Ownable2Step/ILSP14Ownable2Step.sol +21 -20
  43. package/contracts/LSP14Ownable2Step/LSP14Errors.sol +13 -2
  44. package/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol +50 -20
  45. package/contracts/LSP17ContractExtension/LSP17Errors.sol +10 -0
  46. package/contracts/LSP17ContractExtension/LSP17Extendable.sol +16 -34
  47. package/contracts/LSP17ContractExtension/LSP17Utils.sol +1 -1
  48. package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiver.sol +16 -11
  49. package/contracts/LSP1UniversalReceiver/LSP1Errors.sol +5 -10
  50. package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol +192 -177
  51. package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol +150 -88
  52. package/contracts/LSP1UniversalReceiver/LSP1Utils.sol +66 -48
  53. package/contracts/LSP20CallVerification/LSP20CallVerification.sol +1 -1
  54. package/contracts/LSP23LinkedContractsDeployment/ILSP23LinkedContractsFactory.sol +192 -0
  55. package/contracts/LSP23LinkedContractsDeployment/IPostDeploymentModule.sol +18 -0
  56. package/contracts/LSP23LinkedContractsDeployment/LSP23Errors.sol +24 -0
  57. package/contracts/LSP23LinkedContractsDeployment/LSP23LinkedContractsFactory.sol +392 -0
  58. package/contracts/{LSP23MultiChainDeployment → LSP23LinkedContractsDeployment}/modules/UniversalProfileInitPostDeploymentModule.sol +5 -1
  59. package/contracts/LSP23LinkedContractsDeployment/modules/UniversalProfilePostDeploymentModule.sol +61 -0
  60. package/contracts/LSP25ExecuteRelayCall/ILSP25ExecuteRelayCall.sol +68 -0
  61. package/contracts/LSP25ExecuteRelayCall/LSP25Constants.sol +8 -0
  62. package/contracts/LSP25ExecuteRelayCall/LSP25Errors.sol +17 -0
  63. package/contracts/LSP25ExecuteRelayCall/LSP25MultiChannelNonce.sol +143 -0
  64. package/contracts/LSP2ERC725YJSONSchema/LSP2Utils.sol +256 -61
  65. package/contracts/{LSP3UniversalProfile → LSP3ProfileMetadata}/LSP3Constants.sol +3 -3
  66. package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol +9 -8
  67. package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol +13 -6
  68. package/contracts/LSP4DigitalAssetMetadata/LSP4Errors.sol +4 -4
  69. package/contracts/LSP5ReceivedAssets/LSP5Utils.sol +148 -189
  70. package/contracts/LSP6KeyManager/ILSP6KeyManager.sol +26 -54
  71. package/contracts/LSP6KeyManager/LSP6Constants.sol +1 -3
  72. package/contracts/LSP6KeyManager/LSP6Errors.sol +142 -63
  73. package/contracts/LSP6KeyManager/LSP6KeyManager.sol +7 -4
  74. package/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol +125 -80
  75. package/contracts/LSP6KeyManager/LSP6KeyManagerInit.sol +8 -4
  76. package/contracts/LSP6KeyManager/LSP6KeyManagerInitAbstract.sol +1 -1
  77. package/contracts/LSP6KeyManager/LSP6Modules/LSP6ExecuteModule.sol +52 -84
  78. package/contracts/LSP6KeyManager/LSP6Modules/LSP6SetDataModule.sol +59 -10
  79. package/contracts/LSP6KeyManager/LSP6Utils.sol +67 -46
  80. package/contracts/LSP7DigitalAsset/ILSP7DigitalAsset.sol +116 -78
  81. package/contracts/LSP7DigitalAsset/LSP7Constants.sol +4 -1
  82. package/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol +128 -6
  83. package/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +212 -80
  84. package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol +126 -3
  85. package/contracts/LSP7DigitalAsset/LSP7Errors.sol +7 -5
  86. package/contracts/LSP7DigitalAsset/extensions/ILSP7CompatibleERC20.sol +27 -14
  87. package/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol +2 -4
  88. package/contracts/LSP7DigitalAsset/extensions/LSP7BurnableInitAbstract.sol +2 -4
  89. package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol +29 -11
  90. package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyInitAbstract.sol +30 -9
  91. package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol +46 -14
  92. package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20InitAbstract.sol +43 -12
  93. package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol +14 -0
  94. package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInit.sol +9 -4
  95. package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInitAbstract.sol +7 -1
  96. package/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol +8 -8
  97. package/contracts/LSP7DigitalAsset/presets/LSP7MintableInit.sol +7 -6
  98. package/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol +10 -2
  99. package/contracts/LSP8IdentifiableDigitalAsset/ILSP8IdentifiableDigitalAsset.sol +120 -92
  100. package/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol +4 -1
  101. package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol +135 -6
  102. package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +128 -38
  103. package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol +134 -5
  104. package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CompatibleERC721.sol +83 -41
  105. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol +13 -5
  106. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8BurnableInitAbstract.sol +24 -0
  107. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol +30 -12
  108. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInitAbstract.sol +31 -10
  109. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol +96 -31
  110. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol +98 -23
  111. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol +21 -4
  112. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableInitAbstract.sol +12 -2
  113. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol +21 -0
  114. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol +9 -4
  115. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.sol +13 -0
  116. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol +15 -6
  117. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInit.sol +7 -5
  118. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol +17 -2
  119. package/contracts/LSP9Vault/ILSP9Vault.sol +10 -5
  120. package/contracts/LSP9Vault/LSP9Errors.sol +3 -2
  121. package/contracts/LSP9Vault/LSP9Vault.sol +12 -4
  122. package/contracts/LSP9Vault/LSP9VaultCore.sol +245 -182
  123. package/contracts/LSP9Vault/LSP9VaultInit.sol +10 -3
  124. package/contracts/LSP9Vault/LSP9VaultInitAbstract.sol +11 -6
  125. package/contracts/UniversalProfile.sol +8 -6
  126. package/contracts/UniversalProfileInit.sol +6 -6
  127. package/contracts/UniversalProfileInitAbstract.sol +10 -3
  128. package/devdocs/LSP0ERC725Account.json +54 -37
  129. package/devdocs/LSP0ERC725AccountInit.json +56 -38
  130. package/devdocs/LSP1UniversalReceiverDelegateUP.json +14 -55
  131. package/devdocs/LSP1UniversalReceiverDelegateVault.json +9 -33
  132. package/devdocs/LSP23LinkedContractsFactory.json +81 -0
  133. package/devdocs/LSP4DigitalAssetMetadata.json +5 -5
  134. package/devdocs/LSP4DigitalAssetMetadataInitAbstract.json +4 -4
  135. package/devdocs/LSP6KeyManager.json +109 -70
  136. package/devdocs/LSP6KeyManagerInit.json +109 -70
  137. package/devdocs/LSP7CappedSupply.json +90 -42
  138. package/devdocs/LSP7CappedSupplyInitAbstract.json +86 -40
  139. package/devdocs/LSP7CompatibleERC20.json +79 -43
  140. package/devdocs/LSP7CompatibleERC20InitAbstract.json +75 -39
  141. package/devdocs/LSP7CompatibleERC20Mintable.json +87 -40
  142. package/devdocs/LSP7CompatibleERC20MintableInit.json +82 -42
  143. package/devdocs/LSP7DigitalAsset.json +76 -40
  144. package/devdocs/LSP7DigitalAssetInitAbstract.json +73 -37
  145. package/devdocs/LSP7Mintable.json +79 -51
  146. package/devdocs/LSP7MintableInit.json +78 -49
  147. package/devdocs/LSP8CappedSupply.json +72 -43
  148. package/devdocs/LSP8CappedSupplyInitAbstract.json +68 -41
  149. package/devdocs/LSP8CompatibleERC721.json +85 -64
  150. package/devdocs/LSP8CompatibleERC721InitAbstract.json +81 -60
  151. package/devdocs/LSP8CompatibleERC721Mintable.json +98 -60
  152. package/devdocs/LSP8CompatibleERC721MintableInit.json +93 -62
  153. package/devdocs/LSP8IdentifiableDigitalAsset.json +58 -41
  154. package/devdocs/LSP8IdentifiableDigitalAssetInitAbstract.json +57 -40
  155. package/devdocs/LSP8Mintable.json +65 -48
  156. package/devdocs/LSP8MintableInit.json +64 -47
  157. package/devdocs/LSP9Vault.json +61 -18
  158. package/devdocs/LSP9VaultInit.json +59 -17
  159. package/devdocs/UniversalProfile.json +53 -35
  160. package/devdocs/UniversalProfileInit.json +53 -35
  161. package/dist/constants.cjs.js +6236 -2587
  162. package/dist/constants.d.ts +3851 -1129
  163. package/dist/constants.es.js +6236 -2587
  164. package/package.json +6 -4
  165. package/userdocs/LSP0ERC725Account.json +40 -8
  166. package/userdocs/LSP0ERC725AccountInit.json +40 -8
  167. package/userdocs/LSP1UniversalReceiverDelegateUP.json +18 -2
  168. package/userdocs/LSP1UniversalReceiverDelegateVault.json +18 -2
  169. package/userdocs/LSP23LinkedContractsFactory.json +29 -0
  170. package/userdocs/LSP4DigitalAssetMetadata.json +1 -1
  171. package/userdocs/LSP6KeyManager.json +144 -6
  172. package/userdocs/LSP6KeyManagerInit.json +147 -6
  173. package/userdocs/LSP7CappedSupply.json +18 -3
  174. package/userdocs/LSP7CappedSupplyInitAbstract.json +17 -2
  175. package/userdocs/LSP7CompatibleERC20.json +3 -9
  176. package/userdocs/LSP7CompatibleERC20InitAbstract.json +2 -8
  177. package/userdocs/LSP7CompatibleERC20Mintable.json +5 -8
  178. package/userdocs/LSP7CompatibleERC20MintableInit.json +3 -9
  179. package/userdocs/LSP7DigitalAsset.json +2 -2
  180. package/userdocs/LSP7DigitalAssetInitAbstract.json +2 -2
  181. package/userdocs/LSP7Mintable.json +3 -3
  182. package/userdocs/LSP7MintableInit.json +3 -3
  183. package/userdocs/LSP8CappedSupply.json +16 -1
  184. package/userdocs/LSP8CappedSupplyInitAbstract.json +15 -0
  185. package/userdocs/LSP8CompatibleERC721.json +24 -3
  186. package/userdocs/LSP8CompatibleERC721InitAbstract.json +23 -2
  187. package/userdocs/LSP8CompatibleERC721Mintable.json +29 -2
  188. package/userdocs/LSP8CompatibleERC721MintableInit.json +27 -3
  189. package/userdocs/LSP8Mintable.json +4 -1
  190. package/userdocs/LSP8MintableInit.json +4 -1
  191. package/userdocs/LSP9Vault.json +50 -4
  192. package/userdocs/LSP9VaultInit.json +50 -4
  193. package/userdocs/UniversalProfile.json +40 -8
  194. package/userdocs/UniversalProfileInit.json +40 -8
  195. package/contracts/LSP0ERC725Account/LSP0Utils.sol +0 -47
  196. package/contracts/LSP23MultiChainDeployment/IOwnerControlledContractDeployer.sol +0 -174
  197. package/contracts/LSP23MultiChainDeployment/IPostDeploymentModule.sol +0 -10
  198. package/contracts/LSP23MultiChainDeployment/LSP23Errors.sol +0 -24
  199. package/contracts/LSP23MultiChainDeployment/OwnerControlledContractDeployer.sol +0 -388
@@ -15,11 +15,14 @@ bytes4 constant _INTERFACEID_ERC721METADATA = 0x5b5e139f;
15
15
  */
16
16
  interface ILSP8CompatibleERC721 is ILSP8IdentifiableDigitalAsset {
17
17
  /**
18
- * @notice To provide compatibility with indexing ERC721 events.
19
- * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
20
- * @param from The sending address
21
- * @param to The receiving address
22
- * @param tokenId The tokenId to transfer
18
+ * @notice ERC721 `Transfer` compatible event emitted. Successfully transferred tokenId `tokenId` from `from` to `to`.
19
+ *
20
+ * @dev ERC721 `Transfer` event emitted when `tokenId` token is transferred from `from` to `to`.
21
+ * To provide compatibility with indexing ERC721 events.
22
+ *
23
+ * @param from The sending address.
24
+ * @param to The receiving address.
25
+ * @param tokenId The tokenId to transfer.
23
26
  */
24
27
  event Transfer(
25
28
  address indexed from,
@@ -28,21 +31,30 @@ interface ILSP8CompatibleERC721 is ILSP8IdentifiableDigitalAsset {
28
31
  );
29
32
 
30
33
  /**
31
- * @notice To provide compatibility with indexing ERC721 events.
32
- * @dev Emitted when `owner` enables `approved` for `tokenId`.
33
- * @param owner The address of the owner of the `tokenId`
34
- * @param approved The address set as operator
35
- * @param tokenId The approved tokenId
34
+ * @notice ERC721 `Approval` compatible event emitted. Successfully approved operator `operator` to operate on tokenId `tokenId` on behalf of token owner `owner`.
35
+ *
36
+ * @dev ERC721 `Approval` event emitted when `owner` enables `operator` for `tokenId`.
37
+ * To provide compatibility with indexing ERC721 events.
38
+ *
39
+ * @param owner The address of the owner of the `tokenId`.
40
+ * @param operator The address set as operator.
41
+ * @param tokenId The approved tokenId.
36
42
  */
37
43
  event Approval(
38
44
  address indexed owner,
39
- address indexed approved,
45
+ address indexed operator,
40
46
  uint256 indexed tokenId
41
47
  );
42
48
 
43
49
  /**
44
- * @dev This emits when an operator is enabled or disabled for an owner.
45
- * The operator can manage all NFTs of the owner.
50
+ * @notice ERC721 `ApprovalForAll` compatible event emitted. Successfully set "approved for all" status to `approved` for operator `operator` for token owner `owner`.
51
+ *
52
+ * @dev ERC721 `ApprovalForAll` event emitted when an `operator` is enabled or disabled for an owner
53
+ * to transfer any of its tokenIds. The operator can manage all NFTs of the owner.
54
+ *
55
+ * @param owner The address of the owner of tokenIds.
56
+ * @param operator The address set as operator.
57
+ * @param approved If `operator` is approved for all NFTs or not.
46
58
  */
47
59
  event ApprovalForAll(
48
60
  address indexed owner,
@@ -51,18 +63,24 @@ interface ILSP8CompatibleERC721 is ILSP8IdentifiableDigitalAsset {
51
63
  );
52
64
 
53
65
  /**
54
- * @dev Compatible with ERC721 transferFrom.
55
- * @param from The sending address
56
- * @param to The receiving address
57
- * @param tokenId The tokenId to transfer
66
+ * @notice Calling `transferFrom` function on `ILSP8CompatibleERC721` contract. Transferring tokenId `tokenId` from address `from` to address `to`.
67
+ *
68
+ * @dev Transfer functions from the ERC721 standard interface.
69
+ *
70
+ * @param from The sending address.
71
+ * @param to The receiving address.
72
+ * @param tokenId The tokenId to transfer.
58
73
  */
59
74
  function transferFrom(address from, address to, uint256 tokenId) external;
60
75
 
61
76
  /**
62
- * @dev Compatible with ERC721 transferFrom.
63
- * @param from The sending address
64
- * @param to The receiving address
65
- * @param tokenId The tokenId to transfer
77
+ * @notice Calling `safeTransferFrom` function on `ILSP8CompatibleERC721` contract. Transferring tokenId `tokenId` from address `from` to address `to`.
78
+ *
79
+ * @dev Safe Transfer function without optional data from the ERC721 standard interface.
80
+ *
81
+ * @param from The sending address.
82
+ * @param to The receiving address.
83
+ * @param tokenId The tokenId to transfer.
66
84
  */
67
85
  function safeTransferFrom(
68
86
  address from,
@@ -71,11 +89,14 @@ interface ILSP8CompatibleERC721 is ILSP8IdentifiableDigitalAsset {
71
89
  ) external;
72
90
 
73
91
  /**
74
- * @dev Compatible with ERC721 safeTransferFrom.
75
- * @param from The sending address
76
- * @param to The receiving address
77
- * @param tokenId The tokenId to transfer
78
- * @param data The data to be sent with the transfer
92
+ * @notice Calling `safeTransferFrom` function with `data` on `ILSP8CompatibleERC721` contract. Transferring tokenId `tokenId` from address `from` to address `to`.
93
+ *
94
+ * @dev Safe Transfer function with optional data from the ERC721 standard interface.
95
+ *
96
+ * @param from The sending address.
97
+ * @param to The receiving address.
98
+ * @param tokenId The tokenId to transfer.
99
+ * @param data The data to be sent with the transfer.
79
100
  */
80
101
  function safeTransferFrom(
81
102
  address from,
@@ -85,38 +106,55 @@ interface ILSP8CompatibleERC721 is ILSP8IdentifiableDigitalAsset {
85
106
  ) external;
86
107
 
87
108
  /**
109
+ * @notice Retrieving the address that own tokenId `tokenId`.
110
+ *
88
111
  * @dev Compatible with ERC721 ownerOf.
89
- * @param tokenId The tokenId to query
90
- * @return The owner of the tokenId
112
+ *
113
+ * @param tokenId The tokenId to query.
114
+ * @return The owner of the tokenId.
91
115
  */
92
116
  function ownerOf(uint256 tokenId) external view returns (address);
93
117
 
94
118
  /**
95
- * @dev Compatible with ERC721 approve.
96
- * @param operator The address to approve for `tokenId`
97
- * @param tokenId The tokenId to approve
119
+ * @notice Calling `approve` function on `ILSP8CompatibleERC721` contract. Approving operator at address `operator` to transfer tokenId `tokenId` on behalf of its owner.
120
+ *
121
+ * @dev Approval function compatible with ERC721 `approve(address,uint256)`.
122
+ *
123
+ * @param operator The address to approve for `tokenId`.
124
+ * @param tokenId The tokenId to approve.
98
125
  */
99
126
  function approve(address operator, uint256 tokenId) external;
100
127
 
101
128
  /**
102
- * @notice Enable or disable approval for a third party ("operator") to manage all of `msg.sender`'s assets
103
- * @dev Emits the ApprovalForAll event. The contract MUST allow multiple operators per owner.
104
- * @param _operator Address to add to the set of authorized operators
105
- * @param _approved True if the operator is approved, false to revoke approval
129
+ * @notice Setting the "approval for all" status of operator `_operator` to `_approved` to allow it to transfer any tokenIds on behalf of `msg.sender`.
130
+ *
131
+ * @dev Enable or disable approval for a third party ("operator") to manage all of `msg.sender`'s assets. The contract MUST allow multiple operators per owner.
132
+ *
133
+ * @param _operator Address to add to the set of authorized operators.
134
+ * @param _approved True if the operator is approved, false to revoke approval.
135
+ *
136
+ * @custom:events {ApprovalForAll} event
106
137
  */
107
138
  function setApprovalForAll(address _operator, bool _approved) external;
108
139
 
109
140
  /**
141
+ * @notice Retrieving the address other than the token owner that is approved to transfer tokenId `tokenId` on behalf of its owner.
142
+ *
110
143
  * @dev Compatible with ERC721 getApproved.
111
- * @param tokenId The tokenId to query
112
- * @return The address of the operator for `tokenId`
144
+ *
145
+ * @param tokenId The tokenId to query.
146
+ * @return The address of the operator for `tokenId`.
113
147
  */
114
148
  function getApproved(uint256 tokenId) external view returns (address);
115
149
 
116
150
  /*
151
+ * @notice Checking if address `operator` is approved to transfer any tokenId owned by address `owner`.
152
+ *
117
153
  * @dev Compatible with ERC721 isApprovedForAll.
118
- * @param owner The tokenOwner address to query
119
- * @param operator The operator address to query
154
+ *
155
+ * @param owner The tokenOwner address to query.
156
+ * @param operator The operator address to query.
157
+ *
120
158
  * @return Returns if the `operator` is allowed to manage all of the assets of `owner`
121
159
  */
122
160
  function isApprovedForAll(
@@ -125,9 +163,13 @@ interface ILSP8CompatibleERC721 is ILSP8IdentifiableDigitalAsset {
125
163
  ) external view returns (bool);
126
164
 
127
165
  /*
166
+ * @notice Retrieving the token URI of tokenId `tokenId`.
167
+ *
128
168
  * @dev Compatible with ERC721Metadata tokenURI.
129
- * @param tokenId The tokenId to query
130
- * @return The token URI
169
+ *
170
+ * @param tokenId The tokenId to query.
171
+ *
172
+ * @return The token URI.
131
173
  */
132
174
  function tokenURI(uint256 tokenId) external returns (string memory);
133
175
  }
@@ -2,18 +2,26 @@
2
2
  pragma solidity ^0.8.4;
3
3
 
4
4
  import {
5
- LSP8IdentifiableDigitalAssetCore
6
- } from "../LSP8IdentifiableDigitalAssetCore.sol";
5
+ LSP8IdentifiableDigitalAsset
6
+ } from "../LSP8IdentifiableDigitalAsset.sol";
7
7
 
8
8
  // errors
9
9
  import {LSP8NotTokenOperator} from "../LSP8Errors.sol";
10
10
 
11
11
  /**
12
- * @dev LSP8 extension that allows token holders to destroy both
12
+ * @dev LSP8 token extension that allows token holders to destroy both
13
13
  * their own tokens and those that they have an allowance for as an operator.
14
14
  */
15
- abstract contract LSP8Burnable is LSP8IdentifiableDigitalAssetCore {
16
- function burn(bytes32 tokenId, bytes memory data) public virtual {
15
+ abstract contract LSP8Burnable is LSP8IdentifiableDigitalAsset {
16
+ /**
17
+ * @notice Burning tokenId `tokenId`. This tokenId will not be recoverable! (additional data sent: `data`).
18
+ *
19
+ * @dev See internal {_burn} function for details.
20
+ *
21
+ * @param tokenId The tokenId to burn.
22
+ * @param data Any extra data to be sent alongside burning the tokenId.
23
+ */
24
+ function burn(bytes32 tokenId, bytes memory data) public {
17
25
  if (!_isOperatorOrOwner(msg.sender, tokenId)) {
18
26
  revert LSP8NotTokenOperator(tokenId, msg.sender);
19
27
  }
@@ -0,0 +1,24 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.4;
3
+
4
+ import {
5
+ LSP8IdentifiableDigitalAssetInitAbstract
6
+ } from "../LSP8IdentifiableDigitalAssetInitAbstract.sol";
7
+
8
+ // errors
9
+ import {LSP8NotTokenOperator} from "../LSP8Errors.sol";
10
+
11
+ /**
12
+ * @dev LSP8 extension (proxy version) that allows token holders to destroy both
13
+ * their own tokens and those that they have an allowance for as an operator.
14
+ */
15
+ abstract contract LSP8BurnableInitAbstract is
16
+ LSP8IdentifiableDigitalAssetInitAbstract
17
+ {
18
+ function burn(bytes32 tokenId, bytes memory data) public virtual {
19
+ if (!_isOperatorOrOwner(msg.sender, tokenId)) {
20
+ revert LSP8NotTokenOperator(tokenId, msg.sender);
21
+ }
22
+ _burn(tokenId, data);
23
+ }
24
+ }
@@ -8,19 +8,35 @@ import {
8
8
  } from "../LSP8IdentifiableDigitalAsset.sol";
9
9
 
10
10
  /**
11
- * @dev LSP8 extension, adds token supply cap.
11
+ * @dev LSP8 token extension to add a max token supply cap.
12
12
  */
13
13
  abstract contract LSP8CappedSupply is LSP8IdentifiableDigitalAsset {
14
14
  // --- Errors
15
+
16
+ /**
17
+ * @notice The `tokenSupplyCap` must be set and cannot be `0`.
18
+ * @dev Reverts when setting `0` for the {tokenSupplyCap}. The max token supply MUST be set to a number greater than 0.
19
+ */
15
20
  error LSP8CappedSupplyRequired();
21
+
22
+ /**
23
+ * @notice Cannot mint anymore as total supply reached the maximum cap.
24
+ * @dev Reverts when trying to mint tokens but the {totalSupply} has reached the maximum {tokenSupplyCap}.
25
+ */
16
26
  error LSP8CappedSupplyCannotMintOverCap();
17
27
 
18
28
  // --- Storage
19
29
  uint256 private immutable _tokenSupplyCap;
20
30
 
21
31
  /**
22
- * @notice Sets the token max supply
23
- * @param tokenSupplyCap_ The Token max supply
32
+ * @notice Deploying a `LSP8CappedSupply` token contract with max token supply cap set to `tokenSupplyCap_`.
33
+ * @dev Deploy a `LSP8CappedSupply` token contract and set the maximum token supply token cap up to which
34
+ * it is not possible to mint more tokens.
35
+ *
36
+ * @param tokenSupplyCap_ The maximum token supply.
37
+ *
38
+ * @custom:requirements
39
+ * - `tokenSupplyCap_` MUST NOT be 0.
24
40
  */
25
41
  constructor(uint256 tokenSupplyCap_) {
26
42
  if (tokenSupplyCap_ == 0) {
@@ -33,8 +49,12 @@ abstract contract LSP8CappedSupply is LSP8IdentifiableDigitalAsset {
33
49
  // --- Token queries
34
50
 
35
51
  /**
36
- * @dev Returns the number of tokens that can be minted.
37
- * @return The token max supply
52
+ * @notice The maximum supply amount of tokens allowed to exist is `_tokenSupplyCap`.
53
+ *
54
+ * @dev Get the maximum number of tokens that can exist to circulate. Once {totalSupply} reaches
55
+ * reaches {totalSuuplyCap}, it is not possible to mint more tokens.
56
+ *
57
+ * @return The maximum number of tokens that can exist in the contract.
38
58
  */
39
59
  function tokenSupplyCap() public view virtual returns (uint256) {
40
60
  return _tokenSupplyCap;
@@ -43,15 +63,13 @@ abstract contract LSP8CappedSupply is LSP8IdentifiableDigitalAsset {
43
63
  // --- Transfer functionality
44
64
 
45
65
  /**
46
- * @dev Mints `tokenId` and transfers it to `to`.
47
- *
48
- * Requirements:
66
+ * @dev Same as {_mint} but allows to mint only if newly minted `tokenId` does not increase the {totalSupply}
67
+ * over the {tokenSupplyCap}.
68
+ * after a new `tokenId` has of tokens have been minted.
49
69
  *
50
- * - `tokenSupplyCap() - totalSupply()` must be greater than zero.
51
- * - `tokenId` must not exist.
70
+ * @custom:requirements
71
+ * - {totalSupply} + 1 must not be greater than the {tokenSupplyCap} when calling this function.
52
72
  * - `to` cannot be the zero address.
53
- *
54
- * Emits a {Transfer} event.
55
73
  */
56
74
  function _mint(
57
75
  address to,
@@ -8,18 +8,37 @@ import {
8
8
  } from "../LSP8IdentifiableDigitalAssetInitAbstract.sol";
9
9
 
10
10
  /**
11
- * @dev LSP8 extension, adds token supply cap.
11
+ * @dev LSP8 token extension to add a max token supply cap.
12
12
  */
13
13
  abstract contract LSP8CappedSupplyInitAbstract is
14
14
  LSP8IdentifiableDigitalAssetInitAbstract
15
15
  {
16
16
  // --- Errors
17
+
18
+ /**
19
+ * @notice The `tokenSupplyCap` must be set and cannot be `0`.
20
+ * @dev Reverts when setting `0` for the {tokenSupplyCap}. The max token supply MUST be set to a number greater than 0.
21
+ */
17
22
  error LSP8CappedSupplyRequired();
23
+
24
+ /**
25
+ * @notice Cannot mint anymore as total supply reached the maximum cap.
26
+ * @dev Reverts when trying to mint tokens but the {totalSupply} has reached the maximum {tokenSupplyCap}.
27
+ */
18
28
  error LSP8CappedSupplyCannotMintOverCap();
19
29
 
20
30
  // --- Storage
21
31
  uint256 private _tokenSupplyCap;
22
32
 
33
+ /**
34
+ * @dev Initialize a `LSP8CappedSupplyInitAbstract` token contract and set the maximum token supply token cap up to which
35
+ * it is not possible to mint more tokens.
36
+ *
37
+ * @param tokenSupplyCap_ The maximum token supply.
38
+ *
39
+ * @custom:requirements
40
+ * - `tokenSupplyCap_` MUST NOT be 0.
41
+ */
23
42
  function _initialize(
24
43
  uint256 tokenSupplyCap_
25
44
  ) internal virtual onlyInitializing {
@@ -33,8 +52,12 @@ abstract contract LSP8CappedSupplyInitAbstract is
33
52
  // --- Token queries
34
53
 
35
54
  /**
36
- * @dev Returns the number of tokens that can be minted.
37
- * @return The token max supply
55
+ * @notice The maximum supply amount of tokens allowed to exist is `_tokenSupplyCap`.
56
+ *
57
+ * @dev Get the maximum number of tokens that can exist to circulate. Once {totalSupply} reaches
58
+ * reaches {totalSuuplyCap}, it is not possible to mint more tokens.
59
+ *
60
+ * @return The maximum number of tokens that can exist in the contract.
38
61
  */
39
62
  function tokenSupplyCap() public view virtual returns (uint256) {
40
63
  return _tokenSupplyCap;
@@ -43,15 +66,13 @@ abstract contract LSP8CappedSupplyInitAbstract is
43
66
  // --- Transfer functionality
44
67
 
45
68
  /**
46
- * @dev Mints `tokenId` and transfers it to `to`.
47
- *
48
- * Requirements:
69
+ * @dev Same as {_mint} but allows to mint only if newly minted `tokenId` does not increase the {totalSupply}
70
+ * over the {tokenSupplyCap}.
71
+ * after a new `tokenId` has of tokens have been minted.
49
72
  *
50
- * - `tokenSupplyCap() - totalSupply()` must be greater than zero.
51
- * - `tokenId` must not exist.
73
+ * @custom:requirements
74
+ * - {totalSupply} + 1 must not be greater than the {tokenSupplyCap} when calling this function.
52
75
  * - `to` cannot be the zero address.
53
- *
54
- * Emits a {Transfer} event.
55
76
  */
56
77
  function _mint(
57
78
  address to,
@@ -53,16 +53,17 @@ abstract contract LSP8CompatibleERC721 is
53
53
  using EnumerableSet for EnumerableSet.AddressSet;
54
54
 
55
55
  /**
56
- * Mapping from owner to operator approvals
57
- * @dev for backward compatibility with ERC721
56
+ * @dev Mapping from owner to operator approvals for backward compatibility with ERC721
58
57
  */
59
58
  mapping(address => mapping(address => bool)) private _operatorApprovals;
60
59
 
61
60
  /**
62
- * @notice Sets the name, the symbol and the owner of the token
63
- * @param name_ The name of the token
64
- * @param symbol_ The symbol of the token
65
- * @param newOwner_ The owner of the token
61
+ * @notice Deploying a `LSP8CompatibleERC721` token contract with: token name = `name_`, token symbol = `symbol_`, and
62
+ * address `newOwner_` as the token contract owner.
63
+ *
64
+ * @param name_ The name of the token.
65
+ * @param symbol_ The symbol of the token.
66
+ * @param newOwner_ The owner of the token contract.
66
67
  */
67
68
  constructor(
68
69
  string memory name_,
@@ -71,7 +72,7 @@ abstract contract LSP8CompatibleERC721 is
71
72
  ) LSP8IdentifiableDigitalAsset(name_, symbol_, newOwner_) {}
72
73
 
73
74
  /**
74
- * @dev See {IERC165-supportsInterface}.
75
+ * @inheritdoc LSP8IdentifiableDigitalAsset
75
76
  */
76
77
  function supportsInterface(
77
78
  bytes4 interfaceId
@@ -153,12 +154,11 @@ abstract contract LSP8CompatibleERC721 is
153
154
  * @inheritdoc ILSP8CompatibleERC721
154
155
  */
155
156
  function approve(address operator, uint256 tokenId) public virtual {
156
- authorizeOperator(operator, bytes32(tokenId));
157
- emit Approval(tokenOwnerOf(bytes32(tokenId)), operator, tokenId);
157
+ authorizeOperator(operator, bytes32(tokenId), "");
158
158
  }
159
159
 
160
160
  /**
161
- * @dev See _setApprovalForAll
161
+ * @dev See {_setApprovalForAll}
162
162
  */
163
163
  function setApprovalForAll(address operator, bool approved) public virtual {
164
164
  _setApprovalForAll(msg.sender, operator, approved);
@@ -166,8 +166,8 @@ abstract contract LSP8CompatibleERC721 is
166
166
 
167
167
  /**
168
168
  * @inheritdoc ILSP8CompatibleERC721
169
- * @dev Compatible with ERC721 transferFrom.
170
- * Using allowNonLSP1Recipient=true so that EOA and any contract may receive the tokenId.
169
+ *
170
+ * @custom:info This function sets the `allowNonLSP1Recipient` parameter to `true` so that EOAs and any contract can receive the `tokenId`.
171
171
  */
172
172
  function transferFrom(
173
173
  address from,
@@ -179,8 +179,8 @@ abstract contract LSP8CompatibleERC721 is
179
179
 
180
180
  /**
181
181
  * @inheritdoc ILSP8CompatibleERC721
182
- * @dev Compatible with ERC721 safeTransferFrom (without optional data).
183
- * Using allowNonLSP1Recipient=false so that no EOA and only contracts supporting LSP1 interface may receive the tokenId.
182
+ *
183
+ * @custom:info This function sets the `allowNonLSP1Recipient` parameter to `true` so that EOAs and any contract can receive the `tokenId`.
184
184
  */
185
185
  function safeTransferFrom(
186
186
  address from,
@@ -190,9 +190,10 @@ abstract contract LSP8CompatibleERC721 is
190
190
  _safeTransfer(from, to, tokenId, "");
191
191
  }
192
192
 
193
- /*
194
- * @dev Compatible with ERC721 safeTransferFrom (with optional data).
195
- * Using allowNonLSP1Recipient=false so that no EOA and only contracts supporting LSP1 interface may receive the tokenId.
193
+ /**
194
+ * @inheritdoc ILSP8CompatibleERC721
195
+ *
196
+ * @custom:info This function sets the `allowNonLSP1Recipient` parameter to `true` so that EOAs and any contract can receive the `tokenId`.
196
197
  */
197
198
  function safeTransferFrom(
198
199
  address from,
@@ -207,10 +208,15 @@ abstract contract LSP8CompatibleERC721 is
207
208
 
208
209
  /**
209
210
  * @inheritdoc ILSP8IdentifiableDigitalAsset
211
+ *
212
+ * @custom:events
213
+ * - LSP7 {AuthorizedOperator} event.
214
+ * - ERC721 {Approval} event.
210
215
  */
211
216
  function authorizeOperator(
212
217
  address operator,
213
- bytes32 tokenId
218
+ bytes32 tokenId,
219
+ bytes memory operatorNotificationData
214
220
  )
215
221
  public
216
222
  virtual
@@ -219,10 +225,49 @@ abstract contract LSP8CompatibleERC721 is
219
225
  LSP8IdentifiableDigitalAssetCore
220
226
  )
221
227
  {
222
- super.authorizeOperator(operator, tokenId);
228
+ address tokenOwner = tokenOwnerOf(tokenId);
229
+
230
+ if (
231
+ tokenOwner != msg.sender &&
232
+ !isApprovedForAll(tokenOwner, msg.sender)
233
+ ) {
234
+ revert LSP8NotTokenOwner(tokenOwner, tokenId, msg.sender);
235
+ }
236
+
237
+ if (operator == address(0)) {
238
+ revert LSP8CannotUseAddressZeroAsOperator();
239
+ }
240
+
241
+ if (tokenOwner == operator) {
242
+ revert LSP8TokenOwnerCannotBeOperator();
243
+ }
244
+
245
+ bool isAdded = _operators[tokenId].add(operator);
246
+ if (!isAdded) revert LSP8OperatorAlreadyAuthorized(operator, tokenId);
247
+
248
+ emit AuthorizedOperator(
249
+ operator,
250
+ tokenOwner,
251
+ tokenId,
252
+ operatorNotificationData
253
+ );
223
254
  emit Approval(tokenOwnerOf(tokenId), operator, uint256(tokenId));
255
+
256
+ bytes memory lsp1Data = abi.encode(
257
+ msg.sender,
258
+ tokenId,
259
+ operatorNotificationData
260
+ );
261
+ _notifyTokenOperator(operator, lsp1Data);
224
262
  }
225
263
 
264
+ /**
265
+ * @inheritdoc LSP8IdentifiableDigitalAssetCore
266
+ *
267
+ * @custom:events
268
+ * - LSP8 {Transfer} event.
269
+ * - ERC721 {Transfer} event.
270
+ */
226
271
  function _transfer(
227
272
  address from,
228
273
  address to,
@@ -230,19 +275,22 @@ abstract contract LSP8CompatibleERC721 is
230
275
  bool allowNonLSP1Recipient,
231
276
  bytes memory data
232
277
  ) internal virtual override {
233
- address operator = msg.sender;
234
-
235
278
  if (
236
- !isApprovedForAll(from, operator) &&
237
- !_isOperatorOrOwner(operator, tokenId)
279
+ !isApprovedForAll(from, msg.sender) &&
280
+ !_isOperatorOrOwner(msg.sender, tokenId)
238
281
  ) {
239
- revert LSP8NotTokenOperator(tokenId, operator);
282
+ revert LSP8NotTokenOperator(tokenId, msg.sender);
240
283
  }
241
284
 
242
285
  emit Transfer(from, to, uint256(tokenId));
243
286
  super._transfer(from, to, tokenId, allowNonLSP1Recipient, data);
244
287
  }
245
288
 
289
+ /**
290
+ * @dev Transfer the `tokenId` from `from` to `to` and check if the `to` recipient address is
291
+ * a contract that implements the `IERC721Received` interface and return the right magic value.
292
+ * See {_checkOnERC721Received} for more infos.
293
+ */
246
294
  function _safeTransfer(
247
295
  address from,
248
296
  address to,
@@ -256,6 +304,13 @@ abstract contract LSP8CompatibleERC721 is
256
304
  );
257
305
  }
258
306
 
307
+ /**
308
+ * @inheritdoc LSP8IdentifiableDigitalAssetCore
309
+ *
310
+ * @custom:events
311
+ * - LSP8 {Transfer} event with `address(0)` as `from`.
312
+ * - ERC721 {Transfer} event with `address(0)` as `from`.
313
+ */
259
314
  function _mint(
260
315
  address to,
261
316
  bytes32 tokenId,
@@ -266,6 +321,13 @@ abstract contract LSP8CompatibleERC721 is
266
321
  super._mint(to, tokenId, allowNonLSP1Recipient, data);
267
322
  }
268
323
 
324
+ /**
325
+ * @inheritdoc LSP8IdentifiableDigitalAssetCore
326
+ *
327
+ * @custom:events
328
+ * - LSP8 {Transfer} event with `address(0)` as the `to` address.
329
+ * - ERC721 {Transfer} event with `address(0)` as the `to` address.
330
+ */
269
331
  function _burn(
270
332
  bytes32 tokenId,
271
333
  bytes memory data
@@ -279,7 +341,7 @@ abstract contract LSP8CompatibleERC721 is
279
341
  /**
280
342
  * @dev Approve `operator` to operate on all tokens of `tokensOwner`
281
343
  *
282
- * Emits an {ApprovalForAll} event.
344
+ * @custom:events {ApprovalForAll} event.
283
345
  */
284
346
  function _setApprovalForAll(
285
347
  address tokensOwner,
@@ -295,14 +357,14 @@ abstract contract LSP8CompatibleERC721 is
295
357
  }
296
358
 
297
359
  /**
298
- * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
360
+ * @dev Internal function to invoke `IERC721Receiver.onERC721Received(...)` function on a target address.
299
361
  * The call is not executed if the target address is not a contract.
300
362
  *
301
- * @param from address representing the previous owner of the given token ID
302
- * @param to target address that will receive the token
303
- * @param tokenId uint256 ID of the token to be transferred
304
- * @param data bytes optional data to send along with the call
305
- * @return bool whether the call correctly returned the expected magic value
363
+ * @param from address representing the previous owner of the given `tokenId`.
364
+ * @param to target address that will receive the token.
365
+ * @param tokenId uint256 ID of the token to be transferred.
366
+ * @param data bytes optional data to send along with the call.
367
+ * @return bool whether the call correctly returned the expected magic value.
306
368
  */
307
369
  function _checkOnERC721Received(
308
370
  address from,
@@ -338,6 +400,9 @@ abstract contract LSP8CompatibleERC721 is
338
400
  }
339
401
  }
340
402
 
403
+ /**
404
+ * @inheritdoc LSP4DigitalAssetMetadata
405
+ */
341
406
  function _setData(
342
407
  bytes32 key,
343
408
  bytes memory value