@1inch/solidity-utils 4.0.0 → 4.2.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 (213) hide show
  1. package/README.md +9 -208
  2. package/contracts/interfaces/ICreate3Deployer.sol +16 -0
  3. package/contracts/interfaces/IDaiLikePermit.sol +13 -0
  4. package/contracts/interfaces/IERC20MetadataUppercase.sol +12 -0
  5. package/contracts/interfaces/IERC7597Permit.sol +13 -0
  6. package/contracts/interfaces/IPermit2.sol +45 -12
  7. package/contracts/interfaces/IWETH.sol +17 -0
  8. package/contracts/libraries/AddressArray.sol +73 -25
  9. package/contracts/libraries/AddressLib.sol +2 -1
  10. package/contracts/libraries/AddressSet.sol +52 -14
  11. package/contracts/libraries/BySigTraits.sol +37 -5
  12. package/contracts/libraries/BytesMemory.sol +2 -1
  13. package/contracts/libraries/BytesStorage.sol +2 -1
  14. package/contracts/libraries/ECDSA.sol +111 -0
  15. package/contracts/libraries/RevertReasonForwarder.sol +13 -3
  16. package/contracts/libraries/RevertReasonParser.sol +11 -2
  17. package/contracts/libraries/SafeERC20.sol +1 -1
  18. package/contracts/libraries/StringUtil.sol +21 -3
  19. package/contracts/libraries/UniERC20.sol +57 -12
  20. package/contracts/mixins/BySig.sol +220 -0
  21. package/contracts/mixins/EthReceiver.sol +27 -0
  22. package/contracts/mixins/OnlyWethReceiver.sol +31 -0
  23. package/contracts/mixins/PermitAndCall.sol +39 -0
  24. package/contracts/mixins/SelfdestructEthSender.sol +32 -0
  25. package/contracts/mocks/ERC20PermitMock.sol +12 -0
  26. package/contracts/mocks/SelfdestructEthSenderMock.sol +27 -0
  27. package/contracts/mocks/TokenCustomDecimalsMock.sol +25 -4
  28. package/contracts/mocks/TokenMock.sol +19 -0
  29. package/dist/docgen/index.d.ts +2 -0
  30. package/dist/docgen/index.js +7 -0
  31. package/dist/docgen/index.js.map +1 -0
  32. package/dist/docgen/templates.d.ts +6 -0
  33. package/dist/docgen/templates.js +15 -0
  34. package/dist/docgen/templates.js.map +1 -0
  35. package/dist/hardhat-setup/networks.d.ts +23 -0
  36. package/dist/hardhat-setup/networks.js +22 -0
  37. package/dist/hardhat-setup/networks.js.map +1 -1
  38. package/dist/src/expect.d.ts +12 -0
  39. package/dist/src/expect.js +12 -0
  40. package/dist/src/expect.js.map +1 -1
  41. package/dist/src/permit.d.ts +131 -2
  42. package/dist/src/permit.js +126 -9
  43. package/dist/src/permit.js.map +1 -1
  44. package/dist/src/prelude.d.ts +6 -0
  45. package/dist/src/prelude.js +6 -0
  46. package/dist/src/prelude.js.map +1 -1
  47. package/dist/src/profileEVM.d.ts +26 -0
  48. package/dist/src/profileEVM.js +30 -3
  49. package/dist/src/profileEVM.js.map +1 -1
  50. package/dist/src/utils.d.ts +79 -0
  51. package/dist/src/utils.js +92 -1
  52. package/dist/src/utils.js.map +1 -1
  53. package/dist/typechain-types/contracts/mixins/SelfdestructEthSender.d.ts +29 -0
  54. package/dist/typechain-types/contracts/mixins/SelfdestructEthSender.js +3 -0
  55. package/dist/typechain-types/contracts/mixins/SelfdestructEthSender.js.map +1 -0
  56. package/dist/typechain-types/contracts/mixins/index.d.ts +1 -0
  57. package/dist/typechain-types/contracts/mocks/SelfdestructEthSenderMock.d.ts +37 -0
  58. package/dist/typechain-types/contracts/mocks/SelfdestructEthSenderMock.js +3 -0
  59. package/dist/typechain-types/contracts/mocks/SelfdestructEthSenderMock.js.map +1 -0
  60. package/dist/typechain-types/contracts/mocks/TokenCustomDecimalsMock.d.ts +1 -5
  61. package/dist/typechain-types/contracts/mocks/index.d.ts +1 -0
  62. package/dist/typechain-types/factories/@openzeppelin/contracts/utils/Address__factory.d.ts +1 -1
  63. package/dist/typechain-types/factories/@openzeppelin/contracts/utils/Address__factory.js +1 -1
  64. package/dist/typechain-types/factories/@openzeppelin/contracts/utils/ShortStrings__factory.d.ts +1 -1
  65. package/dist/typechain-types/factories/@openzeppelin/contracts/utils/ShortStrings__factory.js +1 -1
  66. package/dist/typechain-types/factories/@openzeppelin/contracts/utils/Strings__factory.d.ts +1 -1
  67. package/dist/typechain-types/factories/@openzeppelin/contracts/utils/Strings__factory.js +1 -1
  68. package/dist/typechain-types/factories/@openzeppelin/contracts/utils/cryptography/ECDSA__factory.d.ts +1 -1
  69. package/dist/typechain-types/factories/@openzeppelin/contracts/utils/cryptography/ECDSA__factory.js +1 -1
  70. package/dist/typechain-types/factories/@openzeppelin/contracts/utils/math/Math__factory.d.ts +1 -1
  71. package/dist/typechain-types/factories/@openzeppelin/contracts/utils/math/Math__factory.js +1 -1
  72. package/dist/typechain-types/factories/contracts/libraries/AddressArray__factory.d.ts +1 -1
  73. package/dist/typechain-types/factories/contracts/libraries/AddressArray__factory.js +1 -1
  74. package/dist/typechain-types/factories/contracts/libraries/BySigTraits__factory.d.ts +1 -1
  75. package/dist/typechain-types/factories/contracts/libraries/BySigTraits__factory.js +1 -1
  76. package/dist/typechain-types/factories/contracts/libraries/BytesMemory__factory.d.ts +1 -1
  77. package/dist/typechain-types/factories/contracts/libraries/BytesMemory__factory.js +1 -1
  78. package/dist/typechain-types/factories/contracts/libraries/BytesStorage__factory.d.ts +1 -1
  79. package/dist/typechain-types/factories/contracts/libraries/BytesStorage__factory.js +1 -1
  80. package/dist/typechain-types/factories/contracts/libraries/RevertReasonParser__factory.d.ts +1 -1
  81. package/dist/typechain-types/factories/contracts/libraries/RevertReasonParser__factory.js +1 -1
  82. package/dist/typechain-types/factories/contracts/libraries/SafeERC20__factory.d.ts +1 -1
  83. package/dist/typechain-types/factories/contracts/libraries/SafeERC20__factory.js +1 -1
  84. package/dist/typechain-types/factories/contracts/libraries/UniERC20__factory.d.ts +1 -1
  85. package/dist/typechain-types/factories/contracts/libraries/UniERC20__factory.js +1 -1
  86. package/dist/typechain-types/factories/contracts/mixins/SelfdestructEthSender__factory.d.ts +17 -0
  87. package/dist/typechain-types/factories/contracts/mixins/SelfdestructEthSender__factory.js +33 -0
  88. package/dist/typechain-types/factories/contracts/mixins/SelfdestructEthSender__factory.js.map +1 -0
  89. package/dist/typechain-types/factories/contracts/mixins/index.d.ts +1 -0
  90. package/dist/typechain-types/factories/contracts/mixins/index.js +3 -1
  91. package/dist/typechain-types/factories/contracts/mixins/index.js.map +1 -1
  92. package/dist/typechain-types/factories/contracts/mocks/ERC20PermitMock__factory.d.ts +1 -1
  93. package/dist/typechain-types/factories/contracts/mocks/ERC20PermitMock__factory.js +1 -1
  94. package/dist/typechain-types/factories/contracts/mocks/ERC20PermitMock__factory.js.map +1 -1
  95. package/dist/typechain-types/factories/contracts/mocks/SelfdestructEthSenderMock__factory.d.ts +49 -0
  96. package/dist/typechain-types/factories/contracts/mocks/SelfdestructEthSenderMock__factory.js +75 -0
  97. package/dist/typechain-types/factories/contracts/mocks/SelfdestructEthSenderMock__factory.js.map +1 -0
  98. package/dist/typechain-types/factories/contracts/mocks/TokenCustomDecimalsMock__factory.d.ts +1 -11
  99. package/dist/typechain-types/factories/contracts/mocks/TokenCustomDecimalsMock__factory.js +1 -14
  100. package/dist/typechain-types/factories/contracts/mocks/TokenCustomDecimalsMock__factory.js.map +1 -1
  101. package/dist/typechain-types/factories/contracts/mocks/TokenMock__factory.d.ts +1 -1
  102. package/dist/typechain-types/factories/contracts/mocks/TokenMock__factory.js +1 -1
  103. package/dist/typechain-types/factories/contracts/mocks/TokenMock__factory.js.map +1 -1
  104. package/dist/typechain-types/factories/contracts/mocks/index.d.ts +1 -0
  105. package/dist/typechain-types/factories/contracts/mocks/index.js +3 -1
  106. package/dist/typechain-types/factories/contracts/mocks/index.js.map +1 -1
  107. package/dist/typechain-types/factories/contracts/tests/ECDSATest__factory.d.ts +1 -1
  108. package/dist/typechain-types/factories/contracts/tests/ECDSATest__factory.js +1 -1
  109. package/dist/typechain-types/factories/contracts/tests/ECDSATest__factory.js.map +1 -1
  110. package/dist/typechain-types/factories/contracts/tests/RevertReasonParserTest__factory.d.ts +1 -1
  111. package/dist/typechain-types/factories/contracts/tests/RevertReasonParserTest__factory.js +1 -1
  112. package/dist/typechain-types/factories/contracts/tests/RevertReasonParserTest__factory.js.map +1 -1
  113. package/dist/typechain-types/factories/contracts/tests/StringUtilTest__factory.d.ts +1 -1
  114. package/dist/typechain-types/factories/contracts/tests/StringUtilTest__factory.js +1 -1
  115. package/dist/typechain-types/factories/contracts/tests/StringUtilTest__factory.js.map +1 -1
  116. package/dist/typechain-types/factories/contracts/tests/mocks/AddressArrayMock__factory.d.ts +1 -1
  117. package/dist/typechain-types/factories/contracts/tests/mocks/AddressArrayMock__factory.js +1 -1
  118. package/dist/typechain-types/factories/contracts/tests/mocks/AddressArrayMock__factory.js.map +1 -1
  119. package/dist/typechain-types/factories/contracts/tests/mocks/AddressLibMock__factory.d.ts +1 -1
  120. package/dist/typechain-types/factories/contracts/tests/mocks/AddressLibMock__factory.js +1 -1
  121. package/dist/typechain-types/factories/contracts/tests/mocks/AddressLibMock__factory.js.map +1 -1
  122. package/dist/typechain-types/factories/contracts/tests/mocks/AddressSetMock__factory.d.ts +1 -1
  123. package/dist/typechain-types/factories/contracts/tests/mocks/AddressSetMock__factory.js +1 -1
  124. package/dist/typechain-types/factories/contracts/tests/mocks/AddressSetMock__factory.js.map +1 -1
  125. package/dist/typechain-types/factories/contracts/tests/mocks/BySigTraitsMock__factory.d.ts +1 -1
  126. package/dist/typechain-types/factories/contracts/tests/mocks/BySigTraitsMock__factory.js +1 -1
  127. package/dist/typechain-types/factories/contracts/tests/mocks/BySigTraitsMock__factory.js.map +1 -1
  128. package/dist/typechain-types/factories/contracts/tests/mocks/BytesMemoryMock__factory.d.ts +1 -1
  129. package/dist/typechain-types/factories/contracts/tests/mocks/BytesMemoryMock__factory.js +1 -1
  130. package/dist/typechain-types/factories/contracts/tests/mocks/BytesMemoryMock__factory.js.map +1 -1
  131. package/dist/typechain-types/factories/contracts/tests/mocks/BytesStorageMock__factory.d.ts +1 -1
  132. package/dist/typechain-types/factories/contracts/tests/mocks/BytesStorageMock__factory.js +1 -1
  133. package/dist/typechain-types/factories/contracts/tests/mocks/BytesStorageMock__factory.js.map +1 -1
  134. package/dist/typechain-types/factories/contracts/tests/mocks/DaiLikePermitMock__factory.d.ts +1 -1
  135. package/dist/typechain-types/factories/contracts/tests/mocks/DaiLikePermitMock__factory.js +1 -1
  136. package/dist/typechain-types/factories/contracts/tests/mocks/DaiLikePermitMock__factory.js.map +1 -1
  137. package/dist/typechain-types/factories/contracts/tests/mocks/ERC1271WalletMock__factory.d.ts +1 -1
  138. package/dist/typechain-types/factories/contracts/tests/mocks/ERC1271WalletMock__factory.js +1 -1
  139. package/dist/typechain-types/factories/contracts/tests/mocks/ERC1271WalletMock__factory.js.map +1 -1
  140. package/dist/typechain-types/factories/contracts/tests/mocks/EthReceiverMock__factory.d.ts +1 -1
  141. package/dist/typechain-types/factories/contracts/tests/mocks/EthReceiverMock__factory.js +1 -1
  142. package/dist/typechain-types/factories/contracts/tests/mocks/EthSenderMock__factory.d.ts +1 -1
  143. package/dist/typechain-types/factories/contracts/tests/mocks/EthSenderMock__factory.js +1 -1
  144. package/dist/typechain-types/factories/contracts/tests/mocks/EthSenderMock__factory.js.map +1 -1
  145. package/dist/typechain-types/factories/contracts/tests/mocks/PermitAndCallMock__factory.d.ts +1 -1
  146. package/dist/typechain-types/factories/contracts/tests/mocks/PermitAndCallMock__factory.js +1 -1
  147. package/dist/typechain-types/factories/contracts/tests/mocks/PermitAndCallMock__factory.js.map +1 -1
  148. package/dist/typechain-types/factories/contracts/tests/mocks/PermitableMock__factory.d.ts +1 -1
  149. package/dist/typechain-types/factories/contracts/tests/mocks/PermitableMock__factory.js +1 -1
  150. package/dist/typechain-types/factories/contracts/tests/mocks/PermitableMock__factory.js.map +1 -1
  151. package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20NoReturnMock__factory.d.ts +1 -1
  152. package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20NoReturnMock__factory.js +1 -1
  153. package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20NoReturnMock__factory.js.map +1 -1
  154. package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20PermitNoRevertMock__factory.d.ts +1 -1
  155. package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20PermitNoRevertMock__factory.js +1 -1
  156. package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20PermitNoRevertMock__factory.js.map +1 -1
  157. package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20ReturnFalseMock__factory.d.ts +1 -1
  158. package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20ReturnFalseMock__factory.js +1 -1
  159. package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20ReturnFalseMock__factory.js.map +1 -1
  160. package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20ReturnTrueMock__factory.d.ts +1 -1
  161. package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20ReturnTrueMock__factory.js +1 -1
  162. package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20ReturnTrueMock__factory.js.map +1 -1
  163. package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20ThroughZeroApprove__factory.d.ts +1 -1
  164. package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20ThroughZeroApprove__factory.js +1 -1
  165. package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20ThroughZeroApprove__factory.js.map +1 -1
  166. package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20WithSafeBalance__factory.d.ts +1 -1
  167. package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20WithSafeBalance__factory.js +1 -1
  168. package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/ERC20WithSafeBalance__factory.js.map +1 -1
  169. package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/Permit2ReturnTrueMock__factory.d.ts +1 -1
  170. package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/Permit2ReturnTrueMock__factory.js +1 -1
  171. package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/Permit2ReturnTrueMock__factory.js.map +1 -1
  172. package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/SafeERC20Wrapper__factory.d.ts +1 -1
  173. package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/SafeERC20Wrapper__factory.js +1 -1
  174. package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/SafeERC20Wrapper__factory.js.map +1 -1
  175. package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/SafeWETHWrapper__factory.d.ts +1 -1
  176. package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/SafeWETHWrapper__factory.js +1 -1
  177. package/dist/typechain-types/factories/contracts/tests/mocks/SafeERC20Helper.sol/SafeWETHWrapper__factory.js.map +1 -1
  178. package/dist/typechain-types/factories/contracts/tests/mocks/TokenWithBySig__factory.d.ts +1 -1
  179. package/dist/typechain-types/factories/contracts/tests/mocks/TokenWithBySig__factory.js +1 -1
  180. package/dist/typechain-types/factories/contracts/tests/mocks/TokenWithBySig__factory.js.map +1 -1
  181. package/dist/typechain-types/factories/contracts/tests/mocks/USDCLikePermitMock__factory.d.ts +1 -1
  182. package/dist/typechain-types/factories/contracts/tests/mocks/USDCLikePermitMock__factory.js +1 -1
  183. package/dist/typechain-types/factories/contracts/tests/mocks/USDCLikePermitMock__factory.js.map +1 -1
  184. package/dist/typechain-types/factories/contracts/tests/mocks/UniERC20Helper.sol/ERC20Capitals__factory.d.ts +1 -1
  185. package/dist/typechain-types/factories/contracts/tests/mocks/UniERC20Helper.sol/ERC20Capitals__factory.js +1 -1
  186. package/dist/typechain-types/factories/contracts/tests/mocks/UniERC20Helper.sol/ERC20Capitals__factory.js.map +1 -1
  187. package/dist/typechain-types/factories/contracts/tests/mocks/UniERC20Helper.sol/ERC20bytes32Capitals__factory.d.ts +1 -1
  188. package/dist/typechain-types/factories/contracts/tests/mocks/UniERC20Helper.sol/ERC20bytes32Capitals__factory.js +1 -1
  189. package/dist/typechain-types/factories/contracts/tests/mocks/UniERC20Helper.sol/ERC20bytes32Capitals__factory.js.map +1 -1
  190. package/dist/typechain-types/factories/contracts/tests/mocks/UniERC20Helper.sol/ERC20bytes32__factory.d.ts +1 -1
  191. package/dist/typechain-types/factories/contracts/tests/mocks/UniERC20Helper.sol/ERC20bytes32__factory.js +1 -1
  192. package/dist/typechain-types/factories/contracts/tests/mocks/UniERC20Helper.sol/ERC20bytes32__factory.js.map +1 -1
  193. package/dist/typechain-types/factories/contracts/tests/mocks/UniERC20Helper.sol/ETHBadReceiver__factory.d.ts +1 -1
  194. package/dist/typechain-types/factories/contracts/tests/mocks/UniERC20Helper.sol/ETHBadReceiver__factory.js +1 -1
  195. package/dist/typechain-types/factories/contracts/tests/mocks/UniERC20Helper.sol/ETHBadReceiver__factory.js.map +1 -1
  196. package/dist/typechain-types/factories/contracts/tests/mocks/UniERC20Helper.sol/UniERC20Wrapper__factory.d.ts +1 -1
  197. package/dist/typechain-types/factories/contracts/tests/mocks/UniERC20Helper.sol/UniERC20Wrapper__factory.js +1 -1
  198. package/dist/typechain-types/factories/contracts/tests/mocks/UniERC20Helper.sol/UniERC20Wrapper__factory.js.map +1 -1
  199. package/dist/typechain-types/factories/contracts/tests/mocks/WETH__factory.d.ts +1 -1
  200. package/dist/typechain-types/factories/contracts/tests/mocks/WETH__factory.js +1 -1
  201. package/dist/typechain-types/factories/contracts/tests/mocks/WETH__factory.js.map +1 -1
  202. package/dist/typechain-types/factories/contracts/tests/mocks/WethReceiverMock__factory.d.ts +1 -1
  203. package/dist/typechain-types/factories/contracts/tests/mocks/WethReceiverMock__factory.js +1 -1
  204. package/dist/typechain-types/factories/contracts/tests/mocks/WethReceiverMock__factory.js.map +1 -1
  205. package/dist/typechain-types/index.d.ts +4 -0
  206. package/dist/typechain-types/index.js +6 -2
  207. package/dist/typechain-types/index.js.map +1 -1
  208. package/package.json +29 -21
  209. package/utils/README.md +198 -0
  210. package/utils/docify.utils.js +3 -34
  211. package/utils/file-dependencies.js +0 -0
  212. package/utils/test-docgen.js +0 -0
  213. package/utils/contract.hbs +0 -69
