@diwantanushh/rapiddex-contracts 1.0.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 (1196) hide show
  1. package/lib/openzeppelin-contracts/contracts/drafts/IERC20Permit.sol +14 -0
  2. package/lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol +14 -0
  3. package/lib/openzeppelin-contracts/contracts/token/ERC721/ERC721.sol +227 -0
  4. package/lib/openzeppelin-contracts/contracts/token/ERC721/IERC721.sol +20 -0
  5. package/lib/openzeppelin-contracts/contracts/token/ERC721/IERC721Enumerable.sol +10 -0
  6. package/lib/openzeppelin-contracts/contracts/token/ERC721/IERC721Metadata.sol +10 -0
  7. package/lib/openzeppelin-contracts/contracts/token/ERC721/IERC721Receiver.sol +8 -0
  8. package/lib/openzeppelin-contracts/contracts/utils/Address.sol +12 -0
  9. package/lib/openzeppelin-contracts/contracts/utils/Context.sol +8 -0
  10. package/lib/openzeppelin-contracts/contracts/utils/introspection/ERC165.sol +10 -0
  11. package/lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol +6 -0
  12. package/lib/openzeppelin-contracts-master/.changeset/better-tires-pull.md +5 -0
  13. package/lib/openzeppelin-contracts-master/.changeset/blue-jars-lay.md +5 -0
  14. package/lib/openzeppelin-contracts-master/.changeset/bright-cooks-brush.md +5 -0
  15. package/lib/openzeppelin-contracts-master/.changeset/chatty-dryers-joke.md +5 -0
  16. package/lib/openzeppelin-contracts-master/.changeset/config.json +12 -0
  17. package/lib/openzeppelin-contracts-master/.changeset/cool-clocks-tick.md +5 -0
  18. package/lib/openzeppelin-contracts-master/.changeset/curly-pandas-flow.md +5 -0
  19. package/lib/openzeppelin-contracts-master/.changeset/flat-flies-hear.md +5 -0
  20. package/lib/openzeppelin-contracts-master/.changeset/floppy-symbols-burn.md +5 -0
  21. package/lib/openzeppelin-contracts-master/.changeset/fruity-coats-smash.md +5 -0
  22. package/lib/openzeppelin-contracts-master/.changeset/gentle-apples-dance.md +5 -0
  23. package/lib/openzeppelin-contracts-master/.changeset/happy-pants-decide.md +5 -0
  24. package/lib/openzeppelin-contracts-master/.changeset/heavy-pots-reply.md +5 -0
  25. package/lib/openzeppelin-contracts-master/.changeset/legal-cameras-sin.md +5 -0
  26. package/lib/openzeppelin-contracts-master/.changeset/rare-bushes-march.md +5 -0
  27. package/lib/openzeppelin-contracts-master/.changeset/red-gifts-appear.md +5 -0
  28. package/lib/openzeppelin-contracts-master/.changeset/silver-falcons-lay.md +5 -0
  29. package/lib/openzeppelin-contracts-master/.changeset/smooth-cows-notice.md +5 -0
  30. package/lib/openzeppelin-contracts-master/.changeset/some-dolls-shine.md +5 -0
  31. package/lib/openzeppelin-contracts-master/.changeset/spicy-seals-bake.md +5 -0
  32. package/lib/openzeppelin-contracts-master/.changeset/sweet-houses-cheer.md +5 -0
  33. package/lib/openzeppelin-contracts-master/.changeset/swift-trees-build.md +5 -0
  34. package/lib/openzeppelin-contracts-master/.changeset/tame-rules-run.md +5 -0
  35. package/lib/openzeppelin-contracts-master/.changeset/tangy-jokes-begin.md +5 -0
  36. package/lib/openzeppelin-contracts-master/.changeset/tidy-turkeys-build.md +5 -0
  37. package/lib/openzeppelin-contracts-master/.codecov.yml +16 -0
  38. package/lib/openzeppelin-contracts-master/.editorconfig +21 -0
  39. package/lib/openzeppelin-contracts-master/.gitattributes +3 -0
  40. package/lib/openzeppelin-contracts-master/.github/CODEOWNERS +10 -0
  41. package/lib/openzeppelin-contracts-master/.github/ISSUE_TEMPLATE/bug_report.md +21 -0
  42. package/lib/openzeppelin-contracts-master/.github/ISSUE_TEMPLATE/config.yml +4 -0
  43. package/lib/openzeppelin-contracts-master/.github/ISSUE_TEMPLATE/feature_request.md +14 -0
  44. package/lib/openzeppelin-contracts-master/.github/PULL_REQUEST_TEMPLATE.md +20 -0
  45. package/lib/openzeppelin-contracts-master/.github/actions/gas-compare/action.yml +51 -0
  46. package/lib/openzeppelin-contracts-master/.github/actions/setup/action.yml +108 -0
  47. package/lib/openzeppelin-contracts-master/.github/actions/storage-layout/action.yml +57 -0
  48. package/lib/openzeppelin-contracts-master/.github/workflows/actionlint.yml +18 -0
  49. package/lib/openzeppelin-contracts-master/.github/workflows/changeset.yml +28 -0
  50. package/lib/openzeppelin-contracts-master/.github/workflows/checks.yml +132 -0
  51. package/lib/openzeppelin-contracts-master/.github/workflows/docs.yml +19 -0
  52. package/lib/openzeppelin-contracts-master/.github/workflows/formal-verification.yml +63 -0
  53. package/lib/openzeppelin-contracts-master/.github/workflows/release-cycle.yml +212 -0
  54. package/lib/openzeppelin-contracts-master/.github/workflows/release-upgradeable.yml +97 -0
  55. package/lib/openzeppelin-contracts-master/.github/workflows/upgradeable.yml +35 -0
  56. package/lib/openzeppelin-contracts-master/.gitmodules +10 -0
  57. package/lib/openzeppelin-contracts-master/.husky/pre-commit +2 -0
  58. package/lib/openzeppelin-contracts-master/.mocharc.js +4 -0
  59. package/lib/openzeppelin-contracts-master/.prettierrc +15 -0
  60. package/lib/openzeppelin-contracts-master/.solcover.js +21 -0
  61. package/lib/openzeppelin-contracts-master/CHANGELOG.md +1424 -0
  62. package/lib/openzeppelin-contracts-master/CODE_OF_CONDUCT.md +73 -0
  63. package/lib/openzeppelin-contracts-master/CONTRIBUTING.md +36 -0
  64. package/lib/openzeppelin-contracts-master/FUNDING.json +10 -0
  65. package/lib/openzeppelin-contracts-master/GUIDELINES.md +170 -0
  66. package/lib/openzeppelin-contracts-master/LICENSE +22 -0
  67. package/lib/openzeppelin-contracts-master/README.md +122 -0
  68. package/lib/openzeppelin-contracts-master/RELEASING.md +45 -0
  69. package/lib/openzeppelin-contracts-master/SECURITY.md +43 -0
  70. package/lib/openzeppelin-contracts-master/audits/2017-03.md +292 -0
  71. package/lib/openzeppelin-contracts-master/audits/2018-10.pdf +0 -0
  72. package/lib/openzeppelin-contracts-master/audits/2022-10-Checkpoints.pdf +0 -0
  73. package/lib/openzeppelin-contracts-master/audits/2022-10-ERC4626.pdf +0 -0
  74. package/lib/openzeppelin-contracts-master/audits/2023-05-v4.9.pdf +0 -0
  75. package/lib/openzeppelin-contracts-master/audits/2023-10-v5.0.pdf +0 -0
  76. package/lib/openzeppelin-contracts-master/audits/2024-10-v5.1.pdf +0 -0
  77. package/lib/openzeppelin-contracts-master/audits/2024-12-v5.2.pdf +0 -0
  78. package/lib/openzeppelin-contracts-master/audits/2025-04-v5.3.pdf +0 -0
  79. package/lib/openzeppelin-contracts-master/audits/2025-07-v5.4.pdf +0 -0
  80. package/lib/openzeppelin-contracts-master/audits/2025-10-v5.5.pdf +0 -0
  81. package/lib/openzeppelin-contracts-master/audits/2025-11-RLP.pdf +0 -0
  82. package/lib/openzeppelin-contracts-master/audits/2026-02-v5.6.pdf +0 -0
  83. package/lib/openzeppelin-contracts-master/audits/README.md +24 -0
  84. package/lib/openzeppelin-contracts-master/contracts/access/AccessControl.sol +207 -0
  85. package/lib/openzeppelin-contracts-master/contracts/access/IAccessControl.sol +98 -0
  86. package/lib/openzeppelin-contracts-master/contracts/access/Ownable.sol +100 -0
  87. package/lib/openzeppelin-contracts-master/contracts/access/Ownable2Step.sol +67 -0
  88. package/lib/openzeppelin-contracts-master/contracts/access/README.adoc +45 -0
  89. package/lib/openzeppelin-contracts-master/contracts/access/extensions/AccessControlDefaultAdminRules.sol +372 -0
  90. package/lib/openzeppelin-contracts-master/contracts/access/extensions/AccessControlEnumerable.sol +81 -0
  91. package/lib/openzeppelin-contracts-master/contracts/access/extensions/IAccessControlDefaultAdminRules.sol +192 -0
  92. package/lib/openzeppelin-contracts-master/contracts/access/extensions/IAccessControlEnumerable.sol +31 -0
  93. package/lib/openzeppelin-contracts-master/contracts/access/manager/AccessManaged.sol +112 -0
  94. package/lib/openzeppelin-contracts-master/contracts/access/manager/AccessManager.sol +751 -0
  95. package/lib/openzeppelin-contracts-master/contracts/access/manager/AuthorityUtils.sol +36 -0
  96. package/lib/openzeppelin-contracts-master/contracts/access/manager/IAccessManaged.sol +32 -0
  97. package/lib/openzeppelin-contracts-master/contracts/access/manager/IAccessManager.sol +404 -0
  98. package/lib/openzeppelin-contracts-master/contracts/access/manager/IAuthority.sol +14 -0
  99. package/lib/openzeppelin-contracts-master/contracts/account/Account.sol +151 -0
  100. package/lib/openzeppelin-contracts-master/contracts/account/README.adoc +30 -0
  101. package/lib/openzeppelin-contracts-master/contracts/account/extensions/draft-AccountERC7579.sol +420 -0
  102. package/lib/openzeppelin-contracts-master/contracts/account/extensions/draft-AccountERC7579Hooked.sol +171 -0
  103. package/lib/openzeppelin-contracts-master/contracts/account/extensions/draft-ERC7821.sol +70 -0
  104. package/lib/openzeppelin-contracts-master/contracts/account/utils/EIP7702Utils.sol +21 -0
  105. package/lib/openzeppelin-contracts-master/contracts/account/utils/draft-ERC4337Utils.sol +279 -0
  106. package/lib/openzeppelin-contracts-master/contracts/account/utils/draft-ERC7579Utils.sol +280 -0
  107. package/lib/openzeppelin-contracts-master/contracts/crosschain/CrosschainLinked.sol +109 -0
  108. package/lib/openzeppelin-contracts-master/contracts/crosschain/CrosschainRemoteExecutor.sol +98 -0
  109. package/lib/openzeppelin-contracts-master/contracts/crosschain/ERC7786Recipient.sol +66 -0
  110. package/lib/openzeppelin-contracts-master/contracts/crosschain/README.adoc +44 -0
  111. package/lib/openzeppelin-contracts-master/contracts/crosschain/bridges/BridgeERC1155.sol +101 -0
  112. package/lib/openzeppelin-contracts-master/contracts/crosschain/bridges/BridgeERC20.sol +37 -0
  113. package/lib/openzeppelin-contracts-master/contracts/crosschain/bridges/BridgeERC721.sol +61 -0
  114. package/lib/openzeppelin-contracts-master/contracts/crosschain/bridges/BridgeERC7802.sol +34 -0
  115. package/lib/openzeppelin-contracts-master/contracts/crosschain/bridges/abstract/BridgeFungible.sol +83 -0
  116. package/lib/openzeppelin-contracts-master/contracts/crosschain/bridges/abstract/BridgeMultiToken.sol +92 -0
  117. package/lib/openzeppelin-contracts-master/contracts/crosschain/bridges/abstract/BridgeNonFungible.sol +75 -0
  118. package/lib/openzeppelin-contracts-master/contracts/finance/README.adoc +14 -0
  119. package/lib/openzeppelin-contracts-master/contracts/finance/VestingWallet.sol +160 -0
  120. package/lib/openzeppelin-contracts-master/contracts/finance/VestingWalletCliff.sol +54 -0
  121. package/lib/openzeppelin-contracts-master/contracts/governance/Governor.sol +820 -0
  122. package/lib/openzeppelin-contracts-master/contracts/governance/IGovernor.sol +449 -0
  123. package/lib/openzeppelin-contracts-master/contracts/governance/README.adoc +201 -0
  124. package/lib/openzeppelin-contracts-master/contracts/governance/TimelockController.sol +470 -0
  125. package/lib/openzeppelin-contracts-master/contracts/governance/extensions/GovernorCountingFractional.sol +190 -0
  126. package/lib/openzeppelin-contracts-master/contracts/governance/extensions/GovernorCountingOverridable.sol +222 -0
  127. package/lib/openzeppelin-contracts-master/contracts/governance/extensions/GovernorCountingSimple.sol +96 -0
  128. package/lib/openzeppelin-contracts-master/contracts/governance/extensions/GovernorCrosschain.sol +30 -0
  129. package/lib/openzeppelin-contracts-master/contracts/governance/extensions/GovernorNoncesKeyed.sol +91 -0
  130. package/lib/openzeppelin-contracts-master/contracts/governance/extensions/GovernorPreventLateQuorum.sol +92 -0
  131. package/lib/openzeppelin-contracts-master/contracts/governance/extensions/GovernorProposalGuardian.sol +59 -0
  132. package/lib/openzeppelin-contracts-master/contracts/governance/extensions/GovernorSequentialProposalId.sol +75 -0
  133. package/lib/openzeppelin-contracts-master/contracts/governance/extensions/GovernorSettings.sol +106 -0
  134. package/lib/openzeppelin-contracts-master/contracts/governance/extensions/GovernorStorage.sol +134 -0
  135. package/lib/openzeppelin-contracts-master/contracts/governance/extensions/GovernorSuperQuorum.sol +59 -0
  136. package/lib/openzeppelin-contracts-master/contracts/governance/extensions/GovernorTimelockAccess.sol +346 -0
  137. package/lib/openzeppelin-contracts-master/contracts/governance/extensions/GovernorTimelockCompound.sol +162 -0
  138. package/lib/openzeppelin-contracts-master/contracts/governance/extensions/GovernorTimelockControl.sol +167 -0
  139. package/lib/openzeppelin-contracts-master/contracts/governance/extensions/GovernorVotes.sol +64 -0
  140. package/lib/openzeppelin-contracts-master/contracts/governance/extensions/GovernorVotesQuorumFraction.sol +113 -0
  141. package/lib/openzeppelin-contracts-master/contracts/governance/extensions/GovernorVotesSuperQuorumFraction.sol +135 -0
  142. package/lib/openzeppelin-contracts-master/contracts/governance/utils/IVotes.sol +60 -0
  143. package/lib/openzeppelin-contracts-master/contracts/governance/utils/Votes.sol +245 -0
  144. package/lib/openzeppelin-contracts-master/contracts/governance/utils/VotesExtended.sol +85 -0
  145. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC1155.sol +6 -0
  146. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC1155MetadataURI.sol +6 -0
  147. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC1155Receiver.sol +6 -0
  148. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC1271.sol +17 -0
  149. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC1363.sol +86 -0
  150. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC1363Receiver.sol +32 -0
  151. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC1363Spender.sol +26 -0
  152. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC165.sol +6 -0
  153. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC1820Implementer.sol +20 -0
  154. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC1820Registry.sol +112 -0
  155. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC1967.sol +24 -0
  156. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC20.sol +6 -0
  157. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC20Metadata.sol +6 -0
  158. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC2309.sol +19 -0
  159. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC2612.sol +8 -0
  160. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC2981.sol +26 -0
  161. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC3156.sol +7 -0
  162. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC3156FlashBorrower.sol +27 -0
  163. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC3156FlashLender.sol +41 -0
  164. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC4626.sol +230 -0
  165. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC4906.sol +20 -0
  166. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC5267.sol +28 -0
  167. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC5313.sol +16 -0
  168. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC5805.sol +9 -0
  169. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC6372.sol +17 -0
  170. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC6909.sol +125 -0
  171. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC721.sol +6 -0
  172. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC721Enumerable.sol +6 -0
  173. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC721Metadata.sol +6 -0
  174. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC721Receiver.sol +6 -0
  175. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC7751.sol +12 -0
  176. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC777.sol +200 -0
  177. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC777Recipient.sol +35 -0
  178. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC777Sender.sol +35 -0
  179. package/lib/openzeppelin-contracts-master/contracts/interfaces/IERC7913.sol +18 -0
  180. package/lib/openzeppelin-contracts-master/contracts/interfaces/README.adoc +138 -0
  181. package/lib/openzeppelin-contracts-master/contracts/interfaces/draft-IERC1822.sol +20 -0
  182. package/lib/openzeppelin-contracts-master/contracts/interfaces/draft-IERC4337.sol +255 -0
  183. package/lib/openzeppelin-contracts-master/contracts/interfaces/draft-IERC6093.sol +162 -0
  184. package/lib/openzeppelin-contracts-master/contracts/interfaces/draft-IERC7579.sol +227 -0
  185. package/lib/openzeppelin-contracts-master/contracts/interfaces/draft-IERC7674.sol +17 -0
  186. package/lib/openzeppelin-contracts-master/contracts/interfaces/draft-IERC7786.sol +64 -0
  187. package/lib/openzeppelin-contracts-master/contracts/interfaces/draft-IERC7802.sol +32 -0
  188. package/lib/openzeppelin-contracts-master/contracts/interfaces/draft-IERC7821.sol +44 -0
  189. package/lib/openzeppelin-contracts-master/contracts/metatx/ERC2771Context.sol +90 -0
  190. package/lib/openzeppelin-contracts-master/contracts/metatx/ERC2771Forwarder.sol +379 -0
  191. package/lib/openzeppelin-contracts-master/contracts/metatx/README.adoc +17 -0
  192. package/lib/openzeppelin-contracts-master/contracts/mocks/AccessManagedTarget.sol +34 -0
  193. package/lib/openzeppelin-contracts-master/contracts/mocks/AccessManagerMock.sol +20 -0
  194. package/lib/openzeppelin-contracts-master/contracts/mocks/ArraysMock.sol +171 -0
  195. package/lib/openzeppelin-contracts-master/contracts/mocks/AuthorityMock.sol +69 -0
  196. package/lib/openzeppelin-contracts-master/contracts/mocks/Base64Dirty.sol +19 -0
  197. package/lib/openzeppelin-contracts-master/contracts/mocks/BatchCaller.sol +20 -0
  198. package/lib/openzeppelin-contracts-master/contracts/mocks/CallReceiverMock.sol +107 -0
  199. package/lib/openzeppelin-contracts-master/contracts/mocks/ConstructorMock.sol +34 -0
  200. package/lib/openzeppelin-contracts-master/contracts/mocks/ContextMock.sol +35 -0
  201. package/lib/openzeppelin-contracts-master/contracts/mocks/DummyImplementation.sol +61 -0
  202. package/lib/openzeppelin-contracts-master/contracts/mocks/EIP712Verifier.sol +16 -0
  203. package/lib/openzeppelin-contracts-master/contracts/mocks/ERC1271WalletMock.sol +24 -0
  204. package/lib/openzeppelin-contracts-master/contracts/mocks/ERC165Mock.sol +100 -0
  205. package/lib/openzeppelin-contracts-master/contracts/mocks/ERC2771ContextMock.sol +28 -0
  206. package/lib/openzeppelin-contracts-master/contracts/mocks/ERC3156FlashBorrowerMock.sol +53 -0
  207. package/lib/openzeppelin-contracts-master/contracts/mocks/EtherReceiverMock.sol +17 -0
  208. package/lib/openzeppelin-contracts-master/contracts/mocks/InitializableMock.sol +130 -0
  209. package/lib/openzeppelin-contracts-master/contracts/mocks/MerkleProofCustomHashMock.sol +62 -0
  210. package/lib/openzeppelin-contracts-master/contracts/mocks/MerkleTreeMock.sol +52 -0
  211. package/lib/openzeppelin-contracts-master/contracts/mocks/MulticallHelper.sol +23 -0
  212. package/lib/openzeppelin-contracts-master/contracts/mocks/MultipleInheritanceInitializableMocks.sol +131 -0
  213. package/lib/openzeppelin-contracts-master/contracts/mocks/PausableMock.sol +31 -0
  214. package/lib/openzeppelin-contracts-master/contracts/mocks/ReentrancyAttack.sol +17 -0
  215. package/lib/openzeppelin-contracts-master/contracts/mocks/ReentrancyMock.sol +59 -0
  216. package/lib/openzeppelin-contracts-master/contracts/mocks/ReentrancyTransientMock.sol +59 -0
  217. package/lib/openzeppelin-contracts-master/contracts/mocks/RegressionImplementation.sol +61 -0
  218. package/lib/openzeppelin-contracts-master/contracts/mocks/SingleInheritanceInitializableMocks.sol +49 -0
  219. package/lib/openzeppelin-contracts-master/contracts/mocks/Stateless.sol +64 -0
  220. package/lib/openzeppelin-contracts-master/contracts/mocks/StorageSlotMock.sol +87 -0
  221. package/lib/openzeppelin-contracts-master/contracts/mocks/TimelockReentrant.sol +26 -0
  222. package/lib/openzeppelin-contracts-master/contracts/mocks/TransientSlotMock.sol +61 -0
  223. package/lib/openzeppelin-contracts-master/contracts/mocks/UpgradeableBeaconMock.sol +27 -0
  224. package/lib/openzeppelin-contracts-master/contracts/mocks/VotesExtendedMock.sol +44 -0
  225. package/lib/openzeppelin-contracts-master/contracts/mocks/VotesMock.sol +44 -0
  226. package/lib/openzeppelin-contracts-master/contracts/mocks/account/AccountMock.sol +181 -0
  227. package/lib/openzeppelin-contracts-master/contracts/mocks/account/modules/ERC7579Mock.sol +141 -0
  228. package/lib/openzeppelin-contracts-master/contracts/mocks/account/utils/ERC7579UtilsMock.sol +23 -0
  229. package/lib/openzeppelin-contracts-master/contracts/mocks/compound/CompTimelock.sol +174 -0
  230. package/lib/openzeppelin-contracts-master/contracts/mocks/crosschain/ERC7786GatewayMock.sol +56 -0
  231. package/lib/openzeppelin-contracts-master/contracts/mocks/crosschain/ERC7786RecipientMock.sol +31 -0
  232. package/lib/openzeppelin-contracts-master/contracts/mocks/docs/AccessManagerEnumerable.sol +161 -0
  233. package/lib/openzeppelin-contracts-master/contracts/mocks/docs/ERC20WithAutoMinerReward.sol +22 -0
  234. package/lib/openzeppelin-contracts-master/contracts/mocks/docs/ERC4626Fees.sol +109 -0
  235. package/lib/openzeppelin-contracts-master/contracts/mocks/docs/MyNFT.sol +9 -0
  236. package/lib/openzeppelin-contracts-master/contracts/mocks/docs/access-control/AccessControlERC20MintBase.sol +25 -0
  237. package/lib/openzeppelin-contracts-master/contracts/mocks/docs/access-control/AccessControlERC20MintMissing.sol +24 -0
  238. package/lib/openzeppelin-contracts-master/contracts/mocks/docs/access-control/AccessControlERC20MintOnlyRole.sol +23 -0
  239. package/lib/openzeppelin-contracts-master/contracts/mocks/docs/access-control/AccessControlModified.sol +14 -0
  240. package/lib/openzeppelin-contracts-master/contracts/mocks/docs/access-control/AccessManagedERC20MintBase.sol +16 -0
  241. package/lib/openzeppelin-contracts-master/contracts/mocks/docs/access-control/MyContractOwnable.sol +17 -0
  242. package/lib/openzeppelin-contracts-master/contracts/mocks/docs/account/MyAccountEIP7702.sol +20 -0
  243. package/lib/openzeppelin-contracts-master/contracts/mocks/docs/account/MyFactoryAccount.sol +37 -0
  244. package/lib/openzeppelin-contracts-master/contracts/mocks/docs/governance/MyGovernor.sol +80 -0
  245. package/lib/openzeppelin-contracts-master/contracts/mocks/docs/governance/MyToken.sol +21 -0
  246. package/lib/openzeppelin-contracts-master/contracts/mocks/docs/governance/MyTokenTimestampBased.sol +32 -0
  247. package/lib/openzeppelin-contracts-master/contracts/mocks/docs/governance/MyTokenWrapped.sol +28 -0
  248. package/lib/openzeppelin-contracts-master/contracts/mocks/docs/token/ERC1155/GameItems.sol +21 -0
  249. package/lib/openzeppelin-contracts-master/contracts/mocks/docs/token/ERC1155/MyERC115HolderContract.sol +7 -0
  250. package/lib/openzeppelin-contracts-master/contracts/mocks/docs/token/ERC20/GLDToken.sol +11 -0
  251. package/lib/openzeppelin-contracts-master/contracts/mocks/docs/token/ERC6909/ERC6909GameItems.sol +26 -0
  252. package/lib/openzeppelin-contracts-master/contracts/mocks/docs/token/ERC721/GameItem.sol +19 -0
  253. package/lib/openzeppelin-contracts-master/contracts/mocks/docs/utilities/Base64NFT.sol +27 -0
  254. package/lib/openzeppelin-contracts-master/contracts/mocks/docs/utilities/Multicall.sol +15 -0
  255. package/lib/openzeppelin-contracts-master/contracts/mocks/governance/GovernorCountingOverridableMock.sol +18 -0
  256. package/lib/openzeppelin-contracts-master/contracts/mocks/governance/GovernorCrosschain.sol +20 -0
  257. package/lib/openzeppelin-contracts-master/contracts/mocks/governance/GovernorFractionalMock.sol +14 -0
  258. package/lib/openzeppelin-contracts-master/contracts/mocks/governance/GovernorMock.sol +14 -0
  259. package/lib/openzeppelin-contracts-master/contracts/mocks/governance/GovernorNoncesKeyedMock.sol +44 -0
  260. package/lib/openzeppelin-contracts-master/contracts/mocks/governance/GovernorPreventLateQuorumMock.sol +40 -0
  261. package/lib/openzeppelin-contracts-master/contracts/mocks/governance/GovernorProposalGuardianMock.sol +27 -0
  262. package/lib/openzeppelin-contracts-master/contracts/mocks/governance/GovernorSequentialProposalIdMock.sol +39 -0
  263. package/lib/openzeppelin-contracts-master/contracts/mocks/governance/GovernorStorageMock.sol +79 -0
  264. package/lib/openzeppelin-contracts-master/contracts/mocks/governance/GovernorSuperQuorumMock.sol +95 -0
  265. package/lib/openzeppelin-contracts-master/contracts/mocks/governance/GovernorTimelockAccessMock.sol +70 -0
  266. package/lib/openzeppelin-contracts-master/contracts/mocks/governance/GovernorTimelockCompoundMock.sol +69 -0
  267. package/lib/openzeppelin-contracts-master/contracts/mocks/governance/GovernorTimelockControlMock.sol +69 -0
  268. package/lib/openzeppelin-contracts-master/contracts/mocks/governance/GovernorVoteMock.sol +20 -0
  269. package/lib/openzeppelin-contracts-master/contracts/mocks/governance/GovernorVotesSuperQuorumFractionMock.sol +37 -0
  270. package/lib/openzeppelin-contracts-master/contracts/mocks/governance/GovernorWithParamsMock.sol +51 -0
  271. package/lib/openzeppelin-contracts-master/contracts/mocks/proxy/BadBeacon.sol +11 -0
  272. package/lib/openzeppelin-contracts-master/contracts/mocks/proxy/ClashingImplementation.sol +19 -0
  273. package/lib/openzeppelin-contracts-master/contracts/mocks/proxy/ERC1967ProxyUnsafe.sol +13 -0
  274. package/lib/openzeppelin-contracts-master/contracts/mocks/proxy/UUPSUpgradeableMock.sol +35 -0
  275. package/lib/openzeppelin-contracts-master/contracts/mocks/token/ERC1155ReceiverMock.sol +74 -0
  276. package/lib/openzeppelin-contracts-master/contracts/mocks/token/ERC1363ForceApproveMock.sol +13 -0
  277. package/lib/openzeppelin-contracts-master/contracts/mocks/token/ERC1363NoReturnMock.sol +33 -0
  278. package/lib/openzeppelin-contracts-master/contracts/mocks/token/ERC1363ReceiverMock.sol +52 -0
  279. package/lib/openzeppelin-contracts-master/contracts/mocks/token/ERC1363ReturnFalseMock.sol +34 -0
  280. package/lib/openzeppelin-contracts-master/contracts/mocks/token/ERC1363SpenderMock.sol +47 -0
  281. package/lib/openzeppelin-contracts-master/contracts/mocks/token/ERC20ApprovalMock.sol +10 -0
  282. package/lib/openzeppelin-contracts-master/contracts/mocks/token/ERC20BridgeableMock.sol +30 -0
  283. package/lib/openzeppelin-contracts-master/contracts/mocks/token/ERC20DecimalsMock.sol +17 -0
  284. package/lib/openzeppelin-contracts-master/contracts/mocks/token/ERC20ExcessDecimalsMock.sol +9 -0
  285. package/lib/openzeppelin-contracts-master/contracts/mocks/token/ERC20FlashMintMock.sol +26 -0
  286. package/lib/openzeppelin-contracts-master/contracts/mocks/token/ERC20ForceApproveMock.sol +13 -0
  287. package/lib/openzeppelin-contracts-master/contracts/mocks/token/ERC20GetterHelper.sol +38 -0
  288. package/lib/openzeppelin-contracts-master/contracts/mocks/token/ERC20Mock.sol +16 -0
  289. package/lib/openzeppelin-contracts-master/contracts/mocks/token/ERC20MulticallMock.sol +8 -0
  290. package/lib/openzeppelin-contracts-master/contracts/mocks/token/ERC20NoReturnMock.sol +30 -0
  291. package/lib/openzeppelin-contracts-master/contracts/mocks/token/ERC20Reentrant.sol +39 -0
  292. package/lib/openzeppelin-contracts-master/contracts/mocks/token/ERC20ReturnFalseMock.sol +19 -0
  293. package/lib/openzeppelin-contracts-master/contracts/mocks/token/ERC20VotesAdditionalCheckpointsMock.sol +33 -0
  294. package/lib/openzeppelin-contracts-master/contracts/mocks/token/ERC20VotesLegacyMock.sol +253 -0
  295. package/lib/openzeppelin-contracts-master/contracts/mocks/token/ERC20VotesTimestampMock.sol +31 -0
  296. package/lib/openzeppelin-contracts-master/contracts/mocks/token/ERC4626LimitsMock.sol +23 -0
  297. package/lib/openzeppelin-contracts-master/contracts/mocks/token/ERC4626Mock.sol +17 -0
  298. package/lib/openzeppelin-contracts-master/contracts/mocks/token/ERC4626OffsetMock.sol +17 -0
  299. package/lib/openzeppelin-contracts-master/contracts/mocks/token/ERC4646FeesMock.sol +40 -0
  300. package/lib/openzeppelin-contracts-master/contracts/mocks/token/ERC721ConsecutiveEnumerableMock.sol +42 -0
  301. package/lib/openzeppelin-contracts-master/contracts/mocks/token/ERC721ConsecutiveMock.sol +61 -0
  302. package/lib/openzeppelin-contracts-master/contracts/mocks/token/ERC721ReceiverMock.sol +47 -0
  303. package/lib/openzeppelin-contracts-master/contracts/mocks/token/ERC721URIStorageMock.sol +17 -0
  304. package/lib/openzeppelin-contracts-master/contracts/mocks/utils/cryptography/ERC7739Mock.sol +12 -0
  305. package/lib/openzeppelin-contracts-master/contracts/package.json +32 -0
  306. package/lib/openzeppelin-contracts-master/contracts/proxy/Clones.sol +294 -0
  307. package/lib/openzeppelin-contracts-master/contracts/proxy/ERC1967/ERC1967Proxy.sol +62 -0
  308. package/lib/openzeppelin-contracts-master/contracts/proxy/ERC1967/ERC1967Utils.sol +177 -0
  309. package/lib/openzeppelin-contracts-master/contracts/proxy/Proxy.sol +69 -0
  310. package/lib/openzeppelin-contracts-master/contracts/proxy/README.adoc +87 -0
  311. package/lib/openzeppelin-contracts-master/contracts/proxy/beacon/BeaconProxy.sol +57 -0
  312. package/lib/openzeppelin-contracts-master/contracts/proxy/beacon/IBeacon.sol +16 -0
  313. package/lib/openzeppelin-contracts-master/contracts/proxy/beacon/UpgradeableBeacon.sol +70 -0
  314. package/lib/openzeppelin-contracts-master/contracts/proxy/transparent/ProxyAdmin.sol +45 -0
  315. package/lib/openzeppelin-contracts-master/contracts/proxy/transparent/TransparentUpgradeableProxy.sol +118 -0
  316. package/lib/openzeppelin-contracts-master/contracts/proxy/utils/Initializable.sol +238 -0
  317. package/lib/openzeppelin-contracts-master/contracts/proxy/utils/UUPSUpgradeable.sol +148 -0
  318. package/lib/openzeppelin-contracts-master/contracts/token/ERC1155/ERC1155.sol +417 -0
  319. package/lib/openzeppelin-contracts-master/contracts/token/ERC1155/IERC1155.sol +123 -0
  320. package/lib/openzeppelin-contracts-master/contracts/token/ERC1155/IERC1155Receiver.sol +59 -0
  321. package/lib/openzeppelin-contracts-master/contracts/token/ERC1155/README.adoc +46 -0
  322. package/lib/openzeppelin-contracts-master/contracts/token/ERC1155/extensions/ERC1155Burnable.sol +22 -0
  323. package/lib/openzeppelin-contracts-master/contracts/token/ERC1155/extensions/ERC1155Crosschain.sol +53 -0
  324. package/lib/openzeppelin-contracts-master/contracts/token/ERC1155/extensions/ERC1155Pausable.sol +38 -0
  325. package/lib/openzeppelin-contracts-master/contracts/token/ERC1155/extensions/ERC1155Supply.sol +88 -0
  326. package/lib/openzeppelin-contracts-master/contracts/token/ERC1155/extensions/ERC1155URIStorage.sol +58 -0
  327. package/lib/openzeppelin-contracts-master/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol +20 -0
  328. package/lib/openzeppelin-contracts-master/contracts/token/ERC1155/utils/ERC1155Holder.sol +42 -0
  329. package/lib/openzeppelin-contracts-master/contracts/token/ERC1155/utils/ERC1155Utils.sol +88 -0
  330. package/lib/openzeppelin-contracts-master/contracts/token/ERC20/ERC20.sol +305 -0
  331. package/lib/openzeppelin-contracts-master/contracts/token/ERC20/IERC20.sol +79 -0
  332. package/lib/openzeppelin-contracts-master/contracts/token/ERC20/README.adoc +81 -0
  333. package/lib/openzeppelin-contracts-master/contracts/token/ERC20/extensions/ERC1363.sol +135 -0
  334. package/lib/openzeppelin-contracts-master/contracts/token/ERC20/extensions/ERC20Burnable.sol +39 -0
  335. package/lib/openzeppelin-contracts-master/contracts/token/ERC20/extensions/ERC20Capped.sol +54 -0
  336. package/lib/openzeppelin-contracts-master/contracts/token/ERC20/extensions/ERC20Crosschain.sol +39 -0
  337. package/lib/openzeppelin-contracts-master/contracts/token/ERC20/extensions/ERC20FlashMint.sol +130 -0
  338. package/lib/openzeppelin-contracts-master/contracts/token/ERC20/extensions/ERC20Pausable.sol +33 -0
  339. package/lib/openzeppelin-contracts-master/contracts/token/ERC20/extensions/ERC20Permit.sol +77 -0
  340. package/lib/openzeppelin-contracts-master/contracts/token/ERC20/extensions/ERC20Votes.sol +83 -0
  341. package/lib/openzeppelin-contracts-master/contracts/token/ERC20/extensions/ERC20Wrapper.sol +93 -0
  342. package/lib/openzeppelin-contracts-master/contracts/token/ERC20/extensions/ERC4626.sol +298 -0
  343. package/lib/openzeppelin-contracts-master/contracts/token/ERC20/extensions/IERC20Metadata.sol +26 -0
  344. package/lib/openzeppelin-contracts-master/contracts/token/ERC20/extensions/IERC20Permit.sol +90 -0
  345. package/lib/openzeppelin-contracts-master/contracts/token/ERC20/extensions/draft-ERC20Bridgeable.sol +51 -0
  346. package/lib/openzeppelin-contracts-master/contracts/token/ERC20/extensions/draft-ERC20TemporaryApproval.sol +119 -0
  347. package/lib/openzeppelin-contracts-master/contracts/token/ERC20/utils/ERC1363Utils.sol +95 -0
  348. package/lib/openzeppelin-contracts-master/contracts/token/ERC20/utils/SafeERC20.sol +292 -0
  349. package/lib/openzeppelin-contracts-master/contracts/token/ERC6909/ERC6909.sol +224 -0
  350. package/lib/openzeppelin-contracts-master/contracts/token/ERC6909/README.adoc +27 -0
  351. package/lib/openzeppelin-contracts-master/contracts/token/ERC6909/extensions/ERC6909ContentURI.sol +59 -0
  352. package/lib/openzeppelin-contracts-master/contracts/token/ERC6909/extensions/ERC6909Metadata.sol +83 -0
  353. package/lib/openzeppelin-contracts-master/contracts/token/ERC6909/extensions/ERC6909TokenSupply.sol +41 -0
  354. package/lib/openzeppelin-contracts-master/contracts/token/ERC721/ERC721.sol +433 -0
  355. package/lib/openzeppelin-contracts-master/contracts/token/ERC721/IERC721.sol +135 -0
  356. package/lib/openzeppelin-contracts-master/contracts/token/ERC721/IERC721Receiver.sol +28 -0
  357. package/lib/openzeppelin-contracts-master/contracts/token/ERC721/README.adoc +72 -0
  358. package/lib/openzeppelin-contracts-master/contracts/token/ERC721/extensions/ERC721Burnable.sol +26 -0
  359. package/lib/openzeppelin-contracts-master/contracts/token/ERC721/extensions/ERC721Consecutive.sol +176 -0
  360. package/lib/openzeppelin-contracts-master/contracts/token/ERC721/extensions/ERC721Crosschain.sol +37 -0
  361. package/lib/openzeppelin-contracts-master/contracts/token/ERC721/extensions/ERC721Enumerable.sol +165 -0
  362. package/lib/openzeppelin-contracts-master/contracts/token/ERC721/extensions/ERC721Pausable.sol +37 -0
  363. package/lib/openzeppelin-contracts-master/contracts/token/ERC721/extensions/ERC721Royalty.sol +26 -0
  364. package/lib/openzeppelin-contracts-master/contracts/token/ERC721/extensions/ERC721URIStorage.sol +62 -0
  365. package/lib/openzeppelin-contracts-master/contracts/token/ERC721/extensions/ERC721Votes.sol +47 -0
  366. package/lib/openzeppelin-contracts-master/contracts/token/ERC721/extensions/ERC721Wrapper.sol +102 -0
  367. package/lib/openzeppelin-contracts-master/contracts/token/ERC721/extensions/IERC721Enumerable.sol +29 -0
  368. package/lib/openzeppelin-contracts-master/contracts/token/ERC721/extensions/IERC721Metadata.sol +27 -0
  369. package/lib/openzeppelin-contracts-master/contracts/token/ERC721/utils/ERC721Holder.sol +26 -0
  370. package/lib/openzeppelin-contracts-master/contracts/token/ERC721/utils/ERC721Utils.sol +50 -0
  371. package/lib/openzeppelin-contracts-master/contracts/token/common/ERC2981.sol +139 -0
  372. package/lib/openzeppelin-contracts-master/contracts/token/common/README.adoc +10 -0
  373. package/lib/openzeppelin-contracts-master/contracts/utils/Address.sol +167 -0
  374. package/lib/openzeppelin-contracts-master/contracts/utils/Arrays.sol +888 -0
  375. package/lib/openzeppelin-contracts-master/contracts/utils/Base58.sol +240 -0
  376. package/lib/openzeppelin-contracts-master/contracts/utils/Base64.sol +234 -0
  377. package/lib/openzeppelin-contracts-master/contracts/utils/Blockhash.sol +54 -0
  378. package/lib/openzeppelin-contracts-master/contracts/utils/Bytes.sol +329 -0
  379. package/lib/openzeppelin-contracts-master/contracts/utils/CAIP10.sol +54 -0
  380. package/lib/openzeppelin-contracts-master/contracts/utils/CAIP2.sol +51 -0
  381. package/lib/openzeppelin-contracts-master/contracts/utils/Calldata.sol +25 -0
  382. package/lib/openzeppelin-contracts-master/contracts/utils/Comparators.sol +19 -0
  383. package/lib/openzeppelin-contracts-master/contracts/utils/Context.sol +28 -0
  384. package/lib/openzeppelin-contracts-master/contracts/utils/Create2.sol +91 -0
  385. package/lib/openzeppelin-contracts-master/contracts/utils/Create3.sol +134 -0
  386. package/lib/openzeppelin-contracts-master/contracts/utils/ERC6372Utils.sol +52 -0
  387. package/lib/openzeppelin-contracts-master/contracts/utils/Errors.sol +34 -0
  388. package/lib/openzeppelin-contracts-master/contracts/utils/LowLevelCall.sol +127 -0
  389. package/lib/openzeppelin-contracts-master/contracts/utils/Memory.sol +149 -0
  390. package/lib/openzeppelin-contracts-master/contracts/utils/Multicall.sol +37 -0
  391. package/lib/openzeppelin-contracts-master/contracts/utils/Nonces.sol +46 -0
  392. package/lib/openzeppelin-contracts-master/contracts/utils/NoncesKeyed.sol +74 -0
  393. package/lib/openzeppelin-contracts-master/contracts/utils/Packing.sol +1656 -0
  394. package/lib/openzeppelin-contracts-master/contracts/utils/Panic.sol +57 -0
  395. package/lib/openzeppelin-contracts-master/contracts/utils/Pausable.sol +112 -0
  396. package/lib/openzeppelin-contracts-master/contracts/utils/README.adoc +169 -0
  397. package/lib/openzeppelin-contracts-master/contracts/utils/RLP.sol +487 -0
  398. package/lib/openzeppelin-contracts-master/contracts/utils/ReentrancyGuard.sol +119 -0
  399. package/lib/openzeppelin-contracts-master/contracts/utils/ReentrancyGuardTransient.sol +84 -0
  400. package/lib/openzeppelin-contracts-master/contracts/utils/RelayedCall.sol +145 -0
  401. package/lib/openzeppelin-contracts-master/contracts/utils/ShortStrings.sol +122 -0
  402. package/lib/openzeppelin-contracts-master/contracts/utils/SimulateCall.sol +113 -0
  403. package/lib/openzeppelin-contracts-master/contracts/utils/SlotDerivation.sol +155 -0
  404. package/lib/openzeppelin-contracts-master/contracts/utils/StorageSlot.sol +143 -0
  405. package/lib/openzeppelin-contracts-master/contracts/utils/Strings.sol +532 -0
  406. package/lib/openzeppelin-contracts-master/contracts/utils/TransientSlot.sol +183 -0
  407. package/lib/openzeppelin-contracts-master/contracts/utils/cryptography/ECDSA.sol +284 -0
  408. package/lib/openzeppelin-contracts-master/contracts/utils/cryptography/EIP712.sol +160 -0
  409. package/lib/openzeppelin-contracts-master/contracts/utils/cryptography/Hashes.sol +31 -0
  410. package/lib/openzeppelin-contracts-master/contracts/utils/cryptography/MerkleProof.sol +510 -0
  411. package/lib/openzeppelin-contracts-master/contracts/utils/cryptography/MessageHashUtils.sol +228 -0
  412. package/lib/openzeppelin-contracts-master/contracts/utils/cryptography/P256.sol +408 -0
  413. package/lib/openzeppelin-contracts-master/contracts/utils/cryptography/README.adoc +76 -0
  414. package/lib/openzeppelin-contracts-master/contracts/utils/cryptography/RSA.sol +154 -0
  415. package/lib/openzeppelin-contracts-master/contracts/utils/cryptography/SignatureChecker.sol +191 -0
  416. package/lib/openzeppelin-contracts-master/contracts/utils/cryptography/TrieProof.sol +256 -0
  417. package/lib/openzeppelin-contracts-master/contracts/utils/cryptography/WebAuthn.sol +269 -0
  418. package/lib/openzeppelin-contracts-master/contracts/utils/cryptography/draft-ERC7739Utils.sol +207 -0
  419. package/lib/openzeppelin-contracts-master/contracts/utils/cryptography/signers/AbstractSigner.sol +23 -0
  420. package/lib/openzeppelin-contracts-master/contracts/utils/cryptography/signers/MultiSignerERC7913.sol +259 -0
  421. package/lib/openzeppelin-contracts-master/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol +208 -0
  422. package/lib/openzeppelin-contracts-master/contracts/utils/cryptography/signers/SignerECDSA.sol +56 -0
  423. package/lib/openzeppelin-contracts-master/contracts/utils/cryptography/signers/SignerEIP7702.sol +25 -0
  424. package/lib/openzeppelin-contracts-master/contracts/utils/cryptography/signers/SignerERC7913.sol +63 -0
  425. package/lib/openzeppelin-contracts-master/contracts/utils/cryptography/signers/SignerP256.sol +64 -0
  426. package/lib/openzeppelin-contracts-master/contracts/utils/cryptography/signers/SignerRSA.sol +65 -0
  427. package/lib/openzeppelin-contracts-master/contracts/utils/cryptography/signers/SignerWebAuthn.sol +46 -0
  428. package/lib/openzeppelin-contracts-master/contracts/utils/cryptography/signers/draft-ERC7739.sol +98 -0
  429. package/lib/openzeppelin-contracts-master/contracts/utils/cryptography/verifiers/ERC7913P256Verifier.sol +29 -0
  430. package/lib/openzeppelin-contracts-master/contracts/utils/cryptography/verifiers/ERC7913RSAVerifier.sol +23 -0
  431. package/lib/openzeppelin-contracts-master/contracts/utils/cryptography/verifiers/ERC7913WebAuthnVerifier.sol +35 -0
  432. package/lib/openzeppelin-contracts-master/contracts/utils/draft-InteroperableAddress.sol +245 -0
  433. package/lib/openzeppelin-contracts-master/contracts/utils/introspection/ERC165.sol +25 -0
  434. package/lib/openzeppelin-contracts-master/contracts/utils/introspection/ERC165Checker.sol +142 -0
  435. package/lib/openzeppelin-contracts-master/contracts/utils/introspection/IERC165.sol +25 -0
  436. package/lib/openzeppelin-contracts-master/contracts/utils/math/Math.sol +763 -0
  437. package/lib/openzeppelin-contracts-master/contracts/utils/math/SafeCast.sol +1162 -0
  438. package/lib/openzeppelin-contracts-master/contracts/utils/math/SignedMath.sol +68 -0
  439. package/lib/openzeppelin-contracts-master/contracts/utils/structs/Accumulators.sol +135 -0
  440. package/lib/openzeppelin-contracts-master/contracts/utils/structs/BitMaps.sol +60 -0
  441. package/lib/openzeppelin-contracts-master/contracts/utils/structs/Checkpoints.sol +833 -0
  442. package/lib/openzeppelin-contracts-master/contracts/utils/structs/CircularBuffer.sol +152 -0
  443. package/lib/openzeppelin-contracts-master/contracts/utils/structs/DoubleEndedQueue.sol +238 -0
  444. package/lib/openzeppelin-contracts-master/contracts/utils/structs/EnumerableMap.sol +1443 -0
  445. package/lib/openzeppelin-contracts-master/contracts/utils/structs/EnumerableSet.sol +895 -0
  446. package/lib/openzeppelin-contracts-master/contracts/utils/structs/Heap.sol +259 -0
  447. package/lib/openzeppelin-contracts-master/contracts/utils/structs/MerkleTree.sol +267 -0
  448. package/lib/openzeppelin-contracts-master/contracts/utils/types/Time.sol +133 -0
  449. package/lib/openzeppelin-contracts-master/contracts/vendor/compound/ICompoundTimelock.sol +86 -0
  450. package/lib/openzeppelin-contracts-master/contracts/vendor/compound/LICENSE +11 -0
  451. package/lib/openzeppelin-contracts-master/docs/README.md +16 -0
  452. package/lib/openzeppelin-contracts-master/docs/antora.yml +7 -0
  453. package/lib/openzeppelin-contracts-master/docs/config.js +21 -0
  454. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/images/access-control-multiple.svg +97 -0
  455. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/images/access-manager-functions.svg +47 -0
  456. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/images/access-manager.svg +99 -0
  457. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/images/erc4626-attack-3a.png +0 -0
  458. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/images/erc4626-attack-3b.png +0 -0
  459. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/images/erc4626-attack-6.png +0 -0
  460. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/images/erc4626-attack.png +0 -0
  461. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/images/erc4626-deposit.png +0 -0
  462. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/images/erc4626-mint.png +0 -0
  463. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/images/erc4626-rate-linear.png +0 -0
  464. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/images/erc4626-rate-loglog.png +0 -0
  465. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/images/erc4626-rate-loglogext.png +0 -0
  466. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/images/tally-exec.png +0 -0
  467. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/images/tally-vote.png +0 -0
  468. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/nav.adoc +29 -0
  469. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/pages/access-control.adoc +339 -0
  470. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/pages/account-abstraction.adoc +100 -0
  471. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/pages/accounts.adoc +354 -0
  472. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/pages/backwards-compatibility.adoc +50 -0
  473. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/pages/eoa-delegation.adoc +143 -0
  474. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/pages/erc1155.adoc +118 -0
  475. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/pages/erc20-supply.adoc +71 -0
  476. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/pages/erc20.adoc +67 -0
  477. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/pages/erc4626.adoc +208 -0
  478. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/pages/erc6909.adoc +47 -0
  479. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/pages/erc721.adoc +58 -0
  480. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/pages/extending-contracts.adoc +67 -0
  481. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/pages/faq.adoc +13 -0
  482. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/pages/governance.adoc +242 -0
  483. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/pages/index.adoc +100 -0
  484. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/pages/multisig.adoc +308 -0
  485. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/pages/tokens.adoc +31 -0
  486. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/pages/upgradeable.adoc +75 -0
  487. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/pages/utilities.adoc +634 -0
  488. package/lib/openzeppelin-contracts-master/docs/modules/ROOT/pages/wizard.adoc +15 -0
  489. package/lib/openzeppelin-contracts-master/docs/templates/contract.hbs +141 -0
  490. package/lib/openzeppelin-contracts-master/docs/templates/helpers.js +46 -0
  491. package/lib/openzeppelin-contracts-master/docs/templates/page.hbs +4 -0
  492. package/lib/openzeppelin-contracts-master/docs/templates/properties.js +88 -0
  493. package/lib/openzeppelin-contracts-master/eslint.config.mjs +29 -0
  494. package/lib/openzeppelin-contracts-master/foundry.toml +20 -0
  495. package/lib/openzeppelin-contracts-master/fv/Makefile +54 -0
  496. package/lib/openzeppelin-contracts-master/fv/README.md +60 -0
  497. package/lib/openzeppelin-contracts-master/fv/diff/access_manager_AccessManager.sol.patch +97 -0
  498. package/lib/openzeppelin-contracts-master/fv/diff/account_extensions_draft-AccountERC7579.sol.patch +25 -0
  499. package/lib/openzeppelin-contracts-master/fv/diff/token_ERC721_ERC721.sol.patch +11 -0
  500. package/lib/openzeppelin-contracts-master/fv/harnesses/AccessControlDefaultAdminRulesHarness.sol +46 -0
  501. package/lib/openzeppelin-contracts-master/fv/harnesses/AccessControlHarness.sol +6 -0
  502. package/lib/openzeppelin-contracts-master/fv/harnesses/AccessManagedHarness.sol +36 -0
  503. package/lib/openzeppelin-contracts-master/fv/harnesses/AccessManagerHarness.sol +116 -0
  504. package/lib/openzeppelin-contracts-master/fv/harnesses/AccountHarness.sol +60 -0
  505. package/lib/openzeppelin-contracts-master/fv/harnesses/DoubleEndedQueueHarness.sol +58 -0
  506. package/lib/openzeppelin-contracts-master/fv/harnesses/ERC20FlashMintHarness.sol +36 -0
  507. package/lib/openzeppelin-contracts-master/fv/harnesses/ERC20PermitHarness.sol +16 -0
  508. package/lib/openzeppelin-contracts-master/fv/harnesses/ERC20WrapperHarness.sol +22 -0
  509. package/lib/openzeppelin-contracts-master/fv/harnesses/ERC3156FlashBorrowerHarness.sol +13 -0
  510. package/lib/openzeppelin-contracts-master/fv/harnesses/ERC721Harness.sol +37 -0
  511. package/lib/openzeppelin-contracts-master/fv/harnesses/ERC721ReceiverHarness.sol +11 -0
  512. package/lib/openzeppelin-contracts-master/fv/harnesses/EnumerableMapHarness.sol +55 -0
  513. package/lib/openzeppelin-contracts-master/fv/harnesses/EnumerableSetHarness.sol +35 -0
  514. package/lib/openzeppelin-contracts-master/fv/harnesses/InitializableHarness.sol +23 -0
  515. package/lib/openzeppelin-contracts-master/fv/harnesses/NoncesHarness.sol +14 -0
  516. package/lib/openzeppelin-contracts-master/fv/harnesses/Ownable2StepHarness.sol +10 -0
  517. package/lib/openzeppelin-contracts-master/fv/harnesses/OwnableHarness.sol +10 -0
  518. package/lib/openzeppelin-contracts-master/fv/harnesses/PausableHarness.sol +18 -0
  519. package/lib/openzeppelin-contracts-master/fv/harnesses/TimelockControllerHarness.sol +13 -0
  520. package/lib/openzeppelin-contracts-master/fv/reports/2021-10.pdf +0 -0
  521. package/lib/openzeppelin-contracts-master/fv/reports/2022-03.pdf +0 -0
  522. package/lib/openzeppelin-contracts-master/fv/reports/2022-05.pdf +0 -0
  523. package/lib/openzeppelin-contracts-master/fv/run.js +68 -0
  524. package/lib/openzeppelin-contracts-master/fv/specs/AccessControl.conf +8 -0
  525. package/lib/openzeppelin-contracts-master/fv/specs/AccessControl.spec +119 -0
  526. package/lib/openzeppelin-contracts-master/fv/specs/AccessControlDefaultAdminRules.conf +8 -0
  527. package/lib/openzeppelin-contracts-master/fv/specs/AccessControlDefaultAdminRules.spec +467 -0
  528. package/lib/openzeppelin-contracts-master/fv/specs/AccessManaged.conf +14 -0
  529. package/lib/openzeppelin-contracts-master/fv/specs/AccessManaged.spec +49 -0
  530. package/lib/openzeppelin-contracts-master/fv/specs/AccessManager.conf +10 -0
  531. package/lib/openzeppelin-contracts-master/fv/specs/AccessManager.spec +837 -0
  532. package/lib/openzeppelin-contracts-master/fv/specs/Account.conf +9 -0
  533. package/lib/openzeppelin-contracts-master/fv/specs/Account.spec +490 -0
  534. package/lib/openzeppelin-contracts-master/fv/specs/DoubleEndedQueue.conf +8 -0
  535. package/lib/openzeppelin-contracts-master/fv/specs/DoubleEndedQueue.spec +300 -0
  536. package/lib/openzeppelin-contracts-master/fv/specs/ERC20.conf +9 -0
  537. package/lib/openzeppelin-contracts-master/fv/specs/ERC20.spec +352 -0
  538. package/lib/openzeppelin-contracts-master/fv/specs/ERC20FlashMint.conf +10 -0
  539. package/lib/openzeppelin-contracts-master/fv/specs/ERC20FlashMint.spec +55 -0
  540. package/lib/openzeppelin-contracts-master/fv/specs/ERC20Wrapper.conf +13 -0
  541. package/lib/openzeppelin-contracts-master/fv/specs/ERC20Wrapper.spec +226 -0
  542. package/lib/openzeppelin-contracts-master/fv/specs/ERC721.conf +10 -0
  543. package/lib/openzeppelin-contracts-master/fv/specs/ERC721.spec +695 -0
  544. package/lib/openzeppelin-contracts-master/fv/specs/EnumerableMap.conf +8 -0
  545. package/lib/openzeppelin-contracts-master/fv/specs/EnumerableMap.spec +364 -0
  546. package/lib/openzeppelin-contracts-master/fv/specs/EnumerableSet.conf +8 -0
  547. package/lib/openzeppelin-contracts-master/fv/specs/EnumerableSet.spec +272 -0
  548. package/lib/openzeppelin-contracts-master/fv/specs/Initializable.conf +8 -0
  549. package/lib/openzeppelin-contracts-master/fv/specs/Initializable.spec +176 -0
  550. package/lib/openzeppelin-contracts-master/fv/specs/Nonces.conf +8 -0
  551. package/lib/openzeppelin-contracts-master/fv/specs/Nonces.spec +92 -0
  552. package/lib/openzeppelin-contracts-master/fv/specs/Ownable.conf +8 -0
  553. package/lib/openzeppelin-contracts-master/fv/specs/Ownable.spec +77 -0
  554. package/lib/openzeppelin-contracts-master/fv/specs/Ownable2Step.conf +8 -0
  555. package/lib/openzeppelin-contracts-master/fv/specs/Ownable2Step.spec +108 -0
  556. package/lib/openzeppelin-contracts-master/fv/specs/Pausable.conf +8 -0
  557. package/lib/openzeppelin-contracts-master/fv/specs/Pausable.spec +96 -0
  558. package/lib/openzeppelin-contracts-master/fv/specs/TimelockController.conf +10 -0
  559. package/lib/openzeppelin-contracts-master/fv/specs/TimelockController.spec +299 -0
  560. package/lib/openzeppelin-contracts-master/fv/specs/helpers/helpers.spec +13 -0
  561. package/lib/openzeppelin-contracts-master/fv/specs/methods/IAccessControl.spec +8 -0
  562. package/lib/openzeppelin-contracts-master/fv/specs/methods/IAccessControlDefaultAdminRules.spec +36 -0
  563. package/lib/openzeppelin-contracts-master/fv/specs/methods/IAccessManaged.spec +5 -0
  564. package/lib/openzeppelin-contracts-master/fv/specs/methods/IAccessManager.spec +33 -0
  565. package/lib/openzeppelin-contracts-master/fv/specs/methods/IAccount.spec +34 -0
  566. package/lib/openzeppelin-contracts-master/fv/specs/methods/IERC20.spec +11 -0
  567. package/lib/openzeppelin-contracts-master/fv/specs/methods/IERC2612.spec +5 -0
  568. package/lib/openzeppelin-contracts-master/fv/specs/methods/IERC3156FlashBorrower.spec +3 -0
  569. package/lib/openzeppelin-contracts-master/fv/specs/methods/IERC3156FlashLender.spec +5 -0
  570. package/lib/openzeppelin-contracts-master/fv/specs/methods/IERC5313.spec +3 -0
  571. package/lib/openzeppelin-contracts-master/fv/specs/methods/IERC721.spec +17 -0
  572. package/lib/openzeppelin-contracts-master/fv/specs/methods/IERC721Receiver.spec +3 -0
  573. package/lib/openzeppelin-contracts-master/fv/specs/methods/IOwnable.spec +5 -0
  574. package/lib/openzeppelin-contracts-master/fv/specs/methods/IOwnable2Step.spec +7 -0
  575. package/lib/openzeppelin-contracts-master/fv-requirements.txt +4 -0
  576. package/lib/openzeppelin-contracts-master/hardhat/async-test-sanity.js +10 -0
  577. package/lib/openzeppelin-contracts-master/hardhat/env-artifacts.js +29 -0
  578. package/lib/openzeppelin-contracts-master/hardhat/ignore-unreachable-warnings.js +45 -0
  579. package/lib/openzeppelin-contracts-master/hardhat/remappings.js +18 -0
  580. package/lib/openzeppelin-contracts-master/hardhat/skip-foundry-tests.js +6 -0
  581. package/lib/openzeppelin-contracts-master/hardhat/task-test-get-files.js +25 -0
  582. package/lib/openzeppelin-contracts-master/hardhat.config.js +124 -0
  583. package/lib/openzeppelin-contracts-master/logo.svg +15 -0
  584. package/lib/openzeppelin-contracts-master/netlify.toml +3 -0
  585. package/lib/openzeppelin-contracts-master/package-lock.json +11197 -0
  586. package/lib/openzeppelin-contracts-master/package.json +109 -0
  587. package/lib/openzeppelin-contracts-master/remappings.txt +1 -0
  588. package/lib/openzeppelin-contracts-master/renovate.json +4 -0
  589. package/lib/openzeppelin-contracts-master/scripts/checks/compare-layout.js +28 -0
  590. package/lib/openzeppelin-contracts-master/scripts/checks/compareGasReports.js +249 -0
  591. package/lib/openzeppelin-contracts-master/scripts/checks/coverage.sh +24 -0
  592. package/lib/openzeppelin-contracts-master/scripts/checks/extract-layout.js +39 -0
  593. package/lib/openzeppelin-contracts-master/scripts/checks/generation.sh +6 -0
  594. package/lib/openzeppelin-contracts-master/scripts/checks/inheritance-ordering.js +56 -0
  595. package/lib/openzeppelin-contracts-master/scripts/checks/pragma-validity.js +45 -0
  596. package/lib/openzeppelin-contracts-master/scripts/fetch-common-contracts.js +50 -0
  597. package/lib/openzeppelin-contracts-master/scripts/gen-nav.js +81 -0
  598. package/lib/openzeppelin-contracts-master/scripts/generate/format-lines.js +16 -0
  599. package/lib/openzeppelin-contracts-master/scripts/generate/helpers/sanitize.js +5 -0
  600. package/lib/openzeppelin-contracts-master/scripts/generate/run.js +61 -0
  601. package/lib/openzeppelin-contracts-master/scripts/generate/templates/Arrays.js +505 -0
  602. package/lib/openzeppelin-contracts-master/scripts/generate/templates/Arrays.opts.js +9 -0
  603. package/lib/openzeppelin-contracts-master/scripts/generate/templates/Checkpoints.js +242 -0
  604. package/lib/openzeppelin-contracts-master/scripts/generate/templates/Checkpoints.opts.js +18 -0
  605. package/lib/openzeppelin-contracts-master/scripts/generate/templates/Checkpoints.t.js +141 -0
  606. package/lib/openzeppelin-contracts-master/scripts/generate/templates/Enumerable.opts.js +56 -0
  607. package/lib/openzeppelin-contracts-master/scripts/generate/templates/EnumerableMap.js +464 -0
  608. package/lib/openzeppelin-contracts-master/scripts/generate/templates/EnumerableSet.js +470 -0
  609. package/lib/openzeppelin-contracts-master/scripts/generate/templates/MerkleProof.js +186 -0
  610. package/lib/openzeppelin-contracts-master/scripts/generate/templates/MerkleProof.opts.js +11 -0
  611. package/lib/openzeppelin-contracts-master/scripts/generate/templates/Packing.js +92 -0
  612. package/lib/openzeppelin-contracts-master/scripts/generate/templates/Packing.opts.js +3 -0
  613. package/lib/openzeppelin-contracts-master/scripts/generate/templates/Packing.t.js +48 -0
  614. package/lib/openzeppelin-contracts-master/scripts/generate/templates/SafeCast.js +136 -0
  615. package/lib/openzeppelin-contracts-master/scripts/generate/templates/Slot.opts.js +15 -0
  616. package/lib/openzeppelin-contracts-master/scripts/generate/templates/SlotDerivation.js +119 -0
  617. package/lib/openzeppelin-contracts-master/scripts/generate/templates/SlotDerivation.t.js +127 -0
  618. package/lib/openzeppelin-contracts-master/scripts/generate/templates/StorageSlot.js +77 -0
  619. package/lib/openzeppelin-contracts-master/scripts/generate/templates/StorageSlotMock.js +57 -0
  620. package/lib/openzeppelin-contracts-master/scripts/generate/templates/TransientSlot.js +80 -0
  621. package/lib/openzeppelin-contracts-master/scripts/generate/templates/TransientSlotMock.js +35 -0
  622. package/lib/openzeppelin-contracts-master/scripts/generate/templates/conversion.js +34 -0
  623. package/lib/openzeppelin-contracts-master/scripts/get-contracts-metadata.js +55 -0
  624. package/lib/openzeppelin-contracts-master/scripts/git-user-config.sh +6 -0
  625. package/lib/openzeppelin-contracts-master/scripts/helpers.js +7 -0
  626. package/lib/openzeppelin-contracts-master/scripts/minimize-pragma.js +140 -0
  627. package/lib/openzeppelin-contracts-master/scripts/prepack.sh +23 -0
  628. package/lib/openzeppelin-contracts-master/scripts/prepare-docs.sh +26 -0
  629. package/lib/openzeppelin-contracts-master/scripts/release/format-changelog.js +33 -0
  630. package/lib/openzeppelin-contracts-master/scripts/release/synchronize-versions.js +15 -0
  631. package/lib/openzeppelin-contracts-master/scripts/release/update-comment.js +34 -0
  632. package/lib/openzeppelin-contracts-master/scripts/release/version.sh +11 -0
  633. package/lib/openzeppelin-contracts-master/scripts/release/workflow/check-upgradeable.sh +27 -0
  634. package/lib/openzeppelin-contracts-master/scripts/release/workflow/exit-prerelease.sh +8 -0
  635. package/lib/openzeppelin-contracts-master/scripts/release/workflow/github-release.js +48 -0
  636. package/lib/openzeppelin-contracts-master/scripts/release/workflow/integrity-check.sh +20 -0
  637. package/lib/openzeppelin-contracts-master/scripts/release/workflow/pack.sh +26 -0
  638. package/lib/openzeppelin-contracts-master/scripts/release/workflow/publish.sh +26 -0
  639. package/lib/openzeppelin-contracts-master/scripts/release/workflow/rerun.js +7 -0
  640. package/lib/openzeppelin-contracts-master/scripts/release/workflow/set-changesets-pr-title.js +17 -0
  641. package/lib/openzeppelin-contracts-master/scripts/release/workflow/start.sh +35 -0
  642. package/lib/openzeppelin-contracts-master/scripts/release/workflow/state.js +112 -0
  643. package/lib/openzeppelin-contracts-master/scripts/remove-ignored-artifacts.js +45 -0
  644. package/lib/openzeppelin-contracts-master/scripts/set-max-old-space-size.sh +10 -0
  645. package/lib/openzeppelin-contracts-master/scripts/solc-versions.js +15 -0
  646. package/lib/openzeppelin-contracts-master/scripts/solhint-custom/index.js +118 -0
  647. package/lib/openzeppelin-contracts-master/scripts/solhint-custom/package.json +8 -0
  648. package/lib/openzeppelin-contracts-master/scripts/update-docs-branch.js +65 -0
  649. package/lib/openzeppelin-contracts-master/scripts/upgradeable/README.md +21 -0
  650. package/lib/openzeppelin-contracts-master/scripts/upgradeable/alias/Initializable.sol +5 -0
  651. package/lib/openzeppelin-contracts-master/scripts/upgradeable/alias/UUPSUpgradeable.sol +5 -0
  652. package/lib/openzeppelin-contracts-master/scripts/upgradeable/patch-apply.sh +19 -0
  653. package/lib/openzeppelin-contracts-master/scripts/upgradeable/patch-save.sh +18 -0
  654. package/lib/openzeppelin-contracts-master/scripts/upgradeable/transpile-onto.sh +54 -0
  655. package/lib/openzeppelin-contracts-master/scripts/upgradeable/transpile.sh +50 -0
  656. package/lib/openzeppelin-contracts-master/scripts/upgradeable/upgradeable.patch +390 -0
  657. package/lib/openzeppelin-contracts-master/slither.config.json +4 -0
  658. package/lib/openzeppelin-contracts-master/solhint.config.js +29 -0
  659. package/lib/openzeppelin-contracts-master/test/TESTING.md +3 -0
  660. package/lib/openzeppelin-contracts-master/test/access/AccessControl.behavior.js +874 -0
  661. package/lib/openzeppelin-contracts-master/test/access/AccessControl.test.js +19 -0
  662. package/lib/openzeppelin-contracts-master/test/access/Ownable.test.js +79 -0
  663. package/lib/openzeppelin-contracts-master/test/access/Ownable2Step.test.js +102 -0
  664. package/lib/openzeppelin-contracts-master/test/access/extensions/AccessControlDefaultAdminRules.test.js +32 -0
  665. package/lib/openzeppelin-contracts-master/test/access/extensions/AccessControlEnumerable.test.js +24 -0
  666. package/lib/openzeppelin-contracts-master/test/access/manager/AccessManaged.test.js +146 -0
  667. package/lib/openzeppelin-contracts-master/test/access/manager/AccessManager.behavior.js +252 -0
  668. package/lib/openzeppelin-contracts-master/test/access/manager/AccessManager.predicate.js +456 -0
  669. package/lib/openzeppelin-contracts-master/test/access/manager/AccessManager.test.js +2536 -0
  670. package/lib/openzeppelin-contracts-master/test/access/manager/AuthorityUtils.test.js +112 -0
  671. package/lib/openzeppelin-contracts-master/test/account/Account.behavior.js +144 -0
  672. package/lib/openzeppelin-contracts-master/test/account/Account.test.js +48 -0
  673. package/lib/openzeppelin-contracts-master/test/account/AccountECDSA.test.js +52 -0
  674. package/lib/openzeppelin-contracts-master/test/account/AccountEIP7702.t.sol +116 -0
  675. package/lib/openzeppelin-contracts-master/test/account/AccountEIP7702.test.js +52 -0
  676. package/lib/openzeppelin-contracts-master/test/account/AccountERC7913.test.js +138 -0
  677. package/lib/openzeppelin-contracts-master/test/account/AccountMultiSigner.test.js +326 -0
  678. package/lib/openzeppelin-contracts-master/test/account/AccountMultiSignerWeighted.test.js +312 -0
  679. package/lib/openzeppelin-contracts-master/test/account/AccountP256.test.js +58 -0
  680. package/lib/openzeppelin-contracts-master/test/account/AccountRSA.test.js +58 -0
  681. package/lib/openzeppelin-contracts-master/test/account/AccountWebAuthn.test.js +75 -0
  682. package/lib/openzeppelin-contracts-master/test/account/examples/AccountEIP7702WithModulesMock.test.js +99 -0
  683. package/lib/openzeppelin-contracts-master/test/account/extensions/AccountERC7579.behavior.js +724 -0
  684. package/lib/openzeppelin-contracts-master/test/account/extensions/AccountERC7579.test.js +60 -0
  685. package/lib/openzeppelin-contracts-master/test/account/extensions/AccountERC7579Hooked.test.js +60 -0
  686. package/lib/openzeppelin-contracts-master/test/account/extensions/ERC7821.behavior.js +145 -0
  687. package/lib/openzeppelin-contracts-master/test/account/utils/EIP7702Utils.test.js +53 -0
  688. package/lib/openzeppelin-contracts-master/test/account/utils/draft-ERC4337Utils.test.js +594 -0
  689. package/lib/openzeppelin-contracts-master/test/account/utils/draft-ERC7579Utils.t.sol +434 -0
  690. package/lib/openzeppelin-contracts-master/test/account/utils/draft-ERC7579Utils.test.js +399 -0
  691. package/lib/openzeppelin-contracts-master/test/crosschain/BridgeERC1155.behavior.js +333 -0
  692. package/lib/openzeppelin-contracts-master/test/crosschain/BridgeERC1155.test.js +70 -0
  693. package/lib/openzeppelin-contracts-master/test/crosschain/BridgeERC20.behavior.js +146 -0
  694. package/lib/openzeppelin-contracts-master/test/crosschain/BridgeERC20.test.js +46 -0
  695. package/lib/openzeppelin-contracts-master/test/crosschain/BridgeERC721.behavior.js +218 -0
  696. package/lib/openzeppelin-contracts-master/test/crosschain/BridgeERC721.test.js +48 -0
  697. package/lib/openzeppelin-contracts-master/test/crosschain/CrosschainExecutor.test.js +144 -0
  698. package/lib/openzeppelin-contracts-master/test/crosschain/ERC7786Recipient.test.js +55 -0
  699. package/lib/openzeppelin-contracts-master/test/finance/VestingWallet.behavior.js +87 -0
  700. package/lib/openzeppelin-contracts-master/test/finance/VestingWallet.test.js +65 -0
  701. package/lib/openzeppelin-contracts-master/test/finance/VestingWalletCliff.test.js +70 -0
  702. package/lib/openzeppelin-contracts-master/test/governance/Governor.t.sol +59 -0
  703. package/lib/openzeppelin-contracts-master/test/governance/Governor.test.js +980 -0
  704. package/lib/openzeppelin-contracts-master/test/governance/TimelockController.test.js +1279 -0
  705. package/lib/openzeppelin-contracts-master/test/governance/extensions/GovernorCountingFractional.test.js +248 -0
  706. package/lib/openzeppelin-contracts-master/test/governance/extensions/GovernorCountingOverridable.test.js +346 -0
  707. package/lib/openzeppelin-contracts-master/test/governance/extensions/GovernorCrosschain.test.js +158 -0
  708. package/lib/openzeppelin-contracts-master/test/governance/extensions/GovernorERC721.test.js +131 -0
  709. package/lib/openzeppelin-contracts-master/test/governance/extensions/GovernorNoncesKeyed.test.js +243 -0
  710. package/lib/openzeppelin-contracts-master/test/governance/extensions/GovernorPreventLateQuorum.test.js +185 -0
  711. package/lib/openzeppelin-contracts-master/test/governance/extensions/GovernorProposalGuardian.test.js +132 -0
  712. package/lib/openzeppelin-contracts-master/test/governance/extensions/GovernorSequentialProposalId.test.js +202 -0
  713. package/lib/openzeppelin-contracts-master/test/governance/extensions/GovernorStorage.test.js +175 -0
  714. package/lib/openzeppelin-contracts-master/test/governance/extensions/GovernorSuperQuorum.test.js +168 -0
  715. package/lib/openzeppelin-contracts-master/test/governance/extensions/GovernorSuperQuorumGreaterThanQuorum.t.sol +79 -0
  716. package/lib/openzeppelin-contracts-master/test/governance/extensions/GovernorTimelockAccess.test.js +906 -0
  717. package/lib/openzeppelin-contracts-master/test/governance/extensions/GovernorTimelockCompound.test.js +450 -0
  718. package/lib/openzeppelin-contracts-master/test/governance/extensions/GovernorTimelockControl.test.js +506 -0
  719. package/lib/openzeppelin-contracts-master/test/governance/extensions/GovernorVotesQuorumFraction.test.js +165 -0
  720. package/lib/openzeppelin-contracts-master/test/governance/extensions/GovernorVotesSuperQuorumFraction.test.js +160 -0
  721. package/lib/openzeppelin-contracts-master/test/governance/extensions/GovernorWithParams.test.js +245 -0
  722. package/lib/openzeppelin-contracts-master/test/governance/utils/ERC6372.behavior.js +29 -0
  723. package/lib/openzeppelin-contracts-master/test/governance/utils/Votes.behavior.js +325 -0
  724. package/lib/openzeppelin-contracts-master/test/governance/utils/Votes.test.js +102 -0
  725. package/lib/openzeppelin-contracts-master/test/governance/utils/VotesExtended.test.js +152 -0
  726. package/lib/openzeppelin-contracts-master/test/helpers/access-manager.js +85 -0
  727. package/lib/openzeppelin-contracts-master/test/helpers/account.js +16 -0
  728. package/lib/openzeppelin-contracts-master/test/helpers/chains.js +56 -0
  729. package/lib/openzeppelin-contracts-master/test/helpers/constants.js +7 -0
  730. package/lib/openzeppelin-contracts-master/test/helpers/deploy.js +14 -0
  731. package/lib/openzeppelin-contracts-master/test/helpers/eip712-types.js +61 -0
  732. package/lib/openzeppelin-contracts-master/test/helpers/eip712.js +45 -0
  733. package/lib/openzeppelin-contracts-master/test/helpers/enums.js +15 -0
  734. package/lib/openzeppelin-contracts-master/test/helpers/erc4337.js +244 -0
  735. package/lib/openzeppelin-contracts-master/test/helpers/erc7579.js +58 -0
  736. package/lib/openzeppelin-contracts-master/test/helpers/erc7739.js +118 -0
  737. package/lib/openzeppelin-contracts-master/test/helpers/governance.js +218 -0
  738. package/lib/openzeppelin-contracts-master/test/helpers/iterate.js +41 -0
  739. package/lib/openzeppelin-contracts-master/test/helpers/math.js +33 -0
  740. package/lib/openzeppelin-contracts-master/test/helpers/methods.js +14 -0
  741. package/lib/openzeppelin-contracts-master/test/helpers/precompiles.js +12 -0
  742. package/lib/openzeppelin-contracts-master/test/helpers/random.js +26 -0
  743. package/lib/openzeppelin-contracts-master/test/helpers/signers.js +225 -0
  744. package/lib/openzeppelin-contracts-master/test/helpers/storage.js +48 -0
  745. package/lib/openzeppelin-contracts-master/test/helpers/strings.js +5 -0
  746. package/lib/openzeppelin-contracts-master/test/helpers/time.js +33 -0
  747. package/lib/openzeppelin-contracts-master/test/helpers/trie.js +79 -0
  748. package/lib/openzeppelin-contracts-master/test/helpers/txpool.js +28 -0
  749. package/lib/openzeppelin-contracts-master/test/metatx/ERC2771Context.test.js +109 -0
  750. package/lib/openzeppelin-contracts-master/test/metatx/ERC2771Forwarder.t.sol +279 -0
  751. package/lib/openzeppelin-contracts-master/test/metatx/ERC2771Forwarder.test.js +398 -0
  752. package/lib/openzeppelin-contracts-master/test/proxy/Clones.behaviour.js +160 -0
  753. package/lib/openzeppelin-contracts-master/test/proxy/Clones.t.sol +91 -0
  754. package/lib/openzeppelin-contracts-master/test/proxy/Clones.test.js +177 -0
  755. package/lib/openzeppelin-contracts-master/test/proxy/ERC1967/ERC1967Proxy.test.js +36 -0
  756. package/lib/openzeppelin-contracts-master/test/proxy/ERC1967/ERC1967Utils.test.js +162 -0
  757. package/lib/openzeppelin-contracts-master/test/proxy/Proxy.behaviour.js +198 -0
  758. package/lib/openzeppelin-contracts-master/test/proxy/beacon/BeaconProxy.test.js +141 -0
  759. package/lib/openzeppelin-contracts-master/test/proxy/beacon/UpgradeableBeacon.test.js +55 -0
  760. package/lib/openzeppelin-contracts-master/test/proxy/transparent/ProxyAdmin.test.js +82 -0
  761. package/lib/openzeppelin-contracts-master/test/proxy/transparent/TransparentUpgradeableProxy.behaviour.js +367 -0
  762. package/lib/openzeppelin-contracts-master/test/proxy/transparent/TransparentUpgradeableProxy.test.js +28 -0
  763. package/lib/openzeppelin-contracts-master/test/proxy/utils/Initializable.test.js +216 -0
  764. package/lib/openzeppelin-contracts-master/test/proxy/utils/UUPSUpgradeable.test.js +120 -0
  765. package/lib/openzeppelin-contracts-master/test/sanity.test.js +27 -0
  766. package/lib/openzeppelin-contracts-master/test/token/ERC1155/ERC1155.behavior.js +865 -0
  767. package/lib/openzeppelin-contracts-master/test/token/ERC1155/ERC1155.test.js +258 -0
  768. package/lib/openzeppelin-contracts-master/test/token/ERC1155/extensions/ERC1155Burnable.test.js +66 -0
  769. package/lib/openzeppelin-contracts-master/test/token/ERC1155/extensions/ERC1155Crosschain.test.js +43 -0
  770. package/lib/openzeppelin-contracts-master/test/token/ERC1155/extensions/ERC1155Pausable.test.js +105 -0
  771. package/lib/openzeppelin-contracts-master/test/token/ERC1155/extensions/ERC1155Supply.test.js +119 -0
  772. package/lib/openzeppelin-contracts-master/test/token/ERC1155/extensions/ERC1155URIStorage.test.js +70 -0
  773. package/lib/openzeppelin-contracts-master/test/token/ERC1155/utils/ERC1155Holder.test.js +56 -0
  774. package/lib/openzeppelin-contracts-master/test/token/ERC1155/utils/ERC1155Utils.test.js +299 -0
  775. package/lib/openzeppelin-contracts-master/test/token/ERC20/ERC20.behavior.js +269 -0
  776. package/lib/openzeppelin-contracts-master/test/token/ERC20/ERC20.test.js +199 -0
  777. package/lib/openzeppelin-contracts-master/test/token/ERC20/extensions/ERC1363.test.js +370 -0
  778. package/lib/openzeppelin-contracts-master/test/token/ERC20/extensions/ERC20Burnable.test.js +105 -0
  779. package/lib/openzeppelin-contracts-master/test/token/ERC20/extensions/ERC20Capped.test.js +55 -0
  780. package/lib/openzeppelin-contracts-master/test/token/ERC20/extensions/ERC20Crosschain.test.js +83 -0
  781. package/lib/openzeppelin-contracts-master/test/token/ERC20/extensions/ERC20FlashMint.test.js +164 -0
  782. package/lib/openzeppelin-contracts-master/test/token/ERC20/extensions/ERC20Pausable.test.js +129 -0
  783. package/lib/openzeppelin-contracts-master/test/token/ERC20/extensions/ERC20Permit.test.js +109 -0
  784. package/lib/openzeppelin-contracts-master/test/token/ERC20/extensions/ERC20Votes.test.js +546 -0
  785. package/lib/openzeppelin-contracts-master/test/token/ERC20/extensions/ERC20Wrapper.test.js +203 -0
  786. package/lib/openzeppelin-contracts-master/test/token/ERC20/extensions/ERC4626.t.sol +41 -0
  787. package/lib/openzeppelin-contracts-master/test/token/ERC20/extensions/ERC4626.test.js +888 -0
  788. package/lib/openzeppelin-contracts-master/test/token/ERC20/extensions/draft-ERC20Bridgeable.test.js +89 -0
  789. package/lib/openzeppelin-contracts-master/test/token/ERC20/extensions/draft-ERC20TemporaryApproval.test.js +142 -0
  790. package/lib/openzeppelin-contracts-master/test/token/ERC20/utils/SafeERC20.test.js +493 -0
  791. package/lib/openzeppelin-contracts-master/test/token/ERC6909/ERC6909.behavior.js +216 -0
  792. package/lib/openzeppelin-contracts-master/test/token/ERC6909/ERC6909.test.js +104 -0
  793. package/lib/openzeppelin-contracts-master/test/token/ERC6909/extensions/ERC6909ContentURI.test.js +52 -0
  794. package/lib/openzeppelin-contracts-master/test/token/ERC6909/extensions/ERC6909Metadata.test.js +62 -0
  795. package/lib/openzeppelin-contracts-master/test/token/ERC6909/extensions/ERC6909TokenSupply.test.js +56 -0
  796. package/lib/openzeppelin-contracts-master/test/token/ERC721/ERC721.behavior.js +954 -0
  797. package/lib/openzeppelin-contracts-master/test/token/ERC721/ERC721.test.js +23 -0
  798. package/lib/openzeppelin-contracts-master/test/token/ERC721/ERC721Enumerable.test.js +28 -0
  799. package/lib/openzeppelin-contracts-master/test/token/ERC721/extensions/ERC721Burnable.test.js +77 -0
  800. package/lib/openzeppelin-contracts-master/test/token/ERC721/extensions/ERC721Consecutive.t.sol +187 -0
  801. package/lib/openzeppelin-contracts-master/test/token/ERC721/extensions/ERC721Consecutive.test.js +228 -0
  802. package/lib/openzeppelin-contracts-master/test/token/ERC721/extensions/ERC721Crosschain.test.js +44 -0
  803. package/lib/openzeppelin-contracts-master/test/token/ERC721/extensions/ERC721Pausable.test.js +81 -0
  804. package/lib/openzeppelin-contracts-master/test/token/ERC721/extensions/ERC721Royalty.test.js +57 -0
  805. package/lib/openzeppelin-contracts-master/test/token/ERC721/extensions/ERC721URIStorage.test.js +134 -0
  806. package/lib/openzeppelin-contracts-master/test/token/ERC721/extensions/ERC721Votes.test.js +194 -0
  807. package/lib/openzeppelin-contracts-master/test/token/ERC721/extensions/ERC721Wrapper.test.js +201 -0
  808. package/lib/openzeppelin-contracts-master/test/token/ERC721/utils/ERC721Holder.test.js +20 -0
  809. package/lib/openzeppelin-contracts-master/test/token/ERC721/utils/ERC721Utils.test.js +94 -0
  810. package/lib/openzeppelin-contracts-master/test/token/common/ERC2981.behavior.js +152 -0
  811. package/lib/openzeppelin-contracts-master/test/utils/Address.test.js +332 -0
  812. package/lib/openzeppelin-contracts-master/test/utils/Arrays.t.sol +416 -0
  813. package/lib/openzeppelin-contracts-master/test/utils/Arrays.test.js +284 -0
  814. package/lib/openzeppelin-contracts-master/test/utils/Base58.t.sol +24 -0
  815. package/lib/openzeppelin-contracts-master/test/utils/Base58.test.js +65 -0
  816. package/lib/openzeppelin-contracts-master/test/utils/Base64.t.sol +36 -0
  817. package/lib/openzeppelin-contracts-master/test/utils/Base64.test.js +79 -0
  818. package/lib/openzeppelin-contracts-master/test/utils/Blockhash.t.sol +101 -0
  819. package/lib/openzeppelin-contracts-master/test/utils/Blockhash.test.js +59 -0
  820. package/lib/openzeppelin-contracts-master/test/utils/Bytes.t.sol +322 -0
  821. package/lib/openzeppelin-contracts-master/test/utils/Bytes.test.js +371 -0
  822. package/lib/openzeppelin-contracts-master/test/utils/CAIP.test.js +56 -0
  823. package/lib/openzeppelin-contracts-master/test/utils/Calldata.test.js +22 -0
  824. package/lib/openzeppelin-contracts-master/test/utils/Context.behavior.js +48 -0
  825. package/lib/openzeppelin-contracts-master/test/utils/Context.test.js +18 -0
  826. package/lib/openzeppelin-contracts-master/test/utils/Create2.t.sol +17 -0
  827. package/lib/openzeppelin-contracts-master/test/utils/Create2.test.js +190 -0
  828. package/lib/openzeppelin-contracts-master/test/utils/Create3.t.sol +25 -0
  829. package/lib/openzeppelin-contracts-master/test/utils/Create3.test.js +185 -0
  830. package/lib/openzeppelin-contracts-master/test/utils/ERC6372Utils.test.js +59 -0
  831. package/lib/openzeppelin-contracts-master/test/utils/LowLevelCall.test.js +257 -0
  832. package/lib/openzeppelin-contracts-master/test/utils/Memory.t.sol +90 -0
  833. package/lib/openzeppelin-contracts-master/test/utils/Memory.test.js +94 -0
  834. package/lib/openzeppelin-contracts-master/test/utils/Multicall.test.js +72 -0
  835. package/lib/openzeppelin-contracts-master/test/utils/Nonces.behavior.js +189 -0
  836. package/lib/openzeppelin-contracts-master/test/utils/Nonces.test.js +16 -0
  837. package/lib/openzeppelin-contracts-master/test/utils/NoncesKeyed.t.sol +51 -0
  838. package/lib/openzeppelin-contracts-master/test/utils/NoncesKeyed.test.js +17 -0
  839. package/lib/openzeppelin-contracts-master/test/utils/Packing.t.sol +993 -0
  840. package/lib/openzeppelin-contracts-master/test/utils/Packing.test.js +70 -0
  841. package/lib/openzeppelin-contracts-master/test/utils/Panic.test.js +37 -0
  842. package/lib/openzeppelin-contracts-master/test/utils/Pausable.test.js +90 -0
  843. package/lib/openzeppelin-contracts-master/test/utils/RLP.t.sol +144 -0
  844. package/lib/openzeppelin-contracts-master/test/utils/RLP.test.js +224 -0
  845. package/lib/openzeppelin-contracts-master/test/utils/ReentrancyGuard.test.js +58 -0
  846. package/lib/openzeppelin-contracts-master/test/utils/RelayedCall.test.js +223 -0
  847. package/lib/openzeppelin-contracts-master/test/utils/ShortStrings.t.sol +109 -0
  848. package/lib/openzeppelin-contracts-master/test/utils/ShortStrings.test.js +64 -0
  849. package/lib/openzeppelin-contracts-master/test/utils/SimulatedCall.test.js +101 -0
  850. package/lib/openzeppelin-contracts-master/test/utils/SlotDerivation.t.sol +248 -0
  851. package/lib/openzeppelin-contracts-master/test/utils/SlotDerivation.test.js +58 -0
  852. package/lib/openzeppelin-contracts-master/test/utils/StorageSlot.test.js +73 -0
  853. package/lib/openzeppelin-contracts-master/test/utils/Strings.t.sol +50 -0
  854. package/lib/openzeppelin-contracts-master/test/utils/Strings.test.js +366 -0
  855. package/lib/openzeppelin-contracts-master/test/utils/TransientSlot.test.js +59 -0
  856. package/lib/openzeppelin-contracts-master/test/utils/cryptography/ECDSA.test.js +322 -0
  857. package/lib/openzeppelin-contracts-master/test/utils/cryptography/EIP712.test.js +105 -0
  858. package/lib/openzeppelin-contracts-master/test/utils/cryptography/ERC1271.behavior.js +111 -0
  859. package/lib/openzeppelin-contracts-master/test/utils/cryptography/ERC7739.test.js +42 -0
  860. package/lib/openzeppelin-contracts-master/test/utils/cryptography/ERC7739Utils.test.js +203 -0
  861. package/lib/openzeppelin-contracts-master/test/utils/cryptography/MerkleProof.test.js +216 -0
  862. package/lib/openzeppelin-contracts-master/test/utils/cryptography/MessageHashUtils.t.sol +33 -0
  863. package/lib/openzeppelin-contracts-master/test/utils/cryptography/MessageHashUtils.test.js +149 -0
  864. package/lib/openzeppelin-contracts-master/test/utils/cryptography/P256.t.sol +44 -0
  865. package/lib/openzeppelin-contracts-master/test/utils/cryptography/P256.test.js +174 -0
  866. package/lib/openzeppelin-contracts-master/test/utils/cryptography/RSA.helper.js +17 -0
  867. package/lib/openzeppelin-contracts-master/test/utils/cryptography/RSA.test.js +102 -0
  868. package/lib/openzeppelin-contracts-master/test/utils/cryptography/SigVer15_186-3.rsp +3850 -0
  869. package/lib/openzeppelin-contracts-master/test/utils/cryptography/SignatureChecker.test.js +427 -0
  870. package/lib/openzeppelin-contracts-master/test/utils/cryptography/TrieProof.test.js +707 -0
  871. package/lib/openzeppelin-contracts-master/test/utils/cryptography/WebAuthn.t.sol +340 -0
  872. package/lib/openzeppelin-contracts-master/test/utils/cryptography/ecdsa_secp256r1_sha256_p1363_test.json +3719 -0
  873. package/lib/openzeppelin-contracts-master/test/utils/draft-InteroperableAddress.t.sol +99 -0
  874. package/lib/openzeppelin-contracts-master/test/utils/draft-InteroperableAddress.test.js +217 -0
  875. package/lib/openzeppelin-contracts-master/test/utils/introspection/ERC165.test.js +18 -0
  876. package/lib/openzeppelin-contracts-master/test/utils/introspection/ERC165Checker.test.js +272 -0
  877. package/lib/openzeppelin-contracts-master/test/utils/introspection/SupportsInterface.behavior.js +169 -0
  878. package/lib/openzeppelin-contracts-master/test/utils/math/Math.t.sol +370 -0
  879. package/lib/openzeppelin-contracts-master/test/utils/math/Math.test.js +746 -0
  880. package/lib/openzeppelin-contracts-master/test/utils/math/SafeCast.test.js +159 -0
  881. package/lib/openzeppelin-contracts-master/test/utils/math/SignedMath.t.sol +81 -0
  882. package/lib/openzeppelin-contracts-master/test/utils/math/SignedMath.test.js +53 -0
  883. package/lib/openzeppelin-contracts-master/test/utils/structs/Accumulators.t.sol +35 -0
  884. package/lib/openzeppelin-contracts-master/test/utils/structs/BitMap.test.js +149 -0
  885. package/lib/openzeppelin-contracts-master/test/utils/structs/Checkpoints.t.sol +440 -0
  886. package/lib/openzeppelin-contracts-master/test/utils/structs/Checkpoints.test.js +147 -0
  887. package/lib/openzeppelin-contracts-master/test/utils/structs/CircularBuffer.test.js +83 -0
  888. package/lib/openzeppelin-contracts-master/test/utils/structs/DoubleEndedQueue.test.js +144 -0
  889. package/lib/openzeppelin-contracts-master/test/utils/structs/EnumerableMap.behavior.js +214 -0
  890. package/lib/openzeppelin-contracts-master/test/utils/structs/EnumerableMap.test.js +83 -0
  891. package/lib/openzeppelin-contracts-master/test/utils/structs/EnumerableSet.behavior.js +175 -0
  892. package/lib/openzeppelin-contracts-master/test/utils/structs/EnumerableSet.test.js +66 -0
  893. package/lib/openzeppelin-contracts-master/test/utils/structs/Heap.t.sol +74 -0
  894. package/lib/openzeppelin-contracts-master/test/utils/structs/Heap.test.js +113 -0
  895. package/lib/openzeppelin-contracts-master/test/utils/structs/MerkleTree.test.js +180 -0
  896. package/lib/openzeppelin-contracts-master/test/utils/types/Time.test.js +135 -0
  897. package/lib/v3-core-main/.gitattributes +1 -0
  898. package/lib/v3-core-main/.github/stale.yml +25 -0
  899. package/lib/v3-core-main/.github/workflows/fuzz-testing.yml +60 -0
  900. package/lib/v3-core-main/.github/workflows/lint.yml +34 -0
  901. package/lib/v3-core-main/.github/workflows/mythx.yml +65 -0
  902. package/lib/v3-core-main/.github/workflows/tests.yml +38 -0
  903. package/lib/v3-core-main/.prettierrc +5 -0
  904. package/lib/v3-core-main/.solhint.json +6 -0
  905. package/lib/v3-core-main/.yarnrc +1 -0
  906. package/lib/v3-core-main/LICENSE +100 -0
  907. package/lib/v3-core-main/README.md +66 -0
  908. package/lib/v3-core-main/audits/abdk/audit.pdf +0 -0
  909. package/lib/v3-core-main/audits/tob/README.md +166 -0
  910. package/lib/v3-core-main/audits/tob/audit.pdf +0 -0
  911. package/lib/v3-core-main/audits/tob/contracts/crytic/echidna/E2E_mint_burn.config.yaml +16 -0
  912. package/lib/v3-core-main/audits/tob/contracts/crytic/echidna/E2E_mint_burn.sol +503 -0
  913. package/lib/v3-core-main/audits/tob/contracts/crytic/echidna/E2E_swap.config.yaml +10 -0
  914. package/lib/v3-core-main/audits/tob/contracts/crytic/echidna/E2E_swap.sol +487 -0
  915. package/lib/v3-core-main/audits/tob/contracts/crytic/echidna/Other.config.yaml +7 -0
  916. package/lib/v3-core-main/audits/tob/contracts/crytic/echidna/Other.sol +21 -0
  917. package/lib/v3-core-main/audits/tob/contracts/crytic/echidna/Setup.sol +205 -0
  918. package/lib/v3-core-main/audits/tob/contracts/crytic/manticore/001.sol +11 -0
  919. package/lib/v3-core-main/audits/tob/contracts/crytic/manticore/002.sol +12 -0
  920. package/lib/v3-core-main/audits/tob/contracts/crytic/manticore/003.sol +9 -0
  921. package/lib/v3-core-main/bug-bounty.md +76 -0
  922. package/lib/v3-core-main/contracts/NoDelegateCall.sol +27 -0
  923. package/lib/v3-core-main/contracts/UniswapV3Factory.sol +73 -0
  924. package/lib/v3-core-main/contracts/UniswapV3Pool.sol +869 -0
  925. package/lib/v3-core-main/contracts/UniswapV3PoolDeployer.sol +38 -0
  926. package/lib/v3-core-main/contracts/interfaces/IERC20Minimal.sol +52 -0
  927. package/lib/v3-core-main/contracts/interfaces/IUniswapV3Factory.sol +78 -0
  928. package/lib/v3-core-main/contracts/interfaces/IUniswapV3Pool.sol +24 -0
  929. package/lib/v3-core-main/contracts/interfaces/IUniswapV3PoolDeployer.sol +26 -0
  930. package/lib/v3-core-main/contracts/interfaces/LICENSE +445 -0
  931. package/lib/v3-core-main/contracts/interfaces/callback/IUniswapV3FlashCallback.sol +18 -0
  932. package/lib/v3-core-main/contracts/interfaces/callback/IUniswapV3MintCallback.sol +18 -0
  933. package/lib/v3-core-main/contracts/interfaces/callback/IUniswapV3SwapCallback.sol +21 -0
  934. package/lib/v3-core-main/contracts/interfaces/pool/IUniswapV3PoolActions.sol +103 -0
  935. package/lib/v3-core-main/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol +40 -0
  936. package/lib/v3-core-main/contracts/interfaces/pool/IUniswapV3PoolEvents.sol +121 -0
  937. package/lib/v3-core-main/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol +35 -0
  938. package/lib/v3-core-main/contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol +23 -0
  939. package/lib/v3-core-main/contracts/interfaces/pool/IUniswapV3PoolState.sol +116 -0
  940. package/lib/v3-core-main/contracts/libraries/BitMath.sol +94 -0
  941. package/lib/v3-core-main/contracts/libraries/FixedPoint128.sol +8 -0
  942. package/lib/v3-core-main/contracts/libraries/FixedPoint96.sol +10 -0
  943. package/lib/v3-core-main/contracts/libraries/FullMath.sol +124 -0
  944. package/lib/v3-core-main/contracts/libraries/LICENSE +445 -0
  945. package/lib/v3-core-main/contracts/libraries/LICENSE_MIT +20 -0
  946. package/lib/v3-core-main/contracts/libraries/LiquidityMath.sol +17 -0
  947. package/lib/v3-core-main/contracts/libraries/LowGasSafeMath.sol +46 -0
  948. package/lib/v3-core-main/contracts/libraries/Oracle.sol +325 -0
  949. package/lib/v3-core-main/contracts/libraries/Position.sol +88 -0
  950. package/lib/v3-core-main/contracts/libraries/SafeCast.sol +28 -0
  951. package/lib/v3-core-main/contracts/libraries/SqrtPriceMath.sol +227 -0
  952. package/lib/v3-core-main/contracts/libraries/SwapMath.sol +98 -0
  953. package/lib/v3-core-main/contracts/libraries/Tick.sol +185 -0
  954. package/lib/v3-core-main/contracts/libraries/TickBitmap.sol +78 -0
  955. package/lib/v3-core-main/contracts/libraries/TickMath.sol +205 -0
  956. package/lib/v3-core-main/contracts/libraries/TransferHelper.sol +23 -0
  957. package/lib/v3-core-main/contracts/libraries/UnsafeMath.sol +17 -0
  958. package/lib/v3-core-main/contracts/test/BitMathEchidnaTest.sol +18 -0
  959. package/lib/v3-core-main/contracts/test/BitMathTest.sol +26 -0
  960. package/lib/v3-core-main/contracts/test/FullMathEchidnaTest.sol +67 -0
  961. package/lib/v3-core-main/contracts/test/FullMathTest.sol +22 -0
  962. package/lib/v3-core-main/contracts/test/LiquidityMathTest.sol +16 -0
  963. package/lib/v3-core-main/contracts/test/LowGasSafeMathEchidnaTest.sol +36 -0
  964. package/lib/v3-core-main/contracts/test/MockTimeUniswapV3Pool.sol +26 -0
  965. package/lib/v3-core-main/contracts/test/MockTimeUniswapV3PoolDeployer.sol +35 -0
  966. package/lib/v3-core-main/contracts/test/NoDelegateCallTest.sol +32 -0
  967. package/lib/v3-core-main/contracts/test/OracleEchidnaTest.sol +137 -0
  968. package/lib/v3-core-main/contracts/test/OracleTest.sol +100 -0
  969. package/lib/v3-core-main/contracts/test/SqrtPriceMathEchidnaTest.sol +232 -0
  970. package/lib/v3-core-main/contracts/test/SqrtPriceMathTest.sol +86 -0
  971. package/lib/v3-core-main/contracts/test/SwapMathEchidnaTest.sol +52 -0
  972. package/lib/v3-core-main/contracts/test/SwapMathTest.sol +37 -0
  973. package/lib/v3-core-main/contracts/test/TestERC20.sol +59 -0
  974. package/lib/v3-core-main/contracts/test/TestUniswapV3Callee.sol +142 -0
  975. package/lib/v3-core-main/contracts/test/TestUniswapV3ReentrantCallee.sol +56 -0
  976. package/lib/v3-core-main/contracts/test/TestUniswapV3Router.sol +91 -0
  977. package/lib/v3-core-main/contracts/test/TestUniswapV3SwapPay.sol +41 -0
  978. package/lib/v3-core-main/contracts/test/TickBitmapEchidnaTest.sol +47 -0
  979. package/lib/v3-core-main/contracts/test/TickBitmapTest.sol +40 -0
  980. package/lib/v3-core-main/contracts/test/TickEchidnaTest.sol +27 -0
  981. package/lib/v3-core-main/contracts/test/TickMathEchidnaTest.sol +22 -0
  982. package/lib/v3-core-main/contracts/test/TickMathTest.sol +34 -0
  983. package/lib/v3-core-main/contracts/test/TickOverflowSafetyEchidnaTest.sol +111 -0
  984. package/lib/v3-core-main/contracts/test/TickTest.sol +79 -0
  985. package/lib/v3-core-main/contracts/test/UniswapV3PoolSwapTest.sol +50 -0
  986. package/lib/v3-core-main/contracts/test/UnsafeMathEchidnaTest.sol +17 -0
  987. package/lib/v3-core-main/echidna.config.yml +74 -0
  988. package/lib/v3-core-main/hardhat.config.ts +68 -0
  989. package/lib/v3-core-main/package.json +59 -0
  990. package/lib/v3-core-main/test/BitMath.spec.ts +79 -0
  991. package/lib/v3-core-main/test/FullMath.spec.ts +182 -0
  992. package/lib/v3-core-main/test/LiquidityMath.spec.ts +44 -0
  993. package/lib/v3-core-main/test/NoDelegateCall.spec.ts +54 -0
  994. package/lib/v3-core-main/test/Oracle.spec.ts +798 -0
  995. package/lib/v3-core-main/test/SqrtPriceMath.spec.ts +379 -0
  996. package/lib/v3-core-main/test/SwapMath.spec.ts +324 -0
  997. package/lib/v3-core-main/test/Tick.spec.ts +329 -0
  998. package/lib/v3-core-main/test/TickBitmap.spec.ts +227 -0
  999. package/lib/v3-core-main/test/TickMath.spec.ts +166 -0
  1000. package/lib/v3-core-main/test/UniswapV3Factory.spec.ts +177 -0
  1001. package/lib/v3-core-main/test/UniswapV3Pool.arbitrage.spec.ts +373 -0
  1002. package/lib/v3-core-main/test/UniswapV3Pool.gas.spec.ts +315 -0
  1003. package/lib/v3-core-main/test/UniswapV3Pool.spec.ts +2043 -0
  1004. package/lib/v3-core-main/test/UniswapV3Pool.swaps.spec.ts +588 -0
  1005. package/lib/v3-core-main/test/UniswapV3Router.spec.ts +133 -0
  1006. package/lib/v3-core-main/test/__snapshots__/BitMath.spec.ts.snap +13 -0
  1007. package/lib/v3-core-main/test/__snapshots__/LiquidityMath.spec.ts.snap +5 -0
  1008. package/lib/v3-core-main/test/__snapshots__/NoDelegateCall.spec.ts.snap +3 -0
  1009. package/lib/v3-core-main/test/__snapshots__/Oracle.spec.ts.snap +87 -0
  1010. package/lib/v3-core-main/test/__snapshots__/SqrtPriceMath.spec.ts.snap +17 -0
  1011. package/lib/v3-core-main/test/__snapshots__/SwapMath.spec.ts.snap +17 -0
  1012. package/lib/v3-core-main/test/__snapshots__/TickBitmap.spec.ts.snap +19 -0
  1013. package/lib/v3-core-main/test/__snapshots__/TickMath.spec.ts.snap +165 -0
  1014. package/lib/v3-core-main/test/__snapshots__/UniswapV3Factory.spec.ts.snap +7 -0
  1015. package/lib/v3-core-main/test/__snapshots__/UniswapV3Pool.arbitrage.spec.ts.snap +977 -0
  1016. package/lib/v3-core-main/test/__snapshots__/UniswapV3Pool.gas.spec.ts.snap +169 -0
  1017. package/lib/v3-core-main/test/__snapshots__/UniswapV3Pool.swaps.spec.ts.snap +3541 -0
  1018. package/lib/v3-core-main/test/shared/checkObservationEquals.ts +38 -0
  1019. package/lib/v3-core-main/test/shared/expect.ts +8 -0
  1020. package/lib/v3-core-main/test/shared/fixtures.ts +92 -0
  1021. package/lib/v3-core-main/test/shared/format.ts +10 -0
  1022. package/lib/v3-core-main/test/shared/snapshotGasCost.ts +27 -0
  1023. package/lib/v3-core-main/test/shared/utilities.ts +258 -0
  1024. package/lib/v3-core-main/test/snapshotCumulativesInside.test.ts +73 -0
  1025. package/lib/v3-core-main/tsconfig.json +13 -0
  1026. package/lib/v3-core-main/yarn.lock +9271 -0
  1027. package/lib/v3-periphery-main/.gitattributes +1 -0
  1028. package/lib/v3-periphery-main/.github/stale.yml +25 -0
  1029. package/lib/v3-periphery-main/.github/workflows/lint.yml +33 -0
  1030. package/lib/v3-periphery-main/.github/workflows/tests.yml +39 -0
  1031. package/lib/v3-periphery-main/.prettierignore +1 -0
  1032. package/lib/v3-periphery-main/.prettierrc +5 -0
  1033. package/lib/v3-periphery-main/.solhint.json +6 -0
  1034. package/lib/v3-periphery-main/.yarnrc +1 -0
  1035. package/lib/v3-periphery-main/LICENSE +339 -0
  1036. package/lib/v3-periphery-main/README.md +52 -0
  1037. package/lib/v3-periphery-main/audits/abdk/audit.pdf +0 -0
  1038. package/lib/v3-periphery-main/bug-bounty.md +80 -0
  1039. package/lib/v3-periphery-main/contracts/NonfungiblePositionManager.sol +400 -0
  1040. package/lib/v3-periphery-main/contracts/NonfungibleTokenPositionDescriptor.sol +124 -0
  1041. package/lib/v3-periphery-main/contracts/SwapRouter.sol +244 -0
  1042. package/lib/v3-periphery-main/contracts/V3Migrator.sol +99 -0
  1043. package/lib/v3-periphery-main/contracts/base/BlockTimestamp.sol +12 -0
  1044. package/lib/v3-periphery-main/contracts/base/ERC721Permit.sol +86 -0
  1045. package/lib/v3-periphery-main/contracts/base/LiquidityManagement.sol +90 -0
  1046. package/lib/v3-periphery-main/contracts/base/Multicall.sol +28 -0
  1047. package/lib/v3-periphery-main/contracts/base/PeripheryImmutableState.sol +18 -0
  1048. package/lib/v3-periphery-main/contracts/base/PeripheryPayments.sol +70 -0
  1049. package/lib/v3-periphery-main/contracts/base/PeripheryPaymentsWithFee.sol +55 -0
  1050. package/lib/v3-periphery-main/contracts/base/PeripheryValidation.sol +11 -0
  1051. package/lib/v3-periphery-main/contracts/base/PoolInitializer.sol +32 -0
  1052. package/lib/v3-periphery-main/contracts/base/SelfPermit.sol +63 -0
  1053. package/lib/v3-periphery-main/contracts/examples/PairFlash.sol +149 -0
  1054. package/lib/v3-periphery-main/contracts/interfaces/IERC20Metadata.sol +18 -0
  1055. package/lib/v3-periphery-main/contracts/interfaces/IERC721Permit.sol +32 -0
  1056. package/lib/v3-periphery-main/contracts/interfaces/IMulticall.sol +13 -0
  1057. package/lib/v3-periphery-main/contracts/interfaces/INonfungiblePositionManager.sol +179 -0
  1058. package/lib/v3-periphery-main/contracts/interfaces/INonfungibleTokenPositionDescriptor.sol +17 -0
  1059. package/lib/v3-periphery-main/contracts/interfaces/IPeripheryImmutableState.sol +12 -0
  1060. package/lib/v3-periphery-main/contracts/interfaces/IPeripheryPayments.sol +28 -0
  1061. package/lib/v3-periphery-main/contracts/interfaces/IPeripheryPaymentsWithFee.sol +29 -0
  1062. package/lib/v3-periphery-main/contracts/interfaces/IPoolInitializer.sol +22 -0
  1063. package/lib/v3-periphery-main/contracts/interfaces/IQuoter.sol +51 -0
  1064. package/lib/v3-periphery-main/contracts/interfaces/IQuoterV2.sol +98 -0
  1065. package/lib/v3-periphery-main/contracts/interfaces/ISelfPermit.sol +76 -0
  1066. package/lib/v3-periphery-main/contracts/interfaces/ISwapRouter.sol +67 -0
  1067. package/lib/v3-periphery-main/contracts/interfaces/ITickLens.sol +25 -0
  1068. package/lib/v3-periphery-main/contracts/interfaces/IV3Migrator.sol +34 -0
  1069. package/lib/v3-periphery-main/contracts/interfaces/external/IERC1271.sol +16 -0
  1070. package/lib/v3-periphery-main/contracts/interfaces/external/IERC20PermitAllowed.sol +27 -0
  1071. package/lib/v3-periphery-main/contracts/interfaces/external/IWETH9.sol +13 -0
  1072. package/lib/v3-periphery-main/contracts/lens/Quoter.sol +170 -0
  1073. package/lib/v3-periphery-main/contracts/lens/QuoterV2.sol +273 -0
  1074. package/lib/v3-periphery-main/contracts/lens/README.md +4 -0
  1075. package/lib/v3-periphery-main/contracts/lens/TickLens.sol +42 -0
  1076. package/lib/v3-periphery-main/contracts/lens/UniswapInterfaceMulticall.sol +39 -0
  1077. package/lib/v3-periphery-main/contracts/libraries/BytesLib.sol +101 -0
  1078. package/lib/v3-periphery-main/contracts/libraries/CallbackValidation.sol +36 -0
  1079. package/lib/v3-periphery-main/contracts/libraries/ChainId.sol +13 -0
  1080. package/lib/v3-periphery-main/contracts/libraries/HexStrings.sol +29 -0
  1081. package/lib/v3-periphery-main/contracts/libraries/LiquidityAmounts.sol +137 -0
  1082. package/lib/v3-periphery-main/contracts/libraries/NFTDescriptor.sol +477 -0
  1083. package/lib/v3-periphery-main/contracts/libraries/NFTSVG.sol +406 -0
  1084. package/lib/v3-periphery-main/contracts/libraries/OracleLibrary.sol +180 -0
  1085. package/lib/v3-periphery-main/contracts/libraries/Path.sol +69 -0
  1086. package/lib/v3-periphery-main/contracts/libraries/PoolAddress.sol +48 -0
  1087. package/lib/v3-periphery-main/contracts/libraries/PoolTicksCounter.sol +96 -0
  1088. package/lib/v3-periphery-main/contracts/libraries/PositionKey.sol +13 -0
  1089. package/lib/v3-periphery-main/contracts/libraries/PositionValue.sol +167 -0
  1090. package/lib/v3-periphery-main/contracts/libraries/SqrtPriceMathPartial.sol +62 -0
  1091. package/lib/v3-periphery-main/contracts/libraries/TokenRatioSortOrder.sol +12 -0
  1092. package/lib/v3-periphery-main/contracts/libraries/TransferHelper.sol +60 -0
  1093. package/lib/v3-periphery-main/contracts/test/Base64Test.sol +16 -0
  1094. package/lib/v3-periphery-main/contracts/test/LiquidityAmountsTest.sol +120 -0
  1095. package/lib/v3-periphery-main/contracts/test/MockObservable.sol +48 -0
  1096. package/lib/v3-periphery-main/contracts/test/MockObservations.sol +82 -0
  1097. package/lib/v3-periphery-main/contracts/test/MockTimeNonfungiblePositionManager.sol +23 -0
  1098. package/lib/v3-periphery-main/contracts/test/MockTimeSwapRouter.sol +19 -0
  1099. package/lib/v3-periphery-main/contracts/test/NFTDescriptorTest.sol +75 -0
  1100. package/lib/v3-periphery-main/contracts/test/NonfungiblePositionManagerPositionsGasTest.sol +18 -0
  1101. package/lib/v3-periphery-main/contracts/test/OracleTest.sol +67 -0
  1102. package/lib/v3-periphery-main/contracts/test/PathTest.sol +37 -0
  1103. package/lib/v3-periphery-main/contracts/test/PeripheryImmutableStateTest.sol +8 -0
  1104. package/lib/v3-periphery-main/contracts/test/PoolAddressTest.sol +30 -0
  1105. package/lib/v3-periphery-main/contracts/test/PoolTicksCounterTest.sol +18 -0
  1106. package/lib/v3-periphery-main/contracts/test/PositionValueTest.sol +57 -0
  1107. package/lib/v3-periphery-main/contracts/test/SelfPermitTest.sol +9 -0
  1108. package/lib/v3-periphery-main/contracts/test/TestCallbackValidation.sol +15 -0
  1109. package/lib/v3-periphery-main/contracts/test/TestERC20.sol +10 -0
  1110. package/lib/v3-periphery-main/contracts/test/TestERC20Metadata.sol +14 -0
  1111. package/lib/v3-periphery-main/contracts/test/TestERC20PermitAllowed.sol +24 -0
  1112. package/lib/v3-periphery-main/contracts/test/TestMulticall.sol +30 -0
  1113. package/lib/v3-periphery-main/contracts/test/TestPositionNFTOwner.sol +28 -0
  1114. package/lib/v3-periphery-main/contracts/test/TestUniswapV3Callee.sol +62 -0
  1115. package/lib/v3-periphery-main/contracts/test/TickLensTest.sol +15 -0
  1116. package/lib/v3-periphery-main/deploys.md +25 -0
  1117. package/lib/v3-periphery-main/hardhat.config.ts +104 -0
  1118. package/lib/v3-periphery-main/package.json +68 -0
  1119. package/lib/v3-periphery-main/test/Base64.spec.ts +81 -0
  1120. package/lib/v3-periphery-main/test/CallbackValidation.spec.ts +56 -0
  1121. package/lib/v3-periphery-main/test/LiquidityAmounts.spec.ts +241 -0
  1122. package/lib/v3-periphery-main/test/Multicall.spec.ts +65 -0
  1123. package/lib/v3-periphery-main/test/NFTDescriptor.spec.ts +907 -0
  1124. package/lib/v3-periphery-main/test/NonfungiblePositionManager.spec.ts +1304 -0
  1125. package/lib/v3-periphery-main/test/NonfungibleTokenPositionDescriptor.spec.ts +217 -0
  1126. package/lib/v3-periphery-main/test/OracleLibrary.spec.ts +675 -0
  1127. package/lib/v3-periphery-main/test/PairFlash.spec.ts +168 -0
  1128. package/lib/v3-periphery-main/test/Path.spec.ts +90 -0
  1129. package/lib/v3-periphery-main/test/PeripheryImmutableState.spec.ts +56 -0
  1130. package/lib/v3-periphery-main/test/PoolAddress.spec.ts +72 -0
  1131. package/lib/v3-periphery-main/test/PoolTicksCounter.spec.ts +280 -0
  1132. package/lib/v3-periphery-main/test/PositionValue.spec.ts +490 -0
  1133. package/lib/v3-periphery-main/test/Quoter.spec.ts +201 -0
  1134. package/lib/v3-periphery-main/test/QuoterV2.spec.ts +578 -0
  1135. package/lib/v3-periphery-main/test/SelfPermit.spec.ts +198 -0
  1136. package/lib/v3-periphery-main/test/SwapRouter.gas.spec.ts +453 -0
  1137. package/lib/v3-periphery-main/test/SwapRouter.spec.ts +916 -0
  1138. package/lib/v3-periphery-main/test/TickLens.spec.ts +223 -0
  1139. package/lib/v3-periphery-main/test/V3Migrator.spec.ts +446 -0
  1140. package/lib/v3-periphery-main/test/__snapshots__/Base64.spec.ts.snap +32 -0
  1141. package/lib/v3-periphery-main/test/__snapshots__/LiquidityAmounts.spec.ts.snap +21 -0
  1142. package/lib/v3-periphery-main/test/__snapshots__/Multicall.spec.ts.snap +5 -0
  1143. package/lib/v3-periphery-main/test/__snapshots__/NFTDescriptor.spec.ts.snap +7 -0
  1144. package/lib/v3-periphery-main/test/__snapshots__/NFTDescriptor.svg +1 -0
  1145. package/lib/v3-periphery-main/test/__snapshots__/NonfungiblePositionManager.spec.ts.snap +41 -0
  1146. package/lib/v3-periphery-main/test/__snapshots__/OracleLibrary.spec.ts.snap +3 -0
  1147. package/lib/v3-periphery-main/test/__snapshots__/PairFlash.spec.ts.snap +3 -0
  1148. package/lib/v3-periphery-main/test/__snapshots__/Path.spec.ts.snap +3 -0
  1149. package/lib/v3-periphery-main/test/__snapshots__/PeripheryImmutableState.spec.ts.snap +3 -0
  1150. package/lib/v3-periphery-main/test/__snapshots__/PoolAddress.spec.ts.snap +5 -0
  1151. package/lib/v3-periphery-main/test/__snapshots__/PositionValue.spec.ts.snap +11 -0
  1152. package/lib/v3-periphery-main/test/__snapshots__/QuoterV2.spec.ts.snap +51 -0
  1153. package/lib/v3-periphery-main/test/__snapshots__/SwapRouter.gas.spec.ts.snap +37 -0
  1154. package/lib/v3-periphery-main/test/__snapshots__/SwapRouter.spec.ts.snap +3 -0
  1155. package/lib/v3-periphery-main/test/__snapshots__/TickLens.spec.ts.snap +5 -0
  1156. package/lib/v3-periphery-main/test/__snapshots__/V3Migrator.spec.ts.snap +3 -0
  1157. package/lib/v3-periphery-main/test/contracts/WETH9.json +156 -0
  1158. package/lib/v3-periphery-main/test/shared/base64.ts +7 -0
  1159. package/lib/v3-periphery-main/test/shared/completeFixture.ts +63 -0
  1160. package/lib/v3-periphery-main/test/shared/computePoolAddress.ts +22 -0
  1161. package/lib/v3-periphery-main/test/shared/constants.ts +15 -0
  1162. package/lib/v3-periphery-main/test/shared/encodePriceSqrt.ts +16 -0
  1163. package/lib/v3-periphery-main/test/shared/expandTo18Decimals.ts +5 -0
  1164. package/lib/v3-periphery-main/test/shared/expect.ts +8 -0
  1165. package/lib/v3-periphery-main/test/shared/externalFixtures.ts +57 -0
  1166. package/lib/v3-periphery-main/test/shared/extractJSONFromURI.ts +5 -0
  1167. package/lib/v3-periphery-main/test/shared/formatSqrtRatioX96.spec.ts +30 -0
  1168. package/lib/v3-periphery-main/test/shared/formatSqrtRatioX96.ts +30 -0
  1169. package/lib/v3-periphery-main/test/shared/getPermitNFTSignature.ts +57 -0
  1170. package/lib/v3-periphery-main/test/shared/path.ts +61 -0
  1171. package/lib/v3-periphery-main/test/shared/permit.ts +61 -0
  1172. package/lib/v3-periphery-main/test/shared/poolAtAddress.ts +7 -0
  1173. package/lib/v3-periphery-main/test/shared/quoter.ts +153 -0
  1174. package/lib/v3-periphery-main/test/shared/snapshotGasCost.ts +27 -0
  1175. package/lib/v3-periphery-main/test/shared/ticks.ts +9 -0
  1176. package/lib/v3-periphery-main/test/shared/tokenSort.ts +10 -0
  1177. package/lib/v3-periphery-main/testnet-deploys.md +3 -0
  1178. package/lib/v3-periphery-main/tsconfig.json +14 -0
  1179. package/lib/v3-periphery-main/yarn.lock +8111 -0
  1180. package/package.json +44 -0
  1181. package/src/LPStateStorage.sol +74 -0
  1182. package/src/MinimalPositionDescriptor.sol +38 -0
  1183. package/src/NonfungiblePositionManagerImporter.sol +13 -0
  1184. package/src/QuoterV2Importer.sol +9 -0
  1185. package/src/RapidexV3FactoryImporter.sol +6 -0
  1186. package/src/SwapRouterImporter.sol +9 -0
  1187. package/src/TestToken.sol +60 -0
  1188. package/src/WMST.sol +63 -0
  1189. package/src/flattened/LPStateStorage.flat.sol +76 -0
  1190. package/src/flattened/MinimalPositionDescriptor.flat.sol +40 -0
  1191. package/src/flattened/NonfungiblePositionManagerImporter.flat.sol +2695 -0
  1192. package/src/flattened/QuoterV2Importer.flat.sol +1616 -0
  1193. package/src/flattened/RapidexV3FactoryImporter.flat.sol +3193 -0
  1194. package/src/flattened/SwapRouterImporter.flat.sol +1811 -0
  1195. package/src/flattened/TestToken.flat.sol +62 -0
  1196. package/src/flattened/WMST.flat.sol +65 -0
