@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
@@ -18,115 +18,177 @@ import {LSP5Utils} from "../../LSP5ReceivedAssets/LSP5Utils.sol";
18
18
 
19
19
  // constants
20
20
  import "../LSP1Constants.sol";
21
+ import {
22
+ _TYPEID_LSP7_TOKENSSENDER,
23
+ _TYPEID_LSP7_TOKENSRECIPIENT,
24
+ _INTERFACEID_LSP7
25
+ } from "../../LSP7DigitalAsset/LSP7Constants.sol";
26
+ import {
27
+ _TYPEID_LSP8_TOKENSSENDER,
28
+ _TYPEID_LSP8_TOKENSRECIPIENT,
29
+ _INTERFACEID_LSP8
30
+ } from "../../LSP8IdentifiableDigitalAsset/LSP8Constants.sol";
21
31
  import "../../LSP9Vault/LSP9Constants.sol";
22
32
 
23
33
  // errors
24
34
  import "../LSP1Errors.sol";
25
35
 
26
36
  /**
27
- * @title Core Implementation of contract writing the received LSP7 and LSP8 assets into your Vault using
28
- * the LSP5-ReceivedAsset standard and removing the sent assets.
29
- *
37
+ * @title Implementation of a UniversalReceiverDelegate for the [LSP9Vault]
30
38
  * @author Fabian Vogelsteller, Yamen Merhi, Jean Cavallera
31
- * @dev Delegate contract of the initial universal receiver
39
+ * @dev The {LSP1UniversalReceiverDelegateVault} follows the [LSP-1-UniversalReceiver] standard and is designed
40
+ * for [LSP9Vault] contracts.
41
+ *
42
+ * The {LSP1UniversalReceiverDelegateVault} is a contract called by the {universalReceiver(...)} function of the [LSP-9-Vault] contract that:
43
+ *
44
+ * - Writes the data keys representing assets received from type [LSP-7-DigitalAsset] and [LSP-8-IdentifiableDigitalAsset] into the account storage, and removes them when the balance is zero according to the [LSP-5-ReceivedAssets] Standard.
32
45
  */
