@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
package/README.md CHANGED
@@ -3,223 +3,24 @@
3
3
  <img src="https://github.com/1inch/solidity-utils/blob/master/.github/1inch_github_b.svg#gh-dark-mode-only">
4
4
  </div>
5
5
 
6
- # Utils library for contracts and tests
6
+ # Utility Library for Smart Contracts and Testing
7
7
 
8
8
  [![Build Status](https://github.com/1inch/solidity-utils/workflows/CI/badge.svg)](https://github.com/1inch/solidity-utils/actions)
9
9
  [![Coverage Status](https://codecov.io/gh/1inch/solidity-utils/branch/master/graph/badge.svg?token=HJWBIVXQQA)](https://codecov.io/gh/1inch/solidity-utils)
10
10
  [![NPM Package](https://img.shields.io/npm/v/@1inch/solidity-utils.svg)](https://www.npmjs.org/package/@1inch/solidity-utils)
11
11
 
12
- ### About
12
+ This repository is a comprehensive toolkit designed to streamline and optimize the development, tests and management of smart contracts. This repository serves as a one-stop resource for developers working on Ethereum and EVM-compatible blockchain projects, offering a blend of Solidity contracts with various utilities and optimizations, alongside JavaScript tools for testing, documentation, and project management.
13
13
 
14
- This repository contains frequently used smart contracts, libraries and interfaces. Also it contains utils which are used in tests.
14
+ ## Features
15
15
 
16
- ### Solidity
16
+ - **[Development and Testing](https://github.com/1inch/solidity-utils/blob/master/docs/js/modules/src.md)**: The tools and utilities provided in this section are designed to aid in the development and testing of smart contracts. They help avoid the duplication of helper methods across different repositories by centralizing commonly used functions and scripts. This not only streamlines the development process but also ensures that the latest versions of these helpers are readily available and consistently used throughout your projects. Leveraging these utilities can significantly enhance efficiency and maintainability of your smart contract code.
17
17
 
18
- |directory|.sol|description|
19
- |--|--|--|
20
- |contracts|`EthReceiver`||
21
- |contracts|`Permitable`||
22
- |contracts|`GasChecker`||
23
- |contracts/interfaces|`IDaiLikePermit`|Interface of token which has `permit` method like DAI token|
24
- |contracts/interfaces|`IWETH`|WETH token interface|
25
- |contracts/libraries|`AddressArray`|library for work with array of addresses|
26
- |contracts/libraries|`AddressSet`|library for work with set of addresses|
27
- |contracts/libraries|`RevertReasonParser`|library parse the message from reverted method to readble format|
28
- |contracts/libraries|`StringUtil`|optimized methods to convert data to hex|
29
- |contracts/libraries|`UniERC20`||
18
+ - **[Documentation and Utilities](https://github.com/1inch/solidity-utils/blob/master/utils/README.md)**: A suite of functionalities for generating documentation and additional utilities to enhance development workflow.
30
19
 
31
- ### JS
20
+ - **[Configuration and Management](https://github.com/1inch/solidity-utils/blob/master/docs/js/modules/hardhat_setup.md)**: Tools for setting up Hardhat network configurations and managing project settings efficiently.
32
21
 
33
- |module|function|descrption|
34
- |--|--|--|
35
- |asserts|`assertThrowsAsync(action, msg)`|checks the async function `action()` thrown with message `msg`|
36
- |asserts|`assertRoughlyEqualValues(expected, actual, relativeDiff)`|checks the `expected` value is equal to `actual` value with `relativeDiff` precision|
37
- |utils|`timeIncreaseTo(seconds)`|increases blockchain time to `seconds` sec|
38
- |utils|`trackReceivedToken(token, wallet, txPromise, ...args)`|returns amount of `token` which recieved the `wallet` in async method `txPromise` with arguments `args`|
39
- |utils|`trackReceivedTokenAndTx(token, wallet, txPromise, ...args)`|returns transaction info and amount of `token` which recieved the `wallet` in async method `txPromise` with arguments `args`|
40
- |utils|`fixSignature(signature)`|patchs ganache's signature to geth's version|
41
- |utils|`signMessage(signer, messageHex) `|signs `messageHex` with `signer` and patchs ganache's signature to geth's version|
42
- |utils|`countInstructions(txHash, instruction)`|counts amount of `instruction` in transaction with `txHash` hash|
43
- |utils|`deployAndGetContract(contractName, constructorArgs, deployments, deployer, deploymentName, skipVerify, skipIfAlreadyDeployed, gasPrice, maxPriorityFeePerGas, maxFeePerGas, log, waitConfirmations)`|deploys contract `contractName` as `deploymentName` if not `skipIfAlreadyDeployed` with `constructorArgs` from `deployer` using `hardhat-deploy` `deployments` with additional gas options `gasPrice`, `maxPriorityFeePerGas` and `maxFeePerGas` and outputs results to the console if `log`. Tries to verify it after `waitConfirmations` on Etherscan if not `skipVerify`.|
44
- |profileEVM|`profileEVM(txHash, instruction, optionalTraceFile)`|the same as the `countInstructions()` with option of writing all trace to `optionalTraceFile`|
45
- |profileEVM|`gasspectEVM(txHash, options, optionalTraceFile)`|returns all used operations in `txHash` transaction with `options` and their costs with option of writing all trace to `optionalTraceFile`|
22
+ - **[Solidity Contracts and Libraries](https://github.com/1inch/solidity-utils/blob/master/docs/contracts/SUMMARY.md)**: Frequently used smart contracts, libraries, and interfaces aimed at providing reusable code for common use cases, alongside optimizations to improve contract efficiency.
46
23
 
47
- ### UTILS
24
+ ## Contributing
48
25
 
49
- #### Docify
50
-
51
- Generates documentation in markdown format from natspec docs
52
-
53
- ##### Usage
54
- Add to `package.json` file solidity compiler version and shortcut to run command
55
-
56
- `devDependencies` section
57
-
58
- ```
59
- "solc": "0.8.12",
60
- ```
61
-
62
- `scripts` section
63
- ```
64
- "docify": "npx solidity-utils-docify"
65
- ```
66
-
67
- You can set output directory with ENV variable:
68
- ```
69
- "docify": "DOCGEN_OUTPUT_DIR=./docs npx solidity-utils-docify"
70
- ```
71
-
72
- ...
73
-
74
- #### Dependencies list (imports-list)
75
-
76
- Lists all imports recursively for the given solidity contract file.
77
-
78
- ##### Usage
79
- ```
80
- npx imports-list -i <solidity file> [-a <alias list>]
81
- ```
82
-
83
- Available parameters
84
- ```
85
- Options:
86
- -i, --input <input> file to get dependencies for
87
- -a, --alias [alias...] projects alias list
88
- -h, --help display help for command
89
- ```
90
- Aliases are used to provide source code for third-party projects.
91
- For example, your contract uses imports from your other project and import is defined as
92
- ```
93
- import "@1inch/otherproject/contracts/dependency.sol";
94
- ```
95
- and you've got source code for `@1inch/otherproject` locally. Then you provide local path for the project to rip dependencies from `dependency.sol` as well.
96
- If there are several dependencies they should be provided using space as separator.
97
-
98
- ##### Example
99
- File imports
100
- ```Solidity
101
- #rootFile.sol
102
- import '@1inch/otherproject/contracts/dependency.sol'
103
-
104
- #@1inch/otherproject/contracts/dependency.sol
105
- import 'helpers/helper.sol'
106
- ```
107
- File and folder structure
108
- ```
109
- rootFolder/
110
-
111
- -- mainProject/
112
- ---- contracts/
113
- ------ rootFile.sol
114
-
115
- -- dependencyProject/
116
- ---- helpers/
117
- ------ helper.sol
118
- ---- dependency.sol
119
- ```
120
- Command
121
- ```
122
- rootFolder/mainProject % npx imports-list -i './contracts/rootFile.sol' -a '@1inch/otherproject' '../dependencyProject'
123
- ```
124
- Output
125
- ```
126
- Project => root
127
- not set
128
-
129
- Project => @1inch/otherproject
130
- ../otherproject/contracts/dependency.sol
131
- ../otherproject/contracts/helpers/helper.sol
132
- ```
133
-
134
- #### Test documentation generator (test-docgen)
135
- Script generates documentation for tests in markdown format.
136
- Give descriptions for `describe` and `it` sections and build documentation using these descriptions.
137
-
138
- ##### Example
139
- Test described as shown below
140
-
141
- ```JavaScript
142
- // Test suite
143
- describe('My feature', function() {
144
- // Nested test suite
145
- describe("My subfeature", function() {
146
- /*
147
- **Test case 1**
148
- Test case should work
149
- */
150
- it("My case", function() {
151
- // code here
152
- })
153
- })
154
- })
155
- ```
156
- will generated the following output
157
- ```Markdown
158
-
159
- # My feature
160
-
161
- Test suite
162
-
163
- ## My subfeature
164
-
165
- Nested test suite
166
-
167
- ### My case
168
-
169
- **Test case 1**
170
- Test case should work
171
- ```
172
-
173
- ##### Installation
174
- - Before use install documentation parser
175
- ```
176
- yarn add acquit --dev
177
- ```
178
- - Optionally configure script for default usage. Add to `script` section in `package.json`
179
- ```
180
- "test:docs": "npx test-docgen"
181
- ```
182
- - Optionally configure script for generating test list only. Add to `script` section in `package.json`
183
- ```
184
- "test:docs": "npx test-docgen -l"
185
- ```
186
-
187
- ##### Usage
188
- If script configured
189
- ```
190
- yarn test:docs
191
- ```
192
- or
193
- ```
194
- npx test-docgen
195
- ```
196
-
197
- Available parameters
198
- ```
199
- Options:
200
- -i, --input <input> tests directory (default: "test")
201
- -x, --exclude [exclude] exclude directories and files. omit argument to exclude all subdirectories (default: false)
202
- -o, --output <output> file to write output (default: "TESTS.md")
203
- -c, --code include code (default: false)
204
- -l, --list list tests only, do not include description (default: false)
205
- -d, --debug debug mode (default: false)
206
- -h, --help display help for command
207
- ```
208
- ##### Examples
209
- Generate docs with default input and output
210
- ```
211
- npx test-docgen
212
- ```
213
-
214
- Generate docs for files in folders `tests/mocks` and `tests/utils`
215
- ```
216
- npx test-docgen -i "tests/mocks;tests/utils"
217
- ```
218
- Exclude from docs file `test/mock-exclude.js` and `test/utils folder`
219
- ```
220
- npx test-docgen -x "tests/mock-exclude.js;tests/utils"
221
- ```
222
- Generate list of tests only
223
- ```
224
- npx test-docgen -l
225
- ```
26
+ Contributions are welcome! If you have a suggestion that would make this repository better, or if you have any questions, please feel free to fork the repo and create a pull request. You can also simply open an issue with your suggestion or question.
@@ -2,7 +2,23 @@
2
2
 
3
3
  pragma solidity ^0.8.0;
4
4
 
5
+ /**
6
+ * @title ICreate3Deployer
7
+ * @dev Interface for deploying contracts with deterministic addresses via CREATE3.
8
+ */
5
9
  interface ICreate3Deployer {
10
+ /**
11
+ * @notice Deploys a contract using CREATE3 with a given salt and bytecode.
12
+ * @param salt Unique value to create deterministic address.
13
+ * @param code Contract bytecode to deploy.
14
+ * @return Address of the deployed contract.
15
+ */
6
16
  function deploy(bytes32 salt, bytes calldata code) external returns (address);
17
+
18
+ /**
19
+ * @notice Computes the address of a contract deployed with the given salt.
20
+ * @param salt Unique value used during deployment.
21
+ * @return Address of the contract.
22
+ */
7
23
  function addressOf(bytes32 salt) external view returns (address);
8
24
  }
@@ -2,7 +2,20 @@
2
2
 
3
3
  pragma solidity ^0.8.0;
4
4
 
5
+ /**
6
+ * @title IDaiLikePermit
7
+ * @dev Interface for Dai-like permit function allowing token spending via signatures.
8
+ */
5
9
  interface IDaiLikePermit {
10
+ /**
11
+ * @notice Approves spending of tokens via off-chain signatures.
12
+ * @param holder Token holder's address.
13
+ * @param spender Spender's address.
14
+ * @param nonce Current nonce of the holder.
15
+ * @param expiry Time when the permit expires.
16
+ * @param allowed True to allow, false to disallow spending.
17
+ * @param v, r, s Signature components.
18
+ */
6
19
  function permit(
7
20
  address holder,
8
21
  address spender,
@@ -2,8 +2,20 @@
2
2
 
3
3
  pragma solidity ^0.8.0;
4
4
 
5
+ /**
6
+ * @title IERC20MetadataUppercase
7
+ * @dev Interface for ERC20 token metadata with uppercase naming convention.
8
+ */
5
9
  interface IERC20MetadataUppercase {
10
+ /**
11
+ * @notice Gets the token name.
12
+ * @return Token name.
13
+ */
6
14
  function NAME() external view returns (string memory); // solhint-disable-line func-name-mixedcase
7
15
 
16
+ /**
17
+ * @notice Gets the token symbol.
18
+ * @return Token symbol.
19
+ */
8
20
  function SYMBOL() external view returns (string memory); // solhint-disable-line func-name-mixedcase
9
21
  }
@@ -2,7 +2,20 @@
2
2
 
3
3
  pragma solidity ^0.8.0;
4
4
 
5
+ /**
6
+ * @title IERC7597Permit
7
+ * @dev A new extension for ERC-2612 permit, which has already been added to USDC v2.2.
8
+ */
5
9
  interface IERC7597Permit {
10
+ /**
11
+ * @notice Update allowance with a signed permit.
12
+ * @dev Signature bytes can be used for both EOA wallets and contract wallets.
13
+ * @param owner Token owner's address (Authorizer).
14
+ * @param spender Spender's address.
15
+ * @param value Amount of allowance.
16
+ * @param deadline The time at which the signature expires (unixtime).
17
+ * @param signature Unstructured bytes signature signed by an EOA wallet or a contract wallet.
18
+ */
6
19
  function permit(
7
20
  address owner,
8
21
  address spender,
@@ -2,39 +2,72 @@
2
2
 
3
3
  pragma solidity ^0.8.0;
4
4
 
5
+ /**
6
+ * @title IPermit2
7
+ * @dev Interface for a flexible permit system that extends ERC20 tokens to support permits in tokens lacking native permit functionality.
8
+ */
5
9
  interface IPermit2 {
10
+ /**
11
+ * @dev Struct for holding permit details.
12
+ * @param token ERC20 token address for which the permit is issued.
13
+ * @param amount The maximum amount allowed to spend.
14
+ * @param expiration Timestamp until which the permit is valid.
15
+ * @param nonce An incrementing value for each signature, unique per owner, token, and spender.
16
+ */
6
17
  struct PermitDetails {
7
- // ERC20 token address
8
18
  address token;
9
- // the maximum amount allowed to spend
10
19
  uint160 amount;
11
- // timestamp at which a spender's token allowances become invalid
12
20
  uint48 expiration;
13
- // an incrementing value indexed per owner,token,and spender for each signature
14
21
  uint48 nonce;
15
22
  }
16
- /// @notice The permit message signed for a single token allownce
23
+
24
+ /**
25
+ * @dev Struct for a single token allowance permit.
26
+ * @param details Permit details including token, amount, expiration, and nonce.
27
+ * @param spender Address authorized to spend the tokens.
28
+ * @param sigDeadline Deadline for the permit signature, ensuring timeliness of the permit.
29
+ */
17
30
  struct PermitSingle {
18
- // the permit data for a single token alownce
19
31
  PermitDetails details;
20
- // address permissioned on the allowed tokens
21
32
  address spender;
22
- // deadline on the permit signature
23
33
  uint256 sigDeadline;
24
34
  }
25
- /// @notice Packed allowance
35
+
36
+ /**
37
+ * @dev Struct for packed allowance data to optimize storage.
38
+ * @param amount Amount allowed.
39
+ * @param expiration Permission expiry timestamp.
40
+ * @param nonce Unique incrementing value for tracking allowances.
41
+ */
26
42
  struct PackedAllowance {
27
- // amount allowed
28
43
  uint160 amount;
29
- // permission expiry
30
44
  uint48 expiration;
31
- // an incrementing value indexed per owner,token,and spender for each signature
32
45
  uint48 nonce;
33
46
  }
34
47
 
48
+ /**
49
+ * @notice Executes a token transfer from one address to another.
50
+ * @param user The token owner's address.
51
+ * @param spender The address authorized to spend the tokens.
52
+ * @param amount The amount of tokens to transfer.
53
+ * @param token The address of the token being transferred.
54
+ */
35
55
  function transferFrom(address user, address spender, uint160 amount, address token) external;
36
56
 
57
+ /**
58
+ * @notice Issues a permit for spending tokens via a signed authorization.
59
+ * @param owner The token owner's address.
60
+ * @param permitSingle Struct containing the permit details.
61
+ * @param signature The signature proving the owner authorized the permit.
62
+ */
37
63
  function permit(address owner, PermitSingle memory permitSingle, bytes calldata signature) external;
38
64
 
65
+ /**
66
+ * @notice Retrieves the allowance details between a token owner and spender.
67
+ * @param user The token owner's address.
68
+ * @param token The token address.
69
+ * @param spender The spender's address.
70
+ * @return The packed allowance details.
71
+ */
39
72
  function allowance(address user, address token, address spender) external view returns (PackedAllowance memory);
40
73
  }
@@ -4,12 +4,29 @@ pragma solidity ^0.8.0;
4
4
 
5
5
  import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
6
6
 
7
+ /**
8
+ * @title IWETH
9
+ * @dev Interface for wrapper as WETH-like token.
10
+ */
7
11
  interface IWETH is IERC20 {
12
+ /**
13
+ * @notice Emitted when Ether is deposited to get wrapper tokens.
14
+ */
8
15
  event Deposit(address indexed dst, uint256 wad);
9
16
 
17
+ /**
18
+ * @notice Emitted when wrapper tokens is withdrawn as Ether.
19
+ */
10
20
  event Withdrawal(address indexed src, uint256 wad);
11
21
 
22
+ /**
23
+ * @notice Deposit Ether to get wrapper tokens.
24
+ */
12
25
  function deposit() external payable;
13
26
 
27
+ /**
28
+ * @notice Withdraw wrapped tokens as Ether.
29
+ * @param amount Amount of wrapped tokens to withdraw.
30
+ */
14
31
  function withdraw(uint256 amount) external;
15
32
  }
@@ -2,10 +2,25 @@
2
2
 
3
3
  pragma solidity ^0.8.0;
4
4
 
5
- /// @title Library that implements address array on mapping, stores array length at 0 index.
5
+ /**
6
+ * @title AddressArray
7
+ * @notice Implements a dynamic array of addresses using a mapping for storage efficiency, with the array length stored at index 0.
8
+ * @dev This library provides basic functionalities such as push, pop, set, and retrieval of addresses in a storage-efficient manner.
9
+ */
6
10
  library AddressArray {
11
+ /**
12
+ * @dev Error thrown when attempting to access an index outside the bounds of the array.
13
+ */
7
14
  error IndexOutOfBounds();
15
+
16
+ /**
17
+ * @dev Error thrown when attempting to pop an element from an empty array.
18
+ */
8
19
  error PopFromEmptyArray();
20
+
21
+ /**
22
+ * @dev Error thrown when the output array provided for getting the list of addresses is too small.
23
+ */
9
24
  error OutputArrayTooSmall();
10
25
 
11
26
  uint256 internal constant _ZERO_ADDRESS = 0x8000000000000000000000000000000000000000000000000000000000000000; // Next tx gas optimization
@@ -14,26 +29,40 @@ library AddressArray {
14
29
  uint256 internal constant _ONE_LENGTH = 0x0000000000000000000000010000000000000000000000000000000000000000;
15
30
  uint256 internal constant _LENGTH_OFFSET = 160;
16
31
 
17
- /// @dev Data struct containing raw mapping.
32
+ /**
33
+ * @dev Struct containing the raw mapping used to store the addresses and the array length.
34
+ */
18
35
  struct Data {
19
36
  uint256[1 << 32] _raw;
20
37
  }
21
38
 
22
- /// @dev Length of array.
39
+ /**
40
+ * @notice Returns the number of addresses stored in the array.
41
+ * @param self The instance of the Data struct.
42
+ * @return The number of addresses.
43
+ */
23
44
  function length(Data storage self) internal view returns (uint256) {
24
45
  return (self._raw[0] & _LENGTH_MASK) >> _LENGTH_OFFSET;
25
46
  }
26
47
 
27
- /// @dev Returns data item from `self` storage at `i`.
48
+ /**
49
+ * @notice Retrieves the address at a specified index in the array.
50
+ * @param self The instance of the Data struct.
51
+ * @param i The index to retrieve the address from.
52
+ * @return The address stored at the specified index.
53
+ */
28
54
  function at(Data storage self, uint256 i) internal view returns (address) {
29
55
  if (i >= 1 << 32) revert IndexOutOfBounds();
30
56
  return address(uint160(self._raw[i] & _ADDRESS_MASK));
31
57
  }
32
58
 
33
- /// @dev Returns list of addresses from storage `self`.
59
+ /**
60
+ * @notice Returns all addresses in the array from storage.
61
+ * @param self The instance of the Data struct.
62
+ * @return output Array containing all the addresses.
63
+ */
34
64
  function get(Data storage self) internal view returns (address[] memory output) {
35
- /// @solidity memory-safe-assembly
36
- assembly { // solhint-disable-line no-inline-assembly
65
+ assembly ("memory-safe") { // solhint-disable-line no-inline-assembly
37
66
  let lengthAndFirst := sload(self.slot)
38
67
  let len := shr(_LENGTH_OFFSET, and(lengthAndFirst, _LENGTH_MASK))
39
68
  let fst := and(lengthAndFirst, _ADDRESS_MASK)
@@ -55,12 +84,16 @@ library AddressArray {
55
84
  }
56
85
  }
57
86
 
58
- /// @dev Puts list of addresses from `self` storage into `output` array.
87
+ /**
88
+ * @notice Copies the addresses into the provided output array.
89
+ * @param self The instance of the Data struct.
90
+ * @param input The array to copy the addresses into.
91
+ * @return output The provided output array filled with addresses.
92
+ */
59
93
  function get(Data storage self, address[] memory input) internal view returns (address[] memory output) {
60
94
  output = input;
61
95
  bytes4 err = OutputArrayTooSmall.selector;
62
- /// @solidity memory-safe-assembly
63
- assembly { // solhint-disable-line no-inline-assembly
96
+ assembly ("memory-safe") { // solhint-disable-line no-inline-assembly
64
97
  let lengthAndFirst := sload(self.slot)
65
98
  let len := shr(_LENGTH_OFFSET, and(lengthAndFirst, _LENGTH_MASK))
66
99
  let fst := and(lengthAndFirst, _ADDRESS_MASK)
@@ -81,10 +114,14 @@ library AddressArray {
81
114
  }
82
115
  }
83
116
 
84
- /// @dev Array push back `account` operation on storage `self`.
117
+ /**
118
+ * @notice Adds an address to the end of the array.
119
+ * @param self The instance of the Data struct.
120
+ * @param account The address to add.
121
+ * @return res The new length of the array.
122
+ */
85
123
  function push(Data storage self, address account) internal returns (uint256 res) {
86
- /// @solidity memory-safe-assembly
87
- assembly { // solhint-disable-line no-inline-assembly
124
+ assembly ("memory-safe") { // solhint-disable-line no-inline-assembly
88
125
  let lengthAndFirst := sload(self.slot)
89
126
  let len := shr(_LENGTH_OFFSET, and(lengthAndFirst, _LENGTH_MASK))
90
127
 
@@ -100,11 +137,13 @@ library AddressArray {
100
137
  }
101
138
  }
102
139
 
103
- /// @dev Array pop back operation for storage `self`.
140
+ /**
141
+ * @notice Removes the last address from the array.
142
+ * @param self The instance of the Data struct.
143
+ */
104
144
  function pop(Data storage self) internal {
105
145
  bytes4 err = PopFromEmptyArray.selector;
106
- /// @solidity memory-safe-assembly
107
- assembly { // solhint-disable-line no-inline-assembly
146
+ assembly ("memory-safe") { // solhint-disable-line no-inline-assembly
108
147
  let lengthAndFirst := sload(self.slot)
109
148
  let len := shr(_LENGTH_OFFSET, and(lengthAndFirst, _LENGTH_MASK))
110
149
 
@@ -122,11 +161,14 @@ library AddressArray {
122
161
  }
123
162
  }
124
163
 
125
- /// @dev Array pop back operation for storage `self` that returns popped element.
164
+ /**
165
+ * @notice Array pop back operation for storage `self` that returns popped element.
166
+ * @param self The instance of the Data struct.
167
+ * @return res The address that was removed from the array.
168
+ */
126
169
  function popGet(Data storage self) internal returns(address res) {
127
170
  bytes4 err = PopFromEmptyArray.selector;
128
- /// @solidity memory-safe-assembly
129
- assembly { // solhint-disable-line no-inline-assembly
171
+ assembly ("memory-safe") { // solhint-disable-line no-inline-assembly
130
172
  let lengthAndFirst := sload(self.slot)
131
173
  let len := shr(_LENGTH_OFFSET, and(lengthAndFirst, _LENGTH_MASK))
132
174
 
@@ -146,11 +188,15 @@ library AddressArray {
146
188
  }
147
189
  }
148
190
 
149
- /// @dev Set element for storage `self` at `index` to `account`.
191
+ /**
192
+ * @notice Sets the address at a specified index in the array.
193
+ * @param self The instance of the Data struct.
194
+ * @param index The index at which to set the address.
195
+ * @param account The address to set at the specified index.
196
+ */
150
197
  function set(Data storage self, uint256 index, address account) internal {
151
198
  bytes4 err = IndexOutOfBounds.selector;
152
- /// @solidity memory-safe-assembly
153
- assembly { // solhint-disable-line no-inline-assembly
199
+ assembly ("memory-safe") { // solhint-disable-line no-inline-assembly
154
200
  let lengthAndFirst := sload(self.slot)
155
201
  let len := shr(_LENGTH_OFFSET, and(lengthAndFirst, _LENGTH_MASK))
156
202
  let fst := and(lengthAndFirst, _ADDRESS_MASK)
@@ -170,10 +216,12 @@ library AddressArray {
170
216
  }
171
217
  }
172
218
 
173
- /// @dev Erase length of the array
219
+ /**
220
+ * @notice Erase length of the array.
221
+ * @param self The instance of the Data struct.
222
+ */
174
223
  function erase(Data storage self) internal {
175
- /// @solidity memory-safe-assembly
176
- assembly { // solhint-disable-line no-inline-assembly
224
+ assembly ("memory-safe") { // solhint-disable-line no-inline-assembly
177
225
  sstore(self.slot, _ADDRESS_MASK)
178
226
  }
179
227
  }
@@ -5,7 +5,8 @@ pragma solidity ^0.8.0;
5
5
  type Address is uint256;
6
6
 
7
7
  /**
8
- * @dev Library for working with addresses encoded as uint256 values, which can include flags in the highest bits.
8
+ * @notice AddressLib
9
+ * @notice Library for working with addresses encoded as uint256 values, which can include flags in the highest bits.
9
10
  */
10
11
  library AddressLib {
11
12
  uint256 private constant _LOW_160_BIT_MASK = (1 << 160) - 1;