@lukso/lsp-smart-contracts 0.8.2 → 0.10.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 (179) hide show
  1. package/README.md +29 -8
  2. package/artifacts/LSP0ERC725Account.json +90 -50
  3. package/artifacts/LSP0ERC725AccountInit.json +90 -50
  4. package/artifacts/LSP11BasicSocialRecovery.json +2 -2
  5. package/artifacts/LSP11BasicSocialRecoveryInit.json +2 -2
  6. package/artifacts/LSP16UniversalFactory.json +31 -2
  7. package/artifacts/LSP1UniversalReceiverDelegateUP.json +19 -35
  8. package/artifacts/LSP1UniversalReceiverDelegateVault.json +13 -13
  9. package/artifacts/LSP4Compatibility.json +39 -40
  10. package/artifacts/LSP4DigitalAssetMetadata.json +39 -40
  11. package/artifacts/LSP4DigitalAssetMetadataInitAbstract.json +39 -40
  12. package/artifacts/LSP6KeyManager.json +107 -8
  13. package/artifacts/LSP6KeyManagerInit.json +119 -20
  14. package/artifacts/LSP7CappedSupply.json +78 -38
  15. package/artifacts/LSP7CappedSupplyInitAbstract.json +78 -38
  16. package/artifacts/LSP7CompatibleERC20.json +78 -38
  17. package/artifacts/LSP7CompatibleERC20InitAbstract.json +78 -38
  18. package/artifacts/LSP7CompatibleERC20Mintable.json +80 -40
  19. package/artifacts/LSP7CompatibleERC20MintableInit.json +80 -40
  20. package/artifacts/LSP7DigitalAsset.json +78 -38
  21. package/artifacts/LSP7DigitalAssetInitAbstract.json +78 -38
  22. package/artifacts/LSP7Mintable.json +80 -40
  23. package/artifacts/LSP7MintableInit.json +80 -40
  24. package/artifacts/LSP8CappedSupply.json +39 -40
  25. package/artifacts/LSP8CappedSupplyInitAbstract.json +39 -40
  26. package/artifacts/LSP8CompatibleERC721.json +42 -43
  27. package/artifacts/LSP8CompatibleERC721InitAbstract.json +42 -43
  28. package/artifacts/LSP8CompatibleERC721Mintable.json +44 -45
  29. package/artifacts/LSP8CompatibleERC721MintableInit.json +44 -45
  30. package/artifacts/LSP8IdentifiableDigitalAsset.json +39 -40
  31. package/artifacts/LSP8IdentifiableDigitalAssetInitAbstract.json +39 -40
  32. package/artifacts/LSP8Mintable.json +41 -42
  33. package/artifacts/LSP8MintableInit.json +41 -42
  34. package/artifacts/LSP9Vault.json +73 -55
  35. package/artifacts/LSP9VaultInit.json +73 -55
  36. package/artifacts/UniversalProfile.json +90 -50
  37. package/artifacts/UniversalProfileInit.json +90 -50
  38. package/contracts/LSP0ERC725Account/ILSP0ERC725Account.sol +62 -0
  39. package/contracts/LSP0ERC725Account/LSP0Constants.sol +1 -1
  40. package/contracts/LSP0ERC725Account/LSP0ERC725Account.sol +36 -6
  41. package/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +605 -219
  42. package/contracts/LSP0ERC725Account/LSP0ERC725AccountInit.sol +31 -5
  43. package/contracts/LSP0ERC725Account/LSP0ERC725AccountInitAbstract.sol +37 -3
  44. package/contracts/LSP0ERC725Account/LSP0Utils.sol +0 -1
  45. package/contracts/LSP10ReceivedVaults/LSP10Utils.sol +71 -60
  46. package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecoveryCore.sol +5 -7
  47. package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecoveryInit.sol +0 -1
  48. package/contracts/LSP14Ownable2Step/ILSP14Ownable2Step.sol +27 -4
  49. package/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol +41 -84
  50. package/contracts/LSP16UniversalFactory/LSP16UniversalFactory.sol +8 -8
  51. package/contracts/LSP17ContractExtension/LSP17Extendable.sol +10 -5
  52. package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiver.sol +0 -4
  53. package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol +129 -77
  54. package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol +45 -16
  55. package/contracts/LSP1UniversalReceiver/LSP1Utils.sol +12 -0
  56. package/contracts/LSP20CallVerification/ILSP20CallVerification.sol +30 -0
  57. package/contracts/LSP20CallVerification/LSP20CallVerification.sol +83 -0
  58. package/contracts/LSP20CallVerification/LSP20Constants.sol +17 -0
  59. package/contracts/LSP20CallVerification/LSP20Errors.sol +15 -0
  60. package/contracts/LSP2ERC725YJSONSchema/LSP2Utils.sol +26 -12
  61. package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol +0 -1
  62. package/contracts/LSP5ReceivedAssets/LSP5Utils.sol +76 -66
  63. package/contracts/LSP6KeyManager/ILSP6KeyManager.sol +12 -3
  64. package/contracts/LSP6KeyManager/LSP6Constants.sol +9 -3
  65. package/contracts/LSP6KeyManager/LSP6Errors.sol +22 -1
  66. package/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol +172 -29
  67. package/contracts/LSP6KeyManager/LSP6KeyManagerInitAbstract.sol +0 -1
  68. package/contracts/LSP6KeyManager/LSP6Modules/LSP6ExecuteModule.sol +270 -100
  69. package/contracts/LSP6KeyManager/LSP6Modules/LSP6SetDataModule.sol +187 -67
  70. package/contracts/LSP6KeyManager/LSP6Utils.sol +31 -20
  71. package/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +79 -30
  72. package/contracts/LSP7DigitalAsset/LSP7Errors.sol +5 -0
  73. package/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol +2 -2
  74. package/contracts/LSP7DigitalAsset/extensions/LSP7BurnableInitAbstract.sol +24 -0
  75. package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol +1 -2
  76. package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyInitAbstract.sol +1 -2
  77. package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol +3 -5
  78. package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20InitAbstract.sol +3 -5
  79. package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +27 -29
  80. package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CompatibleERC721.sol +1 -1
  81. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol +1 -2
  82. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInitAbstract.sol +1 -2
  83. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol +5 -5
  84. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol +6 -6
  85. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol +2 -2
  86. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableInitAbstract.sol +2 -2
  87. package/contracts/LSP9Vault/ILSP9Vault.sol +27 -0
  88. package/contracts/LSP9Vault/LSP9Constants.sol +1 -1
  89. package/contracts/LSP9Vault/LSP9Vault.sol +11 -8
  90. package/contracts/LSP9Vault/LSP9VaultCore.sol +96 -71
  91. package/contracts/LSP9Vault/LSP9VaultInit.sol +2 -1
  92. package/contracts/LSP9Vault/LSP9VaultInitAbstract.sol +19 -7
  93. package/contracts/UniversalProfileInitAbstract.sol +5 -0
  94. package/devdocs/Create2Factory.json +16 -0
  95. package/devdocs/LSP0ERC725Account.json +200 -0
  96. package/devdocs/LSP0ERC725AccountInit.json +203 -0
  97. package/devdocs/LSP11BasicSocialRecovery.json +146 -0
  98. package/devdocs/LSP11BasicSocialRecoveryInit.json +146 -0
  99. package/devdocs/LSP16UniversalFactory.json +51 -0
  100. package/devdocs/LSP1UniversalReceiverDelegateUP.json +80 -0
  101. package/devdocs/LSP1UniversalReceiverDelegateVault.json +62 -0
  102. package/devdocs/LSP4Compatibility.json +79 -0
  103. package/devdocs/LSP4DigitalAssetMetadata.json +84 -0
  104. package/devdocs/LSP4DigitalAssetMetadataInitAbstract.json +77 -0
  105. package/devdocs/LSP6KeyManager.json +257 -0
  106. package/devdocs/LSP6KeyManagerInit.json +260 -0
  107. package/devdocs/LSP7CappedSupply.json +211 -0
  108. package/devdocs/LSP7CappedSupplyInitAbstract.json +206 -0
  109. package/devdocs/LSP7CompatibleERC20.json +225 -0
  110. package/devdocs/LSP7CompatibleERC20InitAbstract.json +218 -0
  111. package/devdocs/LSP7CompatibleERC20Mintable.json +217 -0
  112. package/devdocs/LSP7CompatibleERC20MintableInit.json +227 -0
  113. package/devdocs/LSP7DigitalAsset.json +210 -0
  114. package/devdocs/LSP7DigitalAssetInitAbstract.json +202 -0
  115. package/devdocs/LSP7Mintable.json +219 -0
  116. package/devdocs/LSP7MintableInit.json +220 -0
  117. package/devdocs/LSP8CappedSupply.json +232 -0
  118. package/devdocs/LSP8CappedSupplyInitAbstract.json +227 -0
  119. package/devdocs/LSP8CompatibleERC721.json +298 -0
  120. package/devdocs/LSP8CompatibleERC721InitAbstract.json +291 -0
  121. package/devdocs/LSP8CompatibleERC721Mintable.json +290 -0
  122. package/devdocs/LSP8CompatibleERC721MintableInit.json +300 -0
  123. package/devdocs/LSP8IdentifiableDigitalAsset.json +230 -0
  124. package/devdocs/LSP8IdentifiableDigitalAssetInitAbstract.json +223 -0
  125. package/devdocs/LSP8Mintable.json +242 -0
  126. package/devdocs/LSP8MintableInit.json +245 -0
  127. package/devdocs/LSP9Vault.json +171 -0
  128. package/devdocs/LSP9VaultInit.json +175 -0
  129. package/devdocs/UniversalProfile.json +199 -0
  130. package/devdocs/UniversalProfileInit.json +202 -0
  131. package/devdocs/UniversalReceiverAddressStore.json +9 -0
  132. package/dist/constants.cjs.js +31569 -0
  133. package/dist/constants.d.ts +31681 -0
  134. package/dist/constants.es.js +31550 -0
  135. package/package.json +70 -52
  136. package/userdocs/Create2Factory.json +5 -0
  137. package/userdocs/LSP0ERC725Account.json +47 -0
  138. package/userdocs/LSP0ERC725AccountInit.json +47 -0
  139. package/userdocs/LSP11BasicSocialRecovery.json +29 -0
  140. package/userdocs/LSP11BasicSocialRecoveryInit.json +29 -0
  141. package/userdocs/LSP16UniversalFactory.json +5 -0
  142. package/userdocs/LSP1UniversalReceiverDelegateUP.json +10 -0
  143. package/userdocs/LSP1UniversalReceiverDelegateVault.json +10 -0
  144. package/userdocs/LSP4Compatibility.json +20 -0
  145. package/userdocs/LSP4DigitalAssetMetadata.json +23 -0
  146. package/userdocs/LSP4DigitalAssetMetadataInitAbstract.json +20 -0
  147. package/userdocs/LSP6KeyManager.json +18 -0
  148. package/userdocs/LSP6KeyManagerInit.json +18 -0
  149. package/userdocs/LSP7CappedSupply.json +29 -0
  150. package/userdocs/LSP7CappedSupplyInitAbstract.json +26 -0
  151. package/userdocs/LSP7CompatibleERC20.json +35 -0
  152. package/userdocs/LSP7CompatibleERC20InitAbstract.json +32 -0
  153. package/userdocs/LSP7CompatibleERC20Mintable.json +32 -0
  154. package/userdocs/LSP7CompatibleERC20MintableInit.json +35 -0
  155. package/userdocs/LSP7DigitalAsset.json +29 -0
  156. package/userdocs/LSP7DigitalAssetInitAbstract.json +26 -0
  157. package/userdocs/LSP7Mintable.json +29 -0
  158. package/userdocs/LSP7MintableInit.json +29 -0
  159. package/userdocs/LSP8CappedSupply.json +23 -0
  160. package/userdocs/LSP8CappedSupplyInitAbstract.json +20 -0
  161. package/userdocs/LSP8CompatibleERC721.json +29 -0
  162. package/userdocs/LSP8CompatibleERC721InitAbstract.json +26 -0
  163. package/userdocs/LSP8CompatibleERC721Mintable.json +26 -0
  164. package/userdocs/LSP8CompatibleERC721MintableInit.json +29 -0
  165. package/userdocs/LSP8IdentifiableDigitalAsset.json +23 -0
  166. package/userdocs/LSP8IdentifiableDigitalAssetInitAbstract.json +20 -0
  167. package/userdocs/LSP8Mintable.json +23 -0
  168. package/userdocs/LSP8MintableInit.json +23 -0
  169. package/userdocs/LSP9Vault.json +38 -0
  170. package/userdocs/LSP9VaultInit.json +38 -0
  171. package/userdocs/UniversalProfile.json +50 -0
  172. package/userdocs/UniversalProfileInit.json +50 -0
  173. package/userdocs/UniversalReceiverAddressStore.json +5 -0
  174. package/CONTRIBUTING.md +0 -57
  175. package/common/constants.d.ts +0 -738
  176. package/common/constants.js +0 -785
  177. package/contracts/Utils/GasLib.sol +0 -17
  178. package/module/constants.d.ts +0 -738
  179. package/module/constants.js +0 -782