33
46
  contract LSP1UniversalReceiverDelegateVault is ERC165, ILSP1UniversalReceiver {
34
47
  /**
35
48
  * @inheritdoc ILSP1UniversalReceiver
36
- * @dev allows to register arrayKeys and Map of incoming assets and remove after being sent
37
- * @return result The return value
49
+ * @dev Handles two cases:
50
+ *
51
+ * Writes the received [LSP-7-DigitalAsset] or [LSP-8-IdentifiableDigitalAsset] assets into the vault storage according to the [LSP-5-ReceivedAssets] standard.
52
+ *
53
+ * @notice Reacted on received notification with `typeId`.
54
+ *
55
+ * @custom:requirements Cannot accept native tokens.
56
+ * @custom:info
57
+ * - If some issues occured with generating the `dataKeys` or `dataValues` the `returnedMessage` will be an error message, otherwise it will be empty.
58
+ * - If an error occured when trying to use `setDataBatch(dataKeys,dataValues)`, it will return the raw error data back to the caller.
59
+ *
60
+ * @param typeId Unique identifier for a specific notification.
61
+ * @return The result of the reaction for `typeId`.
38
62
  */
39
63
  function universalReceiver(
40
64
  bytes32 typeId,
41
65
  bytes memory /* data */
42
- ) public payable virtual returns (bytes memory result) {
43
- if (msg.value != 0) revert NativeTokensNotAccepted();
44
- // This contract acts like a UniversalReceiverDelegate of a Vault where we append the
45
- // address and the value, sent to the universalReceiver function of the LSP9, to the msg.data
46
- // Check https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#universalreceiver
66
+ ) public payable virtual returns (bytes memory) {
67
+ // CHECK that we did not send any native tokens to the LSP1 Delegate, as it cannot transfer them back.
68
+ if (msg.value != 0) {
69
+ revert NativeTokensNotAccepted();
70
+ }
71
+
47
72
  address notifier = address(bytes20(msg.data[msg.data.length - 52:]));
48
73
 
49
- (
50
- bool invalid,
51
- bytes10 mapPrefix,
52
- bytes4 interfaceID,
53
- bool isReceiving
54
- ) = LSP1Utils.getTransferDetails(typeId);
74
+ // The notifier is supposed to be either the LSP7 or LSP8 contract
75
+ // If it's EOA we revert to avoid registering the EOA as asset (spam protection)
76
+ // solhint-disable avoid-tx-origin
77
+ if (notifier == tx.origin) {
78
+ revert CannotRegisterEOAsAsAssets(notifier);
79
+ }
80
+
81
+ if (typeId == _TYPEID_LSP7_TOKENSSENDER) {
82
+ return _tokenSender(notifier);
83
+ }
55
84
 
56
- if (invalid || interfaceID == _INTERFACEID_LSP9)
57
- return "LSP1: typeId out of scope";
85
+ if (typeId == _TYPEID_LSP7_TOKENSRECIPIENT) {
86
+ return _tokenRecipient(notifier, _INTERFACEID_LSP7);
87
+ }
58
88
 
59
- // solhint-disable avoid-tx-origin
60
- if (notifier == tx.origin) revert CannotRegisterEOAsAsAssets(notifier);
61
-
62
- bytes32 notifierMapKey = LSP2Utils.generateMappingKey(
63
- mapPrefix,
64
- bytes20(notifier)
65
- );
66
- bytes memory notifierMapValue = IERC725Y(msg.sender).getData(
67
- notifierMapKey
68
- );
69
-
70
- bytes32[] memory dataKeys;
71
- bytes[] memory dataValues;
72
-
73
- if (isReceiving) {
74
- // if the map value is already set, then do nothing
75
- if (bytes20(notifierMapValue) != bytes20(0))
76
- return "URD: asset received is already registered";
77
-
78
- // CHECK balance only when the Token contract is already deployed,
79
- // not when tokens are being transferred on deployment through the `constructor`
80
- if (notifier.code.length > 0) {
81
- // if the amount sent is 0, then do not update the keys
82
- uint256 balance = ILSP7DigitalAsset(notifier).balanceOf(
83
- msg.sender
84
- );
85
- if (balance == 0) return "LSP1: balance not updated";
89
+ if (typeId == _TYPEID_LSP8_TOKENSSENDER) {
90
+ return _tokenSender(notifier);
91
+ }
92
+
93
+ if (typeId == _TYPEID_LSP8_TOKENSRECIPIENT) {
94
+ return _tokenRecipient(notifier, _INTERFACEID_LSP8);
95
+ }
96
+
97
+ return "LSP1: typeId out of scope";
98
+ }
99
+
100
+ /**
101
+ * @dev Handler for LSP7 and LSP8 token sender type id.
102
+ *
103
+ * @custom:info
104
+ * - Tries to generate LSP5 data key/value pairs for removing asset from the ERC725Y storage.
105
+ * - Tries to use `setDataBatch(bytes32[],bytes[])` if generated proper LSP5 data key/value pairs.
106
+ * - Does not revert. But returns an error message. Use off-chain lib to get even more info.
107
+ *
108
+ * @param notifier The LSP7 or LSP8 token address.
109
+ */
110
+ function _tokenSender(address notifier) internal returns (bytes memory) {
111
+ // if the amount sent is not the full balance, then do not update the keys
112
+ try ILSP7DigitalAsset(notifier).balanceOf(msg.sender) returns (
113
+ uint256 balance
114
+ ) {
115
+ if (balance != 0) {
116
+ return "LSP1: full balance is not sent";
117
+ }
118
+ } catch {
119
+ return "LSP1: `balanceOf(address)` function not found";
120
+ }
121
+
122
+ (bytes32[] memory dataKeys, bytes[] memory dataValues) = LSP5Utils
123
+ .generateSentAssetKeys(msg.sender, notifier);
124
+
125
+ // `generateSentAssetKeys(...)` returns empty arrays when encountering errors
126
+ if (dataKeys.length == 0 && dataValues.length == 0) {
127
+ return "LSP5: Error generating data key/value pairs";
128
+ }
129
+
130
+ // Set the LSP5 generated data keys on the account
131
+ return _setDataBatchWithoutReverting(dataKeys, dataValues);
132
+ }
133
+
134
+ /**
135
+ * @dev Handler for LSP7 and LSP8 token recipient type id.
136
+ *
137
+ * @custom:info
138
+ * - Tries to generate LSP5 data key/value pairs for adding asset to the ERC725Y storage.
139
+ * - Tries to use `setDataBatch(bytes32[],bytes[])` if generated proper LSP5 data key/value pairs.
140
+ * - Does not revert. But returns an error message. Use off-chain lib to get even more info.
141
+ *
142
+ * @param notifier The LSP7 or LSP8 token address.
143
+ * @param interfaceId The LSP7 or LSP8 interface id.
144
+ */
145
+ function _tokenRecipient(
146
+ address notifier,
147
+ bytes4 interfaceId
148
+ ) internal returns (bytes memory) {
149
+ // CHECK balance only when the Token contract is already deployed,
150
+ // not when tokens are being transferred on deployment through the `constructor`
151
+ if (notifier.code.length > 0) {
152
+ // if the amount sent is 0, then do not update the keys
153
+ try ILSP7DigitalAsset(notifier).balanceOf(msg.sender) returns (
154
+ uint256 balance
155
+ ) {
156
+ if (balance == 0) {
157
+ return "LSP1: balance is zero";
158
+ }
159
+ } catch {
160
+ return "LSP1: `balanceOf(address)` function not found";
86
161
  }
162
+ }
163
+
164
+ (bytes32[] memory dataKeys, bytes[] memory dataValues) = LSP5Utils
165
+ .generateReceivedAssetKeys(msg.sender, notifier, interfaceId);
166
+
167
+ // `generateReceivedAssetKeys(...)` returns empty arrays when encountering errors
168
+ if (dataKeys.length == 0 && dataValues.length == 0) {
169
+ return "LSP5: Error generating data key/value pairs";
170
+ }
171
+
172
+ // Set the LSP5 generated data keys on the account
173
+ return _setDataBatchWithoutReverting(dataKeys, dataValues);
174
+ }
87
175
 
88
- (dataKeys, dataValues) = LSP5Utils.generateReceivedAssetKeys(
89
- msg.sender,
90
- notifier,
91
- notifierMapKey,
92
- interfaceID
93
- );
94
-
95
- IERC725Y(msg.sender).setDataBatch(dataKeys, dataValues);
96
- } else {
97
- // if there is no map value for the asset to remove, then do nothing
98
- if (bytes20(notifierMapValue) == bytes20(0))
99
- return "LSP1: asset sent is not registered";
100
-
101
- // if it's a token transfer (LSP7/LSP8)
102
- uint256 balance = ILSP7DigitalAsset(notifier).balanceOf(msg.sender);
103
- if (balance != 0) return "LSP1: full balance is not sent";
104
-
105
- // if the value under the `LSP5ReceivedAssetsMap:<asset-address>`
106
- // is not a valid tuple as `(bytes4,uint128)`
107
- if (notifierMapValue.length < 20)
108
- return "LSP1: asset data corrupted";
109
-
110
- // Identify where the asset is located in the `LSP5ReceivedAssets[]` Array
111
- // by extracting the index from the tuple value `(bytes4,uint128)`
112
- // fetched under the LSP5ReceivedAssetsMap/LSP10VaultsMap data key
113
- uint128 assetIndex = uint128(uint160(bytes20(notifierMapValue)));
114
-
115
- (dataKeys, dataValues) = LSP5Utils.generateSentAssetKeys(
116
- msg.sender,
117
- notifierMapKey,
118
- assetIndex
119
- );
120
-
121
- /**
122
- * `generateSentAssetKeys(...)` returns empty arrays in the following cases:
123
- * - the index returned from the data key `notifierMapKey` is bigger than
124
- * the length of the `LSP5ReceivedAssets[]`, meaning, index is out of bounds.
125
- */
126
- if (dataKeys.length == 0 && dataValues.length == 0)
127
- return "LSP1: asset data corrupted";
128
-
129
- IERC725Y(msg.sender).setDataBatch(dataKeys, dataValues);
176
+ /**
177
+ * @dev Calls `bytes4(keccak256(setDataBatch(bytes32[],bytes[])))` without checking for `bool succes`, but it returns all the data back.
178
+ *
179
+ * @custom:info If an the low-level transaction revert, the returned data will be forwarded. Th contract that uses this function can use the `Address` library to revert with the revert reason.
180
+ *
181
+ * @param dataKeys Data Keys to be set.
182
+ * @param dataValues Data Values to be set.
183
+ */
184
+ function _setDataBatchWithoutReverting(
185
+ bytes32[] memory dataKeys,
186
+ bytes[] memory dataValues
187
+ ) internal returns (bytes memory) {
188
+ try IERC725Y(msg.sender).setDataBatch(dataKeys, dataValues) {
189
+ return "";
190
+ } catch (bytes memory errorData) {
191
+ return errorData;
130
192
  }
131
193
  }
132
194
 
@@ -6,19 +6,34 @@ import {Address} from "@openzeppelin/contracts/utils/Address.sol";
6
6
  import {
7
7
  ERC165Checker
8
8
  } from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
9
+ import {LSP2Utils} from "../LSP2ERC725YJSONSchema/LSP2Utils.sol";
9
10
 
10
11
  // constants
11
12
  import "./ILSP1UniversalReceiver.sol";
12
- import {_INTERFACEID_LSP1} from "../LSP1UniversalReceiver/LSP1Constants.sol";
13
- import "../LSP0ERC725Account/LSP0Constants.sol";
14
- import "../LSP5ReceivedAssets/LSP5Constants.sol";
15
- import "../LSP7DigitalAsset/LSP7Constants.sol";
16
- import "../LSP8IdentifiableDigitalAsset/LSP8Constants.sol";
17
- import "../LSP9Vault/LSP9Constants.sol";
18
- import "../LSP14Ownable2Step/LSP14Constants.sol";
19
- import "../LSP10ReceivedVaults/LSP10Constants.sol";
20
13
 
14
+ // constants
15
+ import {
16
+ _INTERFACEID_LSP1,
17
+ _LSP1_UNIVERSAL_RECEIVER_DELEGATE_KEY,
18
+ _LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX
19
+ } from "../LSP1UniversalReceiver/LSP1Constants.sol";
20
+
21
+ /**
22
+ * @title LSP1 Utility library.
23
+ * @author Jean Cavallera <CJ42>, Yamen Merhi <YamenMerhi>, Daniel Afteni <B00ste>
24
+ * @dev LSP1Utils is a library of utility functions that can be used to notify the `universalReceiver` function of a contract
25
+ * that implements LSP1 and retrieve informations related to LSP1 `typeId`.
26
+ * Based on LSP1 Universal Receiver standard.
27
+ */
21
28
  library LSP1Utils {
29
+ /**
30
+ * @dev Notify a contract at `lsp1Implementation` address by calling its `universalReceiver` function if this contract
31
+ * supports the LSP1 interface.
32
+ *
33
+ * @param lsp1Implementation The address of the contract to notify.
34
+ * @param typeId A `bytes32` typeId.
35
+ * @param data Any optional data to send to the `universalReceiver` function to the `lsp1Implementation` address.
36
+ */
22
37
  function tryNotifyUniversalReceiver(
23
38
  address lsp1Implementation,
24
39
  bytes32 typeId,
@@ -37,6 +52,18 @@ library LSP1Utils {
37
52
  }
38
53
  }
39
54
 
55
+ /**
56
+ * @dev Call a LSP1UniversalReceiverDelegate contract at `universalReceiverDelegate` address and append `msgSender` and `msgValue`
57
+ * as additional informations in the calldata.
58
+ *
59
+ * @param universalReceiverDelegate The address of the LSP1UniversalReceiverDelegate to delegate the `universalReceiver` function to.
60
+ * @param typeId A `bytes32` typeId.
61
+ * @param receivedData The data sent initially to the `universalReceiver` function.
62
+ * @param msgSender The address that initially called the `universalReceiver` function.
63
+ * @param msgValue The amount of native token received initially by the `universalReceiver` function.
64
+ *
65
+ * @return The data returned by the LSP1UniversalReceiverDelegate contract.
66
+ */
40
67
  function callUniversalReceiverWithCallerInfos(
41
68
  address universalReceiverDelegate,
42
69
  bytes32 typeId,
@@ -66,47 +93,38 @@ library LSP1Utils {
66
93
  }
67
94
 
68
95
  /**
69
- * @dev Gets all the transfer details depending on the `typeId`
70
- * @param typeId A unique identifier for a specific action
96
+ * @notice Retrieving the value stored under the ERC725Y data key `LSP1UniversalReceiverDelegate`.
97
+ *
98
+ * @dev Query internally the ERC725Y storage of a `ERC725Y` smart contract to retrieve
99
+ * the value set under the `LSP1UniversalReceiverDelegate` data key.
100
+ *
101
+ * @param erc725YStorage A reference to the ERC725Y storage mapping of the contract.
102
+ * @return The bytes value stored under the `LSP1UniversalReceiverDelegate` data key.
71
103
  */
72
- function getTransferDetails(
104
+ function getLSP1DelegateValue(
105
+ mapping(bytes32 => bytes) storage erc725YStorage
106
+ ) internal view returns (bytes memory) {
107
+ return erc725YStorage[_LSP1_UNIVERSAL_RECEIVER_DELEGATE_KEY];
108
+ }
109
+
110
+ /**
111
+ * @notice Retrieving the value stored under the ERC725Y data key `LSP1UniversalReceiverDelegate:<type-id>` for a specific `typeId`.
112
+ *
113
+ * @dev Query internally the ERC725Y storage of a `ERC725Y` smart contract to retrieve
114
+ * the value set under the `LSP1UniversalReceiverDelegate:<bytes32>` data key for a specific LSP1 `typeId`.
115
+ *
116
+ * @param erc725YStorage A reference to the ERC725Y storage mapping of the contract.
117
+ * @param typeId A bytes32 LSP1 `typeId`;
118
+ * @return The bytes value stored under the `LSP1UniversalReceiverDelegate:<bytes32>` data key.
119
+ */
120
+ function getLSP1DelegateValueForTypeId(
121
+ mapping(bytes32 => bytes) storage erc725YStorage,
73
122
  bytes32 typeId
74
- )
75
- internal
76
- pure
77
- returns (
78
- bool invalid,
79
- bytes10 mapPrefix,
80
- bytes4 interfaceId,
81
- bool isReceiving
82
- )
83
- {
84
- if (
85
- typeId == _TYPEID_LSP7_TOKENSSENDER ||
86
- typeId == _TYPEID_LSP7_TOKENSRECIPIENT
87
- ) {
88
- mapPrefix = _LSP5_RECEIVED_ASSETS_MAP_KEY_PREFIX;
89
- interfaceId = _INTERFACEID_LSP7;
90
- isReceiving = typeId == _TYPEID_LSP7_TOKENSRECIPIENT ? true : false;
91
- } else if (
92
- typeId == _TYPEID_LSP8_TOKENSSENDER ||
93
- typeId == _TYPEID_LSP8_TOKENSRECIPIENT
94
- ) {
95
- mapPrefix = _LSP5_RECEIVED_ASSETS_MAP_KEY_PREFIX;
96
- interfaceId = _INTERFACEID_LSP8;
97
- isReceiving = typeId == _TYPEID_LSP8_TOKENSRECIPIENT ? true : false;
98
- } else if (
99
- typeId == _TYPEID_LSP9_OwnershipTransferred_SenderNotification ||
100
- typeId == _TYPEID_LSP9_OwnershipTransferred_RecipientNotification
101
- ) {
102
- mapPrefix = _LSP10_VAULTS_MAP_KEY_PREFIX;
103
- interfaceId = _INTERFACEID_LSP9;
104
- isReceiving = (typeId ==
105
- _TYPEID_LSP9_OwnershipTransferred_RecipientNotification)
106
- ? true
107
- : false;
108
- } else {
109
- invalid = true;
110
- }
123
+ ) internal view returns (bytes memory) {
124
+ bytes32 lsp1TypeIdDataKey = LSP2Utils.generateMappingKey(
125
+ _LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX,
126
+ bytes20(typeId)
127
+ );
128
+ return erc725YStorage[lsp1TypeIdDataKey];
111
129
  }
112
130
  }
@@ -39,7 +39,7 @@ abstract contract LSP20CallVerification {
39
39
  if (bytes3(magicValue) != bytes3(ILSP20.lsp20VerifyCall.selector))
40
40
  revert LSP20InvalidMagicValue(false, returnedData);
41
41
 
42
- return bytes1(magicValue[3]) == 0x01 ? true : false;
42
+ return magicValue[3] == 0x01 ? true : false;
43
43
  }
44
44
 
45
45
  /**
@@ -0,0 +1,192 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.4;
3
+
4
+ interface ILSP23LinkedContractsFactory {
5
+ /**
6
+ * @dev Emitted when a primary and secondary contract are deployed.
7
+ * @param primaryContract Address of the deployed primary contract.
8
+ * @param secondaryContract Address of the deployed secondary contract.
9
+ * @param primaryContractDeployment Parameters used for the primary contract deployment.
10
+ * @param secondaryContractDeployment Parameters used for the secondary contract deployment.
11
+ * @param postDeploymentModule Address of the post-deployment module.
12
+ * @param postDeploymentModuleCalldata Calldata passed to the post-deployment module.
13
+ */
14
+ event DeployedContracts(
15
+ address indexed primaryContract,
16
+ address indexed secondaryContract,
17
+ PrimaryContractDeployment primaryContractDeployment,
18
+ SecondaryContractDeployment secondaryContractDeployment,
19
+ address postDeploymentModule,
20
+ bytes postDeploymentModuleCalldata
21
+ );
22
+
23
+ /**
24
+ * @dev Emitted when proxies of a primary and secondary contract are deployed.
25
+ * @param primaryContract Address of the deployed primary contract proxy.
26
+ * @param secondaryContract Address of the deployed secondary contract proxy.
27
+ * @param primaryContractDeploymentInit Parameters used for the primary contract proxy deployment.
28
+ * @param secondaryContractDeploymentInit Parameters used for the secondary contract proxy deployment.
29
+ * @param postDeploymentModule Address of the post-deployment module.
30
+ * @param postDeploymentModuleCalldata Calldata passed to the post-deployment module.
31
+ */
32
+ event DeployedERC1167Proxies(
33
+ address indexed primaryContract,
34
+ address indexed secondaryContract,
35
+ PrimaryContractDeploymentInit primaryContractDeploymentInit,
36
+ SecondaryContractDeploymentInit secondaryContractDeploymentInit,
37
+ address postDeploymentModule,
38
+ bytes postDeploymentModuleCalldata
39
+ );
40
+
41
+ /**
42
+ * @param salt A unique value used to ensure each created proxies are unique (used for deterministic deployments).
43
+ * @param fundingAmount The value to be sent with the deployment transaction.
44
+ * @param creationBytecode The bytecode of the contract with the constructor params.
45
+ */
46
+ struct PrimaryContractDeployment {
47
+ bytes32 salt;
48
+ uint256 fundingAmount;
49
+ bytes creationBytecode;
50
+ }
51
+
52
+ /**
53
+ * @param fundingAmount The value to be sent with the deployment transaction.
54
+ * @param creationBytecode The bytecode for contract creation, up to but not including the primary contract address (if it needs to be appended).
55
+ * @param addPrimaryContractAddress If set to `true`, this will append the primary contract's address + the `extraConstructorParams` to the `creationBytecode`.
56
+ * @param extraConstructorParams Params to be appended to the `creationBytecode` (after the primary contract address) if `addPrimaryContractAddress` is set to `true`.
57
+ */
58
+ struct SecondaryContractDeployment {
59
+ uint256 fundingAmount;
60
+ bytes creationBytecode;
61
+ bool addPrimaryContractAddress;
62
+ bytes extraConstructorParams;
63
+ }
64
+
65
+ /**
66
+ * @param salt A unique value used to ensure each created proxies are unique. (Can be used to deploy the contract at a desired address.)
67
+ * @param fundingAmount The value to be sent with the deployment transaction.
68
+ * @param implementationContract The address of the contract that will be used as a base contract for the proxy.
69
+ * @param initializationCalldata The calldata used to initialize the contract.
70
+ */
71
+ struct PrimaryContractDeploymentInit {
72
+ bytes32 salt;
73
+ uint256 fundingAmount;
74
+ address implementationContract;
75
+ bytes initializationCalldata;
76
+ }
77
+
78
+ /**
79
+ * @param fundingAmount The value to be sent with the deployment transaction.
80
+ * @param implementationContract The address of the contract that will be used as a base contract for the proxy.
81
+ * @param initializationCalldata Initialization calldata up to, but not including, the primary contract address (if it needs to be appended).
82
+ * @param addPrimaryContractAddress If set to `true`, this will append the primary contract's address + the `extraInitializationParams` to the `initializationCalldata`.
83
+ * @param extraInitializationParams Params to be appended to the `initializationCalldata` (after the primary contract address) if `addPrimaryContractAddress` is set to `true`
84
+ */
85
+ struct SecondaryContractDeploymentInit {
86
+ uint256 fundingAmount;
87
+ address implementationContract;
88
+ bytes initializationCalldata;
89
+ bool addPrimaryContractAddress;
90
+ bytes extraInitializationParams;
91
+ }
92
+
93
+ /**
94
+ * @dev Deploys a primary and a secondary linked contract.
95
+ * @notice Contracts deployed. Contract Address: `primaryContractAddress`. Primary Contract Address: `primaryContractAddress`
96
+ *
97
+ * @param primaryContractDeployment Contains the needed parameter to deploy a contract. (`salt`, `fundingAmount`, `creationBytecode`)
98
+ * @param secondaryContractDeployment Contains the needed parameter to deploy the secondary contract. (`fundingAmount`, `creationBytecode`, `addPrimaryContractAddress`, `extraConstructorParams`)
99
+ * @param postDeploymentModule The optional module to be executed after deployment
100
+ * @param postDeploymentModuleCalldata The data to be passed to the post deployment module
101
+ *
102
+ * @return primaryContractAddress The address of the primary contract.
103
+ * @return secondaryContractAddress The address of the secondary contract.
104
+ */
105
+ function deployContracts(
106
+ PrimaryContractDeployment calldata primaryContractDeployment,
107
+ SecondaryContractDeployment calldata secondaryContractDeployment,
108
+ address postDeploymentModule,
109
+ bytes calldata postDeploymentModuleCalldata
110
+ )
111
+ external
112
+ payable
113
+ returns (
114
+ address primaryContractAddress,
115
+ address secondaryContractAddress
116
+ );
117
+
118
+ /**
119
+ * @dev Deploys ERC1167 proxies of a primary contract and a secondary linked contract
120
+ * @notice Contract proxies deployed. Primary Proxy Address: `primaryContractAddress`. Secondary Contract Proxy Address: `secondaryContractAddress`
121
+ *
122
+ * @param primaryContractDeploymentInit Contains the needed parameters to deploy a proxy contract. (`salt`, `fundingAmount`, `implementationContract`, `initializationCalldata`)
123
+ * @param secondaryContractDeploymentInit Contains the needed parameters to deploy the secondary proxy contract. (`fundingAmount`, `implementationContract`, `initializationCalldata`, `addPrimaryContractAddress`, `extraInitializationParams`)
124
+ * @param postDeploymentModule The optional module to be executed after deployment.
125
+ * @param postDeploymentModuleCalldata The data to be passed to the post deployment module.
126
+ *
127
+ * @return primaryContractAddress The address of the deployed primary contract proxy
128
+ * @return secondaryContractAddress The address of the deployed secondary contract proxy
129
+ */
130
+ function deployERC1167Proxies(
131
+ PrimaryContractDeploymentInit calldata primaryContractDeploymentInit,
132
+ SecondaryContractDeploymentInit
133
+ calldata secondaryContractDeploymentInit,
134
+ address postDeploymentModule,
135
+ bytes calldata postDeploymentModuleCalldata
136
+ )
137
+ external
138
+ payable
139
+ returns (
140
+ address primaryContractAddress,
141
+ address secondaryContractAddress
142
+ );
143
+
144
+ /**
145
+ * @dev Computes the addresses of a primary contract and a secondary linked contract
146
+ *
147
+ * @param primaryContractDeployment Contains the needed parameter to deploy the primary contract. (`salt`, `fundingAmount`, `creationBytecode`)
148
+ * @param secondaryContractDeployment Contains the needed parameter to deploy the secondary contract. (`fundingAmount`, `creationBytecode`, `addPrimaryContractAddress`, `extraConstructorParams`)
149
+ * @param postDeploymentModule The optional module to be executed after deployment
150
+ * @param postDeploymentModuleCalldata The data to be passed to the post deployment module
151
+ *
152
+ * @return primaryContractAddress The address of the deployed primary contract.
153
+ * @return secondaryContractAddress The address of the deployed secondary contract.
154
+ */
155
+ function computeAddresses(
156
+ PrimaryContractDeployment calldata primaryContractDeployment,
157
+ SecondaryContractDeployment calldata secondaryContractDeployment,
158
+ address postDeploymentModule,
159
+ bytes calldata postDeploymentModuleCalldata
160
+ )
161
+ external
162
+ view
163
+ returns (
164
+ address primaryContractAddress,
165
+ address secondaryContractAddress
166
+ );
167
+
168
+ /**
169
+ * @dev Computes the addresses of a primary and a secondary linked contracts ERC1167 proxies to be created
170
+ *
171
+ * @param primaryContractDeploymentInit Contains the needed parameters to deploy a primary proxy contract. (`salt`, `fundingAmount`, `implementationContract`, `initializationCalldata`)
172
+ * @param secondaryContractDeploymentInit Contains the needed parameters to deploy the secondary proxy contract. (`fundingAmount`, `implementationContract`, `initializationCalldata`, `addPrimaryContractAddress`, `extraInitializationParams`)
173
+ * @param postDeploymentModule The optional module to be executed after deployment.
174
+ * @param postDeploymentModuleCalldata The data to be passed to the post deployment module.
175
+ *
176
+ * @return primaryContractAddress The address of the deployed primary contract proxy
177
+ * @return secondaryContractAddress The address of the deployed secondary contract proxy
178
+ */
179
+ function computeERC1167Addresses(
180
+ PrimaryContractDeploymentInit calldata primaryContractDeploymentInit,
181
+ SecondaryContractDeploymentInit
182
+ calldata secondaryContractDeploymentInit,
183
+ address postDeploymentModule,
184
+ bytes calldata postDeploymentModuleCalldata
185
+ )
186
+ external
187
+ view
188
+ returns (
189
+ address primaryContractAddress,
190
+ address secondaryContractAddress
191
+ );
192
+ }
@@ -0,0 +1,18 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.4;
3
+
4
+ interface IPostDeploymentModule {
5
+ /**
6
+ * @dev Executes post-deployment logic for the primary and secondary contracts.
7
+ * @notice This function can be used to perform any additional setup or configuration after the primary and secondary contracts have been deployed.
8
+ *
9
+ * @param primaryContract The address of the deployed primary contract.
10
+ * @param secondaryContract The address of the deployed secondary contract.
11
+ * @param calldataToPostDeploymentModule Calldata to be passed for the post-deployment execution.
12
+ */
13
+ function executePostDeployment(
14
+ address primaryContract,
15
+ address secondaryContract,
16
+ bytes calldata calldataToPostDeploymentModule
17
+ ) external;
18
+ }
@@ -0,0 +1,24 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.4;
3
+
4
+ /**
5
+ * @dev Reverts when the `msg.value` sent is not equal to the sum of value used for the deployment of the contract & its owner contract.
6
+ * @notice Invalid value sent.
7
+ */
8
+ error InvalidValueSum();
9
+
10
+ /**
11
+ * @dev Reverts when the deployment & intialization of the contract has failed.
12
+ * @notice Failed to deploy & initialize the Primary Contract Proxy. Error: `errorData`.
13
+ *
14
+ * @param errorData Potentially information about why the deployment & intialization have failed.
15
+ */
16
+ error PrimaryContractProxyInitFailureError(bytes errorData);
17
+
18
+ /**
19
+ * @dev Reverts when the deployment & intialization of the secondary contract has failed.
20
+ * @notice Failed to deploy & initialize the Secondary Contract Proxy. Error: `errorData`.
21
+ *
22
+ * @param errorData Potentially information about why the deployment & intialization have failed.
23
+ */
24
+ error SecondaryContractProxyInitFailureError(bytes errorData);