@@ -0,0 +1,220 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma solidity ^0.8.0;
4
+
5
+ import { Context } from "@openzeppelin/contracts/utils/Context.sol";
6
+ import { Address } from "@openzeppelin/contracts/utils/Address.sol";
7
+ import { EIP712 } from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
8
+ import { ECDSA } from "../libraries/ECDSA.sol";
9
+ import { BySigTraits } from "../libraries/BySigTraits.sol";
10
+ import { AddressArray } from "../libraries/AddressArray.sol";
11
+
12
+ /**
13
+ * @title BySig
14
+ * @notice Mixin that provides signature-based accessibility to every external method of the smart contract.
15
+ * @dev Inherit your contract from this mixin and use `_msgSender()` instead of `msg.sender` everywhere.
16
+ */
17
+ abstract contract BySig is Context, EIP712 {
18
+ using Address for address;
19
+ using BySigTraits for BySigTraits.Value;
20
+ using AddressArray for AddressArray.Data;
21
+
22
+ /// @notice Emitted when the nonce used for a call is incorrect.
23
+ error WrongNonce();
24
+ /// @notice Emitted when a call is made by an unauthorized relayer.
25
+ error WrongRelayer();
26
+ /// @notice Emitted when the signature provided for a call does not match the expected signature.
27
+ error WrongSignature();
28
+ /// @notice Emitted when a call is attempted after the specified deadline has passed.
29
+ error DeadlineExceeded();
30
+
31
+ /**
32
+ * @notice Represents a call to be signed and executed.
33
+ * @dev This structure encapsulates all necessary information for executing a signed call,
34
+ * including traits that specify how the call should be authorized and the actual data to be executed.
35
+ * @param traits An instance of `Value` from the `BySigTraits` library, specifying the nonce type,
36
+ * nonce value, deadline, whether a relayer is allowed for this call and another params, see {BySigTraits-Value}.
37
+ * These traits define the authorization strategy and replay protection for the signed call.
38
+ * @param data The encoded function call data to be executed. This should be generated, for instance,
39
+ * using `encodeFunctionData` of the target contract's interface, containing the function signature and arguments.
40
+ * It represents the exact action to be taken, including which function to call of which contract and with what parameters.
41
+ */
42
+ struct SignedCall {
43
+ BySigTraits.Value traits;
44
+ bytes data;
45
+ }
46
+
47
+ bytes32 constant public SIGNED_CALL_TYPEHASH = keccak256("SignedCall(uint256 traits,bytes data)");
48
+
49
+ // Various nonces used for signature verification and replay protection.
50
+ AddressArray.Data /* transient */ private _msgSenders;
51
+ mapping(address => uint256) private _bySigAccountNonces;
52
+ mapping(address => mapping(bytes4 => uint256)) private _bySigSelectorNonces;
53
+ mapping(address => mapping(uint256 => uint256)) private _bySigUniqueNonces;
54
+
55
+ /**
56
+ * @notice Retrieves the account nonce for the specified account.
57
+ * @param account The address of the account.
58
+ * @return The current nonce for the account.
59
+ */
60
+ function bySigAccountNonces(address account) public view returns(uint256) {
61
+ return _bySigAccountNonces[account];
62
+ }
63
+
64
+ /**
65
+ * @notice Retrieves the selector nonce for a specific account and selector.
66
+ * @param account The address of the account.
67
+ * @param selector The selector for which the nonce is being retrieved.
68
+ * @return The current nonce for the specified selector and account.
69
+ */
70
+ function bySigSelectorNonces(address account, bytes4 selector) public view returns(uint256) {
71
+ return _bySigSelectorNonces[account][selector];
72
+ }
73
+
74
+ /**
75
+ * @notice Checks if a unique nonce has already been used for a given account.
76
+ * @dev This function divides the nonce space into slots to efficiently manage storage.
77
+ * A unique nonce is considered used if its corresponding bit in the storage slot is set.
78
+ * @param account The address of the account for which the nonce is being checked.
79
+ * @param nonce The unique nonce to check. It is divided into slots for storage efficiency.
80
+ * @return bool True if the nonce has been used, false otherwise.
81
+ */
82
+ function bySigUniqueNonces(address account, uint256 nonce) public view returns(bool) {
83
+ return (_bySigUniqueNonces[account][nonce >> 8] & (1 << (nonce & 0xff))) != 0;
84
+ }
85
+
86
+ /**
87
+ * @notice Retrieves the storage slot value for a given account and nonce slot.
88
+ * @dev This function allows access to the raw storage slot used to track used nonces, divided into slots for efficiency.
89
+ * Each bit in the returned value represents the used/unused status of a nonce within that slot.
90
+ * @param account The address of the account for which the nonce slot is being retrieved.
91
+ * @param nonce The nonce for which the storage slot is being retrieved. The function calculates the correct slot based on this value.
92
+ * @return uint256 The raw value of the storage slot that tracks the used/unused status of nonces in the specified slot for the given account.
93
+ */
94
+ function bySigUniqueNoncesSlot(address account, uint256 nonce) public view returns(uint256) {
95
+ return _bySigUniqueNonces[account][nonce >> 8];
96
+ }
97
+
98
+ /**
99
+ * @notice Hashes a `SignedCall` struct using EIP-712 typed data hashing rules.
100
+ * @param sig The `SignedCall` structure containing the call traits and data.
101
+ * @return The EIP-712 compliant hash of the `SignedCall` struct.
102
+ */
103
+ function hashBySig(SignedCall calldata sig) public view returns(bytes32) {
104
+ return _hashTypedDataV4(
105
+ keccak256(abi.encode(
106
+ SIGNED_CALL_TYPEHASH,
107
+ sig.traits,
108
+ keccak256(sig.data)
109
+ ))
110
+ );
111
+ }
112
+
113
+ /**
114
+ * @notice Executes a signature-authorized call on behalf of the signer.
115
+ * @param signer The address of the signer authorizing the call.
116
+ * @param sig The `SignedCall` structure containing the call traits and data.
117
+ * @param signature The signature authorizing the call.
118
+ * @return ret The bytes result of the executed call.
119
+ */
120
+ function bySig(address signer, SignedCall calldata sig, bytes calldata signature) public payable returns(bytes memory ret) {
121
+ if (block.timestamp > sig.traits.deadline()) revert DeadlineExceeded(); // solhint-disable-line not-rely-on-time
122
+ // Using _msgSender() in the next line allows private relay execution redelegation
123
+ if (!sig.traits.isRelayerAllowed(_msgSender())) revert WrongRelayer();
124
+ if (!_useNonce(signer, sig.traits, sig.data)) revert WrongNonce();
125
+ if (!ECDSA.recoverOrIsValidSignature(signer, hashBySig(sig), signature)) revert WrongSignature();
126
+
127
+ _msgSenders.push(signer);
128
+ ret = address(this).functionDelegateCall(sig.data);
129
+ _msgSenders.pop();
130
+ }
131
+
132
+ /**
133
+ * @notice Executes a call sponsored by the signer (for instance, by fee), intended to be used,
134
+ * for instance, in conjunction with `bySig`.
135
+ * @dev Facilitates execution of a delegate call where the signer covers the transaction fees.
136
+ * Requires `_chargeSigner` to be overridden to define the fee transfer logic.
137
+ * @param token Address of the token used for sponsored logic (for instance, for fee payment).
138
+ * @param amount amount value used for sponsored logic (for instance, fee amount to be charged to the signer).
139
+ * @param data Encoded function call to execute.
140
+ * @param extraData Additional data for sponsored process in `_chargeSigner` method.
141
+ * @return ret Result of the executed call.
142
+ */
143
+ function sponsoredCall(address token, uint256 amount, bytes calldata data, bytes calldata extraData) public payable returns(bytes memory ret) {
144
+ ret = address(this).functionDelegateCall(data);
145
+ _chargeSigner(_msgSender(), msg.sender, token, amount, extraData);
146
+ }
147
+
148
+ /**
149
+ * @dev Placeholder for custom logic to charge the signer for sponsored calls.
150
+ * Override this method to implement sponsored call accounting.
151
+ * Example imeplementation:
152
+ *
153
+ * function _chargeSigner(address signer, address relayer, address token, uint256 amount, bytes calldata extraData) internal override {
154
+ * balances[token][signer] -= amount;
155
+ * balances[token][relayer] += amount;
156
+ * }
157
+ *
158
+ * @param signer The address of the signer being charged.
159
+ * @param relayer The address of the relayer facilitating the call.
160
+ * @param token The token address used for charging.
161
+ * @param amount The amount to be charged.
162
+ * @param extraData Additional data for sponsored call accounting and executions.
163
+ */
164
+ function _chargeSigner(address signer, address relayer, address token, uint256 amount, bytes calldata extraData) internal virtual;
165
+
166
+ /**
167
+ * @notice Advances the account nonce for the sender by a specified amount.
168
+ * @param advance The amount by which to advance the nonce.
169
+ */
170
+ function useBySigAccountNonce(uint32 advance) public {
171
+ _bySigAccountNonces[_msgSender()] += advance;
172
+ }
173
+
174
+ /**
175
+ * @notice Advances the selector nonce for the sender and a specific selector by a specified amount.
176
+ * @param selector The selector for which the nonce is being advanced.
177
+ * @param advance The amount by which to advance the nonce.
178
+ */
179
+ function useBySigSelectorNonce(bytes4 selector, uint32 advance) public {
180
+ _bySigSelectorNonces[_msgSender()][selector] += advance;
181
+ }
182
+
183
+ /**
184
+ * @notice Marks a unique nonce as used for the sender.
185
+ * @param nonce The nonce being marked as used.
186
+ */
187
+ function useBySigUniqueNonce(uint256 nonce) public {
188
+ _bySigUniqueNonces[_msgSender()][nonce >> 8] |= 1 << (nonce & 0xff);
189
+ }
190
+
191
+ /**
192
+ * @dev Returns the address of the message sender, replacing the traditional `msg.sender` with a potentially signed sender.
193
+ * @return The address of the message sender.
194
+ */
195
+ function _msgSender() internal view override virtual returns (address) {
196
+ uint256 length = _msgSenders.length();
197
+ if (length == 0) {
198
+ return super._msgSender();
199
+ }
200
+ return _msgSenders.at(length - 1);
201
+ }
202
+
203
+ function _useNonce(address signer, BySigTraits.Value traits, bytes calldata data) private returns(bool) {
204
+ BySigTraits.NonceType nonceType = traits.nonceType();
205
+ uint256 nonce = traits.nonce();
206
+ if (nonceType == BySigTraits.NonceType.Account) {
207
+ return nonce == _bySigAccountNonces[signer]++;
208
+ }
209
+ if (nonceType == BySigTraits.NonceType.Selector) {
210
+ return nonce == _bySigSelectorNonces[signer][bytes4(data)]++;
211
+ }
212
+ if (nonceType == BySigTraits.NonceType.Unique) {
213
+ mapping(uint256 => uint256) storage map = _bySigUniqueNonces[signer];
214
+ uint256 cache = map[nonce >> 8];
215
+ map[nonce >> 8] |= 1 << (nonce & 0xff);
216
+ return cache != map[nonce >> 8];
217
+ }
218
+ return false;
219
+ }
220
+ }
@@ -0,0 +1,27 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma solidity ^0.8.0;
4
+
5
+ /**
6
+ * @title EthReceiver
7
+ * @dev Abstract contract for rejecting direct ETH transfers from EOAs.
8
+ * Implements a custom error and logic to reject ETH deposits from non-contract addresses.
9
+ */
10
+ abstract contract EthReceiver {
11
+ /// @dev Error thrown when an ETH deposit from an EOA is attempted.
12
+ error EthDepositRejected();
13
+
14
+ /// @dev External payable function to receive ETH, automatically rejects deposits from EOAs.
15
+ receive() external payable {
16
+ _receive();
17
+ }
18
+
19
+ /**
20
+ * @dev Internal function containing the logic to reject ETH deposits.
21
+ * Can be overridden by derived contracts for specific behaviors while maintaining the base rejection mechanism.
22
+ */
23
+ function _receive() internal virtual {
24
+ // solhint-disable-next-line avoid-tx-origin
25
+ if (msg.sender == tx.origin) revert EthDepositRejected();
26
+ }
27
+ }
@@ -0,0 +1,31 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma solidity ^0.8.0;
4
+
5
+ import "./EthReceiver.sol";
6
+
7
+ /**
8
+ * @title OnlyWethReceiver
9
+ * @dev Abstract contract extending EthReceiver to accept only ETH deposits from a specified WETH contract.
10
+ * This contract ensures that only wrapped ETH (WETH) can be deposited, rejecting all other direct ETH transfers.
11
+ */
12
+ abstract contract OnlyWethReceiver is EthReceiver {
13
+ /// @notice Address of the WETH contract allowed to deposit ETH.
14
+ address private immutable _WETH; // solhint-disable-line var-name-mixedcase
15
+
16
+ /**
17
+ * @dev Sets the WETH contract address during construction.
18
+ * @param weth Address of the WETH contract.
19
+ */
20
+ constructor(address weth) {
21
+ _WETH = address(weth);
22
+ }
23
+
24
+ /**
25
+ * @dev Overrides _receive to restrict ETH transfers solely to the WETH contract.
26
+ * Reverts with EthDepositRejected if ETH is sent from any other address.
27
+ */
28
+ function _receive() internal virtual override {
29
+ if (msg.sender != _WETH) revert EthDepositRejected();
30
+ }
31
+ }
@@ -0,0 +1,39 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma solidity ^0.8.0;
4
+
5
+ import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
6
+ import { SafeERC20 } from "../libraries/SafeERC20.sol";
7
+
8
+ /**
9
+ * @title PermitAndCall
10
+ * @dev Abstract contract to support permit and action execution in a single transaction.
11
+ * Allows tokens that implement EIP-2612 permits, DAI-like permits, USDC-like permits and Permit2 to be approved and spent in a single transaction.
12
+ */
13
+ abstract contract PermitAndCall {
14
+ using SafeERC20 for IERC20;
15
+
16
+ /**
17
+ * @notice Executes a permit for an ERC20 token and then a specified action in a single transaction.
18
+ * @param permit ERC20 token address (20 bytes) concatinated with the permit data, allowing this contract to spend the token.
19
+ * Format: [token address (20 bytes)][permit data]
20
+ * @param action The data representing the action to be executed after the permit.
21
+ */
22
+ function permitAndCall(bytes calldata permit, bytes calldata action) external payable {
23
+ IERC20(address(bytes20(permit))).tryPermit(permit[20:]);
24
+ // solhint-disable-next-line no-inline-assembly
25
+ assembly ("memory-safe") {
26
+ let ptr := mload(0x40)
27
+ calldatacopy(ptr, action.offset, action.length)
28
+ let success := delegatecall(gas(), address(), ptr, action.length, 0, 0)
29
+ returndatacopy(ptr, 0, returndatasize())
30
+ switch success
31
+ case 0 {
32
+ revert(ptr, returndatasize())
33
+ }
34
+ default {
35
+ return(ptr, returndatasize())
36
+ }
37
+ }
38
+ }
39
+ }
@@ -0,0 +1,32 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma solidity ^0.8.25;
4
+
5
+ /**
6
+ * @title SelfdestructEthSender
7
+ * @notice A one-time-use contract for cost-effective ETH transfers using the `selfdestruct` mechanism.
8
+ * @dev Upon construction, this contract verifies EVM compatibility with the Cancun upgrade, specifically
9
+ * testing for support of transient storage via `tload`. It is intended for single-use, allowing for ETH to
10
+ * be sent more cheaply by self-destructing and sending its balance to a designated address.
11
+ */
12
+ abstract contract SelfdestructEthSender {
13
+ /**
14
+ * @dev Initializes the contract, verifying compatibility with the Cancun EVM upgrade through transient storage support check.
15
+ */
16
+ constructor() {
17
+ // solhint-disable-next-line no-inline-assembly
18
+ assembly ("memory-safe") {
19
+ pop(tload(0))
20
+ }
21
+ }
22
+
23
+ /**
24
+ * @notice Makes the selfdestruct call, transferring the entire ETH balance of the contract to the specified address.
25
+ * Due to EIP-6780 chnges selfdestruct will destroy the contract only if it was created in the same transaction.
26
+ * In other cases it will stop the execution and transfer all the ETH balance saving about 1700 gas comparing to trivial transfer.
27
+ * @param receiver The recipient address of the contract's ETH balance.
28
+ */
29
+ function stopAndTransferBalance(address payable receiver) external {
30
+ selfdestruct(receiver);
31
+ }
32
+ }
@@ -5,7 +5,19 @@ pragma solidity ^0.8.0;
5
5
  import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol";