@@ -0,0 +1,2695 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity <0.8.0 =0.7.6 >=0.4.0 >=0.5.0 >=0.6.0 >=0.7.0 >=0.7.5;
3
+ pragma abicoder v2;
4
+
5
+ // lib/openzeppelin-contracts/contracts/utils/Address.sol
6
+
7
+ library Address {
8
+ function isContract(address account) internal view returns (bool) {
9
+ uint256 size;
10
+ assembly {
11
+ size := extcodesize(account)
12
+ }
13
+ return size > 0;
14
+ }
15
+ }
16
+
17
+ // lib/v3-periphery-main/contracts/base/BlockTimestamp.sol
18
+
19
+ /// @title Function for getting block timestamp
20
+ /// @dev Base contract that is overridden for tests
21
+ abstract contract BlockTimestamp {
22
+ /// @dev Method that exists purely to be overridden for tests
23
+ /// @return The current block timestamp
24
+ function _blockTimestamp() internal view virtual returns (uint256) {
25
+ return block.timestamp;
26
+ }
27
+ }
28
+
29
+ // lib/v3-periphery-main/contracts/libraries/ChainId.sol
30
+
31
+ /// @title Function for getting the current chain ID
32
+ library ChainId {
33
+ /// @dev Gets the current chain ID
34
+ /// @return chainId The current chain ID
35
+ function get() internal pure returns (uint256 chainId) {
36
+ assembly {
37
+ chainId := chainid()
38
+ }
39
+ }
40
+ }
41
+
42
+ // lib/openzeppelin-contracts/contracts/utils/Context.sol
43
+
44
+ abstract contract Context {
45
+ function _msgSender() internal view virtual returns (address payable) {
46
+ return msg.sender;
47
+ }
48
+ }
49
+
50
+ // lib/v3-core-main/contracts/libraries/FixedPoint128.sol
51
+
52
+ /// @title FixedPoint128
53
+ /// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format)
54
+ library FixedPoint128 {
55
+ uint256 internal constant Q128 = 0x100000000000000000000000000000000;
56
+ }
57
+
58
+ // lib/v3-core-main/contracts/libraries/FixedPoint96.sol
59
+
60
+ /// @title FixedPoint96
61
+ /// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format)
62
+ /// @dev Used in SqrtPriceMath.sol
63
+ library FixedPoint96 {
64
+ uint8 internal constant RESOLUTION = 96;
65
+ uint256 internal constant Q96 = 0x1000000000000000000000000;
66
+ }
67
+
68
+ // lib/v3-core-main/contracts/libraries/FullMath.sol
69
+
70
+ /// @title Contains 512-bit math functions
71
+ /// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision
72
+ /// @dev Handles "phantom overflow" i.e., allows multiplication and division where an intermediate value overflows 256 bits
73
+ library FullMath {
74
+ /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
75
+ /// @param a The multiplicand
76
+ /// @param b The multiplier
77
+ /// @param denominator The divisor
78
+ /// @return result The 256-bit result
79
+ /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv
80
+ function mulDiv(
81
+ uint256 a,
82
+ uint256 b,
83
+ uint256 denominator
84
+ ) internal pure returns (uint256 result) {
85
+ // 512-bit multiply [prod1 prod0] = a * b
86
+ // Compute the product mod 2**256 and mod 2**256 - 1
87
+ // then use the Chinese Remainder Theorem to reconstruct
88
+ // the 512 bit result. The result is stored in two 256
89
+ // variables such that product = prod1 * 2**256 + prod0
90
+ uint256 prod0; // Least significant 256 bits of the product
91
+ uint256 prod1; // Most significant 256 bits of the product
92
+ assembly {
93
+ let mm := mulmod(a, b, not(0))
94
+ prod0 := mul(a, b)
95
+ prod1 := sub(sub(mm, prod0), lt(mm, prod0))
96
+ }
97
+
98
+ // Handle non-overflow cases, 256 by 256 division
99
+ if (prod1 == 0) {
100
+ require(denominator > 0);
101
+ assembly {
102
+ result := div(prod0, denominator)
103
+ }
104
+ return result;
105
+ }
106
+
107
+ // Make sure the result is less than 2**256.
108
+ // Also prevents denominator == 0
109
+ require(denominator > prod1);
110
+
111
+ ///////////////////////////////////////////////
112
+ // 512 by 256 division.
113
+ ///////////////////////////////////////////////
114
+
115
+ // Make division exact by subtracting the remainder from [prod1 prod0]
116
+ // Compute remainder using mulmod
117
+ uint256 remainder;
118
+ assembly {
119
+ remainder := mulmod(a, b, denominator)
120
+ }
121
+ // Subtract 256 bit number from 512 bit number
122
+ assembly {
123
+ prod1 := sub(prod1, gt(remainder, prod0))
124
+ prod0 := sub(prod0, remainder)
125
+ }
126
+
127
+ // Factor powers of two out of denominator
128
+ // Compute largest power of two divisor of denominator.
129
+ // Always >= 1.
130
+ uint256 twos = -denominator & denominator;
131
+ // Divide denominator by power of two
132
+ assembly {
133
+ denominator := div(denominator, twos)
134
+ }
135
+
136
+ // Divide [prod1 prod0] by the factors of two
137
+ assembly {
138
+ prod0 := div(prod0, twos)
139
+ }
140
+ // Shift in bits from prod1 into prod0. For this we need
141
+ // to flip `twos` such that it is 2**256 / twos.
142
+ // If twos is zero, then it becomes one
143
+ assembly {
144
+ twos := add(div(sub(0, twos), twos), 1)
145
+ }
146
+ prod0 |= prod1 * twos;
147
+
148
+ // Invert denominator mod 2**256
149
+ // Now that denominator is an odd number, it has an inverse
150
+ // modulo 2**256 such that denominator * inv = 1 mod 2**256.
151
+ // Compute the inverse by starting with a seed that is correct
152
+ // correct for four bits. That is, denominator * inv = 1 mod 2**4
153
+ uint256 inv = (3 * denominator) ^ 2;
154
+ // Now use Newton-Raphson iteration to improve the precision.
155
+ // Thanks to Hensel's lifting lemma, this also works in modular
156
+ // arithmetic, doubling the correct bits in each step.
157
+ inv *= 2 - denominator * inv; // inverse mod 2**8
158
+ inv *= 2 - denominator * inv; // inverse mod 2**16
159
+ inv *= 2 - denominator * inv; // inverse mod 2**32
160
+ inv *= 2 - denominator * inv; // inverse mod 2**64
161
+ inv *= 2 - denominator * inv; // inverse mod 2**128
162
+ inv *= 2 - denominator * inv; // inverse mod 2**256
163
+
164
+ // Because the division is now exact we can divide by multiplying
165
+ // with the modular inverse of denominator. This will give us the
166
+ // correct result modulo 2**256. Since the precoditions guarantee
167
+ // that the outcome is less than 2**256, this is the final result.
168
+ // We don't need to compute the high bits of the result and prod1
169
+ // is no longer required.
170
+ result = prod0 * inv;
171
+ return result;
172
+ }
173
+
174
+ /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
175
+ /// @param a The multiplicand
176
+ /// @param b The multiplier
177
+ /// @param denominator The divisor
178
+ /// @return result The 256-bit result
179
+ function mulDivRoundingUp(
180
+ uint256 a,
181
+ uint256 b,
182
+ uint256 denominator
183
+ ) internal pure returns (uint256 result) {
184
+ result = mulDiv(a, b, denominator);
185
+ if (mulmod(a, b, denominator) > 0) {
186
+ require(result < type(uint256).max);
187
+ result++;
188
+ }
189
+ }
190
+ }
191
+
192
+ // lib/v3-periphery-main/contracts/interfaces/external/IERC1271.sol
193
+
194
+ /// @title Interface for verifying contract-based account signatures
195
+ /// @notice Interface that verifies provided signature for the data
196
+ /// @dev Interface defined by EIP-1271
197
+ interface IERC1271 {
198
+ /// @notice Returns whether the provided signature is valid for the provided data
199
+ /// @dev MUST return the bytes4 magic value 0x1626ba7e when function passes.
200
+ /// MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5).
201
+ /// MUST allow external calls.
202
+ /// @param hash Hash of the data to be signed
203
+ /// @param signature Signature byte array associated with _data
204
+ /// @return magicValue The bytes4 magic value 0x1626ba7e
205
+ function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);
206
+ }
207
+
208
+ // lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol
209
+
210
+ interface IERC165 {
211
+ function supportsInterface(bytes4 interfaceId) external view returns (bool);
212
+ }
213
+
214
+ // lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol
215
+
216
+ interface IERC20 {
217
+ function totalSupply() external view returns (uint256);
218
+ function balanceOf(address account) external view returns (uint256);
219
+ function transfer(address recipient, uint256 amount) external returns (bool);
220
+ function allowance(address owner, address spender) external view returns (uint256);
221
+ function approve(address spender, uint256 amount) external returns (bool);
222
+ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
223
+
224
+ event Transfer(address indexed from, address indexed to, uint256 value);
225
+ event Approval(address indexed owner, address indexed spender, uint256 value);
226
+ }
227
+
228
+ // lib/openzeppelin-contracts/contracts/drafts/IERC20Permit.sol
229
+
230
+ interface IERC20Permit {
231
+ function permit(
232
+ address owner,
233
+ address spender,
234
+ uint256 value,
235
+ uint256 deadline,
236
+ uint8 v,
237
+ bytes32 r,
238
+ bytes32 s
239
+ ) external;
240
+ }
241
+
242
+ // lib/v3-periphery-main/contracts/interfaces/external/IERC20PermitAllowed.sol
243
+
244
+ /// @title Interface for permit
245
+ /// @notice Interface used by DAI/CHAI for permit
246
+ interface IERC20PermitAllowed {
247
+ /// @notice Approve the spender to spend some tokens via the holder signature
248
+ /// @dev This is the permit interface used by DAI and CHAI
249
+ /// @param holder The address of the token holder, the token owner
250
+ /// @param spender The address of the token spender
251
+ /// @param nonce The holder's nonce, increases at each call to permit
252
+ /// @param expiry The timestamp at which the permit is no longer valid
253
+ /// @param allowed Boolean that sets approval amount, true for type(uint256).max and false for 0
254
+ /// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s`
255
+ /// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s`
256
+ /// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v`
257
+ function permit(
258
+ address holder,
259
+ address spender,
260
+ uint256 nonce,
261
+ uint256 expiry,
262
+ bool allowed,
263
+ uint8 v,
264
+ bytes32 r,
265
+ bytes32 s
266
+ ) external;
267
+ }
268
+
269
+ // lib/openzeppelin-contracts/contracts/token/ERC721/IERC721Receiver.sol
270
+
271
+ interface IERC721Receiver {
272
+ function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data)
273
+ external
274
+ returns (bytes4);
275
+ }
276
+
277
+ // lib/v3-periphery-main/contracts/interfaces/IMulticall.sol
278
+
279
+ /// @title Multicall interface
280
+ /// @notice Enables calling multiple methods in a single call to the contract
281
+ interface IMulticall {
282
+ /// @notice Call multiple functions in the current contract and return the data from all of them if they all succeed
283
+ /// @dev The `msg.value` should not be trusted for any method callable from multicall.
284
+ /// @param data The encoded function data for each of the calls to make to this contract
285
+ /// @return results The results from each of the calls passed in via data
286
+ function multicall(bytes[] calldata data) external payable returns (bytes[] memory results);
287
+ }
288
+
289
+ // lib/v3-periphery-main/contracts/interfaces/IPeripheryImmutableState.sol
290
+
291
+ /// @title Immutable state
292
+ /// @notice Functions that return immutable state of the router
293
+ interface IPeripheryImmutableState {
294
+ /// @return Returns the address of the Uniswap V3 factory
295
+ function factory() external view returns (address);
296
+
297
+ /// @return Returns the address of WETH9
298
+ function WETH9() external view returns (address);
299
+ }
300
+
301
+ // lib/v3-periphery-main/contracts/interfaces/IPeripheryPayments.sol
302
+
303
+ /// @title Periphery Payments
304
+ /// @notice Functions to ease deposits and withdrawals of ETH
305
+ interface IPeripheryPayments {
306
+ /// @notice Unwraps the contract's WETH9 balance and sends it to recipient as ETH.
307
+ /// @dev The amountMinimum parameter prevents malicious contracts from stealing WETH9 from users.
308
+ /// @param amountMinimum The minimum amount of WETH9 to unwrap
309
+ /// @param recipient The address receiving ETH
310
+ function unwrapWETH9(uint256 amountMinimum, address recipient) external payable;
311
+
312
+ /// @notice Refunds any ETH balance held by this contract to the `msg.sender`
313
+ /// @dev Useful for bundling with mint or increase liquidity that uses ether, or exact output swaps
314
+ /// that use ether for the input amount
315
+ function refundETH() external payable;
316
+
317
+ /// @notice Transfers the full amount of a token held by this contract to recipient
318
+ /// @dev The amountMinimum parameter prevents malicious contracts from stealing the token from users
319
+ /// @param token The contract address of the token which will be transferred to `recipient`
320
+ /// @param amountMinimum The minimum amount of token required for a transfer
321
+ /// @param recipient The destination address of the token
322
+ function sweepToken(
323
+ address token,
324
+ uint256 amountMinimum,
325
+ address recipient
326
+ ) external payable;
327
+ }
328
+
329
+ // lib/v3-periphery-main/contracts/interfaces/IPoolInitializer.sol
330
+
331
+ /// @title Creates and initializes V3 Pools
332
+ /// @notice Provides a method for creating and initializing a pool, if necessary, for bundling with other methods that
333
+ /// require the pool to exist.
334
+ interface IPoolInitializer {
335
+ /// @notice Creates a new pool if it does not exist, then initializes if not initialized
336
+ /// @dev This method can be bundled with others via IMulticall for the first action (e.g. mint) performed against a pool
337
+ /// @param token0 The contract address of token0 of the pool
338
+ /// @param token1 The contract address of token1 of the pool
339
+ /// @param fee The fee amount of the v3 pool for the specified token pair
340
+ /// @param sqrtPriceX96 The initial square root price of the pool as a Q64.96 value
341
+ /// @return pool Returns the pool address based on the pair of tokens and fee, will return the newly created pool address if necessary
342
+ function createAndInitializePoolIfNecessary(
343
+ address token0,
344
+ address token1,
345
+ uint24 fee,
346
+ uint160 sqrtPriceX96
347
+ ) external payable returns (address pool);
348
+ }
349
+
350
+ // lib/v3-periphery-main/contracts/interfaces/ISelfPermit.sol
351
+
352
+ /// @title Self Permit
353
+ /// @notice Functionality to call permit on any EIP-2612-compliant token for use in the route
354
+ interface ISelfPermit {
355
+ /// @notice Permits this contract to spend a given token from `msg.sender`
356
+ /// @dev The `owner` is always msg.sender and the `spender` is always address(this).
357
+ /// @param token The address of the token spent
358
+ /// @param value The amount that can be spent of token
359
+ /// @param deadline A timestamp, the current blocktime must be less than or equal to this timestamp
360
+ /// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s`
361
+ /// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s`
362
+ /// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v`
363
+ function selfPermit(
364
+ address token,
365
+ uint256 value,
366
+ uint256 deadline,
367
+ uint8 v,
368
+ bytes32 r,
369
+ bytes32 s
370
+ ) external payable;
371
+
372
+ /// @notice Permits this contract to spend a given token from `msg.sender`
373
+ /// @dev The `owner` is always msg.sender and the `spender` is always address(this).
374
+ /// Can be used instead of #selfPermit to prevent calls from failing due to a frontrun of a call to #selfPermit
375
+ /// @param token The address of the token spent
376
+ /// @param value The amount that can be spent of token
377
+ /// @param deadline A timestamp, the current blocktime must be less than or equal to this timestamp
378
+ /// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s`
379
+ /// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s`
380
+ /// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v`
381
+ function selfPermitIfNecessary(
382
+ address token,
383
+ uint256 value,
384
+ uint256 deadline,
385
+ uint8 v,
386
+ bytes32 r,
387
+ bytes32 s
388
+ ) external payable;
389
+
390
+ /// @notice Permits this contract to spend the sender's tokens for permit signatures that have the `allowed` parameter
391
+ /// @dev The `owner` is always msg.sender and the `spender` is always address(this)
392
+ /// @param token The address of the token spent
393
+ /// @param nonce The current nonce of the owner
394
+ /// @param expiry The timestamp at which the permit is no longer valid
395
+ /// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s`
396
+ /// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s`
397
+ /// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v`
398
+ function selfPermitAllowed(
399
+ address token,
400
+ uint256 nonce,
401
+ uint256 expiry,
402
+ uint8 v,
403
+ bytes32 r,
404
+ bytes32 s
405
+ ) external payable;
406
+
407
+ /// @notice Permits this contract to spend the sender's tokens for permit signatures that have the `allowed` parameter
408
+ /// @dev The `owner` is always msg.sender and the `spender` is always address(this)
409
+ /// Can be used instead of #selfPermitAllowed to prevent calls from failing due to a frontrun of a call to #selfPermitAllowed.
410
+ /// @param token The address of the token spent
411
+ /// @param nonce The current nonce of the owner
412
+ /// @param expiry The timestamp at which the permit is no longer valid
413
+ /// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s`
414
+ /// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s`
415
+ /// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v`
416
+ function selfPermitAllowedIfNecessary(
417
+ address token,
418
+ uint256 nonce,
419
+ uint256 expiry,
420
+ uint8 v,
421
+ bytes32 r,
422
+ bytes32 s
423
+ ) external payable;
424
+ }
425
+
426
+ // lib/v3-core-main/contracts/interfaces/IUniswapV3Factory.sol
427
+
428
+ /// @title The interface for the Uniswap V3 Factory
429
+ /// @notice The Uniswap V3 Factory facilitates creation of Uniswap V3 pools and control over the protocol fees
430
+ interface IUniswapV3Factory {
431
+ /// @notice Emitted when the owner of the factory is changed
432
+ /// @param oldOwner The owner before the owner was changed
433
+ /// @param newOwner The owner after the owner was changed
434
+ event OwnerChanged(address indexed oldOwner, address indexed newOwner);
435
+
436
+ /// @notice Emitted when a pool is created
437
+ /// @param token0 The first token of the pool by address sort order
438
+ /// @param token1 The second token of the pool by address sort order
439
+ /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip
440
+ /// @param tickSpacing The minimum number of ticks between initialized ticks
441
+ /// @param pool The address of the created pool
442
+ event PoolCreated(
443
+ address indexed token0,
444
+ address indexed token1,
445
+ uint24 indexed fee,
446
+ int24 tickSpacing,
447
+ address pool
448
+ );
449
+
450
+ /// @notice Emitted when a new fee amount is enabled for pool creation via the factory
451
+ /// @param fee The enabled fee, denominated in hundredths of a bip
452
+ /// @param tickSpacing The minimum number of ticks between initialized ticks for pools created with the given fee
453
+ event FeeAmountEnabled(uint24 indexed fee, int24 indexed tickSpacing);
454
+
455
+ /// @notice Returns the current owner of the factory
456
+ /// @dev Can be changed by the current owner via setOwner
457
+ /// @return The address of the factory owner
458
+ function owner() external view returns (address);
459
+
460
+ /// @notice Returns the tick spacing for a given fee amount, if enabled, or 0 if not enabled
461
+ /// @dev A fee amount can never be removed, so this value should be hard coded or cached in the calling context
462
+ /// @param fee The enabled fee, denominated in hundredths of a bip. Returns 0 in case of unenabled fee
463
+ /// @return The tick spacing
464
+ function feeAmountTickSpacing(uint24 fee) external view returns (int24);
465
+
466
+ /// @notice Returns the pool address for a given pair of tokens and a fee, or address 0 if it does not exist
467
+ /// @dev tokenA and tokenB may be passed in either token0/token1 or token1/token0 order
468
+ /// @param tokenA The contract address of either token0 or token1
469
+ /// @param tokenB The contract address of the other token
470
+ /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip
471
+ /// @return pool The pool address
472
+ function getPool(
473
+ address tokenA,
474
+ address tokenB,
475
+ uint24 fee
476
+ ) external view returns (address pool);
477
+
478
+ /// @notice Creates a pool for the given two tokens and fee
479
+ /// @param tokenA One of the two tokens in the desired pool
480
+ /// @param tokenB The other of the two tokens in the desired pool
481
+ /// @param fee The desired fee for the pool
482
+ /// @dev tokenA and tokenB may be passed in either order: token0/token1 or token1/token0. tickSpacing is retrieved
483
+ /// from the fee. The call will revert if the pool already exists, the fee is invalid, or the token arguments
484
+ /// are invalid.
485
+ /// @return pool The address of the newly created pool
486
+ function createPool(
487
+ address tokenA,
488
+ address tokenB,
489
+ uint24 fee
490
+ ) external returns (address pool);
491
+
492
+ /// @notice Updates the owner of the factory
493
+ /// @dev Must be called by the current owner
494
+ /// @param _owner The new owner of the factory
495
+ function setOwner(address _owner) external;
496
+
497
+ /// @notice Enables a fee amount with the given tickSpacing
498
+ /// @dev Fee amounts may never be removed once enabled
499
+ /// @param fee The fee amount to enable, denominated in hundredths of a bip (i.e. 1e-6)
500
+ /// @param tickSpacing The spacing between ticks to be enforced for all pools created with the given fee amount
501
+ function enableFeeAmount(uint24 fee, int24 tickSpacing) external;
502
+ }
503
+
504
+ // lib/v3-core-main/contracts/interfaces/callback/IUniswapV3MintCallback.sol
505
+
506
+ /// @title Callback for IUniswapV3PoolActions#mint
507
+ /// @notice Any contract that calls IUniswapV3PoolActions#mint must implement this interface
508
+ interface IUniswapV3MintCallback {
509
+ /// @notice Called to `msg.sender` after minting liquidity to a position from IUniswapV3Pool#mint.
510
+ /// @dev In the implementation you must pay the pool tokens owed for the minted liquidity.
511
+ /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory.
512
+ /// @param amount0Owed The amount of token0 due to the pool for the minted liquidity
513
+ /// @param amount1Owed The amount of token1 due to the pool for the minted liquidity
514
+ /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#mint call
515
+ function uniswapV3MintCallback(
516
+ uint256 amount0Owed,
517
+ uint256 amount1Owed,
518
+ bytes calldata data
519
+ ) external;
520
+ }
521
+
522
+ // lib/v3-core-main/contracts/interfaces/pool/IUniswapV3PoolActions.sol
523
+
524
+ /// @title Permissionless pool actions
525
+ /// @notice Contains pool methods that can be called by anyone
526
+ interface IUniswapV3PoolActions {
527
+ /// @notice Sets the initial price for the pool
528
+ /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value
529
+ /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96
530
+ function initialize(uint160 sqrtPriceX96) external;
531
+
532
+ /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position
533
+ /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback
534
+ /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends
535
+ /// on tickLower, tickUpper, the amount of liquidity, and the current price.
536
+ /// @param recipient The address for which the liquidity will be created
537
+ /// @param tickLower The lower tick of the position in which to add liquidity
538
+ /// @param tickUpper The upper tick of the position in which to add liquidity
539
+ /// @param amount The amount of liquidity to mint
540
+ /// @param data Any data that should be passed through to the callback
541
+ /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback
542
+ /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback
543
+ function mint(
544
+ address recipient,
545
+ int24 tickLower,
546
+ int24 tickUpper,
547
+ uint128 amount,
548
+ bytes calldata data
549
+ ) external returns (uint256 amount0, uint256 amount1);
550
+
551
+ /// @notice Collects tokens owed to a position
552
+ /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.
553
+ /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or
554
+ /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the
555
+ /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.
556
+ /// @param recipient The address which should receive the fees collected
557
+ /// @param tickLower The lower tick of the position for which to collect fees
558
+ /// @param tickUpper The upper tick of the position for which to collect fees
559
+ /// @param amount0Requested How much token0 should be withdrawn from the fees owed
560
+ /// @param amount1Requested How much token1 should be withdrawn from the fees owed
561
+ /// @return amount0 The amount of fees collected in token0
562
+ /// @return amount1 The amount of fees collected in token1
563
+ function collect(
564
+ address recipient,
565
+ int24 tickLower,
566
+ int24 tickUpper,
567
+ uint128 amount0Requested,
568
+ uint128 amount1Requested
569
+ ) external returns (uint128 amount0, uint128 amount1);
570
+
571
+ /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position
572
+ /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0
573
+ /// @dev Fees must be collected separately via a call to #collect
574
+ /// @param tickLower The lower tick of the position for which to burn liquidity
575
+ /// @param tickUpper The upper tick of the position for which to burn liquidity
576
+ /// @param amount How much liquidity to burn
577
+ /// @return amount0 The amount of token0 sent to the recipient
578
+ /// @return amount1 The amount of token1 sent to the recipient
579
+ function burn(
580
+ int24 tickLower,
581
+ int24 tickUpper,
582
+ uint128 amount
583
+ ) external returns (uint256 amount0, uint256 amount1);
584
+
585
+ /// @notice Swap token0 for token1, or token1 for token0
586
+ /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback
587
+ /// @param recipient The address to receive the output of the swap
588
+ /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0
589
+ /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)
590
+ /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this
591
+ /// value after the swap. If one for zero, the price cannot be greater than this value after the swap
592
+ /// @param data Any data to be passed through to the callback
593
+ /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive
594
+ /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive
595
+ function swap(
596
+ address recipient,
597
+ bool zeroForOne,
598
+ int256 amountSpecified,
599
+ uint160 sqrtPriceLimitX96,
600
+ bytes calldata data
601
+ ) external returns (int256 amount0, int256 amount1);
602
+
603
+ /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback
604
+ /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback
605
+ /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling
606
+ /// with 0 amount{0,1} and sending the donation amount(s) from the callback
607
+ /// @param recipient The address which will receive the token0 and token1 amounts
608
+ /// @param amount0 The amount of token0 to send
609
+ /// @param amount1 The amount of token1 to send
610
+ /// @param data Any data to be passed through to the callback
611
+ function flash(
612
+ address recipient,
613
+ uint256 amount0,
614
+ uint256 amount1,
615
+ bytes calldata data
616
+ ) external;
617
+
618
+ /// @notice Increase the maximum number of price and liquidity observations that this pool will store
619
+ /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to
620
+ /// the input observationCardinalityNext.
621
+ /// @param observationCardinalityNext The desired minimum number of observations for the pool to store
622
+ function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;
623
+ }
624
+
625
+ // lib/v3-core-main/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol
626
+
627
+ /// @title Pool state that is not stored
628
+ /// @notice Contains view functions to provide information about the pool that is computed rather than stored on the
629
+ /// blockchain. The functions here may have variable gas costs.
630
+ interface IUniswapV3PoolDerivedState {
631
+ /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp
632
+ /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing
633
+ /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,
634
+ /// you must call it with secondsAgos = [3600, 0].
635
+ /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in
636
+ /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.
637
+ /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned
638
+ /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp
639
+ /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block
640
+ /// timestamp
641
+ function observe(uint32[] calldata secondsAgos)
642
+ external
643
+ view
644
+ returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);
645
+
646
+ /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range
647
+ /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.
648
+ /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first
649
+ /// snapshot is taken and the second snapshot is taken.
650
+ /// @param tickLower The lower tick of the range
651
+ /// @param tickUpper The upper tick of the range
652
+ /// @return tickCumulativeInside The snapshot of the tick accumulator for the range
653
+ /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range
654
+ /// @return secondsInside The snapshot of seconds per liquidity for the range
655
+ function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)
656
+ external
657
+ view
658
+ returns (
659
+ int56 tickCumulativeInside,
660
+ uint160 secondsPerLiquidityInsideX128,
661
+ uint32 secondsInside
662
+ );
663
+ }
664
+
665
+ // lib/v3-core-main/contracts/interfaces/pool/IUniswapV3PoolEvents.sol
666
+
667
+ /// @title Events emitted by a pool
668
+ /// @notice Contains all events emitted by the pool
669
+ interface IUniswapV3PoolEvents {
670
+ /// @notice Emitted exactly once by a pool when #initialize is first called on the pool
671
+ /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize
672
+ /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96
673
+ /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool
674
+ event Initialize(uint160 sqrtPriceX96, int24 tick);
675
+
676
+ /// @notice Emitted when liquidity is minted for a given position
677
+ /// @param sender The address that minted the liquidity
678
+ /// @param owner The owner of the position and recipient of any minted liquidity
679
+ /// @param tickLower The lower tick of the position
680
+ /// @param tickUpper The upper tick of the position
681
+ /// @param amount The amount of liquidity minted to the position range
682
+ /// @param amount0 How much token0 was required for the minted liquidity
683
+ /// @param amount1 How much token1 was required for the minted liquidity
684
+ event Mint(
685
+ address sender,
686
+ address indexed owner,
687
+ int24 indexed tickLower,
688
+ int24 indexed tickUpper,
689
+ uint128 amount,
690
+ uint256 amount0,
691
+ uint256 amount1
692
+ );
693
+
694
+ /// @notice Emitted when fees are collected by the owner of a position
695
+ /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees
696
+ /// @param owner The owner of the position for which fees are collected
697
+ /// @param tickLower The lower tick of the position
698
+ /// @param tickUpper The upper tick of the position
699
+ /// @param amount0 The amount of token0 fees collected
700
+ /// @param amount1 The amount of token1 fees collected
701
+ event Collect(
702
+ address indexed owner,
703
+ address recipient,
704
+ int24 indexed tickLower,
705
+ int24 indexed tickUpper,
706
+ uint128 amount0,
707
+ uint128 amount1
708
+ );
709
+
710
+ /// @notice Emitted when a position's liquidity is removed
711
+ /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect
712
+ /// @param owner The owner of the position for which liquidity is removed
713
+ /// @param tickLower The lower tick of the position
714
+ /// @param tickUpper The upper tick of the position
715
+ /// @param amount The amount of liquidity to remove
716
+ /// @param amount0 The amount of token0 withdrawn
717
+ /// @param amount1 The amount of token1 withdrawn
718
+ event Burn(
719
+ address indexed owner,
720
+ int24 indexed tickLower,
721
+ int24 indexed tickUpper,
722
+ uint128 amount,
723
+ uint256 amount0,
724
+ uint256 amount1
725
+ );
726
+
727
+ /// @notice Emitted by the pool for any swaps between token0 and token1
728
+ /// @param sender The address that initiated the swap call, and that received the callback
729
+ /// @param recipient The address that received the output of the swap
730
+ /// @param amount0 The delta of the token0 balance of the pool
731
+ /// @param amount1 The delta of the token1 balance of the pool
732
+ /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96
733
+ /// @param liquidity The liquidity of the pool after the swap
734
+ /// @param tick The log base 1.0001 of price of the pool after the swap
735
+ event Swap(
736
+ address indexed sender,
737
+ address indexed recipient,
738
+ int256 amount0,
739
+ int256 amount1,
740
+ uint160 sqrtPriceX96,
741
+ uint128 liquidity,
742
+ int24 tick
743
+ );
744
+
745
+ /// @notice Emitted by the pool for any flashes of token0/token1
746
+ /// @param sender The address that initiated the swap call, and that received the callback
747
+ /// @param recipient The address that received the tokens from flash
748
+ /// @param amount0 The amount of token0 that was flashed
749
+ /// @param amount1 The amount of token1 that was flashed
750
+ /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee
751
+ /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee
752
+ event Flash(
753
+ address indexed sender,
754
+ address indexed recipient,
755
+ uint256 amount0,
756
+ uint256 amount1,
757
+ uint256 paid0,
758
+ uint256 paid1
759
+ );
760
+
761
+ /// @notice Emitted by the pool for increases to the number of observations that can be stored
762
+ /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index
763
+ /// just before a mint/swap/burn.
764
+ /// @param observationCardinalityNextOld The previous value of the next observation cardinality
765
+ /// @param observationCardinalityNextNew The updated value of the next observation cardinality
766
+ event IncreaseObservationCardinalityNext(
767
+ uint16 observationCardinalityNextOld,
768
+ uint16 observationCardinalityNextNew
769
+ );
770
+
771
+ /// @notice Emitted when the protocol fee is changed by the pool
772
+ /// @param feeProtocol0Old The previous value of the token0 protocol fee
773
+ /// @param feeProtocol1Old The previous value of the token1 protocol fee
774
+ /// @param feeProtocol0New The updated value of the token0 protocol fee
775
+ /// @param feeProtocol1New The updated value of the token1 protocol fee
776
+ event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);
777
+
778
+ /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner
779
+ /// @param sender The address that collects the protocol fees
780
+ /// @param recipient The address that receives the collected protocol fees
781
+ /// @param amount0 The amount of token0 protocol fees that is withdrawn
782
+ /// @param amount0 The amount of token1 protocol fees that is withdrawn
783
+ event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);
784
+ }
785
+
786
+ // lib/v3-core-main/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol
787
+
788
+ /// @title Pool state that never changes
789
+ /// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values
790
+ interface IUniswapV3PoolImmutables {
791
+ /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface
792
+ /// @return The contract address
793
+ function factory() external view returns (address);
794
+
795
+ /// @notice The first of the two tokens of the pool, sorted by address
796
+ /// @return The token contract address
797
+ function token0() external view returns (address);
798
+
799
+ /// @notice The second of the two tokens of the pool, sorted by address
800
+ /// @return The token contract address
801
+ function token1() external view returns (address);
802
+
803
+ /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6
804
+ /// @return The fee
805
+ function fee() external view returns (uint24);
806
+
807
+ /// @notice The pool tick spacing
808
+ /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive
809
+ /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...
810
+ /// This value is an int24 to avoid casting even though it is always positive.
811
+ /// @return The tick spacing
812
+ function tickSpacing() external view returns (int24);
813
+
814
+ /// @notice The maximum amount of position liquidity that can use any tick in the range
815
+ /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and
816
+ /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool
817
+ /// @return The max amount of liquidity per tick
818
+ function maxLiquidityPerTick() external view returns (uint128);
819
+ }
820
+
821
+ // lib/v3-core-main/contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol
822
+
823
+ /// @title Permissioned pool actions
824
+ /// @notice Contains pool methods that may only be called by the factory owner
825
+ interface IUniswapV3PoolOwnerActions {
826
+ /// @notice Set the denominator of the protocol's % share of the fees
827
+ /// @param feeProtocol0 new protocol fee for token0 of the pool
828
+ /// @param feeProtocol1 new protocol fee for token1 of the pool
829
+ function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;
830
+
831
+ /// @notice Collect the protocol fee accrued to the pool
832
+ /// @param recipient The address to which collected protocol fees should be sent
833
+ /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1
834
+ /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0
835
+ /// @return amount0 The protocol fee collected in token0
836
+ /// @return amount1 The protocol fee collected in token1
837
+ function collectProtocol(
838
+ address recipient,
839
+ uint128 amount0Requested,
840
+ uint128 amount1Requested
841
+ ) external returns (uint128 amount0, uint128 amount1);
842
+ }
843
+
844
+ // lib/v3-core-main/contracts/interfaces/pool/IUniswapV3PoolState.sol
845
+
846
+ /// @title Pool state that can change
847
+ /// @notice These methods compose the pool's state, and can change with any frequency including multiple times
848
+ /// per transaction
849
+ interface IUniswapV3PoolState {
850
+ /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas
851
+ /// when accessed externally.
852
+ /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value
853
+ /// tick The current tick of the pool, i.e. according to the last tick transition that was run.
854
+ /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick
855
+ /// boundary.
856
+ /// observationIndex The index of the last oracle observation that was written,
857
+ /// observationCardinality The current maximum number of observations stored in the pool,
858
+ /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.
859
+ /// feeProtocol The protocol fee for both tokens of the pool.
860
+ /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0
861
+ /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.
862
+ /// unlocked Whether the pool is currently locked to reentrancy
863
+ function slot0()
864
+ external
865
+ view
866
+ returns (
867
+ uint160 sqrtPriceX96,
868
+ int24 tick,
869
+ uint16 observationIndex,
870
+ uint16 observationCardinality,
871
+ uint16 observationCardinalityNext,
872
+ uint8 feeProtocol,
873
+ bool unlocked
874
+ );
875
+
876
+ /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool
877
+ /// @dev This value can overflow the uint256
878
+ function feeGrowthGlobal0X128() external view returns (uint256);
879
+
880
+ /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool
881
+ /// @dev This value can overflow the uint256
882
+ function feeGrowthGlobal1X128() external view returns (uint256);
883
+
884
+ /// @notice The amounts of token0 and token1 that are owed to the protocol
885
+ /// @dev Protocol fees will never exceed uint128 max in either token
886
+ function protocolFees() external view returns (uint128 token0, uint128 token1);
887
+
888
+ /// @notice The currently in range liquidity available to the pool
889
+ /// @dev This value has no relationship to the total liquidity across all ticks
890
+ function liquidity() external view returns (uint128);
891
+
892
+ /// @notice Look up information about a specific tick in the pool
893
+ /// @param tick The tick to look up
894
+ /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or
895
+ /// tick upper,
896
+ /// liquidityNet how much liquidity changes when the pool price crosses the tick,
897
+ /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,
898
+ /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,
899
+ /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick
900
+ /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,
901
+ /// secondsOutside the seconds spent on the other side of the tick from the current tick,
902
+ /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.
903
+ /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.
904
+ /// In addition, these values are only relative and must be used only in comparison to previous snapshots for
905
+ /// a specific position.
906
+ function ticks(int24 tick)
907
+ external
908
+ view
909
+ returns (
910
+ uint128 liquidityGross,
911
+ int128 liquidityNet,
912
+ uint256 feeGrowthOutside0X128,
913
+ uint256 feeGrowthOutside1X128,
914
+ int56 tickCumulativeOutside,
915
+ uint160 secondsPerLiquidityOutsideX128,
916
+ uint32 secondsOutside,
917
+ bool initialized
918
+ );
919
+
920
+ /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information
921
+ function tickBitmap(int16 wordPosition) external view returns (uint256);
922
+
923
+ /// @notice Returns the information about a position by the position's key
924
+ /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper
925
+ /// @return _liquidity The amount of liquidity in the position,
926
+ /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,
927
+ /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,
928
+ /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,
929
+ /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke
930
+ function positions(bytes32 key)
931
+ external
932
+ view
933
+ returns (
934
+ uint128 _liquidity,
935
+ uint256 feeGrowthInside0LastX128,
936
+ uint256 feeGrowthInside1LastX128,
937
+ uint128 tokensOwed0,
938
+ uint128 tokensOwed1
939
+ );
940
+
941
+ /// @notice Returns data about a specific observation index
942
+ /// @param index The element of the observations array to fetch
943
+ /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time
944
+ /// ago, rather than at a specific index in the array.
945
+ /// @return blockTimestamp The timestamp of the observation,
946
+ /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,
947
+ /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,
948
+ /// Returns initialized whether the observation has been initialized and the values are safe to use
949
+ function observations(uint256 index)
950
+ external
951
+ view
952
+ returns (
953
+ uint32 blockTimestamp,
954
+ int56 tickCumulative,
955
+ uint160 secondsPerLiquidityCumulativeX128,
956
+ bool initialized
957
+ );
958
+ }
959
+
960
+ // lib/v3-periphery-main/contracts/libraries/PoolAddress.sol
961
+
962
+ /// @title Provides functions for deriving a pool address from the factory, tokens, and the fee
963
+ library PoolAddress {
964
+ bytes32 internal constant POOL_INIT_CODE_HASH = 0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54;
965
+
966
+ /// @notice The identifying key of the pool
967
+ struct PoolKey {
968
+ address token0;
969
+ address token1;
970
+ uint24 fee;
971
+ }
972
+
973
+ /// @notice Returns PoolKey: the ordered tokens with the matched fee levels
974
+ /// @param tokenA The first token of a pool, unsorted
975
+ /// @param tokenB The second token of a pool, unsorted
976
+ /// @param fee The fee level of the pool
977
+ /// @return Poolkey The pool details with ordered token0 and token1 assignments
978
+ function getPoolKey(
979
+ address tokenA,
980
+ address tokenB,
981
+ uint24 fee
982
+ ) internal pure returns (PoolKey memory) {
983
+ if (tokenA > tokenB) (tokenA, tokenB) = (tokenB, tokenA);
984
+ return PoolKey({token0: tokenA, token1: tokenB, fee: fee});
985
+ }
986
+
987
+ /// @notice Deterministically computes the pool address given the factory and PoolKey
988
+ /// @param factory The Uniswap V3 factory contract address
989
+ /// @param key The PoolKey
990
+ /// @return pool The contract address of the V3 pool
991
+ function computeAddress(address factory, PoolKey memory key) internal pure returns (address pool) {
992
+ require(key.token0 < key.token1);
993
+ pool = address(
994
+ uint256(
995
+ keccak256(
996
+ abi.encodePacked(
997
+ hex'ff',
998
+ factory,
999
+ keccak256(abi.encode(key.token0, key.token1, key.fee)),
1000
+ POOL_INIT_CODE_HASH
1001
+ )
1002
+ )
1003
+ )
1004
+ );
1005
+ }
1006
+ }
1007
+
1008
+ // lib/v3-periphery-main/contracts/libraries/PositionKey.sol
1009
+
1010
+ library PositionKey {
1011
+ /// @dev Returns the key of the position in the core library
1012
+ function compute(
1013
+ address owner,
1014
+ int24 tickLower,
1015
+ int24 tickUpper
1016
+ ) internal pure returns (bytes32) {
1017
+ return keccak256(abi.encodePacked(owner, tickLower, tickUpper));
1018
+ }
1019
+ }
1020
+
1021
+ // lib/v3-core-main/contracts/libraries/TickMath.sol
1022
+
1023
+ /// @title Math library for computing sqrt prices from ticks and vice versa
1024
+ /// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports
1025
+ /// prices between 2**-128 and 2**128
1026
+ library TickMath {
1027
+ /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128
1028
+ int24 internal constant MIN_TICK = -887272;
1029
+ /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128
1030
+ int24 internal constant MAX_TICK = -MIN_TICK;
1031
+
1032
+ /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)
1033
+ uint160 internal constant MIN_SQRT_RATIO = 4295128739;
1034
+ /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)
1035
+ uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;
1036
+
1037
+ /// @notice Calculates sqrt(1.0001^tick) * 2^96
1038
+ /// @dev Throws if |tick| > max tick
1039
+ /// @param tick The input tick for the above formula
1040
+ /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)
1041
+ /// at the given tick
1042
+ function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {
1043
+ uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));
1044
+ require(absTick <= uint256(MAX_TICK), 'T');
1045
+
1046
+ uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000;
1047
+ if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;
1048
+ if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;
1049
+ if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;
1050
+ if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;
1051
+ if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;
1052
+ if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;
1053
+ if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;
1054
+ if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;
1055
+ if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;
1056
+ if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;
1057
+ if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;
1058
+ if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;
1059
+ if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;
1060
+ if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;
1061
+ if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;
1062
+ if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;
1063
+ if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;
1064
+ if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;
1065
+ if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;
1066
+
1067
+ if (tick > 0) ratio = type(uint256).max / ratio;
1068
+
1069
+ // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.
1070
+ // we then downcast because we know the result always fits within 160 bits due to our tick input constraint
1071
+ // we round up in the division so getTickAtSqrtRatio of the output price is always consistent
1072
+ sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));
1073
+ }
1074
+
1075
+ /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio
1076
+ /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may
1077
+ /// ever return.
1078
+ /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96
1079
+ /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio
1080
+ function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {
1081
+ // second inequality must be < because the price can never reach the price at the max tick
1082
+ require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R');
1083
+ uint256 ratio = uint256(sqrtPriceX96) << 32;
1084
+
1085
+ uint256 r = ratio;
1086
+ uint256 msb = 0;
1087
+
1088
+ assembly {
1089
+ let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))
1090
+ msb := or(msb, f)
1091
+ r := shr(f, r)
1092
+ }
1093
+ assembly {
1094
+ let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))
1095
+ msb := or(msb, f)
1096
+ r := shr(f, r)
1097
+ }
1098
+ assembly {
1099
+ let f := shl(5, gt(r, 0xFFFFFFFF))
1100
+ msb := or(msb, f)
1101
+ r := shr(f, r)
1102
+ }
1103
+ assembly {
1104
+ let f := shl(4, gt(r, 0xFFFF))
1105
+ msb := or(msb, f)
1106
+ r := shr(f, r)
1107
+ }
1108
+ assembly {
1109
+ let f := shl(3, gt(r, 0xFF))
1110
+ msb := or(msb, f)
1111
+ r := shr(f, r)
1112
+ }
1113
+ assembly {
1114
+ let f := shl(2, gt(r, 0xF))
1115
+ msb := or(msb, f)
1116
+ r := shr(f, r)
1117
+ }
1118
+ assembly {
1119
+ let f := shl(1, gt(r, 0x3))
1120
+ msb := or(msb, f)
1121
+ r := shr(f, r)
1122
+ }
1123
+ assembly {
1124
+ let f := gt(r, 0x1)
1125
+ msb := or(msb, f)
1126
+ }
1127
+
1128
+ if (msb >= 128) r = ratio >> (msb - 127);
1129
+ else r = ratio << (127 - msb);
1130
+
1131
+ int256 log_2 = (int256(msb) - 128) << 64;
1132
+
1133
+ assembly {
1134
+ r := shr(127, mul(r, r))
1135
+ let f := shr(128, r)
1136
+ log_2 := or(log_2, shl(63, f))
1137
+ r := shr(f, r)
1138
+ }
1139
+ assembly {
1140
+ r := shr(127, mul(r, r))
1141
+ let f := shr(128, r)
1142
+ log_2 := or(log_2, shl(62, f))
1143
+ r := shr(f, r)
1144
+ }
1145
+ assembly {
1146
+ r := shr(127, mul(r, r))
1147
+ let f := shr(128, r)
1148
+ log_2 := or(log_2, shl(61, f))
1149
+ r := shr(f, r)
1150
+ }
1151
+ assembly {
1152
+ r := shr(127, mul(r, r))
1153
+ let f := shr(128, r)
1154
+ log_2 := or(log_2, shl(60, f))
1155
+ r := shr(f, r)
1156
+ }
1157
+ assembly {
1158
+ r := shr(127, mul(r, r))
1159
+ let f := shr(128, r)
1160
+ log_2 := or(log_2, shl(59, f))
1161
+ r := shr(f, r)
1162
+ }
1163
+ assembly {
1164
+ r := shr(127, mul(r, r))
1165
+ let f := shr(128, r)
1166
+ log_2 := or(log_2, shl(58, f))
1167
+ r := shr(f, r)
1168
+ }
1169
+ assembly {
1170
+ r := shr(127, mul(r, r))
1171
+ let f := shr(128, r)
1172
+ log_2 := or(log_2, shl(57, f))
1173
+ r := shr(f, r)
1174
+ }
1175
+ assembly {
1176
+ r := shr(127, mul(r, r))
1177
+ let f := shr(128, r)
1178
+ log_2 := or(log_2, shl(56, f))
1179
+ r := shr(f, r)
1180
+ }
1181
+ assembly {
1182
+ r := shr(127, mul(r, r))
1183
+ let f := shr(128, r)
1184
+ log_2 := or(log_2, shl(55, f))
1185
+ r := shr(f, r)
1186
+ }
1187
+ assembly {
1188
+ r := shr(127, mul(r, r))
1189
+ let f := shr(128, r)
1190
+ log_2 := or(log_2, shl(54, f))
1191
+ r := shr(f, r)
1192
+ }
1193
+ assembly {
1194
+ r := shr(127, mul(r, r))
1195
+ let f := shr(128, r)
1196
+ log_2 := or(log_2, shl(53, f))
1197
+ r := shr(f, r)
1198
+ }
1199
+ assembly {
1200
+ r := shr(127, mul(r, r))
1201
+ let f := shr(128, r)
1202
+ log_2 := or(log_2, shl(52, f))
1203
+ r := shr(f, r)
1204
+ }
1205
+ assembly {
1206
+ r := shr(127, mul(r, r))
1207
+ let f := shr(128, r)
1208
+ log_2 := or(log_2, shl(51, f))
1209
+ r := shr(f, r)
1210
+ }
1211
+ assembly {
1212
+ r := shr(127, mul(r, r))
1213
+ let f := shr(128, r)
1214
+ log_2 := or(log_2, shl(50, f))
1215
+ }
1216
+
1217
+ int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number
1218
+
1219
+ int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);
1220
+ int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);
1221
+
1222
+ tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;
1223
+ }
1224
+ }
1225
+
1226
+ // lib/openzeppelin-contracts/contracts/utils/introspection/ERC165.sol
1227
+
1228
+ abstract contract ERC165 is IERC165 {
1229
+ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
1230
+ return interfaceId == type(IERC165).interfaceId;
1231
+ }
1232
+ }
1233
+
1234
+ // lib/openzeppelin-contracts/contracts/token/ERC721/IERC721.sol
1235
+
1236
+ interface IERC721 is IERC165 {
1237
+ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
1238
+ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
1239
+ event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
1240
+
1241
+ function balanceOf(address owner) external view returns (uint256 balance);
1242
+ function ownerOf(uint256 tokenId) external view returns (address owner);
1243
+ function safeTransferFrom(address from, address to, uint256 tokenId) external;
1244
+ function transferFrom(address from, address to, uint256 tokenId) external;
1245
+ function approve(address to, uint256 tokenId) external;
1246
+ function getApproved(uint256 tokenId) external view returns (address operator);
1247
+ function setApprovalForAll(address operator, bool _approved) external;
1248
+ function isApprovedForAll(address owner, address operator) external view returns (bool);
1249
+ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
1250
+ }
1251
+
1252
+ // lib/v3-periphery-main/contracts/interfaces/external/IWETH9.sol
1253
+
1254
+ /// @title Interface for WETH9
1255
+ interface IWETH9 is IERC20 {
1256
+ /// @notice Deposit ether to get wrapped ether
1257
+ function deposit() external payable;
1258
+
1259
+ /// @notice Withdraw wrapped ether to get ether
1260
+ function withdraw(uint256) external;
1261
+ }
1262
+
1263
+ // lib/v3-periphery-main/contracts/base/Multicall.sol
1264
+
1265
+ /// @title Multicall
1266
+ /// @notice Enables calling multiple methods in a single call to the contract
1267
+ abstract contract Multicall is IMulticall {
1268
+ /// @inheritdoc IMulticall
1269
+ function multicall(bytes[] calldata data) public payable override returns (bytes[] memory results) {
1270
+ results = new bytes[](data.length);
1271
+ for (uint256 i = 0; i < data.length; i++) {
1272
+ (bool success, bytes memory result) = address(this).delegatecall(data[i]);
1273
+
1274
+ if (!success) {
1275
+ // Next 5 lines from https://ethereum.stackexchange.com/a/83577
1276
+ if (result.length < 68) revert();
1277
+ assembly {
1278
+ result := add(result, 0x04)
1279
+ }
1280
+ revert(abi.decode(result, (string)));
1281
+ }
1282
+
1283
+ results[i] = result;
1284
+ }
1285
+ }
1286
+ }
1287
+
1288
+ // lib/v3-periphery-main/contracts/base/PeripheryImmutableState.sol
1289
+
1290
+ /// @title Immutable state
1291
+ /// @notice Immutable state used by periphery contracts
1292
+ abstract contract PeripheryImmutableState is IPeripheryImmutableState {
1293
+ /// @inheritdoc IPeripheryImmutableState
1294
+ address public immutable override factory;
1295
+ /// @inheritdoc IPeripheryImmutableState
1296
+ address public immutable override WETH9;
1297
+
1298
+ constructor(address _factory, address _WETH9) {
1299
+ factory = _factory;
1300
+ WETH9 = _WETH9;
1301
+ }
1302
+ }
1303
+
1304
+ // lib/v3-periphery-main/contracts/base/PeripheryValidation.sol
1305
+
1306
+ abstract contract PeripheryValidation is BlockTimestamp {
1307
+ modifier checkDeadline(uint256 deadline) {
1308
+ require(_blockTimestamp() <= deadline, 'Transaction too old');
1309
+ _;
1310
+ }
1311
+ }
1312
+
1313
+ // lib/v3-periphery-main/contracts/libraries/TransferHelper.sol
1314
+
1315
+ library TransferHelper {
1316
+ /// @notice Transfers tokens from the targeted address to the given destination
1317
+ /// @notice Errors with 'STF' if transfer fails
1318
+ /// @param token The contract address of the token to be transferred
1319
+ /// @param from The originating address from which the tokens will be transferred
1320
+ /// @param to The destination address of the transfer
1321
+ /// @param value The amount to be transferred
1322
+ function safeTransferFrom(
1323
+ address token,
1324
+ address from,
1325
+ address to,
1326
+ uint256 value
1327
+ ) internal {
1328
+ (bool success, bytes memory data) =
1329
+ token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value));
1330
+ require(success && (data.length == 0 || abi.decode(data, (bool))), 'STF');
1331
+ }
1332
+
1333
+ /// @notice Transfers tokens from msg.sender to a recipient
1334
+ /// @dev Errors with ST if transfer fails
1335
+ /// @param token The contract address of the token which will be transferred
1336
+ /// @param to The recipient of the transfer
1337
+ /// @param value The value of the transfer
1338
+ function safeTransfer(
1339
+ address token,
1340
+ address to,
1341
+ uint256 value
1342
+ ) internal {
1343
+ (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.transfer.selector, to, value));
1344
+ require(success && (data.length == 0 || abi.decode(data, (bool))), 'ST');
1345
+ }
1346
+
1347
+ /// @notice Approves the stipulated contract to spend the given allowance in the given token
1348
+ /// @dev Errors with 'SA' if transfer fails
1349
+ /// @param token The contract address of the token to be approved
1350
+ /// @param to The target of the approval
1351
+ /// @param value The amount of the given token the target will be allowed to spend
1352
+ function safeApprove(
1353
+ address token,
1354
+ address to,
1355
+ uint256 value
1356
+ ) internal {
1357
+ (bool success, bytes memory data) = token.call(abi.encodeWithSelector(IERC20.approve.selector, to, value));
1358
+ require(success && (data.length == 0 || abi.decode(data, (bool))), 'SA');
1359
+ }
1360
+
1361
+ /// @notice Transfers ETH to the recipient address
1362
+ /// @dev Fails with `STE`
1363
+ /// @param to The destination of the transfer
1364
+ /// @param value The value to be transferred
1365
+ function safeTransferETH(address to, uint256 value) internal {
1366
+ (bool success, ) = to.call{value: value}(new bytes(0));
1367
+ require(success, 'STE');
1368
+ }
1369
+ }
1370
+
1371
+ // lib/openzeppelin-contracts/contracts/token/ERC721/IERC721Enumerable.sol
1372
+
1373
+ interface IERC721Enumerable is IERC721 {
1374
+ function totalSupply() external view returns (uint256);
1375
+ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
1376
+ function tokenByIndex(uint256 index) external view returns (uint256);
1377
+ }
1378
+
1379
+ // lib/openzeppelin-contracts/contracts/token/ERC721/IERC721Metadata.sol
1380
+
1381
+ interface IERC721Metadata is IERC721 {
1382
+ function name() external view returns (string memory);
1383
+ function symbol() external view returns (string memory);
1384
+ function tokenURI(uint256 tokenId) external view returns (string memory);
1385
+ }
1386
+
1387
+ // lib/v3-periphery-main/contracts/interfaces/IERC721Permit.sol
1388
+
1389
+ /// @title ERC721 with permit
1390
+ /// @notice Extension to ERC721 that includes a permit function for signature based approvals
1391
+ interface IERC721Permit is IERC721 {
1392
+ /// @notice The permit typehash used in the permit signature
1393
+ /// @return The typehash for the permit
1394
+ function PERMIT_TYPEHASH() external pure returns (bytes32);
1395
+
1396
+ /// @notice The domain separator used in the permit signature
1397
+ /// @return The domain seperator used in encoding of permit signature
1398
+ function DOMAIN_SEPARATOR() external view returns (bytes32);
1399
+
1400
+ /// @notice Approve of a specific token ID for spending by spender via signature
1401
+ /// @param spender The account that is being approved
1402
+ /// @param tokenId The ID of the token that is being approved for spending
1403
+ /// @param deadline The deadline timestamp by which the call must be mined for the approve to work
1404
+ /// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s`
1405
+ /// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s`
1406
+ /// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v`
1407
+ function permit(
1408
+ address spender,
1409
+ uint256 tokenId,
1410
+ uint256 deadline,
1411
+ uint8 v,
1412
+ bytes32 r,
1413
+ bytes32 s
1414
+ ) external payable;
1415
+ }
1416
+
1417
+ // lib/v3-periphery-main/contracts/libraries/LiquidityAmounts.sol
1418
+
1419
+ /// @title Liquidity amount functions
1420
+ /// @notice Provides functions for computing liquidity amounts from token amounts and prices
1421
+ library LiquidityAmounts {
1422
+ /// @notice Downcasts uint256 to uint128
1423
+ /// @param x The uint258 to be downcasted
1424
+ /// @return y The passed value, downcasted to uint128
1425
+ function toUint128(uint256 x) private pure returns (uint128 y) {
1426
+ require((y = uint128(x)) == x);
1427
+ }
1428
+
1429
+ /// @notice Computes the amount of liquidity received for a given amount of token0 and price range
1430
+ /// @dev Calculates amount0 * (sqrt(upper) * sqrt(lower)) / (sqrt(upper) - sqrt(lower))
1431
+ /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary
1432
+ /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary
1433
+ /// @param amount0 The amount0 being sent in
1434
+ /// @return liquidity The amount of returned liquidity
1435
+ function getLiquidityForAmount0(
1436
+ uint160 sqrtRatioAX96,
1437
+ uint160 sqrtRatioBX96,
1438
+ uint256 amount0
1439
+ ) internal pure returns (uint128 liquidity) {
1440
+ if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);
1441
+ uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96);
1442
+ return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96));
1443
+ }
1444
+
1445
+ /// @notice Computes the amount of liquidity received for a given amount of token1 and price range
1446
+ /// @dev Calculates amount1 / (sqrt(upper) - sqrt(lower)).
1447
+ /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary
1448
+ /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary
1449
+ /// @param amount1 The amount1 being sent in
1450
+ /// @return liquidity The amount of returned liquidity
1451
+ function getLiquidityForAmount1(
1452
+ uint160 sqrtRatioAX96,
1453
+ uint160 sqrtRatioBX96,
1454
+ uint256 amount1
1455
+ ) internal pure returns (uint128 liquidity) {
1456
+ if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);
1457
+ return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96));
1458
+ }
1459
+
1460
+ /// @notice Computes the maximum amount of liquidity received for a given amount of token0, token1, the current
1461
+ /// pool prices and the prices at the tick boundaries
1462
+ /// @param sqrtRatioX96 A sqrt price representing the current pool prices
1463
+ /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary
1464
+ /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary
1465
+ /// @param amount0 The amount of token0 being sent in
1466
+ /// @param amount1 The amount of token1 being sent in
1467
+ /// @return liquidity The maximum amount of liquidity received
1468
+ function getLiquidityForAmounts(
1469
+ uint160 sqrtRatioX96,
1470
+ uint160 sqrtRatioAX96,
1471
+ uint160 sqrtRatioBX96,
1472
+ uint256 amount0,
1473
+ uint256 amount1
1474
+ ) internal pure returns (uint128 liquidity) {
1475
+ if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);
1476
+
1477
+ if (sqrtRatioX96 <= sqrtRatioAX96) {
1478
+ liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0);
1479
+ } else if (sqrtRatioX96 < sqrtRatioBX96) {
1480
+ uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0);
1481
+ uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1);
1482
+
1483
+ liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1;
1484
+ } else {
1485
+ liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1);
1486
+ }
1487
+ }
1488
+
1489
+ /// @notice Computes the amount of token0 for a given amount of liquidity and a price range
1490
+ /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary
1491
+ /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary
1492
+ /// @param liquidity The liquidity being valued
1493
+ /// @return amount0 The amount of token0
1494
+ function getAmount0ForLiquidity(
1495
+ uint160 sqrtRatioAX96,
1496
+ uint160 sqrtRatioBX96,
1497
+ uint128 liquidity
1498
+ ) internal pure returns (uint256 amount0) {
1499
+ if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);
1500
+
1501
+ return
1502
+ FullMath.mulDiv(
1503
+ uint256(liquidity) << FixedPoint96.RESOLUTION,
1504
+ sqrtRatioBX96 - sqrtRatioAX96,
1505
+ sqrtRatioBX96
1506
+ ) / sqrtRatioAX96;
1507
+ }
1508
+
1509
+ /// @notice Computes the amount of token1 for a given amount of liquidity and a price range
1510
+ /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary
1511
+ /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary
1512
+ /// @param liquidity The liquidity being valued
1513
+ /// @return amount1 The amount of token1
1514
+ function getAmount1ForLiquidity(
1515
+ uint160 sqrtRatioAX96,
1516
+ uint160 sqrtRatioBX96,
1517
+ uint128 liquidity
1518
+ ) internal pure returns (uint256 amount1) {
1519
+ if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);
1520
+
1521
+ return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96);
1522
+ }
1523
+
1524
+ /// @notice Computes the token0 and token1 value for a given amount of liquidity, the current
1525
+ /// pool prices and the prices at the tick boundaries
1526
+ /// @param sqrtRatioX96 A sqrt price representing the current pool prices
1527
+ /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary
1528
+ /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary
1529
+ /// @param liquidity The liquidity being valued
1530
+ /// @return amount0 The amount of token0
1531
+ /// @return amount1 The amount of token1
1532
+ function getAmountsForLiquidity(
1533
+ uint160 sqrtRatioX96,
1534
+ uint160 sqrtRatioAX96,
1535
+ uint160 sqrtRatioBX96,
1536
+ uint128 liquidity
1537
+ ) internal pure returns (uint256 amount0, uint256 amount1) {
1538
+ if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96);
1539
+
1540
+ if (sqrtRatioX96 <= sqrtRatioAX96) {
1541
+ amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);
1542
+ } else if (sqrtRatioX96 < sqrtRatioBX96) {
1543
+ amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity);
1544
+ amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity);
1545
+ } else {
1546
+ amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity);
1547
+ }
1548
+ }
1549
+ }
1550
+
1551
+ // lib/v3-periphery-main/contracts/base/SelfPermit.sol
1552
+
1553
+ /// @title Self Permit
1554
+ /// @notice Functionality to call permit on any EIP-2612-compliant token for use in the route
1555
+ /// @dev These functions are expected to be embedded in multicalls to allow EOAs to approve a contract and call a function
1556
+ /// that requires an approval in a single transaction.
1557
+ abstract contract SelfPermit is ISelfPermit {
1558
+ /// @inheritdoc ISelfPermit
1559
+ function selfPermit(
1560
+ address token,
1561
+ uint256 value,
1562
+ uint256 deadline,
1563
+ uint8 v,
1564
+ bytes32 r,
1565
+ bytes32 s
1566
+ ) public payable override {
1567
+ IERC20Permit(token).permit(msg.sender, address(this), value, deadline, v, r, s);
1568
+ }
1569
+
1570
+ /// @inheritdoc ISelfPermit
1571
+ function selfPermitIfNecessary(
1572
+ address token,
1573
+ uint256 value,
1574
+ uint256 deadline,
1575
+ uint8 v,
1576
+ bytes32 r,
1577
+ bytes32 s
1578
+ ) external payable override {
1579
+ if (IERC20(token).allowance(msg.sender, address(this)) < value) selfPermit(token, value, deadline, v, r, s);
1580
+ }
1581
+
1582
+ /// @inheritdoc ISelfPermit
1583
+ function selfPermitAllowed(
1584
+ address token,
1585
+ uint256 nonce,
1586
+ uint256 expiry,
1587
+ uint8 v,
1588
+ bytes32 r,
1589
+ bytes32 s
1590
+ ) public payable override {
1591
+ IERC20PermitAllowed(token).permit(msg.sender, address(this), nonce, expiry, true, v, r, s);
1592
+ }
1593
+
1594
+ /// @inheritdoc ISelfPermit
1595
+ function selfPermitAllowedIfNecessary(
1596
+ address token,
1597
+ uint256 nonce,
1598
+ uint256 expiry,
1599
+ uint8 v,
1600
+ bytes32 r,
1601
+ bytes32 s
1602
+ ) external payable override {
1603
+ if (IERC20(token).allowance(msg.sender, address(this)) < type(uint256).max)
1604
+ selfPermitAllowed(token, nonce, expiry, v, r, s);
1605
+ }
1606
+ }
1607
+
1608
+ // lib/v3-core-main/contracts/interfaces/IUniswapV3Pool.sol
1609
+
1610
+ /// @title The interface for a Uniswap V3 Pool
1611
+ /// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform
1612
+ /// to the ERC20 specification
1613
+ /// @dev The pool interface is broken up into many smaller pieces
1614
+ interface IUniswapV3Pool is
1615
+ IUniswapV3PoolImmutables,
1616
+ IUniswapV3PoolState,
1617
+ IUniswapV3PoolDerivedState,
1618
+ IUniswapV3PoolActions,
1619
+ IUniswapV3PoolOwnerActions,
1620
+ IUniswapV3PoolEvents
1621
+ {
1622
+
1623
+ }
1624
+
1625
+ // lib/v3-periphery-main/contracts/base/PeripheryPayments.sol
1626
+
1627
+ abstract contract PeripheryPayments is IPeripheryPayments, PeripheryImmutableState {
1628
+ receive() external payable {
1629
+ require(msg.sender == WETH9, 'Not WETH9');
1630
+ }
1631
+
1632
+ /// @inheritdoc IPeripheryPayments
1633
+ function unwrapWETH9(uint256 amountMinimum, address recipient) public payable override {
1634
+ uint256 balanceWETH9 = IWETH9(WETH9).balanceOf(address(this));
1635
+ require(balanceWETH9 >= amountMinimum, 'Insufficient WETH9');
1636
+
1637
+ if (balanceWETH9 > 0) {
1638
+ IWETH9(WETH9).withdraw(balanceWETH9);
1639
+ TransferHelper.safeTransferETH(recipient, balanceWETH9);
1640
+ }
1641
+ }
1642
+
1643
+ /// @inheritdoc IPeripheryPayments
1644
+ function sweepToken(
1645
+ address token,
1646
+ uint256 amountMinimum,
1647
+ address recipient
1648
+ ) public payable override {
1649
+ uint256 balanceToken = IERC20(token).balanceOf(address(this));
1650
+ require(balanceToken >= amountMinimum, 'Insufficient token');
1651
+
1652
+ if (balanceToken > 0) {
1653
+ TransferHelper.safeTransfer(token, recipient, balanceToken);
1654
+ }
1655
+ }
1656
+
1657
+ /// @inheritdoc IPeripheryPayments
1658
+ function refundETH() external payable override {
1659
+ if (address(this).balance > 0) TransferHelper.safeTransferETH(msg.sender, address(this).balance);
1660
+ }
1661
+
1662
+ /// @param token The token to pay
1663
+ /// @param payer The entity that must pay
1664
+ /// @param recipient The entity that will receive payment
1665
+ /// @param value The amount to pay
1666
+ function pay(
1667
+ address token,
1668
+ address payer,
1669
+ address recipient,
1670
+ uint256 value
1671
+ ) internal {
1672
+ if (token == WETH9 && address(this).balance >= value) {
1673
+ // pay with WETH9
1674
+ IWETH9(WETH9).deposit{value: value}(); // wrap only what is needed to pay
1675
+ IWETH9(WETH9).transfer(recipient, value);
1676
+ } else if (payer == address(this)) {
1677
+ // pay with tokens already in the contract (for the exact input multihop case)
1678
+ TransferHelper.safeTransfer(token, recipient, value);
1679
+ } else {
1680
+ // pull payment
1681
+ TransferHelper.safeTransferFrom(token, payer, recipient, value);
1682
+ }
1683
+ }
1684
+ }
1685
+
1686
+ // lib/v3-periphery-main/contracts/libraries/CallbackValidation.sol
1687
+
1688
+ /// @notice Provides validation for callbacks from Uniswap V3 Pools
1689
+ library CallbackValidation {
1690
+ /// @notice Returns the address of a valid Uniswap V3 Pool
1691
+ /// @param factory The contract address of the Uniswap V3 factory
1692
+ /// @param tokenA The contract address of either token0 or token1
1693
+ /// @param tokenB The contract address of the other token
1694
+ /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip
1695
+ /// @return pool The V3 pool contract address
1696
+ function verifyCallback(
1697
+ address factory,
1698
+ address tokenA,
1699
+ address tokenB,
1700
+ uint24 fee
1701
+ ) internal view returns (IUniswapV3Pool pool) {
1702
+ return verifyCallback(factory, PoolAddress.getPoolKey(tokenA, tokenB, fee));
1703
+ }
1704
+
1705
+ /// @notice Returns the address of a valid Uniswap V3 Pool
1706
+ /// @param factory The contract address of the Uniswap V3 factory
1707
+ /// @param poolKey The identifying key of the V3 pool
1708
+ /// @return pool The V3 pool contract address
1709
+ function verifyCallback(address factory, PoolAddress.PoolKey memory poolKey)
1710
+ internal
1711
+ view
1712
+ returns (IUniswapV3Pool pool)
1713
+ {
1714
+ pool = IUniswapV3Pool(PoolAddress.computeAddress(factory, poolKey));
1715
+ require(msg.sender == address(pool));
1716
+ }
1717
+ }
1718
+
1719
+ // lib/openzeppelin-contracts/contracts/token/ERC721/ERC721.sol
1720
+
1721
+ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable {
1722
+ using Address for address;
1723
+
1724
+ string private _name;
1725
+ string private _symbol;
1726
+
1727
+ mapping(uint256 => address) private _owners;
1728
+ mapping(address => uint256) private _balances;
1729
+ mapping(uint256 => address) private _tokenApprovals;
1730
+ mapping(address => mapping(address => bool)) private _operatorApprovals;
1731
+
1732
+ uint256[] private _allTokens;
1733
+ mapping(uint256 => uint256) private _allTokensIndex;
1734
+ mapping(address => uint256[]) private _ownedTokens;
1735
+ mapping(uint256 => uint256) private _ownedTokensIndex;
1736
+
1737
+ constructor(string memory name_, string memory symbol_) {
1738
+ _name = name_;
1739
+ _symbol = symbol_;
1740
+ }
1741
+
1742
+ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
1743
+ return
1744
+ interfaceId == type(IERC721).interfaceId ||
1745
+ interfaceId == type(IERC721Metadata).interfaceId ||
1746
+ interfaceId == type(IERC721Enumerable).interfaceId ||
1747
+ super.supportsInterface(interfaceId);
1748
+ }
1749
+
1750
+ function name() public view virtual override returns (string memory) {
1751
+ return _name;
1752
+ }
1753
+
1754
+ function symbol() public view virtual override returns (string memory) {
1755
+ return _symbol;
1756
+ }
1757
+
1758
+ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
1759
+ require(_exists(tokenId), "ERC721: URI query for nonexistent token");
1760
+ return "";
1761
+ }
1762
+
1763
+ function baseURI() public pure virtual returns (string memory) {
1764
+ return "";
1765
+ }
1766
+
1767
+ function balanceOf(address owner) public view virtual override returns (uint256) {
1768
+ require(owner != address(0), "ERC721: balance query for zero address");
1769
+ return _balances[owner];
1770
+ }
1771
+
1772
+ function ownerOf(uint256 tokenId) public view virtual override returns (address) {
1773
+ address owner = _owners[tokenId];
1774
+ require(owner != address(0), "ERC721: owner query for nonexistent token");
1775
+ return owner;
1776
+ }
1777
+
1778
+ function totalSupply() public view virtual override returns (uint256) {
1779
+ return _allTokens.length;
1780
+ }
1781
+
1782
+ function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
1783
+ require(index < _allTokens.length, "ERC721Enumerable: global index out of bounds");
1784
+ return _allTokens[index];
1785
+ }
1786
+
1787
+ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
1788
+ require(index < _ownedTokens[owner].length, "ERC721Enumerable: owner index out of bounds");
1789
+ return _ownedTokens[owner][index];
1790
+ }
1791
+
1792
+ function approve(address to, uint256 tokenId) public virtual override {
1793
+ address owner = ownerOf(tokenId);
1794
+ require(to != owner, "ERC721: approval to current owner");
1795
+ require(_msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller not owner nor approved");
1796
+ _approve(to, tokenId);
1797
+ }
1798
+
1799
+ function getApproved(uint256 tokenId) public view virtual override returns (address) {
1800
+ require(_exists(tokenId), "ERC721: approved query for nonexistent token");
1801
+ return _tokenApprovals[tokenId];
1802
+ }
1803
+
1804
+ function setApprovalForAll(address operator, bool approved) public virtual override {
1805
+ require(operator != _msgSender(), "ERC721: approve to caller");
1806
+ _operatorApprovals[_msgSender()][operator] = approved;
1807
+ emit ApprovalForAll(_msgSender(), operator, approved);
1808
+ }
1809
+
1810
+ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
1811
+ return _operatorApprovals[owner][operator];
1812
+ }
1813
+
1814
+ function transferFrom(address from, address to, uint256 tokenId) public virtual override {
1815
+ require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller not owner nor approved");
1816
+ _transfer(from, to, tokenId);
1817
+ }
1818
+
1819
+ function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
1820
+ safeTransferFrom(from, to, tokenId, "");
1821
+ }
1822
+
1823
+ function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {
1824
+ transferFrom(from, to, tokenId);
1825
+ require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer");
1826
+ }
1827
+
1828
+ function _exists(uint256 tokenId) internal view virtual returns (bool) {
1829
+ return _owners[tokenId] != address(0);
1830
+ }
1831
+
1832
+ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
1833
+ require(_exists(tokenId), "ERC721: operator query for nonexistent token");
1834
+ address owner = ownerOf(tokenId);
1835
+ return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
1836
+ }
1837
+
1838
+ function _mint(address to, uint256 tokenId) internal virtual {
1839
+ require(to != address(0), "ERC721: mint to zero address");
1840
+ require(!_exists(tokenId), "ERC721: token already minted");
1841
+
1842
+ _beforeTokenTransfer(address(0), to, tokenId);
1843
+ _balances[to] += 1;
1844
+ _owners[tokenId] = to;
1845
+ emit Transfer(address(0), to, tokenId);
1846
+ }
1847
+
1848
+ function _burn(uint256 tokenId) internal virtual {
1849
+ address owner = ownerOf(tokenId);
1850
+
1851
+ _beforeTokenTransfer(owner, address(0), tokenId);
1852
+ _approve(address(0), tokenId);
1853
+ _balances[owner] -= 1;
1854
+ delete _owners[tokenId];
1855
+ emit Transfer(owner, address(0), tokenId);
1856
+ }
1857
+
1858
+ function _transfer(address from, address to, uint256 tokenId) internal virtual {
1859
+ require(ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
1860
+ require(to != address(0), "ERC721: transfer to zero address");
1861
+
1862
+ _beforeTokenTransfer(from, to, tokenId);
1863
+ _approve(address(0), tokenId);
1864
+ _balances[from] -= 1;
1865
+ _balances[to] += 1;
1866
+ _owners[tokenId] = to;
1867
+ emit Transfer(from, to, tokenId);
1868
+ }
1869
+
1870
+ function _approve(address to, uint256 tokenId) internal virtual {
1871
+ _tokenApprovals[tokenId] = to;
1872
+ emit Approval(ownerOf(tokenId), to, tokenId);
1873
+ }
1874
+
1875
+ function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual {
1876
+ if (from == address(0)) {
1877
+ _addTokenToAllTokensEnumeration(tokenId);
1878
+ } else if (from != to) {
1879
+ _removeTokenFromOwnerEnumeration(from, tokenId);
1880
+ }
1881
+
1882
+ if (to == address(0)) {
1883
+ _removeTokenFromAllTokensEnumeration(tokenId);
1884
+ } else if (to != from) {
1885
+ _addTokenToOwnerEnumeration(to, tokenId);
1886
+ }
1887
+ }
1888
+
1889
+ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
1890
+ _ownedTokensIndex[tokenId] = _ownedTokens[to].length;
1891
+ _ownedTokens[to].push(tokenId);
1892
+ }
1893
+
1894
+ function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
1895
+ _allTokensIndex[tokenId] = _allTokens.length;
1896
+ _allTokens.push(tokenId);
1897
+ }
1898
+
1899
+ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
1900
+ uint256 lastTokenIndex = _ownedTokens[from].length - 1;
1901
+ uint256 tokenIndex = _ownedTokensIndex[tokenId];
1902
+
1903
+ if (tokenIndex != lastTokenIndex) {
1904
+ uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];
1905
+ _ownedTokens[from][tokenIndex] = lastTokenId;
1906
+ _ownedTokensIndex[lastTokenId] = tokenIndex;
1907
+ }
1908
+
1909
+ _ownedTokens[from].pop();
1910
+ delete _ownedTokensIndex[tokenId];
1911
+ }
1912
+
1913
+ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
1914
+ uint256 lastTokenIndex = _allTokens.length - 1;
1915
+ uint256 tokenIndex = _allTokensIndex[tokenId];
1916
+ uint256 lastTokenId = _allTokens[lastTokenIndex];
1917
+
1918
+ _allTokens[tokenIndex] = lastTokenId;
1919
+ _allTokensIndex[lastTokenId] = tokenIndex;
1920
+ _allTokens.pop();
1921
+ delete _allTokensIndex[tokenId];
1922
+ }
1923
+
1924
+ function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory data) private returns (bool) {
1925
+ if (!to.isContract()) {
1926
+ return true;
1927
+ }
1928
+
1929
+ try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
1930
+ return retval == IERC721Receiver(to).onERC721Received.selector;
1931
+ } catch {
1932
+ return false;
1933
+ }
1934
+ }
1935
+ }
1936
+
1937
+ // lib/v3-periphery-main/contracts/interfaces/INonfungiblePositionManager.sol
1938
+
1939
+ /// @title Non-fungible token for positions
1940
+ /// @notice Wraps Uniswap V3 positions in a non-fungible token interface which allows for them to be transferred
1941
+ /// and authorized.
1942
+ interface INonfungiblePositionManager is
1943
+ IPoolInitializer,
1944
+ IPeripheryPayments,
1945
+ IPeripheryImmutableState,
1946
+ IERC721Metadata,
1947
+ IERC721Enumerable,
1948
+ IERC721Permit
1949
+ {
1950
+ /// @notice Emitted when liquidity is increased for a position NFT
1951
+ /// @dev Also emitted when a token is minted
1952
+ /// @param tokenId The ID of the token for which liquidity was increased
1953
+ /// @param liquidity The amount by which liquidity for the NFT position was increased
1954
+ /// @param amount0 The amount of token0 that was paid for the increase in liquidity
1955
+ /// @param amount1 The amount of token1 that was paid for the increase in liquidity
1956
+ event IncreaseLiquidity(uint256 indexed tokenId, uint128 liquidity, uint256 amount0, uint256 amount1);
1957
+ /// @notice Emitted when liquidity is decreased for a position NFT
1958
+ /// @param tokenId The ID of the token for which liquidity was decreased
1959
+ /// @param liquidity The amount by which liquidity for the NFT position was decreased
1960
+ /// @param amount0 The amount of token0 that was accounted for the decrease in liquidity
1961
+ /// @param amount1 The amount of token1 that was accounted for the decrease in liquidity
1962
+ event DecreaseLiquidity(uint256 indexed tokenId, uint128 liquidity, uint256 amount0, uint256 amount1);
1963
+ /// @notice Emitted when tokens are collected for a position NFT
1964
+ /// @dev The amounts reported may not be exactly equivalent to the amounts transferred, due to rounding behavior
1965
+ /// @param tokenId The ID of the token for which underlying tokens were collected
1966
+ /// @param recipient The address of the account that received the collected tokens
1967
+ /// @param amount0 The amount of token0 owed to the position that was collected
1968
+ /// @param amount1 The amount of token1 owed to the position that was collected
1969
+ event Collect(uint256 indexed tokenId, address recipient, uint256 amount0, uint256 amount1);
1970
+
1971
+ /// @notice Returns the position information associated with a given token ID.
1972
+ /// @dev Throws if the token ID is not valid.
1973
+ /// @param tokenId The ID of the token that represents the position
1974
+ /// @return nonce The nonce for permits
1975
+ /// @return operator The address that is approved for spending
1976
+ /// @return token0 The address of the token0 for a specific pool
1977
+ /// @return token1 The address of the token1 for a specific pool
1978
+ /// @return fee The fee associated with the pool
1979
+ /// @return tickLower The lower end of the tick range for the position
1980
+ /// @return tickUpper The higher end of the tick range for the position
1981
+ /// @return liquidity The liquidity of the position
1982
+ /// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last action on the individual position
1983
+ /// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last action on the individual position
1984
+ /// @return tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation
1985
+ /// @return tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation
1986
+ function positions(uint256 tokenId)
1987
+ external
1988
+ view
1989
+ returns (
1990
+ uint96 nonce,
1991
+ address operator,
1992
+ address token0,
1993
+ address token1,
1994
+ uint24 fee,
1995
+ int24 tickLower,
1996
+ int24 tickUpper,
1997
+ uint128 liquidity,
1998
+ uint256 feeGrowthInside0LastX128,
1999
+ uint256 feeGrowthInside1LastX128,
2000
+ uint128 tokensOwed0,
2001
+ uint128 tokensOwed1
2002
+ );
2003
+
2004
+ struct MintParams {
2005
+ address token0;
2006
+ address token1;
2007
+ uint24 fee;
2008
+ int24 tickLower;
2009
+ int24 tickUpper;
2010
+ uint256 amount0Desired;
2011
+ uint256 amount1Desired;
2012
+ uint256 amount0Min;
2013
+ uint256 amount1Min;
2014
+ address recipient;
2015
+ uint256 deadline;
2016
+ }
2017
+
2018
+ /// @notice Creates a new position wrapped in a NFT
2019
+ /// @dev Call this when the pool does exist and is initialized. Note that if the pool is created but not initialized
2020
+ /// a method does not exist, i.e. the pool is assumed to be initialized.
2021
+ /// @param params The params necessary to mint a position, encoded as `MintParams` in calldata
2022
+ /// @return tokenId The ID of the token that represents the minted position
2023
+ /// @return liquidity The amount of liquidity for this position
2024
+ /// @return amount0 The amount of token0
2025
+ /// @return amount1 The amount of token1
2026
+ function mint(MintParams calldata params)
2027
+ external
2028
+ payable
2029
+ returns (
2030
+ uint256 tokenId,
2031
+ uint128 liquidity,
2032
+ uint256 amount0,
2033
+ uint256 amount1
2034
+ );
2035
+
2036
+ struct IncreaseLiquidityParams {
2037
+ uint256 tokenId;
2038
+ uint256 amount0Desired;
2039
+ uint256 amount1Desired;
2040
+ uint256 amount0Min;
2041
+ uint256 amount1Min;
2042
+ uint256 deadline;
2043
+ }
2044
+
2045
+ /// @notice Increases the amount of liquidity in a position, with tokens paid by the `msg.sender`
2046
+ /// @param params tokenId The ID of the token for which liquidity is being increased,
2047
+ /// amount0Desired The desired amount of token0 to be spent,
2048
+ /// amount1Desired The desired amount of token1 to be spent,
2049
+ /// amount0Min The minimum amount of token0 to spend, which serves as a slippage check,
2050
+ /// amount1Min The minimum amount of token1 to spend, which serves as a slippage check,
2051
+ /// deadline The time by which the transaction must be included to effect the change
2052
+ /// @return liquidity The new liquidity amount as a result of the increase
2053
+ /// @return amount0 The amount of token0 to acheive resulting liquidity
2054
+ /// @return amount1 The amount of token1 to acheive resulting liquidity
2055
+ function increaseLiquidity(IncreaseLiquidityParams calldata params)
2056
+ external
2057
+ payable
2058
+ returns (
2059
+ uint128 liquidity,
2060
+ uint256 amount0,
2061
+ uint256 amount1
2062
+ );
2063
+
2064
+ struct DecreaseLiquidityParams {
2065
+ uint256 tokenId;
2066
+ uint128 liquidity;
2067
+ uint256 amount0Min;
2068
+ uint256 amount1Min;
2069
+ uint256 deadline;
2070
+ }
2071
+
2072
+ /// @notice Decreases the amount of liquidity in a position and accounts it to the position
2073
+ /// @param params tokenId The ID of the token for which liquidity is being decreased,
2074
+ /// amount The amount by which liquidity will be decreased,
2075
+ /// amount0Min The minimum amount of token0 that should be accounted for the burned liquidity,
2076
+ /// amount1Min The minimum amount of token1 that should be accounted for the burned liquidity,
2077
+ /// deadline The time by which the transaction must be included to effect the change
2078
+ /// @return amount0 The amount of token0 accounted to the position's tokens owed
2079
+ /// @return amount1 The amount of token1 accounted to the position's tokens owed
2080
+ function decreaseLiquidity(DecreaseLiquidityParams calldata params)
2081
+ external
2082
+ payable
2083
+ returns (uint256 amount0, uint256 amount1);
2084
+
2085
+ struct CollectParams {
2086
+ uint256 tokenId;
2087
+ address recipient;
2088
+ uint128 amount0Max;
2089
+ uint128 amount1Max;
2090
+ }
2091
+
2092
+ /// @notice Collects up to a maximum amount of fees owed to a specific position to the recipient
2093
+ /// @param params tokenId The ID of the NFT for which tokens are being collected,
2094
+ /// recipient The account that should receive the tokens,
2095
+ /// amount0Max The maximum amount of token0 to collect,
2096
+ /// amount1Max The maximum amount of token1 to collect
2097
+ /// @return amount0 The amount of fees collected in token0
2098
+ /// @return amount1 The amount of fees collected in token1
2099
+ function collect(CollectParams calldata params) external payable returns (uint256 amount0, uint256 amount1);
2100
+
2101
+ /// @notice Burns a token ID, which deletes it from the NFT contract. The token must have 0 liquidity and all tokens
2102
+ /// must be collected first.
2103
+ /// @param tokenId The ID of the token that is being burned
2104
+ function burn(uint256 tokenId) external payable;
2105
+ }
2106
+
2107
+ // lib/v3-periphery-main/contracts/interfaces/INonfungibleTokenPositionDescriptor.sol
2108
+
2109
+ /// @title Describes position NFT tokens via URI
2110
+ interface INonfungibleTokenPositionDescriptor {
2111
+ /// @notice Produces the URI describing a particular token ID for a position manager
2112
+ /// @dev Note this URI may be a data: URI with the JSON contents directly inlined
2113
+ /// @param positionManager The position manager for which to describe the token
2114
+ /// @param tokenId The ID of the token for which to produce a description, which may not be valid
2115
+ /// @return The URI of the ERC721-compliant metadata
2116
+ function tokenURI(INonfungiblePositionManager positionManager, uint256 tokenId)
2117
+ external
2118
+ view
2119
+ returns (string memory);
2120
+ }
2121
+
2122
+ // lib/v3-periphery-main/contracts/base/PoolInitializer.sol
2123
+
2124
+ /// @title Creates and initializes V3 Pools
2125
+ abstract contract PoolInitializer is IPoolInitializer, PeripheryImmutableState {
2126
+ /// @inheritdoc IPoolInitializer
2127
+ function createAndInitializePoolIfNecessary(
2128
+ address token0,
2129
+ address token1,
2130
+ uint24 fee,
2131
+ uint160 sqrtPriceX96
2132
+ ) external payable override returns (address pool) {
2133
+ require(token0 < token1);
2134
+ pool = IUniswapV3Factory(factory).getPool(token0, token1, fee);
2135
+
2136
+ if (pool == address(0)) {
2137
+ pool = IUniswapV3Factory(factory).createPool(token0, token1, fee);
2138
+ IUniswapV3Pool(pool).initialize(sqrtPriceX96);
2139
+ } else {
2140
+ (uint160 sqrtPriceX96Existing, , , , , , ) = IUniswapV3Pool(pool).slot0();
2141
+ if (sqrtPriceX96Existing == 0) {
2142
+ IUniswapV3Pool(pool).initialize(sqrtPriceX96);
2143
+ }
2144
+ }
2145
+ }
2146
+ }
2147
+
2148
+ // lib/v3-periphery-main/contracts/base/ERC721Permit.sol
2149
+
2150
+ /// @title ERC721 with permit
2151
+ /// @notice Nonfungible tokens that support an approve via signature, i.e. permit
2152
+ abstract contract ERC721Permit is BlockTimestamp, ERC721, IERC721Permit {
2153
+ /// @dev Gets the current nonce for a token ID and then increments it, returning the original value
2154
+ function _getAndIncrementNonce(uint256 tokenId) internal virtual returns (uint256);
2155
+
2156
+ /// @dev The hash of the name used in the permit signature verification
2157
+ bytes32 private immutable nameHash;
2158
+
2159
+ /// @dev The hash of the version string used in the permit signature verification
2160
+ bytes32 private immutable versionHash;
2161
+
2162
+ /// @notice Computes the nameHash and versionHash
2163
+ constructor(
2164
+ string memory name_,
2165
+ string memory symbol_,
2166
+ string memory version_
2167
+ ) ERC721(name_, symbol_) {
2168
+ nameHash = keccak256(bytes(name_));
2169
+ versionHash = keccak256(bytes(version_));
2170
+ }
2171
+
2172
+ /// @inheritdoc IERC721Permit
2173
+ function DOMAIN_SEPARATOR() public view override returns (bytes32) {
2174
+ return
2175
+ keccak256(
2176
+ abi.encode(
2177
+ // keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)')
2178
+ 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f,
2179
+ nameHash,
2180
+ versionHash,
2181
+ ChainId.get(),
2182
+ address(this)
2183
+ )
2184
+ );
2185
+ }
2186
+
2187
+ /// @inheritdoc IERC721Permit
2188
+ /// @dev Value is equal to keccak256("Permit(address spender,uint256 tokenId,uint256 nonce,uint256 deadline)");
2189
+ bytes32 public constant override PERMIT_TYPEHASH =
2190
+ 0x49ecf333e5b8c95c40fdafc95c1ad136e8914a8fb55e9dc8bb01eaa83a2df9ad;
2191
+
2192
+ /// @inheritdoc IERC721Permit
2193
+ function permit(
2194
+ address spender,
2195
+ uint256 tokenId,
2196
+ uint256 deadline,
2197
+ uint8 v,
2198
+ bytes32 r,
2199
+ bytes32 s
2200
+ ) external payable override {
2201
+ require(_blockTimestamp() <= deadline, 'Permit expired');
2202
+
2203
+ bytes32 digest =
2204
+ keccak256(
2205
+ abi.encodePacked(
2206
+ '\x19\x01',
2207
+ DOMAIN_SEPARATOR(),
2208
+ keccak256(abi.encode(PERMIT_TYPEHASH, spender, tokenId, _getAndIncrementNonce(tokenId), deadline))
2209
+ )
2210
+ );
2211
+ address owner = ownerOf(tokenId);
2212
+ require(spender != owner, 'ERC721Permit: approval to current owner');
2213
+
2214
+ if (Address.isContract(owner)) {
2215
+ require(IERC1271(owner).isValidSignature(digest, abi.encodePacked(r, s, v)) == 0x1626ba7e, 'Unauthorized');
2216
+ } else {
2217
+ address recoveredAddress = ecrecover(digest, v, r, s);
2218
+ require(recoveredAddress != address(0), 'Invalid signature');
2219
+ require(recoveredAddress == owner, 'Unauthorized');
2220
+ }
2221
+
2222
+ _approve(spender, tokenId);
2223
+ }
2224
+ }
2225
+
2226
+ // lib/v3-periphery-main/contracts/base/LiquidityManagement.sol
2227
+
2228
+ /// @title Liquidity management functions
2229
+ /// @notice Internal functions for safely managing liquidity in Uniswap V3
2230
+ abstract contract LiquidityManagement is IUniswapV3MintCallback, PeripheryImmutableState, PeripheryPayments {
2231
+ struct MintCallbackData {
2232
+ PoolAddress.PoolKey poolKey;
2233
+ address payer;
2234
+ }
2235
+
2236
+ /// @inheritdoc IUniswapV3MintCallback
2237
+ function uniswapV3MintCallback(
2238
+ uint256 amount0Owed,
2239
+ uint256 amount1Owed,
2240
+ bytes calldata data
2241
+ ) external override {
2242
+ MintCallbackData memory decoded = abi.decode(data, (MintCallbackData));
2243
+ CallbackValidation.verifyCallback(factory, decoded.poolKey);
2244
+
2245
+ if (amount0Owed > 0) pay(decoded.poolKey.token0, decoded.payer, msg.sender, amount0Owed);
2246
+ if (amount1Owed > 0) pay(decoded.poolKey.token1, decoded.payer, msg.sender, amount1Owed);
2247
+ }
2248
+
2249
+ struct AddLiquidityParams {
2250
+ address token0;
2251
+ address token1;
2252
+ uint24 fee;
2253
+ address recipient;
2254
+ int24 tickLower;
2255
+ int24 tickUpper;
2256
+ uint256 amount0Desired;
2257
+ uint256 amount1Desired;
2258
+ uint256 amount0Min;
2259
+ uint256 amount1Min;
2260
+ }
2261
+
2262
+ /// @notice Add liquidity to an initialized pool
2263
+ function addLiquidity(AddLiquidityParams memory params)
2264
+ internal
2265
+ returns (
2266
+ uint128 liquidity,
2267
+ uint256 amount0,
2268
+ uint256 amount1,
2269
+ IUniswapV3Pool pool
2270
+ )
2271
+ {
2272
+ PoolAddress.PoolKey memory poolKey =
2273
+ PoolAddress.PoolKey({token0: params.token0, token1: params.token1, fee: params.fee});
2274
+
2275
+ pool = IUniswapV3Pool(PoolAddress.computeAddress(factory, poolKey));
2276
+
2277
+ // compute the liquidity amount
2278
+ {
2279
+ (uint160 sqrtPriceX96, , , , , , ) = pool.slot0();
2280
+ uint160 sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(params.tickLower);
2281
+ uint160 sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(params.tickUpper);
2282
+
2283
+ liquidity = LiquidityAmounts.getLiquidityForAmounts(
2284
+ sqrtPriceX96,
2285
+ sqrtRatioAX96,
2286
+ sqrtRatioBX96,
2287
+ params.amount0Desired,
2288
+ params.amount1Desired
2289
+ );
2290
+ }
2291
+
2292
+ (amount0, amount1) = pool.mint(
2293
+ params.recipient,
2294
+ params.tickLower,
2295
+ params.tickUpper,
2296
+ liquidity,
2297
+ abi.encode(MintCallbackData({poolKey: poolKey, payer: msg.sender}))
2298
+ );
2299
+
2300
+ require(amount0 >= params.amount0Min && amount1 >= params.amount1Min, 'Price slippage check');
2301
+ }
2302
+ }
2303
+
2304
+ // lib/v3-periphery-main/contracts/NonfungiblePositionManager.sol
2305
+
2306
+ /// @title NFT positions
2307
+ /// @notice Wraps Uniswap V3 positions in the ERC721 non-fungible token interface
2308
+ contract NonfungiblePositionManager is
2309
+ INonfungiblePositionManager,
2310
+ Multicall,
2311
+ ERC721Permit,
2312
+ PeripheryImmutableState,
2313
+ PoolInitializer,
2314
+ LiquidityManagement,
2315
+ PeripheryValidation,
2316
+ SelfPermit
2317
+ {
2318
+ // details about the uniswap position
2319
+ struct Position {
2320
+ // the nonce for permits
2321
+ uint96 nonce;
2322
+ // the address that is approved for spending this token
2323
+ address operator;
2324
+ // the ID of the pool with which this token is connected
2325
+ uint80 poolId;
2326
+ // the tick range of the position
2327
+ int24 tickLower;
2328
+ int24 tickUpper;
2329
+ // the liquidity of the position
2330
+ uint128 liquidity;
2331
+ // the fee growth of the aggregate position as of the last action on the individual position
2332
+ uint256 feeGrowthInside0LastX128;
2333
+ uint256 feeGrowthInside1LastX128;
2334
+ // how many uncollected tokens are owed to the position, as of the last computation
2335
+ uint128 tokensOwed0;
2336
+ uint128 tokensOwed1;
2337
+ }
2338
+
2339
+ /// @dev IDs of pools assigned by this contract
2340
+ mapping(address => uint80) private _poolIds;
2341
+
2342
+ /// @dev Pool keys by pool ID, to save on SSTOREs for position data
2343
+ mapping(uint80 => PoolAddress.PoolKey) private _poolIdToPoolKey;
2344
+
2345
+ /// @dev The token ID position data
2346
+ mapping(uint256 => Position) private _positions;
2347
+
2348
+ /// @dev The ID of the next token that will be minted. Skips 0
2349
+ uint176 private _nextId = 1;
2350
+ /// @dev The ID of the next pool that is used for the first time. Skips 0
2351
+ uint80 private _nextPoolId = 1;
2352
+
2353
+ /// @dev The address of the token descriptor contract, which handles generating token URIs for position tokens
2354
+ address private immutable _tokenDescriptor;
2355
+
2356
+ constructor(
2357
+ address _factory,
2358
+ address _WETH9,
2359
+ address _tokenDescriptor_
2360
+ ) ERC721Permit('Uniswap V3 Positions NFT-V1', 'UNI-V3-POS', '1') PeripheryImmutableState(_factory, _WETH9) {
2361
+ _tokenDescriptor = _tokenDescriptor_;
2362
+ }
2363
+
2364
+ /// @inheritdoc INonfungiblePositionManager
2365
+ function positions(uint256 tokenId)
2366
+ external
2367
+ view
2368
+ override
2369
+ returns (
2370
+ uint96 nonce,
2371
+ address operator,
2372
+ address token0,
2373
+ address token1,
2374
+ uint24 fee,
2375
+ int24 tickLower,
2376
+ int24 tickUpper,
2377
+ uint128 liquidity,
2378
+ uint256 feeGrowthInside0LastX128,
2379
+ uint256 feeGrowthInside1LastX128,
2380
+ uint128 tokensOwed0,
2381
+ uint128 tokensOwed1
2382
+ )
2383
+ {
2384
+ Position memory position = _positions[tokenId];
2385
+ require(position.poolId != 0, 'Invalid token ID');
2386
+ PoolAddress.PoolKey memory poolKey = _poolIdToPoolKey[position.poolId];
2387
+ return (
2388
+ position.nonce,
2389
+ position.operator,
2390
+ poolKey.token0,
2391
+ poolKey.token1,
2392
+ poolKey.fee,
2393
+ position.tickLower,
2394
+ position.tickUpper,
2395
+ position.liquidity,
2396
+ position.feeGrowthInside0LastX128,
2397
+ position.feeGrowthInside1LastX128,
2398
+ position.tokensOwed0,
2399
+ position.tokensOwed1
2400
+ );
2401
+ }
2402
+
2403
+ /// @dev Caches a pool key
2404
+ function cachePoolKey(address pool, PoolAddress.PoolKey memory poolKey) private returns (uint80 poolId) {
2405
+ poolId = _poolIds[pool];
2406
+ if (poolId == 0) {
2407
+ _poolIds[pool] = (poolId = _nextPoolId++);
2408
+ _poolIdToPoolKey[poolId] = poolKey;
2409
+ }
2410
+ }
2411
+
2412
+ /// @inheritdoc INonfungiblePositionManager
2413
+ function mint(MintParams calldata params)
2414
+ external
2415
+ payable
2416
+ override
2417
+ checkDeadline(params.deadline)
2418
+ returns (
2419
+ uint256 tokenId,
2420
+ uint128 liquidity,
2421
+ uint256 amount0,
2422
+ uint256 amount1
2423
+ )
2424
+ {
2425
+ IUniswapV3Pool pool;
2426
+ (liquidity, amount0, amount1, pool) = addLiquidity(
2427
+ AddLiquidityParams({
2428
+ token0: params.token0,
2429
+ token1: params.token1,
2430
+ fee: params.fee,
2431
+ recipient: address(this),
2432
+ tickLower: params.tickLower,
2433
+ tickUpper: params.tickUpper,
2434
+ amount0Desired: params.amount0Desired,
2435
+ amount1Desired: params.amount1Desired,
2436
+ amount0Min: params.amount0Min,
2437
+ amount1Min: params.amount1Min
2438
+ })
2439
+ );
2440
+
2441
+ _mint(params.recipient, (tokenId = _nextId++));
2442
+
2443
+ bytes32 positionKey = PositionKey.compute(address(this), params.tickLower, params.tickUpper);
2444
+ (, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, , ) = pool.positions(positionKey);
2445
+
2446
+ // idempotent set
2447
+ uint80 poolId =
2448
+ cachePoolKey(
2449
+ address(pool),
2450
+ PoolAddress.PoolKey({token0: params.token0, token1: params.token1, fee: params.fee})
2451
+ );
2452
+
2453
+ _positions[tokenId] = Position({
2454
+ nonce: 0,
2455
+ operator: address(0),
2456
+ poolId: poolId,
2457
+ tickLower: params.tickLower,
2458
+ tickUpper: params.tickUpper,
2459
+ liquidity: liquidity,
2460
+ feeGrowthInside0LastX128: feeGrowthInside0LastX128,
2461
+ feeGrowthInside1LastX128: feeGrowthInside1LastX128,
2462
+ tokensOwed0: 0,
2463
+ tokensOwed1: 0
2464
+ });
2465
+
2466
+ emit IncreaseLiquidity(tokenId, liquidity, amount0, amount1);
2467
+ }
2468
+
2469
+ modifier isAuthorizedForToken(uint256 tokenId) {
2470
+ require(_isApprovedOrOwner(msg.sender, tokenId), 'Not approved');
2471
+ _;
2472
+ }
2473
+
2474
+ function tokenURI(uint256 tokenId) public view override(ERC721, IERC721Metadata) returns (string memory) {
2475
+ require(_exists(tokenId));
2476
+ return INonfungibleTokenPositionDescriptor(_tokenDescriptor).tokenURI(this, tokenId);
2477
+ }
2478
+
2479
+ // save bytecode by removing implementation of unused method
2480
+ function baseURI() public pure override returns (string memory) {}
2481
+
2482
+ /// @inheritdoc INonfungiblePositionManager
2483
+ function increaseLiquidity(IncreaseLiquidityParams calldata params)
2484
+ external
2485
+ payable
2486
+ override
2487
+ checkDeadline(params.deadline)
2488
+ returns (
2489
+ uint128 liquidity,
2490
+ uint256 amount0,
2491
+ uint256 amount1
2492
+ )
2493
+ {
2494
+ Position storage position = _positions[params.tokenId];
2495
+
2496
+ PoolAddress.PoolKey memory poolKey = _poolIdToPoolKey[position.poolId];
2497
+
2498
+ IUniswapV3Pool pool;
2499
+ (liquidity, amount0, amount1, pool) = addLiquidity(
2500
+ AddLiquidityParams({
2501
+ token0: poolKey.token0,
2502
+ token1: poolKey.token1,
2503
+ fee: poolKey.fee,
2504
+ tickLower: position.tickLower,
2505
+ tickUpper: position.tickUpper,
2506
+ amount0Desired: params.amount0Desired,
2507
+ amount1Desired: params.amount1Desired,
2508
+ amount0Min: params.amount0Min,
2509
+ amount1Min: params.amount1Min,
2510
+ recipient: address(this)
2511
+ })
2512
+ );
2513
+
2514
+ bytes32 positionKey = PositionKey.compute(address(this), position.tickLower, position.tickUpper);
2515
+
2516
+ // this is now updated to the current transaction
2517
+ (, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, , ) = pool.positions(positionKey);
2518
+
2519
+ position.tokensOwed0 += uint128(
2520
+ FullMath.mulDiv(
2521
+ feeGrowthInside0LastX128 - position.feeGrowthInside0LastX128,
2522
+ position.liquidity,
2523
+ FixedPoint128.Q128
2524
+ )
2525
+ );
2526
+ position.tokensOwed1 += uint128(
2527
+ FullMath.mulDiv(
2528
+ feeGrowthInside1LastX128 - position.feeGrowthInside1LastX128,
2529
+ position.liquidity,
2530
+ FixedPoint128.Q128
2531
+ )
2532
+ );
2533
+
2534
+ position.feeGrowthInside0LastX128 = feeGrowthInside0LastX128;
2535
+ position.feeGrowthInside1LastX128 = feeGrowthInside1LastX128;
2536
+ position.liquidity += liquidity;
2537
+
2538
+ emit IncreaseLiquidity(params.tokenId, liquidity, amount0, amount1);
2539
+ }
2540
+
2541
+ /// @inheritdoc INonfungiblePositionManager
2542
+ function decreaseLiquidity(DecreaseLiquidityParams calldata params)
2543
+ external
2544
+ payable
2545
+ override
2546
+ isAuthorizedForToken(params.tokenId)
2547
+ checkDeadline(params.deadline)
2548
+ returns (uint256 amount0, uint256 amount1)
2549
+ {
2550
+ require(params.liquidity > 0);
2551
+ Position storage position = _positions[params.tokenId];
2552
+
2553
+ uint128 positionLiquidity = position.liquidity;
2554
+ require(positionLiquidity >= params.liquidity);
2555
+
2556
+ PoolAddress.PoolKey memory poolKey = _poolIdToPoolKey[position.poolId];
2557
+ IUniswapV3Pool pool = IUniswapV3Pool(PoolAddress.computeAddress(factory, poolKey));
2558
+ (amount0, amount1) = pool.burn(position.tickLower, position.tickUpper, params.liquidity);
2559
+
2560
+ require(amount0 >= params.amount0Min && amount1 >= params.amount1Min, 'Price slippage check');
2561
+
2562
+ bytes32 positionKey = PositionKey.compute(address(this), position.tickLower, position.tickUpper);
2563
+ // this is now updated to the current transaction
2564
+ (, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, , ) = pool.positions(positionKey);
2565
+
2566
+ position.tokensOwed0 +=
2567
+ uint128(amount0) +
2568
+ uint128(
2569
+ FullMath.mulDiv(
2570
+ feeGrowthInside0LastX128 - position.feeGrowthInside0LastX128,
2571
+ positionLiquidity,
2572
+ FixedPoint128.Q128
2573
+ )
2574
+ );
2575
+ position.tokensOwed1 +=
2576
+ uint128(amount1) +
2577
+ uint128(
2578
+ FullMath.mulDiv(
2579
+ feeGrowthInside1LastX128 - position.feeGrowthInside1LastX128,
2580
+ positionLiquidity,
2581
+ FixedPoint128.Q128
2582
+ )
2583
+ );
2584
+
2585
+ position.feeGrowthInside0LastX128 = feeGrowthInside0LastX128;
2586
+ position.feeGrowthInside1LastX128 = feeGrowthInside1LastX128;
2587
+ // subtraction is safe because we checked positionLiquidity is gte params.liquidity
2588
+ position.liquidity = positionLiquidity - params.liquidity;
2589
+
2590
+ emit DecreaseLiquidity(params.tokenId, params.liquidity, amount0, amount1);
2591
+ }
2592
+
2593
+ /// @inheritdoc INonfungiblePositionManager
2594
+ function collect(CollectParams calldata params)
2595
+ external
2596
+ payable
2597
+ override
2598
+ isAuthorizedForToken(params.tokenId)
2599
+ returns (uint256 amount0, uint256 amount1)
2600
+ {
2601
+ require(params.amount0Max > 0 || params.amount1Max > 0);
2602
+ // allow collecting to the nft position manager address with address 0
2603
+ address recipient = params.recipient == address(0) ? address(this) : params.recipient;
2604
+
2605
+ Position storage position = _positions[params.tokenId];
2606
+
2607
+ PoolAddress.PoolKey memory poolKey = _poolIdToPoolKey[position.poolId];
2608
+
2609
+ IUniswapV3Pool pool = IUniswapV3Pool(PoolAddress.computeAddress(factory, poolKey));
2610
+
2611
+ (uint128 tokensOwed0, uint128 tokensOwed1) = (position.tokensOwed0, position.tokensOwed1);
2612
+
2613
+ // trigger an update of the position fees owed and fee growth snapshots if it has any liquidity
2614
+ if (position.liquidity > 0) {
2615
+ pool.burn(position.tickLower, position.tickUpper, 0);
2616
+ (, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, , ) =
2617
+ pool.positions(PositionKey.compute(address(this), position.tickLower, position.tickUpper));
2618
+
2619
+ tokensOwed0 += uint128(
2620
+ FullMath.mulDiv(
2621
+ feeGrowthInside0LastX128 - position.feeGrowthInside0LastX128,
2622
+ position.liquidity,
2623
+ FixedPoint128.Q128
2624
+ )
2625
+ );
2626
+ tokensOwed1 += uint128(
2627
+ FullMath.mulDiv(
2628
+ feeGrowthInside1LastX128 - position.feeGrowthInside1LastX128,
2629
+ position.liquidity,
2630
+ FixedPoint128.Q128
2631
+ )
2632
+ );
2633
+
2634
+ position.feeGrowthInside0LastX128 = feeGrowthInside0LastX128;
2635
+ position.feeGrowthInside1LastX128 = feeGrowthInside1LastX128;
2636
+ }
2637
+
2638
+ // compute the arguments to give to the pool#collect method
2639
+ (uint128 amount0Collect, uint128 amount1Collect) =
2640
+ (
2641
+ params.amount0Max > tokensOwed0 ? tokensOwed0 : params.amount0Max,
2642
+ params.amount1Max > tokensOwed1 ? tokensOwed1 : params.amount1Max
2643
+ );
2644
+
2645
+ // the actual amounts collected are returned
2646
+ (amount0, amount1) = pool.collect(
2647
+ recipient,
2648
+ position.tickLower,
2649
+ position.tickUpper,
2650
+ amount0Collect,
2651
+ amount1Collect
2652
+ );
2653
+
2654
+ // sometimes there will be a few less wei than expected due to rounding down in core, but we just subtract the full amount expected
2655
+ // instead of the actual amount so we can burn the token
2656
+ (position.tokensOwed0, position.tokensOwed1) = (tokensOwed0 - amount0Collect, tokensOwed1 - amount1Collect);
2657
+
2658
+ emit Collect(params.tokenId, recipient, amount0Collect, amount1Collect);
2659
+ }
2660
+
2661
+ /// @inheritdoc INonfungiblePositionManager
2662
+ function burn(uint256 tokenId) external payable override isAuthorizedForToken(tokenId) {
2663
+ Position storage position = _positions[tokenId];
2664
+ require(position.liquidity == 0 && position.tokensOwed0 == 0 && position.tokensOwed1 == 0, 'Not cleared');
2665
+ delete _positions[tokenId];
2666
+ _burn(tokenId);
2667
+ }
2668
+
2669
+ function _getAndIncrementNonce(uint256 tokenId) internal override returns (uint256) {
2670
+ return uint256(_positions[tokenId].nonce++);
2671
+ }
2672
+
2673
+ /// @inheritdoc IERC721
2674
+ function getApproved(uint256 tokenId) public view override(ERC721, IERC721) returns (address) {
2675
+ require(_exists(tokenId), 'ERC721: approved query for nonexistent token');
2676
+
2677
+ return _positions[tokenId].operator;
2678
+ }
2679
+
2680
+ /// @dev Overrides _approve to use the operator in the position, which is packed with the position permit nonce
2681
+ function _approve(address to, uint256 tokenId) internal override(ERC721) {
2682
+ _positions[tokenId].operator = to;
2683
+ emit Approval(ownerOf(tokenId), to, tokenId);
2684
+ }
2685
+ }
2686
+
2687
+ // src/NonfungiblePositionManagerImporter.sol
2688
+
2689
+ contract NonfungiblePositionManagerImporter is NonfungiblePositionManager {
2690
+ constructor(
2691
+ address factory,
2692
+ address wmst,
2693
+ address tokenDescriptor
2694
+ ) NonfungiblePositionManager(factory, wmst, tokenDescriptor) {}
2695
+ }