@@ -64,7 +64,7 @@ contract LSP16UniversalFactory {
64
64
  bool initializable,
65
65
  bytes calldata initializeCallData
66
66
  ) public view virtual returns (address) {
67
- bytes32 generatedSalt = _generateSalt(initializable, initializeCallData, providedSalt);
67
+ bytes32 generatedSalt = generateSalt(initializable, initializeCallData, providedSalt);
68
68
  return Create2.computeAddress(generatedSalt, byteCodeHash);
69
69
  }
70
70
 
@@ -78,7 +78,7 @@ contract LSP16UniversalFactory {
78
78
  bool initializable,
79
79
  bytes calldata initializeCallData
80
80
  ) public view virtual returns (address) {
81
- bytes32 generatedSalt = _generateSalt(initializable, initializeCallData, providedSalt);
81
+ bytes32 generatedSalt = generateSalt(initializable, initializeCallData, providedSalt);
82
82
  return Clones.predictDeterministicAddress(baseContract, generatedSalt);
83
83
  }
84
84
 
@@ -99,7 +99,7 @@ contract LSP16UniversalFactory {
99
99
  virtual
100
100
  returns (address)
101
101
  {
102
- bytes32 generatedSalt = _generateSalt(false, _EMPTY_BYTE, providedSalt);
102
+ bytes32 generatedSalt = generateSalt(false, _EMPTY_BYTE, providedSalt);
103
103
  address contractCreated = Create2.deploy(msg.value, generatedSalt, byteCode);
104
104
  emit ContractCreated(contractCreated, providedSalt, false, _EMPTY_BYTE);
105
105
 
@@ -132,7 +132,7 @@ contract LSP16UniversalFactory {
132
132
  if (constructorMsgValue + initializeCalldataMsgValue != msg.value)
133
133
  revert InvalidMsgValueDistribution();
134
134
 
135
- bytes32 generatedSalt = _generateSalt(true, initializeCalldata, providedSalt);
135
+ bytes32 generatedSalt = generateSalt(true, initializeCalldata, providedSalt);
136
136
  address contractCreated = Create2.deploy(constructorMsgValue, generatedSalt, byteCode);
137
137
  emit ContractCreated(contractCreated, providedSalt, true, initializeCalldata);
138
138
 
@@ -163,7 +163,7 @@ contract LSP16UniversalFactory {
163
163
  virtual
164
164
  returns (address)
165
165
  {
166
- bytes32 generatedSalt = _generateSalt(false, _EMPTY_BYTE, providedSalt);
166
+ bytes32 generatedSalt = generateSalt(false, _EMPTY_BYTE, providedSalt);
167
167
 
168
168
  address proxy = Clones.cloneDeterministic(baseContract, generatedSalt);
169
169
  emit ContractCreated(proxy, providedSalt, false, _EMPTY_BYTE);
@@ -190,7 +190,7 @@ contract LSP16UniversalFactory {
190
190
  bytes32 providedSalt,
191
191
  bytes calldata initializeCalldata
192
192
  ) public payable virtual returns (address) {
193
- bytes32 generatedSalt = _generateSalt(true, initializeCalldata, providedSalt);
193
+ bytes32 generatedSalt = generateSalt(true, initializeCalldata, providedSalt);
194
194
 
195
195
  address proxy = Clones.cloneDeterministic(baseContract, generatedSalt);
196
196
  emit ContractCreated(proxy, providedSalt, true, initializeCalldata);
@@ -211,11 +211,11 @@ contract LSP16UniversalFactory {
211
211
  * to deploy the same bytecode + the same salt to get the same address of the contract on
212
212
  * another chain without applying the effect of initializing.
213
213
  */
214
- function _generateSalt(
214
+ function generateSalt(
215
215
  bool initializable,
216
216
  bytes memory initializeCallData,
217
217
  bytes32 providedSalt
218
- ) internal pure virtual returns (bytes32) {
218
+ ) public pure virtual returns (bytes32) {
219
219
  if (initializable) {
220
220
  return keccak256(abi.encodePacked(initializable, initializeCallData, providedSalt));
221
221
  } else {
@@ -54,13 +54,18 @@ abstract contract LSP17Extendable is ERC165 {
54
54
  function _getExtension(bytes4 functionSelector) internal view virtual returns (address);
55
55
 
56
56
  /**
57
- * @dev Forwards the call to an extension mapped to a function selector. If no extension address
58
- * is mapped to the function selector (address(0)), then revert.
57
+ * @dev Forwards the call to an extension mapped to a function selector.
59
58
  *
60
- * The call to the extension is appended with bytes20 (msg.sender) and bytes32 (msg.value).
61
- * Returns the return value on success and revert in case of failure.
59
+ * Calls {_getExtension} to get the address of the extension mapped to the function selector being
60
+ * called on the account. If there is no extension, the address(0) will be returned.
62
61
  *
63
- * As the function uses assembly {return()/revert()} to terminate the call, it cannot be
62
+ * Reverts if there is no extension for the function being called.
63
+ *
64
+ * If there is an extension for the function selector being called, it calls the extension with the
65
+ * CALL opcode, passing the {msg.data} appended with the 20 bytes of the {msg.sender} and
66
+ * 32 bytes of the {msg.value}
67
+ *
68
+ * Because the function uses assembly {return()/revert()} to terminate the call, it cannot be
64
69
  * called before other codes in fallback().
65
70
  *
66
71
  * Otherwise, the codes after _fallbackLSP17Extendable() may never be reached.
@@ -27,10 +27,6 @@ interface ILSP1UniversalReceiver {
27
27
  * @param data The arbitrary data received with the call
28
28
  * @dev Emits an event when it's succesfully executed
29
29
  *
30
- * Call the universalReceiverDelegate function in the UniversalReceiverDelegate (URD) contract, if the address of the URD
31
- * was set as a value for the `_UniversalReceiverKey` in the account key/value value store of the same contract implementing
32
- * the universalReceiver function and if the URD contract has the LSP1UniversalReceiverDelegate Interface Id registred using ERC165
33
- *
34
30
  * Emits a {UniversalReceiver} event
35
31
  */
36
32
  function universalReceiver(bytes32 typeId, bytes calldata data)
@@ -4,18 +4,15 @@ pragma solidity ^0.8.4;
4
4
  // interfaces
5
5
  import {IERC725Y} from "@erc725/smart-contracts/contracts/interfaces/IERC725Y.sol";
6
6
  import {ILSP1UniversalReceiver} from "../ILSP1UniversalReceiver.sol";
7
- import {ILSP6KeyManager} from "../../LSP6KeyManager/ILSP6KeyManager.sol";
8
7
  import {ILSP7DigitalAsset} from "../../LSP7DigitalAsset/ILSP7DigitalAsset.sol";
9
8
 
10
9
  // modules
11
10
  import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
12
- import {ERC725Y} from "@erc725/smart-contracts/contracts/ERC725Y.sol";
13
11
 
14
12
  // libraries
15
13
  import {ERC165Checker} from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
16
14
  import {LSP1Utils} from "../LSP1Utils.sol";
17
15
  import {LSP2Utils} from "../../LSP2ERC725YJSONSchema/LSP2Utils.sol";
18
- import {LSP6Utils} from "../../LSP6KeyManager/LSP6Utils.sol";
19
16
  import {LSP5Utils} from "../../LSP5ReceivedAssets/LSP5Utils.sol";
20
17
  import {LSP10Utils} from "../../LSP10ReceivedVaults/LSP10Utils.sol";
21
18
 
@@ -31,22 +28,48 @@ import "../../LSP14Ownable2Step/LSP14Constants.sol";
31
28
  import "../LSP1Errors.sol";
32
29
 
33
30
  /**
34
- * @title Core Implementation of contract writing the received Vaults and LSP7, LSP8 assets into your ERC725Account using
35
- * the LSP5-ReceivedAsset and LSP10-ReceivedVaults standard and removing the sent vaults and assets.
36
- *
31
+ * @title Implementation of a UniversalReceiverDelegate for LSP0ERC725Account
37
32
  * @author Fabian Vogelsteller, Yamen Merhi, Jean Cavallera
38
- * @dev Delegate contract of the initial universal receiver
33
+ * @dev This UniversalReceiverDelegate follows the {LSP1-UniversalReceiver} standards and is designed
34
+ * for LSP0ERC725Account contracts.
35
+ *
36
+ * @dev Handles two cases:
37
+ * - Registers the address of received assets (exclusively LSP7 and LSP8) and vaults (exclusively LSP9) according
38
+ * to {LSP5-ReceivedAssets} and {LSP10-ReceivedVaults} respectively
39
+ *
40
+ * https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-5-ReceivedAssets.md
41
+ * https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-10-ReceivedVaults.md
42
+ *
43
+ * - Removes the address of registered assets and vaults when the full balance is sent from the LSP0ERC725Account contract
39
44
  *
40
- * Owner of the UniversalProfile MUST be a KeyManager that allows (this) address to setData on the UniversalProfile
45
+ * Requirements:
46
+ * - The contract should be able to setData the LSP5 and LSP10 data Keys according to the logic of the owner
47
+ * of the LSP0ERC725Account.
41
48
  *
49
+ * For example, for contracts that are owned by an LSP6KeyManager, this contract should be granted
50
+ * the SUPER/SETDATA and REENTRANCY Permission.
51
+ *
52
+ * Assets and Vaults that are compliant with this version of the UniversalReceiverDelegate are:
53
+ *
54
+ * - LSP7-DigitalAsset: https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md
55
+ * - LSP8-IdentifiableDigitalAsset: https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md
56
+ * - LSP9-Vault: https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md
42
57
  */
43
58
  contract LSP1UniversalReceiverDelegateUP is ERC165, ILSP1UniversalReceiver {
44
59
  using ERC165Checker for address;
45
60
 
46
61
  /**
47
- * @inheritdoc ILSP1UniversalReceiver
48
- * @dev Allows to register arrayKeys and Map of incoming vaults and assets and removing them after being sent
49
- * @return result the return value of keyManager's execute function
62
+ * @dev Handles two cases:
63
+ * - Registers the address of received assets (exclusively LSP7 and LSP8) and vaults (exclusively LSP9) according
64
+ * to {LSP5-ReceivedAssets} and {LSP10-ReceivedVaults} respectively
65
+ *
66
+ * - Removes the address of registered assets and vaults when the full balance is sent from the LSP0ERC725Account contract
67
+ *
68
+ * Requirements:
69
+ * - The contract should be able to setData the LSP5 and LSP10 data Keys according to the logic of the owner
70
+ * of the LSP0ERC725Account.
71
+ *
72
+ * - Cannot accept native tokens
50
73
  */
51
74
  function universalReceiver(
52
75
  bytes32 typeId,
@@ -54,45 +77,52 @@ contract LSP1UniversalReceiverDelegateUP is ERC165, ILSP1UniversalReceiver {
54
77
  ) public payable virtual returns (bytes memory result) {
55
78
  if (msg.value != 0) revert NativeTokensNotAccepted();
56
79
 
57
- // This contract acts like a UniversalReceiverDelegate of a UP where we append the
80
+ // This contract acts like a UniversalReceiverDelegate of an LSP0ERC725Account where we append the
58
81
  // address and the value, sent to the universalReceiver function of the LSP0, to the msg.data
59
82
  // Check https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#universalreceiver
60
83
  address notifier = address(bytes20(msg.data[msg.data.length - 52:]));
61
84
 
85
+ // Get the supposed mapPrefix and interfaceId based on the typeID
62
86
  (bool invalid, bytes10 mapPrefix, bytes4 interfaceID, bool isReceiving) = LSP1Utils
63
87
  .getTransferDetails(typeId);
64
88
 
89
+ // If it's a typeId different than LSP7/LSP8/LSP9 typeIds
65
90
  if (invalid) return "LSP1: typeId out of scope";
66
91
 
92
+ // The notifier is supposed to be either the LSP7 or LSP8 or LSP9 contract
93
+ // If it's EOA we revert to avoid registering the EOA as asset or vault (spam protection)
67
94
  // solhint-disable avoid-tx-origin
68
95
  if (notifier == tx.origin) revert CannotRegisterEOAsAsAssets(notifier);
69
96
 
70
- (address keyManager, bool ownerIsKeyManager) = _validateCallerViaKeyManager();
71
- if (!ownerIsKeyManager) return "LSP1: account owner is not a LSP6KeyManager";
72
-
73
- // if the contract being transferred doesn't support LSP9, do not register it as a received vault
74
- if (mapPrefix == _LSP10_VAULTS_MAP_KEY_PREFIX) {
75
- if (notifier.code.length > 0) {
76
- if (!notifier.supportsERC165InterfaceUnchecked(_INTERFACEID_LSP9))
77
- return "LSP1: not an LSP9Vault ownership transfer";
78
- }
79
- }
80
-
97
+ // Generate the LSP5ReceivedAssetsMap/LSP10VaultsMap based on the prefix and the notifier
81
98
  bytes32 notifierMapKey = LSP2Utils.generateMappingKey(mapPrefix, bytes20(notifier));
99
+
100
+ // Query the ERC725Y storage of the LSP0-ERC725Account
82
101
  bytes memory notifierMapValue = IERC725Y(msg.sender).getData(notifierMapKey);
83
102
 
103
+ bool isMapValueSet = bytes20(notifierMapValue) != bytes20(0);
104
+
84
105
  if (isReceiving) {
85
- // if the map value is already set, then do nothing
86
- if (bytes12(notifierMapValue) != bytes12(0))
87
- return "LSP1: asset received is already registered";
106
+ // If the mapValue is set, we assume that all other data keys relevant to the asset/vault
107
+ // are registered in the account, we don't need to re register the asset being received
108
+ if (isMapValueSet) return "LSP1: asset received is already registered";
88
109
 
89
- result = _whenReceiving(typeId, notifier, keyManager, notifierMapKey, interfaceID);
110
+ return _whenReceiving(typeId, notifier, notifierMapKey, interfaceID);
90
111
  } else {
91
- // if there is no map value for the asset/vault to remove, then do nothing
92
- if (bytes12(notifierMapValue) == bytes12(0))
93
- return "LSP1: asset sent is not registered";
112
+ // If the mapValue is not set, we assume that all other data keys relevant to the asset/vault
113
+ // are not registered in the account, we cannot remove non-existing data keys for the asset being sent
114
+ if (!isMapValueSet) return "LSP1: asset sent is not registered";
115
+
116
+ // if the value under the `LSP5ReceivedAssetsMap:<asset-address>` or `LSP10VaultsMap:<vault-address>`
117
+ // is not a valid tuple as `(bytes4,uint128)`
118
+ if (notifierMapValue.length < 20) return "LSP1: asset data corrupted";
94
119
 
95
- result = _whenSending(typeId, notifier, keyManager, notifierMapKey, notifierMapValue);
120
+ // Identify where the asset/vault is located in the `LSP5ReceivedAssets[]` / `LSP10Vaults[]` Array
121
+ // by extracting the index from the tuple value `(bytes4,uint128)`
122
+ // fetched under the `LSP5ReceivedAssetsMap` / `LSP10VaultsMap` data key
123
+ uint128 arrayIndex = uint128(uint160(bytes20(notifierMapValue)));
124
+
125
+ return _whenSending(typeId, notifier, notifierMapKey, arrayIndex);
96
126
  }
97
127
  }
98
128
 
@@ -101,81 +131,103 @@ contract LSP1UniversalReceiverDelegateUP is ERC165, ILSP1UniversalReceiver {
101
131
  /**
102
132
  * @dev To avoid stack too deep error
103
133
  * Generate the keys/values of the asset/vault received to set and set them
104
- * on the Key Manager depending on the type of the transfer (asset/vault)
134
+ * on the account depending on the type of the transfer (asset/vault)
105
135
  */
106
136
  function _whenReceiving(
107
137
  bytes32 typeId,
108
138
  address notifier,
109
- address keyManager,
110
139
  bytes32 notifierMapKey,
111
140
  bytes4 interfaceID
112
- ) internal virtual returns (bytes memory result) {
141
+ ) internal virtual returns (bytes memory) {
142
+ bytes32[] memory dataKeys;
143
+ bytes[] memory dataValues;
144
+
113
145
  // if it's a token transfer (LSP7/LSP8)
114
146
  if (typeId != _TYPEID_LSP9_OwnershipTransferred_RecipientNotification) {
115
- // if the amount sent is 0, then do not update the keys
116
- uint256 balance = ILSP7DigitalAsset(notifier).balanceOf(msg.sender);
117
- if (balance == 0) return "LSP1: balance not updated";
147
+ // CHECK balance only when the Token contract is already deployed,
148
+ // not when tokens are being transferred on deployment through the `constructor`
149
+ if (notifier.code.length > 0) {
150
+ // if the amount sent is 0, then do not update the keys
151
+ uint256 balance = ILSP7DigitalAsset(notifier).balanceOf(msg.sender);
152
+ if (balance == 0) return "LSP1: balance not updated";
153
+ }
118
154
 
119
- (bytes32[] memory dataKeys, bytes[] memory dataValues) = LSP5Utils
120
- .generateReceivedAssetKeys(msg.sender, notifier, notifierMapKey, interfaceID);
155
+ (dataKeys, dataValues) = LSP5Utils.generateReceivedAssetKeys(
156
+ msg.sender,
157
+ notifier,
158
+ notifierMapKey,
159
+ interfaceID
160
+ );
121
161
 
122
- result = LSP6Utils.setDataViaKeyManager(keyManager, dataKeys, dataValues);
162
+ // Set the LSP5 generated data keys on the account
163
+ IERC725Y(msg.sender).setDataBatch(dataKeys, dataValues);
164
+ return "";
123
165
  } else {
124
- (bytes32[] memory dataKeys, bytes[] memory dataValues) = LSP10Utils
125
- .generateReceivedVaultKeys(msg.sender, notifier, notifierMapKey);
126
-
127
- result = LSP6Utils.setDataViaKeyManager(keyManager, dataKeys, dataValues);
166
+ (dataKeys, dataValues) = LSP10Utils.generateReceivedVaultKeys(
167
+ msg.sender,
168
+ notifier,
169
+ notifierMapKey
170
+ );
171
+
172
+ // Set the LSP10 generated data keys on the account
173
+ IERC725Y(msg.sender).setDataBatch(dataKeys, dataValues);
174
+ return "";
128
175
  }
129
176
  }
130
177
 
131
178
  /**
132
179
  * @dev To avoid stack too deep error
133
180
  * Generate the keys/values of the asset/vault sent to set and set them
134
- * on the Key Manager depending on the type of the transfer (asset/vault)
181
+ * on the account depending on the type of the transfer (asset/vault)
135
182
  */
136
183
  function _whenSending(
137
184
  bytes32 typeId,
138
185
  address notifier,
139
- address keyManager,
140
186
  bytes32 notifierMapKey,
141
- bytes memory notifierMapValue
142
- ) internal virtual returns (bytes memory result) {
187
+ uint128 arrayIndex
188
+ ) internal virtual returns (bytes memory) {
189
+ bytes32[] memory dataKeys;
190
+ bytes[] memory dataValues;
191
+
143
192
  // if it's a token transfer (LSP7/LSP8)
144
193
  if (typeId != _TYPEID_LSP9_OwnershipTransferred_SenderNotification) {
145
194
  // if the amount sent is not the full balance, then do not update the keys
146
195
  uint256 balance = ILSP7DigitalAsset(notifier).balanceOf(msg.sender);
147
196
  if (balance != 0) return "LSP1: full balance is not sent";
148
197
 
149
- (bytes32[] memory dataKeys, bytes[] memory dataValues) = LSP5Utils
150
- .generateSentAssetKeys(msg.sender, notifierMapKey, notifierMapValue);
151
-
152
- result = LSP6Utils.setDataViaKeyManager(keyManager, dataKeys, dataValues);
198
+ (dataKeys, dataValues) = LSP5Utils.generateSentAssetKeys(
199
+ msg.sender,
200
+ notifierMapKey,
201
+ arrayIndex
202
+ );
203
+
204
+ /**
205
+ * `generateSentAssetKeys(...)` returns empty arrays in the following cases:
206
+ * - the index returned from the data key `notifierMapKey` is bigger than
207
+ * the length of the `LSP5ReceivedAssets[]`, meaning, index is out of bounds.
208
+ */
209
+ if (dataKeys.length == 0 && dataValues.length == 0) return "LSP1: asset data corrupted";
210
+
211
+ // Set the LSP5 generated data keys on the account
212
+ IERC725Y(msg.sender).setDataBatch(dataKeys, dataValues);
213
+ return "";
153
214
  } else {
154
- (bytes32[] memory dataKeys, bytes[] memory dataValues) = LSP10Utils
155
- .generateSentVaultKeys(msg.sender, notifierMapKey, notifierMapValue);
156
-
157
- result = LSP6Utils.setDataViaKeyManager(keyManager, dataKeys, dataValues);
158
- }
159
- }
160
-
161
- /**
162
- * @dev Check if the caller is owned by an LSP6KeyManager and linked to
163
- * the owner returned
164
- */
165
- function _validateCallerViaKeyManager()
166
- internal
167
- view
168
- virtual
169
- returns (address accountOwner, bool ownerIsKeyManager)
170
- {
171
- accountOwner = ERC725Y(msg.sender).owner();
172
- if (accountOwner.supportsERC165InterfaceUnchecked(_INTERFACEID_LSP6))
173
- ownerIsKeyManager = true;
174
-
175
- if (ownerIsKeyManager) {
176
- address target = ILSP6KeyManager(accountOwner).target();
177
- // check if the caller is the same account controlled by the keyManager
178
- if (target != msg.sender) revert CallerNotLSP6LinkedTarget(msg.sender, target);
215
+ (dataKeys, dataValues) = LSP10Utils.generateSentVaultKeys(
216
+ msg.sender,
217
+ notifierMapKey,
218
+ arrayIndex
219
+ );
220
+
221
+ /**
222
+ * `generateSentAssetKeys(...)` returns empty arrays in the following cases:
223
+ * - the index returned from the data key `notifierMapKey` is bigger than
224
+ * the length of the `LSP10Vaults[]`, meaning, index is out of bounds.
225
+ */
226
+ if (dataKeys.length == 0 && dataValues.length == 0) return "LSP1: asset data corrupted";
227
+
228
+ // Set the LSP10 generated data keys on the account
229
+ IERC725Y(msg.sender).setDataBatch(dataKeys, dataValues);
230
+ return "";
179
231
  }
180
232
  }
181
233
 
@@ -8,10 +8,8 @@ import {ILSP7DigitalAsset} from "../../LSP7DigitalAsset/ILSP7DigitalAsset.sol";
8
8
 
9
9
  // modules
10
10
  import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
11
- import {ERC725Y} from "@erc725/smart-contracts/contracts/ERC725Y.sol";
12
11
 
13
12
  // libraries
14
- import {ERC165Checker} from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
15
13
  import {LSP1Utils} from "../LSP1Utils.sol";
16
14
  import {LSP2Utils} from "../../LSP2ERC725YJSONSchema/LSP2Utils.sol";
17
15
  import {LSP5Utils} from "../../LSP5ReceivedAssets/LSP5Utils.sol";
@@ -57,31 +55,62 @@ contract LSP1UniversalReceiverDelegateVault is ERC165, ILSP1UniversalReceiver {
57
55
  bytes32 notifierMapKey = LSP2Utils.generateMappingKey(mapPrefix, bytes20(notifier));
58
56
  bytes memory notifierMapValue = IERC725Y(msg.sender).getData(notifierMapKey);
59
57
 
58
+ bytes32[] memory dataKeys;
59
+ bytes[] memory dataValues;
60
+
60
61
  if (isReceiving) {
61
62
  // if the map value is already set, then do nothing
62
- if (bytes12(notifierMapValue) != bytes12(0))
63
+ if (bytes20(notifierMapValue) != bytes20(0))
63
64
  return "URD: asset received is already registered";
64
65
 
65
- // if the amount sent is 0, then do not update the keys
66
- uint256 balance = ILSP7DigitalAsset(notifier).balanceOf(msg.sender);
67
- if (balance == 0) return "LSP1: balance not updated";
68
-
69
- (bytes32[] memory receiverDataKeys, bytes[] memory receiverDataValues) = LSP5Utils
70
- .generateReceivedAssetKeys(msg.sender, notifier, notifierMapKey, interfaceID);
71
-
72
- IERC725Y(msg.sender).setData(receiverDataKeys, receiverDataValues);
66
+ // CHECK balance only when the Token contract is already deployed,
67
+ // not when tokens are being transferred on deployment through the `constructor`
68
+ if (notifier.code.length > 0) {
69
+ // if the amount sent is 0, then do not update the keys
70
+ uint256 balance = ILSP7DigitalAsset(notifier).balanceOf(msg.sender);
71
+ if (balance == 0) return "LSP1: balance not updated";
72
+ }
73
+
74
+ (dataKeys, dataValues) = LSP5Utils.generateReceivedAssetKeys(
75
+ msg.sender,
76
+ notifier,
77
+ notifierMapKey,
78
+ interfaceID
79
+ );
80
+
81
+ IERC725Y(msg.sender).setDataBatch(dataKeys, dataValues);
73
82
  } else {
74
83
  // if there is no map value for the asset to remove, then do nothing
75
- if (bytes12(notifierMapValue) == bytes12(0))
84
+ if (bytes20(notifierMapValue) == bytes20(0))
76
85
  return "LSP1: asset sent is not registered";
86
+
77
87
  // if it's a token transfer (LSP7/LSP8)
78
88
  uint256 balance = ILSP7DigitalAsset(notifier).balanceOf(msg.sender);
79
89
  if (balance != 0) return "LSP1: full balance is not sent";
80
90
 
81
- (bytes32[] memory senderDataKeys, bytes[] memory senderDataValues) = LSP5Utils
82
- .generateSentAssetKeys(msg.sender, notifierMapKey, notifierMapValue);
83
-
84
- IERC725Y(msg.sender).setData(senderDataKeys, senderDataValues);
91
+ // if the value under the `LSP5ReceivedAssetsMap:<asset-address>`
92
+ // is not a valid tuple as `(bytes4,uint128)`
93
+ if (notifierMapValue.length < 20) return "LSP1: asset data corrupted";
94
+
95
+ // Identify where the asset is located in the `LSP5ReceivedAssets[]` Array
96
+ // by extracting the index from the tuple value `(bytes4,uint128)`
97
+ // fetched under the LSP5ReceivedAssetsMap/LSP10VaultsMap data key
98
+ uint128 assetIndex = uint128(uint160(bytes20(notifierMapValue)));
99
+
100
+ (dataKeys, dataValues) = LSP5Utils.generateSentAssetKeys(
101
+ msg.sender,
102
+ notifierMapKey,
103
+ assetIndex
104
+ );
105
+
106
+ /**
107
+ * `generateSentAssetKeys(...)` returns empty arrays in the following cases:
108
+ * - the index returned from the data key `notifierMapKey` is bigger than
109
+ * the length of the `LSP5ReceivedAssets[]`, meaning, index is out of bounds.
110
+ */
111
+ if (dataKeys.length == 0 && dataValues.length == 0) return "LSP1: asset data corrupted";
112
+
113
+ IERC725Y(msg.sender).setDataBatch(dataKeys, dataValues);
85
114
  }
86
115
  }
87
116
 
@@ -3,9 +3,11 @@ pragma solidity ^0.8.4;
3
3
 
4
4
  // libraries
5
5
  import {Address} from "@openzeppelin/contracts/utils/Address.sol";
6
+ import {ERC165Checker} from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
6
7
 
7
8
  // constants
8
9
  import "./ILSP1UniversalReceiver.sol";
10
+ import {_INTERFACEID_LSP1} from "../LSP1UniversalReceiver/LSP1Constants.sol";
9
11
  import "../LSP0ERC725Account/LSP0Constants.sol";
10
12
  import "../LSP5ReceivedAssets/LSP5Constants.sol";
11
13
  import "../LSP7DigitalAsset/LSP7Constants.sol";
@@ -15,6 +17,16 @@ import "../LSP14Ownable2Step/LSP14Constants.sol";
15
17
  import "../LSP10ReceivedVaults/LSP10Constants.sol";
16
18
 
17
19
  library LSP1Utils {
20
+ function tryNotifyUniversalReceiver(
21
+ address lsp1Implementation,
22
+ bytes32 typeId,
23
+ bytes memory data
24
+ ) internal {
25
+ if (ERC165Checker.supportsERC165InterfaceUnchecked(lsp1Implementation, _INTERFACEID_LSP1)) {
26
+ ILSP1UniversalReceiver(lsp1Implementation).universalReceiver(typeId, data);
27
+ }
28
+ }
29
+
18
30
  function callUniversalReceiverWithCallerInfos(
19
31
  address universalReceiverDelegate,
20
32
  bytes32 typeId,
@@ -0,0 +1,30 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.4;
3
+
4
+ /**
5
+ * @dev Interface to be inherited for contract supporting LSP20-CallVerification
6
+ */
7
+ interface ILSP20CallVerification {
8
+ /**
9
+ * @return magicValue MUST return the first 3 bytes of `lsp20VerifyCall(address,uint256,bytes)` function selector if the call to
10
+ * the function is allowed, concatened with a byte that determines if the lsp20VerifyCallResult function should
11
+ * be called after the original function call. The byte that invoke the lsp20VerifyCallResult function is strictly `0x01`.
12
+ *
13
+ * @param caller The address who called the function on the msg.sender
14
+ * @param value The value sent by the caller to the function called on the msg.sender
15
+ * @param receivedCalldata The receivedCalldata sent by the caller to the msg.sender
16
+ */
17
+ function lsp20VerifyCall(
18
+ address caller,
19
+ uint256 value,
20
+ bytes memory receivedCalldata
21
+ ) external returns (bytes4 magicValue);
22
+
23
+ /**
24
+ * @return MUST return the lsp20VerifyCallResult function selector if the call to the function is allowed
25
+ *
26
+ * @param callHash The keccak256 of the parameters of {lsp20VerifyCall} concatenated
27
+ * @param result The value result of the function called on the msg.sender
28
+ */
29
+ function lsp20VerifyCallResult(bytes32 callHash, bytes memory result) external returns (bytes4);
30
+ }
@@ -0,0 +1,83 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.4;
3
+
4
+ // interfaces
5
+
6
+ import {ILSP20CallVerification as ILSP20} from "./ILSP20CallVerification.sol";
7
+
8
+ // errors
9
+ import "./LSP20Errors.sol";
10
+
11
+ /**
12
+ * @title Implementation of contract calling the verification functions according to LSP20CallVerification
13
+ * @dev Module to be inherited used to verify the execution of functions according to a verifier address.
14
+ * Verification can happen before or after execution based on a magicValue.
15
+ */
16
+ abstract contract LSP20CallVerification {
17
+ /**
18
+ * @dev Calls {lsp20VerifyCall} function on the logicVerifier.
19
+ * Reverts in case the value returned does not match the magic value (lsp20VerifyCall selector)
20
+ * Returns whether a verification after the execution should happen based on the last byte of the magicValue
21
+ */
22
+ function _verifyCall(address logicVerifier) internal virtual returns (bool verifyAfter) {
23
+ (bool success, bytes memory returnedData) = logicVerifier.call(
24
+ abi.encodeWithSelector(ILSP20.lsp20VerifyCall.selector, msg.sender, msg.value, msg.data)
25
+ );
26
+
27
+ _validateCall(false, success, returnedData);
28
+
29
+ bytes4 magicValue = abi.decode(returnedData, (bytes4));
30
+
31
+ if (bytes3(magicValue) != bytes3(ILSP20.lsp20VerifyCall.selector))
32
+ revert LSP20InvalidMagicValue(false, returnedData);
33
+
34
+ return bytes1(magicValue[3]) == 0x01 ? true : false;
35
+ }
36
+
37
+ /**
38
+ * @dev Calls {lsp20VerifyCallResult} function on the logicVerifier.
39
+ * Reverts in case the value returned does not match the magic value (lsp20VerifyCallResult selector)
40
+ */
41
+ function _verifyCallResult(address logicVerifier, bytes memory callResult) internal virtual {
42
+ (bool success, bytes memory returnedData) = logicVerifier.call(
43
+ abi.encodeWithSelector(
44
+ ILSP20.lsp20VerifyCallResult.selector,
45
+ keccak256(abi.encodePacked(msg.sender, msg.value, msg.data)),
46
+ callResult
47
+ )
48
+ );
49
+
50
+ _validateCall(true, success, returnedData);
51
+
52
+ if (abi.decode(returnedData, (bytes4)) != ILSP20.lsp20VerifyCallResult.selector)
53
+ revert LSP20InvalidMagicValue(true, returnedData);
54
+ }
55
+
56
+ function _validateCall(
57
+ bool postCall,
58
+ bool success,
59
+ bytes memory returnedData
60
+ ) internal pure {
61
+ if (!success) _revert(postCall, returnedData);
62
+
63
+ // check if the returned data contains at least 32 bytes, potentially an abi encoded bytes4 value
64
+ // check if the returned data has in the first 32 bytes an abi encoded bytes4 value
65
+ if (returnedData.length < 32 || bytes28(bytes32(returnedData) << 32) != bytes28(0))
66
+ revert LSP20InvalidMagicValue(postCall, returnedData);
67
+ }
68
+
69
+ function _revert(bool postCall, bytes memory returnedData) internal pure {
70
+ // Look for revert reason and bubble it up if present
71
+ if (returnedData.length > 0) {
72
+ // The easiest way to bubble the revert reason is using memory via assembly
73
+ // solhint-disable no-inline-assembly
74
+ /// @solidity memory-safe-assembly
75
+ assembly {
76
+ let returndata_size := mload(returnedData)
77
+ revert(add(32, returnedData), returndata_size)
78
+ }
79
+ } else {
80
+ revert LSP20CallingVerifierFailed(postCall);
81
+ }
82
+ }
83
+ }