6
6
  import "./TokenMock.sol";
7
7
 
8
+ /**
9
+ * @title ERC20PermitMock
10
+ * @dev Extends ERC20Permit and TokenMock for testing purposes, incorporating permit functionality.
11
+ * This contract simplifies the testing of ERC20 tokens with permit capabilities by allowing easy setup of initial states.
12
+ */
8
13
  contract ERC20PermitMock is ERC20Permit, TokenMock {
14
+ /**
15
+ * @dev Creates an instance of `ERC20PermitMock` with specified token details and initial token distribution.
16
+ * @param name Name of the ERC20 token.
17
+ * @param symbol Symbol of the ERC20 token.
18
+ * @param initialAccount Address to receive the initial token supply.
19
+ * @param initialBalance Amount of tokens to mint to the `initialAccount`.
20
+ */
9
21
  constructor(
10
22
  string memory name,
11
23
  string memory symbol,
@@ -0,0 +1,27 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ pragma solidity ^0.8.25;
4
+
5
+ import "../mixins/SelfdestructEthSender.sol";
6
+
7
+ /**
8
+ * @title SelfdestructEthSenderMock
9
+ * @notice Mock contract extending SelfdestructEthSender for testing purposes, with added functionality to transfer ETH.
10
+ */
11
+ contract SelfdestructEthSenderMock is SelfdestructEthSender {
12
+ /// @notice Indicates that an attempt to transfer ETH has failed.
13
+ error ETHTransferFailed();
14
+
15
+ /// @notice Allows the contract to receive ETH.
16
+ receive() external payable {}
17
+
18
+ /**
19
+ * @notice Transfers the contract's entire ETH balance to the specified address.
20
+ * @param receiver The address to which the contract's ETH balance will be transferred.
21
+ */
22
+ function transferBalance(address payable receiver) external payable {
23
+ // solhint-disable-next-line avoid-low-level-calls
24
+ (bool success, ) = receiver.call{value: address(this).balance}("");
25
+ if (!success) revert ETHTransferFailed();
26
+ }
27
+ }
@@ -5,9 +5,20 @@ pragma solidity ^0.8.0;
5
5
  import "@openzeppelin/contracts/access/Ownable.sol";
6
6
  import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol";
7
7
 
8
+ /**
9
+ * @title TokenCustomDecimalsMock
10
+ * @dev Extends ERC20Permit token with custom number of decimals and only owner access to `mint` and `burn` functionality.
11
+ */
8
12
  contract TokenCustomDecimalsMock is ERC20Permit, Ownable {
9
13
  uint8 internal immutable _DECIMALS;
10
14
 
15
+ /**
16
+ * @dev Sets up the ERC20 token with a name, symbol, initial amount to mint, and custom decimals.
17
+ * @param name Name of the token.
18
+ * @param symbol Symbol of the token.
19
+ * @param amount Initial amount of tokens to mint to the owner.
20
+ * @param decimals_ Custom number of decimal places for the token.
21
+ */
11
22
  constructor(
12
23
  string memory name,
13
24
  string memory symbol,
@@ -18,19 +29,29 @@ contract TokenCustomDecimalsMock is ERC20Permit, Ownable {
18
29
  _DECIMALS = decimals_;
19
30
  }
20
31
 
32
+ /**
33
+ * @notice Mints tokens to a specified account, callable only by the owner.
34
+ * @param account The address to mint tokens to.
35
+ * @param amount The amount of tokens to mint.
36
+ */
21
37
  function mint(address account, uint256 amount) external onlyOwner {
22
38
  _mint(account, amount);
23
39
  }
24
40
 
41
+ /**
42
+ * @notice Burns tokens from a specified account, callable only by the owner.
43
+ * @param account The address to burn tokens from.
44
+ * @param amount The amount of tokens to burn.
45
+ */
25
46
  function burn(address account, uint256 amount) external onlyOwner {
26
47
  _burn(account, amount);
27
48
  }
28
49
 
50
+ /**
51
+ * @dev Returns the number of decimal places of the token.
52
+ * @return Number of decimal places.
53
+ */
29
54
  function decimals() public view virtual override returns (uint8) {
30
55
  return _DECIMALS;
31
56
  }
32
-
33
- function getChainId() external view returns (uint256) {
34
- return block.chainid;
35
- }
36
57
  }
@@ -5,14 +5,33 @@ pragma solidity ^0.8.0;
5
5
  import "@openzeppelin/contracts/access/Ownable.sol";
6
6
  import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
7
7
 
8
+ /**
9
+ * @title TokenMock
10
+ * @dev Simple ERC20 token mock for testing purposes, with minting and burning capabilities restricted to the owner.
11
+ */
8
12
  contract TokenMock is ERC20, Ownable {
13
+ /**
14
+ * @dev Initializes the contract with token name and symbol, setting the deployer as the owner.
15
+ * @param name Name of the ERC20 token.
16
+ * @param symbol Symbol of the ERC20 token.
17
+ */
9
18
  // solhint-disable-next-line no-empty-blocks
10
19
  constructor(string memory name, string memory symbol) ERC20(name, symbol) Ownable(msg.sender) {}
11
20
 
21
+ /**
22
+ * @notice Mints tokens to a specified account, callable only by the owner.
23
+ * @param account The address to mint tokens to.
24
+ * @param amount The amount of tokens to mint.
25
+ */
12
26
  function mint(address account, uint256 amount) external onlyOwner {
13
27
  _mint(account, amount);
14
28
  }
15
29
 
30
+ /**
31
+ * @notice Burns tokens from a specified account, callable only by the owner.
32
+ * @param account The address to burn tokens from.
33
+ * @param amount The amount of tokens to burn.
34
+ */
16
35
  function burn(address account, uint256 amount) external onlyOwner {
17
36
  _burn(account, amount);
18
37
  }
@@ -0,0 +1,2 @@
1
+ export * from './templates';
2
+ export * from './templates';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ // created from 'create-ts-index'
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const tslib_1 = require("tslib");
5
+ tslib_1.__exportStar(require("./templates"), exports);
6
+ tslib_1.__exportStar(require("./templates"), exports);
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../docgen/index.ts"],"names":[],"mappings":";AAAA,iCAAiC;;;AAEjC,sDAA4B;AAC5B,sDAA4B"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @category Docgen
3
+ * @notice A helper method to get the path to the templates folder.
4
+ * @returns The the path to templates folder.
5
+ */
6
+ export declare function oneInchTemplates(): string;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.oneInchTemplates = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const path_1 = tslib_1.__importDefault(require("path"));
6
+ /**
7
+ * @category Docgen
8
+ * @notice A helper method to get the path to the templates folder.
9
+ * @returns The the path to templates folder.
10
+ */
11
+ function oneInchTemplates() {
12
+ return path_1.default.normalize(path_1.default.join(__dirname, '../../docgen/templates'));
13
+ }
14
+ exports.oneInchTemplates = oneInchTemplates;
15
+ //# sourceMappingURL=templates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../docgen/templates.ts"],"names":[],"mappings":";;;;AAAA,wDAAwB;AAExB;;;;GAIG;AACH,SAAgB,gBAAgB;IAC5B,OAAO,cAAI,CAAC,SAAS,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,wBAAwB,CAAC,CAAC,CAAC;AAC1E,CAAC;AAFD,4CAEC"}
@@ -1,17 +1,40 @@
1
1
  import { ChainConfig } from '@nomicfoundation/hardhat-verify/src/types';
2
2
  import { Network, NetworksUserConfig } from 'hardhat/types';
3
+ /** @internal */
3
4
  export type Etherscan = {
4
5
  apiKey: {
5
6
  [key: string]: string;
6
7
  };
7
8
  customChains: ChainConfig[];
8
9
  };
10
+ /**
11
+ * @category Hardhat-Setup
12
+ * @notice A helper method to get the network name from the command line arguments.
13
+ * @returns The network name.
14
+ */
9
15
  export declare function getNetwork(): string;
16
+ /**
17
+ * @category Hardhat-Setup
18
+ * @notice A helper method to parse RPC configuration strings. Checks that the string is in the expected format.
19
+ * @param envRpc The RPC configuration string to parse.
20
+ * @returns An object containing the RPC URL and optional auth key HTTP header.
21
+ */
10
22
  export declare function parseRpcEnv(envRpc: string): {
11
23
  url: string;
12
24
  authKeyHttpHeader?: string;
13
25
  };
26
+ /**
27
+ * @category Hardhat-Setup
28
+ * @notice A helper method to reset the Hardhat network to the local network or to a fork.
29
+ * @param network The Hardhat network object.
30
+ * @param networkName The name of the network to reset to.
31
+ */
14
32
  export declare function resetHardhatNetworkFork(network: Network, networkName: string): Promise<void>;
33
+ /**
34
+ * @category Hardhat-Setup
35
+ * @notice The Network class is a helper class to register networks and Etherscan API keys.
36
+ * See the [README](https://github.com/1inch/solidity-utils/tree/master/hardhat-setup/README.md) for usage.
37
+ */
15
38
  export declare class Networks {
16
39
  networks: NetworksUserConfig;
17
40
  etherscan: Etherscan;
@@ -3,11 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Networks = exports.resetHardhatNetworkFork = exports.parseRpcEnv = exports.getNetwork = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const dotenv_1 = tslib_1.__importDefault(require("dotenv"));
6
+ /**
7
+ * @category Hardhat-Setup
8
+ * @notice A helper method to get the network name from the command line arguments.
9
+ * @returns The network name.
10
+ */
6
11
  function getNetwork() {
7
12
  const index = process.argv.findIndex((arg) => arg === '--network') + 1;
8
13
  return index !== 0 ? process.argv[index] : 'unknown';
9
14
  }
10
15
  exports.getNetwork = getNetwork;
16
+ /**
17
+ * @category Hardhat-Setup
18
+ * @notice A helper method to parse RPC configuration strings. Checks that the string is in the expected format.
19
+ * @param envRpc The RPC configuration string to parse.
20
+ * @returns An object containing the RPC URL and optional auth key HTTP header.
21
+ */
11
22
  function parseRpcEnv(envRpc) {
12
23
  const [url, authKeyHttpHeader, overflow] = envRpc.split('|');
13
24
  if (overflow || url === '') {
@@ -16,6 +27,12 @@ function parseRpcEnv(envRpc) {
16
27
  return { url, authKeyHttpHeader };
17
28
  }
18
29
  exports.parseRpcEnv = parseRpcEnv;
30
+ /**
31
+ * @category Hardhat-Setup
32
+ * @notice A helper method to reset the Hardhat network to the local network or to a fork.
33
+ * @param network The Hardhat network object.
34
+ * @param networkName The name of the network to reset to.
35
+ */
19
36
  async function resetHardhatNetworkFork(network, networkName) {
20
37
  if (networkName.toLowerCase() === 'hardhat') {
21
38
  await network.provider.request({
@@ -37,6 +54,11 @@ async function resetHardhatNetworkFork(network, networkName) {
37
54
  }
38
55
  }
39
56
  exports.resetHardhatNetworkFork = resetHardhatNetworkFork;
57
+ /**
58
+ * @category Hardhat-Setup
59
+ * @notice The Network class is a helper class to register networks and Etherscan API keys.
60
+ * See the [README](https://github.com/1inch/solidity-utils/tree/master/hardhat-setup/README.md) for usage.
61
+ */
40
62
  class Networks {
41
63
  constructor(useHardhat = true, forkingNetworkName, saveHardhatDeployments = false) {
42
64
  this.networks = {};
@@ -1 +1 @@
1
- {"version":3,"file":"networks.js","sourceRoot":"","sources":["../../hardhat-setup/networks.ts"],"names":[],"mappings":";;;;AAAA,4DAA4B;AAM5B,SAAgB,UAAU;IACtB,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,KAAK,WAAW,CAAC,GAAG,CAAC,CAAC;IACvE,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACzD,CAAC;AAHD,gCAGC;AAED,SAAgB,WAAW,CAAC,MAAc;IACtC,MAAM,CAAE,GAAG,EAAE,iBAAiB,EAAE,QAAQ,CAAE,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC/D,IAAI,QAAQ,IAAI,GAAG,KAAK,EAAE,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,sBAAsB,MAAM,6EAA6E,CAAC,CAAC;IAC/H,CAAC;IACD,OAAO,EAAE,GAAG,EAAE,iBAAiB,EAAE,CAAC;AACtC,CAAC;AAND,kCAMC;AAEM,KAAK,UAAU,uBAAuB,CAAC,OAAgB,EAAE,WAAmB;IAC/E,IAAI,WAAW,CAAC,WAAW,EAAE,KAAK,SAAS,EAAE,CAAC;QAC1C,MAAM,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;YAC3B,MAAM,EAAE,eAAe;YACvB,MAAM,EAAE,EAAE;SACb,CAAC,CAAC;IACP,CAAC;SAAM,CAAC;QACJ,MAAM,EAAE,GAAG,EAAE,iBAAiB,E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