@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,2536 @@
1
+ const { ethers } = require('hardhat');
2
+ const { expect } = require('chai');
3
+ const { loadFixture } = require('@nomicfoundation/hardhat-network-helpers');
4
+
5
+ const { impersonate } = require('../../helpers/account');
6
+ const { MAX_UINT48 } = require('../../helpers/constants');
7
+ const { selector } = require('../../helpers/methods');
8
+ const time = require('../../helpers/time');
9
+
10
+ const {
11
+ buildBaseRoles,
12
+ formatAccess,
13
+ EXPIRATION,
14
+ MINSETBACK,
15
+ EXECUTION_ID_STORAGE_SLOT,
16
+ CONSUMING_SCHEDULE_STORAGE_SLOT,
17
+ prepareOperation,
18
+ hashOperation,
19
+ } = require('../../helpers/access-manager');
20
+
21
+ const {
22
+ shouldBehaveLikeDelayedAdminOperation,
23
+ shouldBehaveLikeNotDelayedAdminOperation,
24
+ shouldBehaveLikeRoleAdminOperation,
25
+ shouldBehaveLikeAManagedRestrictedOperation,
26
+ shouldBehaveLikeASelfRestrictedOperation,
27
+ } = require('./AccessManager.behavior');
28
+
29
+ const {
30
+ LIKE_COMMON_SCHEDULABLE,
31
+ testAsClosable,
32
+ testAsDelay,
33
+ testAsSchedulableOperation,
34
+ testAsCanCall,
35
+ testAsHasRole,
36
+ testAsGetAccess,
37
+ } = require('./AccessManager.predicate');
38
+
39
+ async function fixture() {
40
+ const [admin, roleAdmin, roleGuardian, member, user, other] = await ethers.getSigners();
41
+
42
+ // Build roles
43
+ const roles = buildBaseRoles();
44
+
45
+ // Add members
46
+ roles.ADMIN.members = [admin];
47
+ roles.SOME_ADMIN.members = [roleAdmin];
48
+ roles.SOME_GUARDIAN.members = [roleGuardian];
49
+ roles.SOME.members = [member];
50
+ roles.PUBLIC.members = [admin, roleAdmin, roleGuardian, member, user, other];
51
+
52
+ const manager = await ethers.deployContract('$AccessManagerMock', [admin]);
53
+ const target = await ethers.deployContract('$AccessManagedTarget', [manager]);
54
+
55
+ for (const { id: roleId, admin, guardian, members } of Object.values(roles)) {
56
+ if (roleId === roles.PUBLIC.id) continue; // Every address belong to public and is locked
57
+ if (roleId === roles.ADMIN.id) continue; // Admin set during construction and is locked
58
+
59
+ // Set admin role avoiding default
60
+ if (admin.id !== roles.ADMIN.id) {
61
+ await manager.$_setRoleAdmin(roleId, admin.id);
62
+ }
63
+
64
+ // Set guardian role avoiding default
65
+ if (guardian.id !== roles.ADMIN.id) {
66
+ await manager.$_setRoleGuardian(roleId, guardian.id);
67
+ }
68
+
69
+ // Grant role to members
70
+ for (const member of members) {
71
+ await manager.$_grantRole(roleId, member, 0, 0);
72
+ }
73
+ }
74
+
75
+ return {
76
+ admin,
77
+ roleAdmin,
78
+ user,
79
+ other,
80
+ roles,
81
+ manager,
82
+ target,
83
+ };
84
+ }
85
+
86
+ // This test suite is made using the following tools:
87
+ //
88
+ // * Predicates: Functions with common conditional setups without assertions.
89
+ // * Behaviors: Functions with common assertions.
90
+ //
91
+ // The behavioral tests are built by composing predicates and are used as templates
92
+ // for testing access to restricted functions.
93
+ //
94
+ // Similarly, unit tests in this suite will use predicates to test subsets of these
95
+ // behaviors and are helped by common assertions provided for some of the predicates.
96
+ //
97
+ // The predicates can be identified by the `testAs*` prefix while the behaviors
98
+ // are prefixed with `shouldBehave*`. The common assertions for predicates are
99
+ // defined as constants.
100
+ describe('AccessManager', function () {
101
+ beforeEach(async function () {
102
+ Object.assign(this, await loadFixture(fixture));
103
+ });
104
+
105
+ describe('during construction', function () {
106
+ it('grants admin role to initialAdmin', async function () {
107
+ const manager = await ethers.deployContract('$AccessManager', [this.other]);
108
+ expect(await manager.hasRole(this.roles.ADMIN.id, this.other).then(formatAccess)).to.be.deep.equal([true, '0']);
109
+ });
110
+
111
+ it('rejects zero address for initialAdmin', async function () {
112
+ await expect(ethers.deployContract('$AccessManager', [ethers.ZeroAddress]))
113
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerInvalidInitialAdmin')
114
+ .withArgs(ethers.ZeroAddress);
115
+ });
116
+
117
+ it('initializes setup roles correctly', async function () {
118
+ for (const { id: roleId, admin, guardian, members } of Object.values(this.roles)) {
119
+ expect(await this.manager.getRoleAdmin(roleId)).to.equal(admin.id);
120
+ expect(await this.manager.getRoleGuardian(roleId)).to.equal(guardian.id);
121
+
122
+ for (const user of this.roles.PUBLIC.members) {
123
+ expect(await this.manager.hasRole(roleId, user).then(formatAccess)).to.be.deep.equal([
124
+ members.includes(user),
125
+ '0',
126
+ ]);
127
+ }
128
+ }
129
+ });
130
+ });
131
+
132
+ describe('getters', function () {
133
+ describe('#canCall', function () {
134
+ beforeEach('set calldata', function () {
135
+ this.calldata = '0x12345678';
136
+ this.role = { id: 379204n };
137
+ });
138
+
139
+ testAsCanCall({
140
+ closed() {
141
+ it('should return false and no delay', async function () {
142
+ const { immediate, delay } = await this.manager.canCall(
143
+ this.other,
144
+ this.target,
145
+ this.calldata.substring(0, 10),
146
+ );
147
+ expect(immediate).to.be.false;
148
+ expect(delay).to.equal(0n);
149
+ });
150
+ },
151
+ open: {
152
+ callerIsTheManager: {
153
+ executing() {
154
+ it('should return true and no delay', async function () {
155
+ const { immediate, delay } = await this.manager.canCall(
156
+ this.caller,
157
+ this.target,
158
+ this.calldata.substring(0, 10),
159
+ );
160
+ expect(immediate).to.be.true;
161
+ expect(delay).to.equal(0n);
162
+ });
163
+ },
164
+ notExecuting() {
165
+ it('should return false and no delay', async function () {
166
+ const { immediate, delay } = await this.manager.canCall(
167
+ this.caller,
168
+ this.target,
169
+ this.calldata.substring(0, 10),
170
+ );
171
+ expect(immediate).to.be.false;
172
+ expect(delay).to.equal(0n);
173
+ });
174
+ },
175
+ },
176
+ callerIsNotTheManager: {
177
+ publicRoleIsRequired() {
178
+ it('should return true and no delay', async function () {
179
+ const { immediate, delay } = await this.manager.canCall(
180
+ this.caller,
181
+ this.target,
182
+ this.calldata.substring(0, 10),
183
+ );
184
+ expect(immediate).to.be.true;
185
+ expect(delay).to.equal(0n);
186
+ });
187
+ },
188
+ specificRoleIsRequired: {
189
+ requiredRoleIsGranted: {
190
+ roleGrantingIsDelayed: {
191
+ callerHasAnExecutionDelay: {
192
+ beforeGrantDelay: function self() {
193
+ self.mineDelay = true;
194
+
195
+ it('should return false and no execution delay', async function () {
196
+ const { immediate, delay } = await this.manager.canCall(
197
+ this.caller,
198
+ this.target,
199
+ this.calldata.substring(0, 10),
200
+ );
201
+ expect(immediate).to.be.false;
202
+ expect(delay).to.equal(0n);
203
+ });
204
+ },
205
+ afterGrantDelay: function self() {
206
+ self.mineDelay = true;
207
+
208
+ beforeEach('sets execution delay', function () {
209
+ this.scheduleIn = this.executionDelay; // For testAsSchedulableOperation
210
+ });
211
+
212
+ testAsSchedulableOperation({
213
+ scheduled: {
214
+ before: function self() {
215
+ self.mineDelay = true;
216
+
217
+ it('should return false and execution delay', async function () {
218
+ const { immediate, delay } = await this.manager.canCall(
219
+ this.caller,
220
+ this.target,
221
+ this.calldata.substring(0, 10),
222
+ );
223
+ expect(immediate).to.be.false;
224
+ expect(delay).to.equal(this.executionDelay);
225
+ });
226
+ },
227
+ after: function self() {
228
+ self.mineDelay = true;
229
+
230
+ it('should return false and execution delay', async function () {
231
+ const { immediate, delay } = await this.manager.canCall(
232
+ this.caller,
233
+ this.target,
234
+ this.calldata.substring(0, 10),
235
+ );
236
+ expect(immediate).to.be.false;
237
+ expect(delay).to.equal(this.executionDelay);
238
+ });
239
+ },
240
+ expired: function self() {
241
+ self.mineDelay = true;
242
+
243
+ it('should return false and execution delay', async function () {
244
+ const { immediate, delay } = await this.manager.canCall(
245
+ this.caller,
246
+ this.target,
247
+ this.calldata.substring(0, 10),
248
+ );
249
+ expect(immediate).to.be.false;
250
+ expect(delay).to.equal(this.executionDelay);
251
+ });
252
+ },
253
+ },
254
+ notScheduled() {
255
+ it('should return false and execution delay', async function () {
256
+ const { immediate, delay } = await this.manager.canCall(
257
+ this.caller,
258
+ this.target,
259
+ this.calldata.substring(0, 10),
260
+ );
261
+ expect(immediate).to.be.false;
262
+ expect(delay).to.equal(this.executionDelay);
263
+ });
264
+ },
265
+ });
266
+ },
267
+ },
268
+ callerHasNoExecutionDelay: {
269
+ beforeGrantDelay: function self() {
270
+ self.mineDelay = true;
271
+
272
+ it('should return false and no execution delay', async function () {
273
+ const { immediate, delay } = await this.manager.canCall(
274
+ this.caller,
275
+ this.target,
276
+ this.calldata.substring(0, 10),
277
+ );
278
+ expect(immediate).to.be.false;
279
+ expect(delay).to.equal(0n);
280
+ });
281
+ },
282
+ afterGrantDelay: function self() {
283
+ self.mineDelay = true;
284
+
285
+ it('should return true and no execution delay', async function () {
286
+ const { immediate, delay } = await this.manager.canCall(
287
+ this.caller,
288
+ this.target,
289
+ this.calldata.substring(0, 10),
290
+ );
291
+ expect(immediate).to.be.true;
292
+ expect(delay).to.equal(0n);
293
+ });
294
+ },
295
+ },
296
+ },
297
+ roleGrantingIsNotDelayed: {
298
+ callerHasAnExecutionDelay() {
299
+ it('should return false and execution delay', async function () {
300
+ const { immediate, delay } = await this.manager.canCall(
301
+ this.caller,
302
+ this.target,
303
+ this.calldata.substring(0, 10),
304
+ );
305
+ expect(immediate).to.be.false;
306
+ expect(delay).to.equal(this.executionDelay);
307
+ });
308
+ },
309
+ callerHasNoExecutionDelay() {
310
+ it('should return true and no execution delay', async function () {
311
+ const { immediate, delay } = await this.manager.canCall(
312
+ this.caller,
313
+ this.target,
314
+ this.calldata.substring(0, 10),
315
+ );
316
+ expect(immediate).to.be.true;
317
+ expect(delay).to.equal(0n);
318
+ });
319
+ },
320
+ },
321
+ },
322
+ requiredRoleIsNotGranted() {
323
+ it('should return false and no execution delay', async function () {
324
+ const { immediate, delay } = await this.manager.canCall(
325
+ this.caller,
326
+ this.target,
327
+ this.calldata.substring(0, 10),
328
+ );
329
+ expect(immediate).to.be.false;
330
+ expect(delay).to.equal(0n);
331
+ });
332
+ },
333
+ },
334
+ },
335
+ },
336
+ });
337
+ });
338
+
339
+ describe('#expiration', function () {
340
+ it('has a 7 days default expiration', async function () {
341
+ expect(await this.manager.expiration()).to.equal(EXPIRATION);
342
+ });
343
+ });
344
+
345
+ describe('#minSetback', function () {
346
+ it('has a 5 days default minimum setback', async function () {
347
+ expect(await this.manager.minSetback()).to.equal(MINSETBACK);
348
+ });
349
+ });
350
+
351
+ describe('#isTargetClosed', function () {
352
+ testAsClosable({
353
+ closed() {
354
+ it('returns true', async function () {
355
+ expect(await this.manager.isTargetClosed(this.target)).to.be.true;
356
+ });
357
+ },
358
+ open() {
359
+ it('returns false', async function () {
360
+ expect(await this.manager.isTargetClosed(this.target)).to.be.false;
361
+ });
362
+ },
363
+ });
364
+ });
365
+
366
+ describe('#getTargetFunctionRole', function () {
367
+ const methodSelector = selector('something(address,bytes)');
368
+
369
+ it('returns the target function role', async function () {
370
+ const roleId = 21498n;
371
+ await this.manager.$_setTargetFunctionRole(this.target, methodSelector, roleId);
372
+
373
+ expect(await this.manager.getTargetFunctionRole(this.target, methodSelector)).to.equal(roleId);
374
+ });
375
+
376
+ it('returns the ADMIN role if not set', async function () {
377
+ expect(await this.manager.getTargetFunctionRole(this.target, methodSelector)).to.equal(this.roles.ADMIN.id);
378
+ });
379
+ });
380
+
381
+ describe('#getTargetAdminDelay', function () {
382
+ describe('when the target admin delay is setup', function () {
383
+ beforeEach('set target admin delay', async function () {
384
+ this.oldDelay = await this.manager.getTargetAdminDelay(this.target);
385
+ this.newDelay = time.duration.days(10);
386
+
387
+ await this.manager.$_setTargetAdminDelay(this.target, this.newDelay);
388
+ this.delay = MINSETBACK; // For testAsDelay
389
+ });
390
+
391
+ testAsDelay('effect', {
392
+ before: function self() {
393
+ self.mineDelay = true;
394
+
395
+ it('returns the old target admin delay', async function () {
396
+ expect(await this.manager.getTargetAdminDelay(this.target)).to.equal(this.oldDelay);
397
+ });
398
+ },
399
+ after: function self() {
400
+ self.mineDelay = true;
401
+
402
+ it('returns the new target admin delay', async function () {
403
+ expect(await this.manager.getTargetAdminDelay(this.target)).to.equal(this.newDelay);
404
+ });
405
+ },
406
+ });
407
+ });
408
+
409
+ it('returns the 0 if not set', async function () {
410
+ expect(await this.manager.getTargetAdminDelay(this.target)).to.equal(0n);
411
+ });
412
+ });
413
+
414
+ describe('#getRoleAdmin', function () {
415
+ const roleId = 5234907n;
416
+
417
+ it('returns the role admin', async function () {
418
+ const adminId = 789433n;
419
+
420
+ await this.manager.$_setRoleAdmin(roleId, adminId);
421
+
422
+ expect(await this.manager.getRoleAdmin(roleId)).to.equal(adminId);
423
+ });
424
+
425
+ it('returns the ADMIN role if not set', async function () {
426
+ expect(await this.manager.getRoleAdmin(roleId)).to.equal(this.roles.ADMIN.id);
427
+ });
428
+ });
429
+
430
+ describe('#getRoleGuardian', function () {
431
+ const roleId = 5234907n;
432
+
433
+ it('returns the role guardian', async function () {
434
+ const guardianId = 789433n;
435
+
436
+ await this.manager.$_setRoleGuardian(roleId, guardianId);
437
+
438
+ expect(await this.manager.getRoleGuardian(roleId)).to.equal(guardianId);
439
+ });
440
+
441
+ it('returns the ADMIN role if not set', async function () {
442
+ expect(await this.manager.getRoleGuardian(roleId)).to.equal(this.roles.ADMIN.id);
443
+ });
444
+ });
445
+
446
+ describe('#getRoleGrantDelay', function () {
447
+ const roleId = 9248439n;
448
+
449
+ describe('when the grant admin delay is setup', function () {
450
+ beforeEach('set grant admin delay', async function () {
451
+ this.oldDelay = await this.manager.getRoleGrantDelay(roleId);
452
+ this.newDelay = time.duration.days(11);
453
+
454
+ await this.manager.$_setGrantDelay(roleId, this.newDelay);
455
+ this.delay = MINSETBACK; // For testAsDelay
456
+ });
457
+
458
+ testAsDelay('grant', {
459
+ before: function self() {
460
+ self.mineDelay = true;
461
+
462
+ it('returns the old role grant delay', async function () {
463
+ expect(await this.manager.getRoleGrantDelay(roleId)).to.equal(this.oldDelay);
464
+ });
465
+ },
466
+ after: function self() {
467
+ self.mineDelay = true;
468
+
469
+ it('returns the new role grant delay', async function () {
470
+ expect(await this.manager.getRoleGrantDelay(roleId)).to.equal(this.newDelay);
471
+ });
472
+ },
473
+ });
474
+ });
475
+
476
+ it('returns 0 if delay is not set', async function () {
477
+ expect(await this.manager.getTargetAdminDelay(this.target)).to.equal(0n);
478
+ });
479
+ });
480
+
481
+ describe('#getAccess', function () {
482
+ beforeEach('set role', function () {
483
+ this.role = { id: 9452n };
484
+ this.caller = this.user;
485
+ });
486
+
487
+ testAsGetAccess({
488
+ requiredRoleIsGranted: {
489
+ roleGrantingIsDelayed: {
490
+ callerHasAnExecutionDelay: {
491
+ beforeGrantDelay: function self() {
492
+ self.mineDelay = true;
493
+
494
+ it('role is not in effect and execution delay is set', async function () {
495
+ const access = await this.manager.getAccess(this.role.id, this.caller);
496
+ expect(access[0]).to.equal(this.delayEffect); // inEffectSince
497
+ expect(access[1]).to.equal(this.executionDelay); // currentDelay
498
+ expect(access[2]).to.equal(0n); // pendingDelay
499
+ expect(access[3]).to.equal(0n); // pendingDelayEffect
500
+
501
+ // Not in effect yet
502
+ expect(await time.clock.timestamp()).to.lt(access[0]);
503
+ });
504
+ },
505
+ afterGrantDelay: function self() {
506
+ self.mineDelay = true;
507
+
508
+ it('access has role in effect and execution delay is set', async function () {
509
+ const access = await this.manager.getAccess(this.role.id, this.caller);
510
+
511
+ expect(access[0]).to.equal(this.delayEffect); // inEffectSince
512
+ expect(access[1]).to.equal(this.executionDelay); // currentDelay
513
+ expect(access[2]).to.equal(0n); // pendingDelay
514
+ expect(access[3]).to.equal(0n); // pendingDelayEffect
515
+
516
+ // Already in effect
517
+ expect(await time.clock.timestamp()).to.equal(access[0]);
518
+ });
519
+ },
520
+ },
521
+ callerHasNoExecutionDelay: {
522
+ beforeGrantDelay: function self() {
523
+ self.mineDelay = true;
524
+
525
+ it('access has role not in effect without execution delay', async function () {
526
+ const access = await this.manager.getAccess(this.role.id, this.caller);
527
+ expect(access[0]).to.equal(this.delayEffect); // inEffectSince
528
+ expect(access[1]).to.equal(0n); // currentDelay
529
+ expect(access[2]).to.equal(0n); // pendingDelay
530
+ expect(access[3]).to.equal(0n); // pendingDelayEffect
531
+
532
+ // Not in effect yet
533
+ expect(await time.clock.timestamp()).to.lt(access[0]);
534
+ });
535
+ },
536
+ afterGrantDelay: function self() {
537
+ self.mineDelay = true;
538
+
539
+ it('role is in effect without execution delay', async function () {
540
+ const access = await this.manager.getAccess(this.role.id, this.caller);
541
+ expect(access[0]).to.equal(this.delayEffect); // inEffectSince
542
+ expect(access[1]).to.equal(0n); // currentDelay
543
+ expect(access[2]).to.equal(0n); // pendingDelay
544
+ expect(access[3]).to.equal(0n); // pendingDelayEffect
545
+
546
+ // Already in effect
547
+ expect(await time.clock.timestamp()).to.equal(access[0]);
548
+ });
549
+ },
550
+ },
551
+ },
552
+ roleGrantingIsNotDelayed: {
553
+ callerHasAnExecutionDelay() {
554
+ it('access has role in effect and execution delay is set', async function () {
555
+ const access = await this.manager.getAccess(this.role.id, this.caller);
556
+ expect(access[0]).to.equal(await time.clock.timestamp()); // inEffectSince
557
+ expect(access[1]).to.equal(this.executionDelay); // currentDelay
558
+ expect(access[2]).to.equal(0n); // pendingDelay
559
+ expect(access[3]).to.equal(0n); // pendingDelayEffect
560
+
561
+ // Already in effect
562
+ expect(await time.clock.timestamp()).to.equal(access[0]);
563
+ });
564
+ },
565
+ callerHasNoExecutionDelay() {
566
+ it('access has role in effect without execution delay', async function () {
567
+ const access = await this.manager.getAccess(this.role.id, this.caller);
568
+ expect(access[0]).to.equal(await time.clock.timestamp()); // inEffectSince
569
+ expect(access[1]).to.equal(0n); // currentDelay
570
+ expect(access[2]).to.equal(0n); // pendingDelay
571
+ expect(access[3]).to.equal(0n); // pendingDelayEffect
572
+
573
+ // Already in effect
574
+ expect(await time.clock.timestamp()).to.equal(access[0]);
575
+ });
576
+ },
577
+ },
578
+ },
579
+ requiredRoleIsNotGranted() {
580
+ it('has empty access', async function () {
581
+ const access = await this.manager.getAccess(this.role.id, this.caller);
582
+ expect(access[0]).to.equal(0n); // inEffectSince
583
+ expect(access[1]).to.equal(0n); // currentDelay
584
+ expect(access[2]).to.equal(0n); // pendingDelay
585
+ expect(access[3]).to.equal(0n); // pendingDelayEffect
586
+ });
587
+ },
588
+ });
589
+ });
590
+
591
+ describe('#hasRole', function () {
592
+ beforeEach('setup testAsHasRole', function () {
593
+ this.role = { id: 49832n };
594
+ this.calldata = '0x12345678';
595
+ this.caller = this.user;
596
+ });
597
+
598
+ testAsHasRole({
599
+ publicRoleIsRequired() {
600
+ it('has PUBLIC role', async function () {
601
+ const { isMember, executionDelay } = await this.manager.hasRole(this.role.id, this.caller);
602
+ expect(isMember).to.be.true;
603
+ expect(executionDelay).to.equal('0');
604
+ });
605
+ },
606
+ specificRoleIsRequired: {
607
+ requiredRoleIsGranted: {
608
+ roleGrantingIsDelayed: {
609
+ callerHasAnExecutionDelay: {
610
+ beforeGrantDelay: function self() {
611
+ self.mineDelay = true;
612
+
613
+ it('does not have role but execution delay', async function () {
614
+ const { isMember, executionDelay } = await this.manager.hasRole(this.role.id, this.caller);
615
+ expect(isMember).to.be.false;
616
+ expect(executionDelay).to.equal(this.executionDelay);
617
+ });
618
+ },
619
+ afterGrantDelay: function self() {
620
+ self.mineDelay = true;
621
+
622
+ it('has role and execution delay', async function () {
623
+ const { isMember, executionDelay } = await this.manager.hasRole(this.role.id, this.caller);
624
+ expect(isMember).to.be.true;
625
+ expect(executionDelay).to.equal(this.executionDelay);
626
+ });
627
+ },
628
+ },
629
+ callerHasNoExecutionDelay: {
630
+ beforeGrantDelay: function self() {
631
+ self.mineDelay = true;
632
+
633
+ it('does not have role nor execution delay', async function () {
634
+ const { isMember, executionDelay } = await this.manager.hasRole(this.role.id, this.caller);
635
+ expect(isMember).to.be.false;
636
+ expect(executionDelay).to.equal('0');
637
+ });
638
+ },
639
+ afterGrantDelay: function self() {
640
+ self.mineDelay = true;
641
+
642
+ it('has role and no execution delay', async function () {
643
+ const { isMember, executionDelay } = await this.manager.hasRole(this.role.id, this.caller);
644
+ expect(isMember).to.be.true;
645
+ expect(executionDelay).to.equal('0');
646
+ });
647
+ },
648
+ },
649
+ },
650
+ roleGrantingIsNotDelayed: {
651
+ callerHasAnExecutionDelay() {
652
+ it('has role and execution delay', async function () {
653
+ const { isMember, executionDelay } = await this.manager.hasRole(this.role.id, this.caller);
654
+ expect(isMember).to.be.true;
655
+ expect(executionDelay).to.equal(this.executionDelay);
656
+ });
657
+ },
658
+ callerHasNoExecutionDelay() {
659
+ it('has role and no execution delay', async function () {
660
+ const { isMember, executionDelay } = await this.manager.hasRole(this.role.id, this.caller);
661
+ expect(isMember).to.be.true;
662
+ expect(executionDelay).to.equal('0');
663
+ });
664
+ },
665
+ },
666
+ },
667
+ requiredRoleIsNotGranted() {
668
+ it('has no role and no execution delay', async function () {
669
+ const { isMember, executionDelay } = await this.manager.hasRole(this.role.id, this.caller);
670
+ expect(isMember).to.be.false;
671
+ expect(executionDelay).to.equal('0');
672
+ });
673
+ },
674
+ },
675
+ });
676
+ });
677
+
678
+ describe('#getSchedule', function () {
679
+ beforeEach('set role and calldata', async function () {
680
+ const fnRestricted = this.target.fnRestricted.getFragment().selector;
681
+ this.caller = this.user;
682
+ this.role = { id: 493590n };
683
+ await this.manager.$_setTargetFunctionRole(this.target, fnRestricted, this.role.id);
684
+ await this.manager.$_grantRole(this.role.id, this.caller, 0, 1); // nonzero execution delay
685
+
686
+ this.calldata = this.target.interface.encodeFunctionData(fnRestricted, []);
687
+ this.scheduleIn = time.duration.days(10); // For testAsSchedulableOperation
688
+ });
689
+
690
+ testAsSchedulableOperation({
691
+ scheduled: {
692
+ before: function self() {
693
+ self.mineDelay = true;
694
+
695
+ it('returns schedule in the future', async function () {
696
+ const schedule = await this.manager.getSchedule(this.operationId);
697
+ expect(schedule).to.equal(this.scheduledAt + this.scheduleIn);
698
+ expect(schedule).to.gt(await time.clock.timestamp());
699
+ });
700
+ },
701
+ after: function self() {
702
+ self.mineDelay = true;
703
+
704
+ it('returns schedule', async function () {
705
+ const schedule = await this.manager.getSchedule(this.operationId);
706
+ expect(schedule).to.equal(this.scheduledAt + this.scheduleIn);
707
+ expect(schedule).to.equal(await time.clock.timestamp());
708
+ });
709
+ },
710
+ expired: function self() {
711
+ self.mineDelay = true;
712
+
713
+ it('returns 0', async function () {
714
+ expect(await this.manager.getSchedule(this.operationId)).to.equal(0n);
715
+ });
716
+ },
717
+ },
718
+ notScheduled() {
719
+ it('defaults to 0', async function () {
720
+ expect(await this.manager.getSchedule(this.operationId)).to.equal(0n);
721
+ });
722
+ },
723
+ });
724
+ });
725
+
726
+ describe('#getNonce', function () {
727
+ describe('when operation is scheduled', function () {
728
+ beforeEach('schedule operation', async function () {
729
+ const fnRestricted = this.target.fnRestricted.getFragment().selector;
730
+ this.caller = this.user;
731
+ this.role = { id: 4209043n };
732
+ await this.manager.$_setTargetFunctionRole(this.target, fnRestricted, this.role.id);
733
+ await this.manager.$_grantRole(this.role.id, this.caller, 0, 1); // nonzero execution delay
734
+
735
+ this.calldata = this.target.interface.encodeFunctionData(fnRestricted, []);
736
+ this.delay = time.duration.days(10);
737
+
738
+ const { operationId, schedule } = await prepareOperation(this.manager, {
739
+ caller: this.caller,
740
+ target: this.target,
741
+ calldata: this.calldata,
742
+ delay: this.delay,
743
+ });
744
+ await schedule();
745
+ this.operationId = operationId;
746
+ });
747
+
748
+ it('returns nonce', async function () {
749
+ expect(await this.manager.getNonce(this.operationId)).to.equal(1n);
750
+ });
751
+ });
752
+
753
+ describe('when is not scheduled', function () {
754
+ it('returns default 0', async function () {
755
+ expect(await this.manager.getNonce(ethers.id('operation'))).to.equal(0n);
756
+ });
757
+ });
758
+ });
759
+
760
+ describe('#hashOperation', function () {
761
+ it('returns an operationId', async function () {
762
+ const args = [this.user, this.other, '0x123543'];
763
+ expect(await this.manager.hashOperation(...args)).to.equal(hashOperation(...args));
764
+ });
765
+ });
766
+ });
767
+
768
+ describe('admin operations', function () {
769
+ beforeEach('set required role', function () {
770
+ this.role = this.roles.ADMIN;
771
+ });
772
+
773
+ describe('subject to a delay', function () {
774
+ describe('#labelRole', function () {
775
+ describe('restrictions', function () {
776
+ beforeEach('set method and args', function () {
777
+ const args = [123443, 'TEST'];
778
+ const method = this.manager.interface.getFunction('labelRole(uint64,string)');
779
+ this.calldata = this.manager.interface.encodeFunctionData(method, args);
780
+ });
781
+
782
+ shouldBehaveLikeDelayedAdminOperation();
783
+ });
784
+
785
+ it('emits an event with the label', async function () {
786
+ await expect(this.manager.connect(this.admin).labelRole(this.roles.SOME.id, 'Some label'))
787
+ .to.emit(this.manager, 'RoleLabel')
788
+ .withArgs(this.roles.SOME.id, 'Some label');
789
+ });
790
+
791
+ it('updates label on a second call', async function () {
792
+ await this.manager.connect(this.admin).labelRole(this.roles.SOME.id, 'Some label');
793
+
794
+ await expect(this.manager.connect(this.admin).labelRole(this.roles.SOME.id, 'Updated label'))
795
+ .to.emit(this.manager, 'RoleLabel')
796
+ .withArgs(this.roles.SOME.id, 'Updated label');
797
+ });
798
+
799
+ it('reverts labeling PUBLIC_ROLE', async function () {
800
+ await expect(this.manager.connect(this.admin).labelRole(this.roles.PUBLIC.id, 'Some label'))
801
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerLockedRole')
802
+ .withArgs(this.roles.PUBLIC.id);
803
+ });
804
+
805
+ it('reverts labeling ADMIN_ROLE', async function () {
806
+ await expect(this.manager.connect(this.admin).labelRole(this.roles.ADMIN.id, 'Some label'))
807
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerLockedRole')
808
+ .withArgs(this.roles.ADMIN.id);
809
+ });
810
+ });
811
+
812
+ describe('#setRoleAdmin', function () {
813
+ describe('restrictions', function () {
814
+ beforeEach('set method and args', function () {
815
+ const args = [93445, 84532];
816
+ const method = this.manager.interface.getFunction('setRoleAdmin(uint64,uint64)');
817
+ this.calldata = this.manager.interface.encodeFunctionData(method, args);
818
+ });
819
+
820
+ shouldBehaveLikeDelayedAdminOperation();
821
+ });
822
+
823
+ it("sets any role's admin if called by an admin", async function () {
824
+ expect(await this.manager.getRoleAdmin(this.roles.SOME.id)).to.equal(this.roles.SOME_ADMIN.id);
825
+
826
+ await expect(this.manager.connect(this.admin).setRoleAdmin(this.roles.SOME.id, this.roles.ADMIN.id))
827
+ .to.emit(this.manager, 'RoleAdminChanged')
828
+ .withArgs(this.roles.SOME.id, this.roles.ADMIN.id);
829
+
830
+ expect(await this.manager.getRoleAdmin(this.roles.SOME.id)).to.equal(this.roles.ADMIN.id);
831
+ });
832
+
833
+ it('reverts setting PUBLIC_ROLE admin', async function () {
834
+ await expect(this.manager.connect(this.admin).setRoleAdmin(this.roles.PUBLIC.id, this.roles.ADMIN.id))
835
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerLockedRole')
836
+ .withArgs(this.roles.PUBLIC.id);
837
+ });
838
+
839
+ it('reverts setting ADMIN_ROLE admin', async function () {
840
+ await expect(this.manager.connect(this.admin).setRoleAdmin(this.roles.ADMIN.id, this.roles.ADMIN.id))
841
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerLockedRole')
842
+ .withArgs(this.roles.ADMIN.id);
843
+ });
844
+ });
845
+
846
+ describe('#setRoleGuardian', function () {
847
+ describe('restrictions', function () {
848
+ beforeEach('set method and args', function () {
849
+ const args = [93445, 84532];
850
+ const method = this.manager.interface.getFunction('setRoleGuardian(uint64,uint64)');
851
+ this.calldata = this.manager.interface.encodeFunctionData(method, args);
852
+ });
853
+
854
+ shouldBehaveLikeDelayedAdminOperation();
855
+ });
856
+
857
+ it("sets any role's guardian if called by an admin", async function () {
858
+ expect(await this.manager.getRoleGuardian(this.roles.SOME.id)).to.equal(this.roles.SOME_GUARDIAN.id);
859
+
860
+ await expect(this.manager.connect(this.admin).setRoleGuardian(this.roles.SOME.id, this.roles.ADMIN.id))
861
+ .to.emit(this.manager, 'RoleGuardianChanged')
862
+ .withArgs(this.roles.SOME.id, this.roles.ADMIN.id);
863
+
864
+ expect(await this.manager.getRoleGuardian(this.roles.SOME.id)).to.equal(this.roles.ADMIN.id);
865
+ });
866
+
867
+ it('reverts setting PUBLIC_ROLE admin', async function () {
868
+ await expect(this.manager.connect(this.admin).setRoleGuardian(this.roles.PUBLIC.id, this.roles.ADMIN.id))
869
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerLockedRole')
870
+ .withArgs(this.roles.PUBLIC.id);
871
+ });
872
+
873
+ it('reverts setting ADMIN_ROLE admin', async function () {
874
+ await expect(this.manager.connect(this.admin).setRoleGuardian(this.roles.ADMIN.id, this.roles.ADMIN.id))
875
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerLockedRole')
876
+ .withArgs(this.roles.ADMIN.id);
877
+ });
878
+ });
879
+
880
+ describe('#setGrantDelay', function () {
881
+ describe('restrictions', function () {
882
+ beforeEach('set method and args', function () {
883
+ const args = [984910, time.duration.days(2)];
884
+ const method = this.manager.interface.getFunction('setGrantDelay(uint64,uint32)');
885
+ this.calldata = this.manager.interface.encodeFunctionData(method, args);
886
+ });
887
+
888
+ shouldBehaveLikeDelayedAdminOperation();
889
+ });
890
+
891
+ it('reverts setting grant delay for the PUBLIC_ROLE', async function () {
892
+ await expect(this.manager.connect(this.admin).setGrantDelay(this.roles.PUBLIC.id, 69n))
893
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerLockedRole')
894
+ .withArgs(this.roles.PUBLIC.id);
895
+ });
896
+
897
+ describe('when increasing the delay', function () {
898
+ const oldDelay = 10n;
899
+ const newDelay = 100n;
900
+
901
+ beforeEach('sets old delay', async function () {
902
+ this.role = this.roles.SOME;
903
+ await this.manager.$_setGrantDelay(this.role.id, oldDelay);
904
+ await time.increaseBy.timestamp(MINSETBACK);
905
+ expect(await this.manager.getRoleGrantDelay(this.role.id)).to.equal(oldDelay);
906
+ });
907
+
908
+ it('increases the delay after minsetback', async function () {
909
+ const txResponse = await this.manager.connect(this.admin).setGrantDelay(this.role.id, newDelay);
910
+ const setGrantDelayAt = await time.clockFromReceipt.timestamp(txResponse);
911
+ await expect(txResponse)
912
+ .to.emit(this.manager, 'RoleGrantDelayChanged')
913
+ .withArgs(this.role.id, newDelay, setGrantDelayAt + MINSETBACK);
914
+
915
+ expect(await this.manager.getRoleGrantDelay(this.role.id)).to.equal(oldDelay);
916
+ await time.increaseBy.timestamp(MINSETBACK);
917
+ expect(await this.manager.getRoleGrantDelay(this.role.id)).to.equal(newDelay);
918
+ });
919
+ });
920
+
921
+ describe('when reducing the delay', function () {
922
+ const oldDelay = time.duration.days(10);
923
+
924
+ beforeEach('sets old delay', async function () {
925
+ this.role = this.roles.SOME;
926
+ await this.manager.$_setGrantDelay(this.role.id, oldDelay);
927
+ await time.increaseBy.timestamp(MINSETBACK);
928
+ expect(await this.manager.getRoleGrantDelay(this.role.id)).to.equal(oldDelay);
929
+ });
930
+
931
+ describe('when the delay difference is shorter than minimum setback', function () {
932
+ const newDelay = oldDelay - 1n;
933
+
934
+ it('increases the delay after minsetback', async function () {
935
+ const txResponse = await this.manager.connect(this.admin).setGrantDelay(this.role.id, newDelay);
936
+ const setGrantDelayAt = await time.clockFromReceipt.timestamp(txResponse);
937
+ await expect(txResponse)
938
+ .to.emit(this.manager, 'RoleGrantDelayChanged')
939
+ .withArgs(this.role.id, newDelay, setGrantDelayAt + MINSETBACK);
940
+
941
+ expect(await this.manager.getRoleGrantDelay(this.role.id)).to.equal(oldDelay);
942
+ await time.increaseBy.timestamp(MINSETBACK);
943
+ expect(await this.manager.getRoleGrantDelay(this.role.id)).to.equal(newDelay);
944
+ });
945
+ });
946
+
947
+ describe('when the delay difference is longer than minimum setback', function () {
948
+ const newDelay = 1n;
949
+
950
+ beforeEach('assert delay difference is higher than minsetback', function () {
951
+ expect(oldDelay - newDelay).to.gt(MINSETBACK);
952
+ });
953
+
954
+ it('increases the delay after delay difference', async function () {
955
+ const setback = oldDelay - newDelay;
956
+
957
+ const txResponse = await this.manager.connect(this.admin).setGrantDelay(this.role.id, newDelay);
958
+ const setGrantDelayAt = await time.clockFromReceipt.timestamp(txResponse);
959
+
960
+ await expect(txResponse)
961
+ .to.emit(this.manager, 'RoleGrantDelayChanged')
962
+ .withArgs(this.role.id, newDelay, setGrantDelayAt + setback);
963
+
964
+ expect(await this.manager.getRoleGrantDelay(this.role.id)).to.equal(oldDelay);
965
+ await time.increaseBy.timestamp(setback);
966
+ expect(await this.manager.getRoleGrantDelay(this.role.id)).to.equal(newDelay);
967
+ });
968
+ });
969
+ });
970
+ });
971
+
972
+ describe('#setTargetAdminDelay', function () {
973
+ describe('restrictions', function () {
974
+ beforeEach('set method and args', function () {
975
+ const args = [this.other.address, time.duration.days(3)];
976
+ const method = this.manager.interface.getFunction('setTargetAdminDelay(address,uint32)');
977
+ this.calldata = this.manager.interface.encodeFunctionData(method, args);
978
+ });
979
+
980
+ shouldBehaveLikeDelayedAdminOperation();
981
+ });
982
+
983
+ describe('when increasing the delay', function () {
984
+ const oldDelay = time.duration.days(10);
985
+ const newDelay = time.duration.days(11);
986
+
987
+ beforeEach('sets old delay', async function () {
988
+ await this.manager.$_setTargetAdminDelay(this.other, oldDelay);
989
+ await time.increaseBy.timestamp(MINSETBACK);
990
+ expect(await this.manager.getTargetAdminDelay(this.other)).to.equal(oldDelay);
991
+ });
992
+
993
+ it('increases the delay after minsetback', async function () {
994
+ const txResponse = await this.manager.connect(this.admin).setTargetAdminDelay(this.other, newDelay);
995
+ const setTargetAdminDelayAt = await time.clockFromReceipt.timestamp(txResponse);
996
+ await expect(txResponse)
997
+ .to.emit(this.manager, 'TargetAdminDelayUpdated')
998
+ .withArgs(this.other, newDelay, setTargetAdminDelayAt + MINSETBACK);
999
+
1000
+ expect(await this.manager.getTargetAdminDelay(this.other)).to.equal(oldDelay);
1001
+ await time.increaseBy.timestamp(MINSETBACK);
1002
+ expect(await this.manager.getTargetAdminDelay(this.other)).to.equal(newDelay);
1003
+ });
1004
+ });
1005
+
1006
+ describe('when reducing the delay', function () {
1007
+ const oldDelay = time.duration.days(10);
1008
+
1009
+ beforeEach('sets old delay', async function () {
1010
+ await this.manager.$_setTargetAdminDelay(this.other, oldDelay);
1011
+ await time.increaseBy.timestamp(MINSETBACK);
1012
+ expect(await this.manager.getTargetAdminDelay(this.other)).to.equal(oldDelay);
1013
+ });
1014
+
1015
+ describe('when the delay difference is shorter than minimum setback', function () {
1016
+ const newDelay = oldDelay - 1n;
1017
+
1018
+ it('increases the delay after minsetback', async function () {
1019
+ const txResponse = await this.manager.connect(this.admin).setTargetAdminDelay(this.other, newDelay);
1020
+ const setTargetAdminDelayAt = await time.clockFromReceipt.timestamp(txResponse);
1021
+ await expect(txResponse)
1022
+ .to.emit(this.manager, 'TargetAdminDelayUpdated')
1023
+ .withArgs(this.other, newDelay, setTargetAdminDelayAt + MINSETBACK);
1024
+
1025
+ expect(await this.manager.getTargetAdminDelay(this.other)).to.equal(oldDelay);
1026
+ await time.increaseBy.timestamp(MINSETBACK);
1027
+ expect(await this.manager.getTargetAdminDelay(this.other)).to.equal(newDelay);
1028
+ });
1029
+ });
1030
+
1031
+ describe('when the delay difference is longer than minimum setback', function () {
1032
+ const newDelay = 1n;
1033
+
1034
+ beforeEach('assert delay difference is higher than minsetback', function () {
1035
+ expect(oldDelay - newDelay).to.gt(MINSETBACK);
1036
+ });
1037
+
1038
+ it('increases the delay after delay difference', async function () {
1039
+ const setback = oldDelay - newDelay;
1040
+
1041
+ const txResponse = await this.manager.connect(this.admin).setTargetAdminDelay(this.other, newDelay);
1042
+ const setTargetAdminDelayAt = await time.clockFromReceipt.timestamp(txResponse);
1043
+
1044
+ await expect(txResponse)
1045
+ .to.emit(this.manager, 'TargetAdminDelayUpdated')
1046
+ .withArgs(this.other, newDelay, setTargetAdminDelayAt + setback);
1047
+
1048
+ expect(await this.manager.getTargetAdminDelay(this.other)).to.equal(oldDelay);
1049
+ await time.increaseBy.timestamp(setback);
1050
+ expect(await this.manager.getTargetAdminDelay(this.other)).to.equal(newDelay);
1051
+ });
1052
+ });
1053
+ });
1054
+ });
1055
+ });
1056
+
1057
+ describe('not subject to a delay', function () {
1058
+ describe('#updateAuthority', function () {
1059
+ beforeEach('create a target and a new authority', async function () {
1060
+ this.newAuthority = await ethers.deployContract('$AccessManager', [this.admin]);
1061
+ this.newManagedTarget = await ethers.deployContract('$AccessManagedTarget', [this.manager]);
1062
+ });
1063
+
1064
+ describe('restrictions', function () {
1065
+ beforeEach('set method and args', function () {
1066
+ this.operationDelayTarget = this.newManagedTarget;
1067
+ this.calldata = this.manager.interface.encodeFunctionData('updateAuthority(address,address)', [
1068
+ this.newManagedTarget.target,
1069
+ this.newAuthority.target,
1070
+ ]);
1071
+ });
1072
+
1073
+ shouldBehaveLikeNotDelayedAdminOperation();
1074
+ });
1075
+
1076
+ it('changes the authority', async function () {
1077
+ expect(await this.newManagedTarget.authority()).to.equal(this.manager);
1078
+
1079
+ await expect(this.manager.connect(this.admin).updateAuthority(this.newManagedTarget, this.newAuthority))
1080
+ .to.emit(this.newManagedTarget, 'AuthorityUpdated') // Managed contract is responsible of notifying the change through an event
1081
+ .withArgs(this.newAuthority);
1082
+
1083
+ expect(await this.newManagedTarget.authority()).to.equal(this.newAuthority);
1084
+ });
1085
+ });
1086
+
1087
+ describe('#setTargetClosed', function () {
1088
+ describe('restrictions', function () {
1089
+ beforeEach('set method and args', function () {
1090
+ this.operationDelayTarget = this.other;
1091
+ const args = [this.other.address, true];
1092
+ const method = this.manager.interface.getFunction('setTargetClosed(address,bool)');
1093
+ this.calldata = this.manager.interface.encodeFunctionData(method, args);
1094
+ });
1095
+
1096
+ shouldBehaveLikeNotDelayedAdminOperation();
1097
+ });
1098
+
1099
+ it('closes and opens a target', async function () {
1100
+ await expect(this.manager.connect(this.admin).setTargetClosed(this.target, true))
1101
+ .to.emit(this.manager, 'TargetClosed')
1102
+ .withArgs(this.target, true);
1103
+ expect(await this.manager.isTargetClosed(this.target)).to.be.true;
1104
+
1105
+ await expect(this.manager.connect(this.admin).setTargetClosed(this.target, false))
1106
+ .to.emit(this.manager, 'TargetClosed')
1107
+ .withArgs(this.target, false);
1108
+ expect(await this.manager.isTargetClosed(this.target)).to.be.false;
1109
+ });
1110
+
1111
+ describe('when the target is the manager', async function () {
1112
+ it('closes and opens the manager', async function () {
1113
+ await expect(this.manager.connect(this.admin).setTargetClosed(this.manager, true))
1114
+ .to.emit(this.manager, 'TargetClosed')
1115
+ .withArgs(this.manager, true);
1116
+ expect(await this.manager.isTargetClosed(this.manager)).to.be.true;
1117
+
1118
+ await expect(this.manager.connect(this.admin).setTargetClosed(this.manager, false))
1119
+ .to.emit(this.manager, 'TargetClosed')
1120
+ .withArgs(this.manager, false);
1121
+ expect(await this.manager.isTargetClosed(this.manager)).to.be.false;
1122
+ });
1123
+ });
1124
+ });
1125
+
1126
+ describe('#setTargetFunctionRole', function () {
1127
+ describe('restrictions', function () {
1128
+ beforeEach('set method and args', function () {
1129
+ this.operationDelayTarget = this.other;
1130
+ const args = [this.other.address, ['0x12345678'], 443342];
1131
+ const method = this.manager.interface.getFunction('setTargetFunctionRole(address,bytes4[],uint64)');
1132
+ this.calldata = this.manager.interface.encodeFunctionData(method, args);
1133
+ });
1134
+
1135
+ shouldBehaveLikeNotDelayedAdminOperation();
1136
+ });
1137
+
1138
+ const sigs = ['someFunction()', 'someOtherFunction(uint256)', 'oneMoreFunction(address,uint8)'].map(selector);
1139
+
1140
+ it('sets function roles', async function () {
1141
+ for (const sig of sigs) {
1142
+ expect(await this.manager.getTargetFunctionRole(this.target, sig)).to.equal(this.roles.ADMIN.id);
1143
+ }
1144
+
1145
+ const allowRole = await this.manager
1146
+ .connect(this.admin)
1147
+ .setTargetFunctionRole(this.target, sigs, this.roles.SOME.id);
1148
+
1149
+ for (const sig of sigs) {
1150
+ await expect(allowRole)
1151
+ .to.emit(this.manager, 'TargetFunctionRoleUpdated')
1152
+ .withArgs(this.target, sig, this.roles.SOME.id);
1153
+ expect(await this.manager.getTargetFunctionRole(this.target, sig)).to.equal(this.roles.SOME.id);
1154
+ }
1155
+
1156
+ await expect(
1157
+ this.manager.connect(this.admin).setTargetFunctionRole(this.target, [sigs[1]], this.roles.SOME_ADMIN.id),
1158
+ )
1159
+ .to.emit(this.manager, 'TargetFunctionRoleUpdated')
1160
+ .withArgs(this.target, sigs[1], this.roles.SOME_ADMIN.id);
1161
+
1162
+ for (const sig of sigs) {
1163
+ expect(await this.manager.getTargetFunctionRole(this.target, sig)).to.equal(
1164
+ sig == sigs[1] ? this.roles.SOME_ADMIN.id : this.roles.SOME.id,
1165
+ );
1166
+ }
1167
+ });
1168
+
1169
+ it('reverts setting a function role for the setAuthority selector', async function () {
1170
+ const { selector } = this.target.interface.getFunction('setAuthority');
1171
+ await expect(
1172
+ this.manager.connect(this.admin).$_setTargetFunctionRole(this.target, selector, this.roles.ADMIN.id),
1173
+ )
1174
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerLockedFunction')
1175
+ .withArgs(selector);
1176
+ });
1177
+ });
1178
+
1179
+ describe('role admin operations', function () {
1180
+ const ANOTHER_ADMIN = 0xdeadc0de1n;
1181
+ const ANOTHER_ROLE = 0xdeadc0de2n;
1182
+
1183
+ beforeEach('set required role', async function () {
1184
+ // Make admin a member of ANOTHER_ADMIN
1185
+ await this.manager.$_grantRole(ANOTHER_ADMIN, this.admin, 0, 0);
1186
+ await this.manager.$_setRoleAdmin(ANOTHER_ROLE, ANOTHER_ADMIN);
1187
+
1188
+ this.role = { id: ANOTHER_ADMIN };
1189
+ await this.manager.$_grantRole(this.role.id, this.user, 0, 0);
1190
+ });
1191
+
1192
+ describe('#grantRole', function () {
1193
+ describe('restrictions', function () {
1194
+ beforeEach('set method and args', function () {
1195
+ const args = [ANOTHER_ROLE, this.other.address, 0];
1196
+ const method = this.manager.interface.getFunction('grantRole(uint64,address,uint32)');
1197
+ this.calldata = this.manager.interface.encodeFunctionData(method, args);
1198
+ });
1199
+
1200
+ shouldBehaveLikeRoleAdminOperation(ANOTHER_ADMIN);
1201
+ });
1202
+
1203
+ it('reverts when granting PUBLIC_ROLE', async function () {
1204
+ await expect(this.manager.connect(this.admin).grantRole(this.roles.PUBLIC.id, this.user, 0))
1205
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerLockedRole')
1206
+ .withArgs(this.roles.PUBLIC.id);
1207
+ });
1208
+
1209
+ describe('when the user is not a role member', function () {
1210
+ describe('with grant delay', function () {
1211
+ beforeEach('set grant delay and grant role', async function () {
1212
+ // Delay granting
1213
+ this.grantDelay = time.duration.weeks(2);
1214
+ await this.manager.$_setGrantDelay(ANOTHER_ROLE, this.grantDelay);
1215
+ await time.increaseBy.timestamp(MINSETBACK);
1216
+
1217
+ // Grant role
1218
+ this.executionDelay = time.duration.days(3);
1219
+ expect(await this.manager.hasRole(ANOTHER_ROLE, this.user).then(formatAccess)).to.be.deep.equal([
1220
+ false,
1221
+ '0',
1222
+ ]);
1223
+
1224
+ this.txResponse = await this.manager
1225
+ .connect(this.admin)
1226
+ .grantRole(ANOTHER_ROLE, this.user, this.executionDelay);
1227
+ this.delay = this.grantDelay; // For testAsDelay
1228
+ });
1229
+
1230
+ testAsDelay('grant', {
1231
+ before: function self() {
1232
+ self.mineDelay = true;
1233
+
1234
+ it('does not grant role to the user yet', async function () {
1235
+ const timestamp = await time.clockFromReceipt.timestamp(this.txResponse);
1236
+ await expect(this.txResponse)
1237
+ .to.emit(this.manager, 'RoleGranted')
1238
+ .withArgs(ANOTHER_ROLE, this.user, this.executionDelay, timestamp + this.grantDelay, true);
1239
+
1240
+ // Access is correctly stored
1241
+ const access = await this.manager.getAccess(ANOTHER_ROLE, this.user);
1242
+ expect(access[0]).to.equal(timestamp + this.grantDelay); // inEffectSince
1243
+ expect(access[1]).to.equal(this.executionDelay); // currentDelay
1244
+ expect(access[2]).to.equal(0n); // pendingDelay
1245
+ expect(access[3]).to.equal(0n); // pendingDelayEffect
1246
+
1247
+ // Not in effect yet
1248
+ const currentTimestamp = await time.clock.timestamp();
1249
+ expect(currentTimestamp).to.be.lt(access[0]);
1250
+ expect(await this.manager.hasRole(ANOTHER_ROLE, this.user).then(formatAccess)).to.be.deep.equal([
1251
+ false,
1252
+ this.executionDelay.toString(),
1253
+ ]);
1254
+ });
1255
+ },
1256
+ after: function self() {
1257
+ self.mineDelay = true;
1258
+
1259
+ it('grants role to the user', async function () {
1260
+ const timestamp = await time.clockFromReceipt.timestamp(this.txResponse);
1261
+ await expect(this.txResponse)
1262
+ .to.emit(this.manager, 'RoleGranted')
1263
+ .withArgs(ANOTHER_ROLE, this.user, this.executionDelay, timestamp + this.grantDelay, true);
1264
+
1265
+ // Access is correctly stored
1266
+ const access = await this.manager.getAccess(ANOTHER_ROLE, this.user);
1267
+ expect(access[0]).to.equal(timestamp + this.grantDelay); // inEffectSince
1268
+ expect(access[1]).to.equal(this.executionDelay); // currentDelay
1269
+ expect(access[2]).to.equal(0n); // pendingDelay
1270
+ expect(access[3]).to.equal(0n); // pendingDelayEffect
1271
+
1272
+ // Already in effect
1273
+ const currentTimestamp = await time.clock.timestamp();
1274
+ expect(currentTimestamp).to.equal(access[0]);
1275
+ expect(await this.manager.hasRole(ANOTHER_ROLE, this.user).then(formatAccess)).to.be.deep.equal([
1276
+ true,
1277
+ this.executionDelay.toString(),
1278
+ ]);
1279
+ });
1280
+ },
1281
+ });
1282
+ });
1283
+
1284
+ describe('without grant delay', function () {
1285
+ beforeEach('set granting delay', async function () {
1286
+ // Delay granting
1287
+ this.grantDelay = 0;
1288
+ await this.manager.$_setGrantDelay(ANOTHER_ROLE, this.grantDelay);
1289
+ await time.increaseBy.timestamp(MINSETBACK);
1290
+ });
1291
+
1292
+ it('immediately grants the role to the user', async function () {
1293
+ const executionDelay = time.duration.days(6);
1294
+ expect(await this.manager.hasRole(ANOTHER_ROLE, this.user).then(formatAccess)).to.be.deep.equal([
1295
+ false,
1296
+ '0',
1297
+ ]);
1298
+ const txResponse = await this.manager
1299
+ .connect(this.admin)
1300
+ .grantRole(ANOTHER_ROLE, this.user, executionDelay);
1301
+ const grantedAt = await time.clockFromReceipt.timestamp(txResponse);
1302
+ await expect(txResponse)
1303
+ .to.emit(this.manager, 'RoleGranted')
1304
+ .withArgs(ANOTHER_ROLE, this.user, executionDelay, grantedAt, true);
1305
+
1306
+ // Access is correctly stored
1307
+ const access = await this.manager.getAccess(ANOTHER_ROLE, this.user);
1308
+ expect(access[0]).to.equal(grantedAt); // inEffectSince
1309
+ expect(access[1]).to.equal(executionDelay); // currentDelay
1310
+ expect(access[2]).to.equal(0n); // pendingDelay
1311
+ expect(access[3]).to.equal(0n); // pendingDelayEffect
1312
+
1313
+ // Already in effect
1314
+ const currentTimestamp = await time.clock.timestamp();
1315
+ expect(currentTimestamp).to.equal(access[0]);
1316
+ expect(await this.manager.hasRole(ANOTHER_ROLE, this.user).then(formatAccess)).to.be.deep.equal([
1317
+ true,
1318
+ executionDelay.toString(),
1319
+ ]);
1320
+ });
1321
+ });
1322
+ });
1323
+
1324
+ describe('when the user is already a role member', function () {
1325
+ beforeEach('make user role member', async function () {
1326
+ this.previousExecutionDelay = time.duration.days(6);
1327
+ await this.manager.$_grantRole(ANOTHER_ROLE, this.user, 0, this.previousExecutionDelay);
1328
+ this.oldAccess = await this.manager.getAccess(ANOTHER_ROLE, this.user);
1329
+ });
1330
+
1331
+ describe('with grant delay', function () {
1332
+ beforeEach('set granting delay', async function () {
1333
+ // Delay granting
1334
+ const grantDelay = time.duration.weeks(2);
1335
+ await this.manager.$_setGrantDelay(ANOTHER_ROLE, grantDelay);
1336
+ await time.increaseBy.timestamp(MINSETBACK);
1337
+ });
1338
+
1339
+ describe('when increasing the execution delay', function () {
1340
+ beforeEach('set increased new execution delay', async function () {
1341
+ expect(await this.manager.hasRole(ANOTHER_ROLE, this.user).then(formatAccess)).to.be.deep.equal([
1342
+ true,
1343
+ this.previousExecutionDelay.toString(),
1344
+ ]);
1345
+
1346
+ this.newExecutionDelay = this.previousExecutionDelay + time.duration.days(4);
1347
+ });
1348
+
1349
+ it('emits event and immediately changes the execution delay', async function () {
1350
+ expect(await this.manager.hasRole(ANOTHER_ROLE, this.user).then(formatAccess)).to.be.deep.equal([
1351
+ true,
1352
+ this.previousExecutionDelay.toString(),
1353
+ ]);
1354
+ const txResponse = await this.manager
1355
+ .connect(this.admin)
1356
+ .grantRole(ANOTHER_ROLE, this.user, this.newExecutionDelay);
1357
+ const timestamp = await time.clockFromReceipt.timestamp(txResponse);
1358
+
1359
+ await expect(txResponse)
1360
+ .to.emit(this.manager, 'RoleGranted')
1361
+ .withArgs(ANOTHER_ROLE, this.user, this.newExecutionDelay, timestamp, false);
1362
+
1363
+ // Access is correctly stored
1364
+ const access = await this.manager.getAccess(ANOTHER_ROLE, this.user);
1365
+ expect(access[0]).to.equal(this.oldAccess[0]); // inEffectSince
1366
+ expect(access[1]).to.equal(this.newExecutionDelay); // currentDelay
1367
+ expect(access[2]).to.equal(0n); // pendingDelay
1368
+ expect(access[3]).to.equal(0n); // pendingDelayEffect
1369
+
1370
+ // Already in effect
1371
+ expect(await this.manager.hasRole(ANOTHER_ROLE, this.user).then(formatAccess)).to.be.deep.equal([
1372
+ true,
1373
+ this.newExecutionDelay.toString(),
1374
+ ]);
1375
+ });
1376
+ });
1377
+
1378
+ describe('when decreasing the execution delay', function () {
1379
+ beforeEach('decrease execution delay', async function () {
1380
+ expect(await this.manager.hasRole(ANOTHER_ROLE, this.user).then(formatAccess)).to.be.deep.equal([
1381
+ true,
1382
+ this.previousExecutionDelay.toString(),
1383
+ ]);
1384
+
1385
+ this.newExecutionDelay = this.previousExecutionDelay - time.duration.days(4);
1386
+ this.txResponse = await this.manager
1387
+ .connect(this.admin)
1388
+ .grantRole(ANOTHER_ROLE, this.user, this.newExecutionDelay);
1389
+ this.grantTimestamp = await time.clockFromReceipt.timestamp(this.txResponse);
1390
+
1391
+ this.delay = this.previousExecutionDelay - this.newExecutionDelay; // For testAsDelay
1392
+ });
1393
+
1394
+ it('emits event', async function () {
1395
+ await expect(this.txResponse)
1396
+ .to.emit(this.manager, 'RoleGranted')
1397
+ .withArgs(ANOTHER_ROLE, this.user, this.newExecutionDelay, this.grantTimestamp + this.delay, false);
1398
+ });
1399
+
1400
+ testAsDelay('execution delay effect', {
1401
+ before: function self() {
1402
+ self.mineDelay = true;
1403
+
1404
+ it('does not change the execution delay yet', async function () {
1405
+ // Access is correctly stored
1406
+ const access = await this.manager.getAccess(ANOTHER_ROLE, this.user);
1407
+ expect(access[0]).to.equal(this.oldAccess[0]); // inEffectSince
1408
+ expect(access[1]).to.equal(this.previousExecutionDelay); // currentDelay
1409
+ expect(access[2]).to.equal(this.newExecutionDelay); // pendingDelay
1410
+ expect(access[3]).to.equal(this.grantTimestamp + this.delay); // pendingDelayEffect
1411
+
1412
+ // Not in effect yet
1413
+ expect(await this.manager.hasRole(ANOTHER_ROLE, this.user).then(formatAccess)).to.be.deep.equal([
1414
+ true,
1415
+ this.previousExecutionDelay.toString(),
1416
+ ]);
1417
+ });
1418
+ },
1419
+ after: function self() {
1420
+ self.mineDelay = true;
1421
+
1422
+ it('changes the execution delay', async function () {
1423
+ // Access is correctly stored
1424
+ const access = await this.manager.getAccess(ANOTHER_ROLE, this.user);
1425
+
1426
+ expect(access[0]).to.equal(this.oldAccess[0]); // inEffectSince
1427
+ expect(access[1]).to.equal(this.newExecutionDelay); // currentDelay
1428
+ expect(access[2]).to.equal(0n); // pendingDelay
1429
+ expect(access[3]).to.equal(0n); // pendingDelayEffect
1430
+
1431
+ // Already in effect
1432
+ expect(await this.manager.hasRole(ANOTHER_ROLE, this.user).then(formatAccess)).to.be.deep.equal([
1433
+ true,
1434
+ this.newExecutionDelay.toString(),
1435
+ ]);
1436
+ });
1437
+ },
1438
+ });
1439
+ });
1440
+ });
1441
+
1442
+ describe('without grant delay', function () {
1443
+ beforeEach('set granting delay', async function () {
1444
+ // Delay granting
1445
+ const grantDelay = 0;
1446
+ await this.manager.$_setGrantDelay(ANOTHER_ROLE, grantDelay);
1447
+ await time.increaseBy.timestamp(MINSETBACK);
1448
+ });
1449
+
1450
+ describe('when increasing the execution delay', function () {
1451
+ beforeEach('set increased new execution delay', async function () {
1452
+ expect(await this.manager.hasRole(ANOTHER_ROLE, this.user).then(formatAccess)).to.be.deep.equal([
1453
+ true,
1454
+ this.previousExecutionDelay.toString(),
1455
+ ]);
1456
+
1457
+ this.newExecutionDelay = this.previousExecutionDelay + time.duration.days(4);
1458
+ });
1459
+
1460
+ it('emits event and immediately changes the execution delay', async function () {
1461
+ expect(await this.manager.hasRole(ANOTHER_ROLE, this.user).then(formatAccess)).to.be.deep.equal([
1462
+ true,
1463
+ this.previousExecutionDelay.toString(),
1464
+ ]);
1465
+ const txResponse = await this.manager
1466
+ .connect(this.admin)
1467
+ .grantRole(ANOTHER_ROLE, this.user, this.newExecutionDelay);
1468
+ const timestamp = await time.clockFromReceipt.timestamp(txResponse);
1469
+
1470
+ await expect(txResponse)
1471
+ .to.emit(this.manager, 'RoleGranted')
1472
+ .withArgs(ANOTHER_ROLE, this.user, this.newExecutionDelay, timestamp, false);
1473
+
1474
+ // Access is correctly stored
1475
+ const access = await this.manager.getAccess(ANOTHER_ROLE, this.user);
1476
+ expect(access[0]).to.equal(this.oldAccess[0]); // inEffectSince
1477
+ expect(access[1]).to.equal(this.newExecutionDelay); // currentDelay
1478
+ expect(access[2]).to.equal(0n); // pendingDelay
1479
+ expect(access[3]).to.equal(0n); // pendingDelayEffect
1480
+
1481
+ // Already in effect
1482
+ expect(await this.manager.hasRole(ANOTHER_ROLE, this.user).then(formatAccess)).to.be.deep.equal([
1483
+ true,
1484
+ this.newExecutionDelay.toString(),
1485
+ ]);
1486
+ });
1487
+ });
1488
+
1489
+ describe('when decreasing the execution delay', function () {
1490
+ beforeEach('decrease execution delay', async function () {
1491
+ expect(await this.manager.hasRole(ANOTHER_ROLE, this.user).then(formatAccess)).to.be.deep.equal([
1492
+ true,
1493
+ this.previousExecutionDelay.toString(),
1494
+ ]);
1495
+
1496
+ this.newExecutionDelay = this.previousExecutionDelay - time.duration.days(4);
1497
+ this.txResponse = await this.manager
1498
+ .connect(this.admin)
1499
+ .grantRole(ANOTHER_ROLE, this.user, this.newExecutionDelay);
1500
+ this.grantTimestamp = await time.clockFromReceipt.timestamp(this.txResponse);
1501
+
1502
+ this.delay = this.previousExecutionDelay - this.newExecutionDelay; // For testAsDelay
1503
+ });
1504
+
1505
+ it('emits event', async function () {
1506
+ await expect(this.txResponse)
1507
+ .to.emit(this.manager, 'RoleGranted')
1508
+ .withArgs(ANOTHER_ROLE, this.user, this.newExecutionDelay, this.grantTimestamp + this.delay, false);
1509
+ });
1510
+
1511
+ testAsDelay('execution delay effect', {
1512
+ before: function self() {
1513
+ self.mineDelay = true;
1514
+
1515
+ it('does not change the execution delay yet', async function () {
1516
+ // Access is correctly stored
1517
+ const access = await this.manager.getAccess(ANOTHER_ROLE, this.user);
1518
+ expect(access[0]).to.equal(this.oldAccess[0]); // inEffectSince
1519
+ expect(access[1]).to.equal(this.previousExecutionDelay); // currentDelay
1520
+ expect(access[2]).to.equal(this.newExecutionDelay); // pendingDelay
1521
+ expect(access[3]).to.equal(this.grantTimestamp + this.delay); // pendingDelayEffect
1522
+
1523
+ // Not in effect yet
1524
+ expect(await this.manager.hasRole(ANOTHER_ROLE, this.user).then(formatAccess)).to.be.deep.equal([
1525
+ true,
1526
+ this.previousExecutionDelay.toString(),
1527
+ ]);
1528
+ });
1529
+ },
1530
+ after: function self() {
1531
+ self.mineDelay = true;
1532
+
1533
+ it('changes the execution delay', async function () {
1534
+ // Access is correctly stored
1535
+ const access = await this.manager.getAccess(ANOTHER_ROLE, this.user);
1536
+
1537
+ expect(access[0]).to.equal(this.oldAccess[0]); // inEffectSince
1538
+ expect(access[1]).to.equal(this.newExecutionDelay); // currentDelay
1539
+ expect(access[2]).to.equal(0n); // pendingDelay
1540
+ expect(access[3]).to.equal(0n); // pendingDelayEffect
1541
+
1542
+ // Already in effect
1543
+ expect(await this.manager.hasRole(ANOTHER_ROLE, this.user).then(formatAccess)).to.be.deep.equal([
1544
+ true,
1545
+ this.newExecutionDelay.toString(),
1546
+ ]);
1547
+ });
1548
+ },
1549
+ });
1550
+ });
1551
+ });
1552
+ });
1553
+ });
1554
+
1555
+ describe('#revokeRole', function () {
1556
+ describe('restrictions', function () {
1557
+ beforeEach('set method and args', async function () {
1558
+ const args = [ANOTHER_ROLE, this.other.address];
1559
+ const method = this.manager.interface.getFunction('revokeRole(uint64,address)');
1560
+ this.calldata = this.manager.interface.encodeFunctionData(method, args);
1561
+
1562
+ // Need to be set before revoking
1563
+ await this.manager.$_grantRole(...args, 0, 0);
1564
+ });
1565
+
1566
+ shouldBehaveLikeRoleAdminOperation(ANOTHER_ADMIN);
1567
+ });
1568
+
1569
+ describe('when role has been granted', function () {
1570
+ beforeEach('grant role with grant delay', async function () {
1571
+ this.grantDelay = time.duration.weeks(1);
1572
+ await this.manager.$_grantRole(ANOTHER_ROLE, this.user, this.grantDelay, 0);
1573
+
1574
+ this.delay = this.grantDelay; // For testAsDelay
1575
+ });
1576
+
1577
+ testAsDelay('grant', {
1578
+ before: function self() {
1579
+ self.mineDelay = true;
1580
+
1581
+ it('revokes a granted role that will take effect in the future', async function () {
1582
+ expect(await this.manager.hasRole(ANOTHER_ROLE, this.user).then(formatAccess)).to.be.deep.equal([
1583
+ false,
1584
+ '0',
1585
+ ]);
1586
+
1587
+ await expect(this.manager.connect(this.admin).revokeRole(ANOTHER_ROLE, this.user))
1588
+ .to.emit(this.manager, 'RoleRevoked')
1589
+ .withArgs(ANOTHER_ROLE, this.user);
1590
+
1591
+ expect(await this.manager.hasRole(ANOTHER_ROLE, this.user).then(formatAccess)).to.be.deep.equal([
1592
+ false,
1593
+ '0',
1594
+ ]);
1595
+
1596
+ const access = await this.manager.getAccess(ANOTHER_ROLE, this.user);
1597
+ expect(access[0]).to.equal(0n); // inRoleSince
1598
+ expect(access[1]).to.equal(0n); // currentDelay
1599
+ expect(access[2]).to.equal(0n); // pendingDelay
1600
+ expect(access[3]).to.equal(0n); // effect
1601
+ });
1602
+ },
1603
+ after: function self() {
1604
+ self.mineDelay = true;
1605
+
1606
+ it('revokes a granted role that already took effect', async function () {
1607
+ expect(await this.manager.hasRole(ANOTHER_ROLE, this.user).then(formatAccess)).to.be.deep.equal([
1608
+ true,
1609
+ '0',
1610
+ ]);
1611
+
1612
+ await expect(this.manager.connect(this.admin).revokeRole(ANOTHER_ROLE, this.user))
1613
+ .to.emit(this.manager, 'RoleRevoked')
1614
+ .withArgs(ANOTHER_ROLE, this.user);
1615
+
1616
+ expect(await this.manager.hasRole(ANOTHER_ROLE, this.user).then(formatAccess)).to.be.deep.equal([
1617
+ false,
1618
+ '0',
1619
+ ]);
1620
+
1621
+ const access = await this.manager.getAccess(ANOTHER_ROLE, this.user);
1622
+ expect(access[0]).to.equal(0n); // inRoleSince
1623
+ expect(access[1]).to.equal(0n); // currentDelay
1624
+ expect(access[2]).to.equal(0n); // pendingDelay
1625
+ expect(access[3]).to.equal(0n); // effect
1626
+ });
1627
+ },
1628
+ });
1629
+ });
1630
+
1631
+ describe('when role has not been granted', function () {
1632
+ it('has no effect', async function () {
1633
+ expect(await this.manager.hasRole(this.roles.SOME.id, this.user).then(formatAccess)).to.be.deep.equal([
1634
+ false,
1635
+ '0',
1636
+ ]);
1637
+ await expect(this.manager.connect(this.roleAdmin).revokeRole(this.roles.SOME.id, this.user)).to.not.emit(
1638
+ this.manager,
1639
+ 'RoleRevoked',
1640
+ );
1641
+ expect(await this.manager.hasRole(this.roles.SOME.id, this.user).then(formatAccess)).to.be.deep.equal([
1642
+ false,
1643
+ '0',
1644
+ ]);
1645
+ });
1646
+ });
1647
+
1648
+ it('reverts revoking PUBLIC_ROLE', async function () {
1649
+ await expect(this.manager.connect(this.admin).revokeRole(this.roles.PUBLIC.id, this.user))
1650
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerLockedRole')
1651
+ .withArgs(this.roles.PUBLIC.id);
1652
+ });
1653
+ });
1654
+ });
1655
+
1656
+ describe('self role operations', function () {
1657
+ describe('#renounceRole', function () {
1658
+ beforeEach('grant role', async function () {
1659
+ this.role = { id: 783164n };
1660
+ this.caller = this.user;
1661
+ await this.manager.$_grantRole(this.role.id, this.caller, 0, 0);
1662
+ });
1663
+
1664
+ it('renounces a role', async function () {
1665
+ expect(await this.manager.hasRole(this.role.id, this.caller).then(formatAccess)).to.be.deep.equal([
1666
+ true,
1667
+ '0',
1668
+ ]);
1669
+ await expect(this.manager.connect(this.caller).renounceRole(this.role.id, this.caller))
1670
+ .to.emit(this.manager, 'RoleRevoked')
1671
+ .withArgs(this.role.id, this.caller);
1672
+ expect(await this.manager.hasRole(this.role.id, this.caller).then(formatAccess)).to.be.deep.equal([
1673
+ false,
1674
+ '0',
1675
+ ]);
1676
+ });
1677
+
1678
+ it('reverts if renouncing the PUBLIC_ROLE', async function () {
1679
+ await expect(this.manager.connect(this.caller).renounceRole(this.roles.PUBLIC.id, this.caller))
1680
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerLockedRole')
1681
+ .withArgs(this.roles.PUBLIC.id);
1682
+ });
1683
+
1684
+ it('reverts if renouncing with bad caller confirmation', async function () {
1685
+ await expect(
1686
+ this.manager.connect(this.caller).renounceRole(this.role.id, this.other),
1687
+ ).to.be.revertedWithCustomError(this.manager, 'AccessManagerBadConfirmation');
1688
+ });
1689
+ });
1690
+ });
1691
+ });
1692
+ });
1693
+
1694
+ describe('access managed self operations', function () {
1695
+ describe('when calling a restricted target function', function () {
1696
+ const method = 'fnRestricted()';
1697
+
1698
+ beforeEach('set required role', async function () {
1699
+ this.role = { id: 785913n };
1700
+ await this.manager.$_setTargetFunctionRole(
1701
+ this.manager,
1702
+ this.manager[method].getFragment().selector,
1703
+ this.role.id,
1704
+ );
1705
+ });
1706
+
1707
+ describe('restrictions', function () {
1708
+ beforeEach('set method and args', function () {
1709
+ this.caller = this.user;
1710
+ this.calldata = this.manager.interface.encodeFunctionData(method, []);
1711
+ });
1712
+
1713
+ shouldBehaveLikeASelfRestrictedOperation();
1714
+ });
1715
+
1716
+ it('succeeds called by a role member', async function () {
1717
+ await this.manager.$_grantRole(this.role.id, this.user, 0, 0);
1718
+
1719
+ await expect(this.manager.connect(this.user)[method]())
1720
+ .to.emit(this.manager, 'CalledRestricted')
1721
+ .withArgs(this.user);
1722
+ });
1723
+ });
1724
+
1725
+ describe('when calling a non-restricted target function', function () {
1726
+ const method = 'fnUnrestricted()';
1727
+
1728
+ beforeEach('set required role', async function () {
1729
+ this.role = { id: 879435n };
1730
+ await this.manager.$_setTargetFunctionRole(
1731
+ this.manager,
1732
+ this.manager[method].getFragment().selector,
1733
+ this.role.id,
1734
+ );
1735
+ });
1736
+
1737
+ it('succeeds called by anyone', async function () {
1738
+ await expect(this.manager.connect(this.user)[method]())
1739
+ .to.emit(this.manager, 'CalledUnrestricted')
1740
+ .withArgs(this.user);
1741
+ });
1742
+ });
1743
+ });
1744
+
1745
+ describe('access managed target operations', function () {
1746
+ describe('when calling a restricted target function', function () {
1747
+ const method = 'fnRestricted()';
1748
+
1749
+ beforeEach('set required role', async function () {
1750
+ this.role = { id: 3597243n };
1751
+ await this.manager.$_setTargetFunctionRole(
1752
+ this.target,
1753
+ this.target[method].getFragment().selector,
1754
+ this.role.id,
1755
+ );
1756
+ });
1757
+
1758
+ describe('restrictions', function () {
1759
+ beforeEach('set method and args', function () {
1760
+ this.caller = this.user;
1761
+ this.calldata = this.target.interface.encodeFunctionData(method, []);
1762
+ });
1763
+
1764
+ shouldBehaveLikeAManagedRestrictedOperation();
1765
+ });
1766
+
1767
+ it('succeeds called by a role member', async function () {
1768
+ await this.manager.$_grantRole(this.role.id, this.user, 0, 0);
1769
+
1770
+ await expect(this.target.connect(this.user)[method]())
1771
+ .to.emit(this.target, 'CalledRestricted')
1772
+ .withArgs(this.user);
1773
+ });
1774
+ });
1775
+
1776
+ describe('when calling a non-restricted target function', function () {
1777
+ const method = 'fnUnrestricted()';
1778
+
1779
+ beforeEach('set required role', async function () {
1780
+ this.role = { id: 879435n };
1781
+ await this.manager.$_setTargetFunctionRole(
1782
+ this.target,
1783
+ this.target[method].getFragment().selector,
1784
+ this.role.id,
1785
+ );
1786
+ });
1787
+
1788
+ it('succeeds called by anyone', async function () {
1789
+ await expect(this.target.connect(this.user)[method]())
1790
+ .to.emit(this.target, 'CalledUnrestricted')
1791
+ .withArgs(this.user);
1792
+ });
1793
+ });
1794
+ });
1795
+
1796
+ describe('#schedule', function () {
1797
+ beforeEach('set target function role', async function () {
1798
+ this.method = this.target.fnRestricted.getFragment();
1799
+ this.role = { id: 498305n };
1800
+ this.caller = this.user;
1801
+
1802
+ await this.manager.$_setTargetFunctionRole(this.target, this.method.selector, this.role.id);
1803
+ await this.manager.$_grantRole(this.role.id, this.caller, 0, 1); // nonzero execution delay
1804
+
1805
+ this.calldata = this.target.interface.encodeFunctionData(this.method, []);
1806
+ this.delay = time.duration.weeks(2);
1807
+ });
1808
+
1809
+ describe('restrictions', function () {
1810
+ testAsCanCall({
1811
+ closed() {
1812
+ it('reverts as AccessManagerUnauthorizedCall', async function () {
1813
+ const { schedule } = await prepareOperation(this.manager, {
1814
+ caller: this.caller,
1815
+ target: this.target,
1816
+ calldata: this.calldata,
1817
+ delay: this.delay,
1818
+ });
1819
+ await expect(schedule())
1820
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerUnauthorizedCall')
1821
+ .withArgs(this.caller, this.target, this.calldata.substring(0, 10));
1822
+ });
1823
+ },
1824
+ open: {
1825
+ callerIsTheManager: {
1826
+ executing() {
1827
+ it.skip('is not reachable because schedule is not restrictable');
1828
+ },
1829
+ notExecuting() {
1830
+ it('reverts as AccessManagerUnauthorizedCall', async function () {
1831
+ const { schedule } = await prepareOperation(this.manager, {
1832
+ caller: this.caller,
1833
+ target: this.target,
1834
+ calldata: this.calldata,
1835
+ delay: this.delay,
1836
+ });
1837
+ await expect(schedule())
1838
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerUnauthorizedCall')
1839
+ .withArgs(this.caller, this.target, this.calldata.substring(0, 10));
1840
+ });
1841
+ },
1842
+ },
1843
+ callerIsNotTheManager: {
1844
+ publicRoleIsRequired() {
1845
+ it('reverts as AccessManagerUnauthorizedCall', async function () {
1846
+ // prepareOperation is not used here because it alters the next block timestamp
1847
+ await expect(this.manager.connect(this.caller).schedule(this.target, this.calldata, MAX_UINT48))
1848
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerUnauthorizedCall')
1849
+ .withArgs(this.caller, this.target, this.calldata.substring(0, 10));
1850
+ });
1851
+ },
1852
+ specificRoleIsRequired: {
1853
+ requiredRoleIsGranted: {
1854
+ roleGrantingIsDelayed: {
1855
+ callerHasAnExecutionDelay: {
1856
+ beforeGrantDelay() {
1857
+ it('reverts as AccessManagerUnauthorizedCall', async function () {
1858
+ // prepareOperation is not used here because it alters the next block timestamp
1859
+ await expect(this.manager.connect(this.caller).schedule(this.target, this.calldata, MAX_UINT48))
1860
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerUnauthorizedCall')
1861
+ .withArgs(this.caller, this.target, this.calldata.substring(0, 10));
1862
+ });
1863
+ },
1864
+ afterGrantDelay() {
1865
+ it('succeeds', async function () {
1866
+ // prepareOperation is not used here because it alters the next block timestamp
1867
+ await this.manager.connect(this.caller).schedule(this.target, this.calldata, MAX_UINT48);
1868
+ });
1869
+ },
1870
+ },
1871
+ callerHasNoExecutionDelay: {
1872
+ beforeGrantDelay() {
1873
+ it('reverts as AccessManagerUnauthorizedCall', async function () {
1874
+ // prepareOperation is not used here because it alters the next block timestamp
1875
+ await expect(this.manager.connect(this.caller).schedule(this.target, this.calldata, MAX_UINT48))
1876
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerUnauthorizedCall')
1877
+ .withArgs(this.caller, this.target, this.calldata.substring(0, 10));
1878
+ });
1879
+ },
1880
+ afterGrantDelay() {
1881
+ it('reverts as AccessManagerUnauthorizedCall', async function () {
1882
+ // prepareOperation is not used here because it alters the next block timestamp
1883
+ await expect(this.manager.connect(this.caller).schedule(this.target, this.calldata, MAX_UINT48))
1884
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerUnauthorizedCall')
1885
+ .withArgs(this.caller, this.target, this.calldata.substring(0, 10));
1886
+ });
1887
+ },
1888
+ },
1889
+ },
1890
+ roleGrantingIsNotDelayed: {
1891
+ callerHasAnExecutionDelay() {
1892
+ it('succeeds', async function () {
1893
+ const { schedule } = await prepareOperation(this.manager, {
1894
+ caller: this.caller,
1895
+ target: this.target,
1896
+ calldata: this.calldata,
1897
+ delay: this.delay,
1898
+ });
1899
+
1900
+ await schedule();
1901
+ });
1902
+ },
1903
+ callerHasNoExecutionDelay() {
1904
+ it('reverts as AccessManagerUnauthorizedCall', async function () {
1905
+ // prepareOperation is not used here because it alters the next block timestamp
1906
+ await expect(this.manager.connect(this.caller).schedule(this.target, this.calldata, MAX_UINT48))
1907
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerUnauthorizedCall')
1908
+ .withArgs(this.caller, this.target, this.calldata.substring(0, 10));
1909
+ });
1910
+ },
1911
+ },
1912
+ },
1913
+ requiredRoleIsNotGranted() {
1914
+ it('reverts as AccessManagerUnauthorizedCall', async function () {
1915
+ const { schedule } = await prepareOperation(this.manager, {
1916
+ caller: this.caller,
1917
+ target: this.target,
1918
+ calldata: this.calldata,
1919
+ delay: this.delay,
1920
+ });
1921
+ await expect(schedule())
1922
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerUnauthorizedCall')
1923
+ .withArgs(this.caller, this.target, this.calldata.substring(0, 10));
1924
+ });
1925
+ },
1926
+ },
1927
+ },
1928
+ },
1929
+ });
1930
+ });
1931
+
1932
+ it('schedules an operation at the specified execution date if it is larger than caller execution delay', async function () {
1933
+ const { operationId, scheduledAt, schedule } = await prepareOperation(this.manager, {
1934
+ caller: this.caller,
1935
+ target: this.target,
1936
+ calldata: this.calldata,
1937
+ delay: this.delay,
1938
+ });
1939
+
1940
+ const txResponse = await schedule();
1941
+
1942
+ expect(await this.manager.getSchedule(operationId)).to.equal(scheduledAt + this.delay);
1943
+ await expect(txResponse)
1944
+ .to.emit(this.manager, 'OperationScheduled')
1945
+ .withArgs(operationId, '1', scheduledAt + this.delay, this.caller, this.target, this.calldata);
1946
+ });
1947
+
1948
+ it('schedules an operation at the minimum execution date if no specified execution date (when == 0)', async function () {
1949
+ const executionDelay = await time.duration.hours(72);
1950
+ await this.manager.$_grantRole(this.role.id, this.caller, 0, executionDelay);
1951
+
1952
+ const txResponse = await this.manager.connect(this.caller).schedule(this.target, this.calldata, 0);
1953
+ const scheduledAt = await time.clockFromReceipt.timestamp(txResponse);
1954
+
1955
+ const operationId = await this.manager.hashOperation(this.caller, this.target, this.calldata);
1956
+
1957
+ expect(await this.manager.getSchedule(operationId)).to.equal(scheduledAt + executionDelay);
1958
+ await expect(txResponse)
1959
+ .to.emit(this.manager, 'OperationScheduled')
1960
+ .withArgs(operationId, '1', scheduledAt + executionDelay, this.caller, this.target, this.calldata);
1961
+ });
1962
+
1963
+ it('increases the nonce of an operation scheduled more than once', async function () {
1964
+ // Setup and check initial nonce
1965
+ const expectedOperationId = hashOperation(this.caller, this.target, this.calldata);
1966
+ expect(await this.manager.getNonce(expectedOperationId)).to.equal('0');
1967
+
1968
+ // Schedule
1969
+ const op1 = await prepareOperation(this.manager, {
1970
+ caller: this.caller,
1971
+ target: this.target,
1972
+ calldata: this.calldata,
1973
+ delay: this.delay,
1974
+ });
1975
+ await expect(op1.schedule())
1976
+ .to.emit(this.manager, 'OperationScheduled')
1977
+ .withArgs(op1.operationId, 1n, op1.scheduledAt + this.delay, this.caller, this.target, this.calldata);
1978
+ expect(expectedOperationId).to.equal(op1.operationId);
1979
+
1980
+ // Consume
1981
+ await time.increaseBy.timestamp(this.delay);
1982
+ await this.manager.$_consumeScheduledOp(expectedOperationId);
1983
+
1984
+ // Check nonce
1985
+ expect(await this.manager.getNonce(expectedOperationId)).to.equal('1');
1986
+
1987
+ // Schedule again
1988
+ const op2 = await prepareOperation(this.manager, {
1989
+ caller: this.caller,
1990
+ target: this.target,
1991
+ calldata: this.calldata,
1992
+ delay: this.delay,
1993
+ });
1994
+ await expect(op2.schedule())
1995
+ .to.emit(this.manager, 'OperationScheduled')
1996
+ .withArgs(op2.operationId, 2n, op2.scheduledAt + this.delay, this.caller, this.target, this.calldata);
1997
+ expect(expectedOperationId).to.equal(op2.operationId);
1998
+
1999
+ // Check final nonce
2000
+ expect(await this.manager.getNonce(expectedOperationId)).to.equal('2');
2001
+ });
2002
+
2003
+ it('reverts if the specified execution date is before the current timestamp + caller execution delay', async function () {
2004
+ const executionDelay = time.duration.weeks(1) + this.delay;
2005
+ await this.manager.$_grantRole(this.role.id, this.caller, 0, executionDelay);
2006
+
2007
+ const { schedule } = await prepareOperation(this.manager, {
2008
+ caller: this.caller,
2009
+ target: this.target,
2010
+ calldata: this.calldata,
2011
+ delay: this.delay,
2012
+ });
2013
+
2014
+ await expect(schedule())
2015
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerUnauthorizedCall')
2016
+ .withArgs(this.caller, this.target, this.calldata.substring(0, 10));
2017
+ });
2018
+
2019
+ it('reverts if an operation is already schedule', async function () {
2020
+ const op1 = await prepareOperation(this.manager, {
2021
+ caller: this.caller,
2022
+ target: this.target,
2023
+ calldata: this.calldata,
2024
+ delay: this.delay,
2025
+ });
2026
+
2027
+ await op1.schedule();
2028
+
2029
+ const op2 = await prepareOperation(this.manager, {
2030
+ caller: this.caller,
2031
+ target: this.target,
2032
+ calldata: this.calldata,
2033
+ delay: this.delay,
2034
+ });
2035
+
2036
+ await expect(op2.schedule())
2037
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerAlreadyScheduled')
2038
+ .withArgs(op1.operationId);
2039
+ });
2040
+
2041
+ it('panics scheduling calldata with less than 4 bytes', async function () {
2042
+ const calldata = '0x1234'; // 2 bytes
2043
+
2044
+ // Managed contract
2045
+ const op1 = await prepareOperation(this.manager, {
2046
+ caller: this.caller,
2047
+ target: this.target,
2048
+ calldata: calldata,
2049
+ delay: this.delay,
2050
+ });
2051
+ await expect(op1.schedule()).to.be.revertedWithoutReason();
2052
+
2053
+ // Manager contract
2054
+ const op2 = await prepareOperation(this.manager, {
2055
+ caller: this.caller,
2056
+ target: this.manager,
2057
+ calldata: calldata,
2058
+ delay: this.delay,
2059
+ });
2060
+ await expect(op2.schedule()).to.be.revertedWithoutReason();
2061
+ });
2062
+
2063
+ it('reverts scheduling an unknown operation to the manager', async function () {
2064
+ const calldata = '0x12345678';
2065
+
2066
+ const { schedule } = await prepareOperation(this.manager, {
2067
+ caller: this.caller,
2068
+ target: this.manager,
2069
+ calldata,
2070
+ delay: this.delay,
2071
+ });
2072
+
2073
+ await expect(schedule())
2074
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerUnauthorizedCall')
2075
+ .withArgs(this.caller, this.manager, calldata);
2076
+ });
2077
+ });
2078
+
2079
+ describe('#execute', function () {
2080
+ beforeEach('set target function role', async function () {
2081
+ this.method = this.target.fnRestricted.getFragment();
2082
+ this.role = { id: 9825430n };
2083
+ this.caller = this.user;
2084
+
2085
+ await this.manager.$_setTargetFunctionRole(this.target, this.method.selector, this.role.id);
2086
+ await this.manager.$_grantRole(this.role.id, this.caller, 0, 0);
2087
+
2088
+ this.calldata = this.target.interface.encodeFunctionData(this.method, []);
2089
+ });
2090
+
2091
+ describe('restrictions', function () {
2092
+ testAsCanCall({
2093
+ closed() {
2094
+ it('reverts as AccessManagerUnauthorizedCall', async function () {
2095
+ await expect(this.manager.connect(this.caller).execute(this.target, this.calldata))
2096
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerUnauthorizedCall')
2097
+ .withArgs(this.caller, this.target, this.calldata.substring(0, 10));
2098
+ });
2099
+ },
2100
+ open: {
2101
+ callerIsTheManager: {
2102
+ executing() {
2103
+ it('succeeds', async function () {
2104
+ await this.manager.connect(this.caller).execute(this.target, this.calldata);
2105
+ });
2106
+ },
2107
+ notExecuting() {
2108
+ it('reverts as AccessManagerUnauthorizedCall', async function () {
2109
+ await expect(this.manager.connect(this.caller).execute(this.target, this.calldata))
2110
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerUnauthorizedCall')
2111
+ .withArgs(this.caller, this.target, this.calldata.substring(0, 10));
2112
+ });
2113
+ },
2114
+ },
2115
+ callerIsNotTheManager: {
2116
+ publicRoleIsRequired() {
2117
+ it('succeeds', async function () {
2118
+ await this.manager.connect(this.caller).execute(this.target, this.calldata);
2119
+ });
2120
+ },
2121
+ specificRoleIsRequired: {
2122
+ requiredRoleIsGranted: {
2123
+ roleGrantingIsDelayed: {
2124
+ callerHasAnExecutionDelay: {
2125
+ beforeGrantDelay() {
2126
+ it('reverts as AccessManagerUnauthorizedCall', async function () {
2127
+ await expect(this.manager.connect(this.caller).execute(this.target, this.calldata))
2128
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerUnauthorizedCall')
2129
+ .withArgs(this.caller, this.target, this.calldata.substring(0, 10));
2130
+ });
2131
+ },
2132
+ afterGrantDelay: function self() {
2133
+ self.mineDelay = true;
2134
+
2135
+ beforeEach('define schedule delay', function () {
2136
+ this.scheduleIn = time.duration.days(21); // For testAsSchedulableOperation
2137
+ });
2138
+
2139
+ testAsSchedulableOperation(LIKE_COMMON_SCHEDULABLE);
2140
+ },
2141
+ },
2142
+ callerHasNoExecutionDelay: {
2143
+ beforeGrantDelay() {
2144
+ it('reverts as AccessManagerUnauthorizedCall', async function () {
2145
+ await expect(this.manager.connect(this.caller).execute(this.target, this.calldata))
2146
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerUnauthorizedCall')
2147
+ .withArgs(this.caller, this.target, this.calldata.substring(0, 10));
2148
+ });
2149
+ },
2150
+ afterGrantDelay: function self() {
2151
+ self.mineDelay = true;
2152
+
2153
+ it('succeeds', async function () {
2154
+ await this.manager.connect(this.caller).execute(this.target, this.calldata);
2155
+ });
2156
+ },
2157
+ },
2158
+ },
2159
+ roleGrantingIsNotDelayed: {
2160
+ callerHasAnExecutionDelay() {
2161
+ beforeEach('define schedule delay', function () {
2162
+ this.scheduleIn = time.duration.days(15); // For testAsSchedulableOperation
2163
+ });
2164
+
2165
+ testAsSchedulableOperation(LIKE_COMMON_SCHEDULABLE);
2166
+ },
2167
+ callerHasNoExecutionDelay() {
2168
+ it('succeeds', async function () {
2169
+ await this.manager.connect(this.caller).execute(this.target, this.calldata);
2170
+ });
2171
+ },
2172
+ },
2173
+ },
2174
+ requiredRoleIsNotGranted() {
2175
+ it('reverts as AccessManagerUnauthorizedCall', async function () {
2176
+ await expect(this.manager.connect(this.caller).execute(this.target, this.calldata))
2177
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerUnauthorizedCall')
2178
+ .withArgs(this.caller, this.target, this.calldata.substring(0, 10));
2179
+ });
2180
+ },
2181
+ },
2182
+ },
2183
+ },
2184
+ });
2185
+ });
2186
+
2187
+ it('executes with a delay consuming the scheduled operation', async function () {
2188
+ const delay = time.duration.hours(4);
2189
+ await this.manager.$_grantRole(this.role.id, this.caller, 0, 1); // Execution delay is needed so the operation is consumed
2190
+
2191
+ const { operationId, schedule } = await prepareOperation(this.manager, {
2192
+ caller: this.caller,
2193
+ target: this.target,
2194
+ calldata: this.calldata,
2195
+ delay,
2196
+ });
2197
+ await schedule();
2198
+ await time.increaseBy.timestamp(delay);
2199
+ await expect(this.manager.connect(this.caller).execute(this.target, this.calldata))
2200
+ .to.emit(this.manager, 'OperationExecuted')
2201
+ .withArgs(operationId, 1n);
2202
+
2203
+ expect(await this.manager.getSchedule(operationId)).to.equal(0n);
2204
+ });
2205
+
2206
+ it('executes with no delay consuming a scheduled operation', async function () {
2207
+ const delay = time.duration.hours(4);
2208
+
2209
+ // give caller an execution delay
2210
+ await this.manager.$_grantRole(this.role.id, this.caller, 0, 1);
2211
+
2212
+ const { operationId, schedule } = await prepareOperation(this.manager, {
2213
+ caller: this.caller,
2214
+ target: this.target,
2215
+ calldata: this.calldata,
2216
+ delay,
2217
+ });
2218
+ await schedule();
2219
+
2220
+ // remove the execution delay
2221
+ await this.manager.$_grantRole(this.role.id, this.caller, 0, 0);
2222
+
2223
+ await time.increaseBy.timestamp(delay);
2224
+ await expect(this.manager.connect(this.caller).execute(this.target, this.calldata))
2225
+ .to.emit(this.manager, 'OperationExecuted')
2226
+ .withArgs(operationId, 1n);
2227
+
2228
+ expect(await this.manager.getSchedule(operationId)).to.equal(0n);
2229
+ });
2230
+
2231
+ it('keeps the original _executionId after finishing the call', async function () {
2232
+ const executionIdBefore = await ethers.provider.getStorage(this.manager, EXECUTION_ID_STORAGE_SLOT);
2233
+ await this.manager.connect(this.caller).execute(this.target, this.calldata);
2234
+ const executionIdAfter = await ethers.provider.getStorage(this.manager, EXECUTION_ID_STORAGE_SLOT);
2235
+ expect(executionIdBefore).to.equal(executionIdAfter);
2236
+ });
2237
+
2238
+ it('reverts executing twice', async function () {
2239
+ const delay = time.duration.hours(2);
2240
+ await this.manager.$_grantRole(this.role.id, this.caller, 0, 1); // Execution delay is needed so the operation is consumed
2241
+
2242
+ const { operationId, schedule } = await prepareOperation(this.manager, {
2243
+ caller: this.caller,
2244
+ target: this.target,
2245
+ calldata: this.calldata,
2246
+ delay,
2247
+ });
2248
+ await schedule();
2249
+ await time.increaseBy.timestamp(delay);
2250
+ await this.manager.connect(this.caller).execute(this.target, this.calldata);
2251
+ await expect(this.manager.connect(this.caller).execute(this.target, this.calldata))
2252
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerNotScheduled')
2253
+ .withArgs(operationId);
2254
+ });
2255
+
2256
+ it('can execute a setAuthority call when no target admin delay is set', async function () {
2257
+ const newAuthority = await ethers.deployContract('$AccessManager', [this.admin]);
2258
+
2259
+ await expect(this.manager.getTargetAdminDelay(this.target)).to.eventually.equal(0n);
2260
+
2261
+ await expect(
2262
+ this.manager
2263
+ .connect(this.admin)
2264
+ .execute(this.target, this.target.interface.encodeFunctionData('setAuthority', [newAuthority.target])),
2265
+ )
2266
+ .to.emit(this.target, 'AuthorityUpdated')
2267
+ .withArgs(newAuthority);
2268
+ });
2269
+
2270
+ it('cannot execute a setAuthority call when a target admin delay is set', async function () {
2271
+ const newAuthority = await ethers.deployContract('$AccessManager', [this.admin]);
2272
+
2273
+ await this.manager.$_setTargetAdminDelay(this.target, 10n);
2274
+ await time.increaseBy.timestamp(5n * 86400n, true); // minSetBack is 5 days
2275
+
2276
+ await expect(this.manager.getTargetAdminDelay(this.target)).to.eventually.equal(10n);
2277
+
2278
+ // cannot update directly - there is a delay
2279
+ await expect(
2280
+ this.manager.connect(this.admin).updateAuthority(this.target, newAuthority),
2281
+ ).to.be.revertedWithCustomError(this.manager, 'AccessManagerNotScheduled');
2282
+
2283
+ // cannot bypass via execute either - targetAdminDelay is enforced for setAuthority
2284
+ await expect(
2285
+ this.manager
2286
+ .connect(this.admin)
2287
+ .execute(this.target, this.target.interface.encodeFunctionData('setAuthority', [newAuthority.target])),
2288
+ ).to.be.revertedWithCustomError(this.manager, 'AccessManagerNotScheduled');
2289
+ });
2290
+ });
2291
+
2292
+ describe('#consumeScheduledOp', function () {
2293
+ beforeEach('define scheduling parameters', async function () {
2294
+ const method = this.target.fnRestricted.getFragment();
2295
+ this.caller = await ethers.getSigner(this.target.target);
2296
+ await impersonate(this.caller.address);
2297
+ this.calldata = this.target.interface.encodeFunctionData(method, []);
2298
+ this.role = { id: 9834983n };
2299
+
2300
+ await this.manager.$_setTargetFunctionRole(this.target, method.selector, this.role.id);
2301
+ await this.manager.$_grantRole(this.role.id, this.caller, 0, 1); // nonzero execution delay
2302
+
2303
+ this.scheduleIn = time.duration.hours(10); // For testAsSchedulableOperation
2304
+ });
2305
+
2306
+ describe('when caller is not consuming scheduled operation', function () {
2307
+ beforeEach('set consuming false', async function () {
2308
+ await this.target.setIsConsumingScheduledOp(false, ethers.toBeHex(CONSUMING_SCHEDULE_STORAGE_SLOT, 32));
2309
+ });
2310
+
2311
+ it('reverts as AccessManagerUnauthorizedConsume', async function () {
2312
+ await expect(this.manager.connect(this.caller).consumeScheduledOp(this.caller, this.calldata))
2313
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerUnauthorizedConsume')
2314
+ .withArgs(this.caller);
2315
+ });
2316
+ });
2317
+
2318
+ describe('when caller is consuming scheduled operation', function () {
2319
+ beforeEach('set consuming true', async function () {
2320
+ await this.target.setIsConsumingScheduledOp(true, ethers.toBeHex(CONSUMING_SCHEDULE_STORAGE_SLOT, 32));
2321
+ });
2322
+
2323
+ testAsSchedulableOperation({
2324
+ scheduled: {
2325
+ before() {
2326
+ it('reverts as AccessManagerNotReady', async function () {
2327
+ await expect(this.manager.connect(this.caller).consumeScheduledOp(this.caller, this.calldata))
2328
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerNotReady')
2329
+ .withArgs(this.operationId);
2330
+ });
2331
+ },
2332
+ after() {
2333
+ it('consumes the scheduled operation and resets timepoint', async function () {
2334
+ expect(await this.manager.getSchedule(this.operationId)).to.equal(this.scheduledAt + this.scheduleIn);
2335
+
2336
+ await expect(this.manager.connect(this.caller).consumeScheduledOp(this.caller, this.calldata))
2337
+ .to.emit(this.manager, 'OperationExecuted')
2338
+ .withArgs(this.operationId, 1n);
2339
+ expect(await this.manager.getSchedule(this.operationId)).to.equal(0n);
2340
+ });
2341
+ },
2342
+ expired() {
2343
+ it('reverts as AccessManagerExpired', async function () {
2344
+ await expect(this.manager.connect(this.caller).consumeScheduledOp(this.caller, this.calldata))
2345
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerExpired')
2346
+ .withArgs(this.operationId);
2347
+ });
2348
+ },
2349
+ },
2350
+ notScheduled() {
2351
+ it('reverts as AccessManagerNotScheduled', async function () {
2352
+ await expect(this.manager.connect(this.caller).consumeScheduledOp(this.caller, this.calldata))
2353
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerNotScheduled')
2354
+ .withArgs(this.operationId);
2355
+ });
2356
+ },
2357
+ });
2358
+ });
2359
+ });
2360
+
2361
+ describe('#cancelScheduledOp', function () {
2362
+ beforeEach('setup scheduling', async function () {
2363
+ this.method = this.target.fnRestricted.getFragment();
2364
+ this.caller = this.roles.SOME.members[0];
2365
+ await this.manager.$_setTargetFunctionRole(this.target, this.method.selector, this.roles.SOME.id);
2366
+ await this.manager.$_grantRole(this.roles.SOME.id, this.caller, 0, 1); // nonzero execution delay
2367
+
2368
+ this.calldata = this.target.interface.encodeFunctionData(this.method, []);
2369
+ this.scheduleIn = time.duration.days(10); // For testAsSchedulableOperation
2370
+ });
2371
+
2372
+ testAsSchedulableOperation({
2373
+ scheduled: {
2374
+ before() {
2375
+ describe('when caller is the scheduler', function () {
2376
+ it('succeeds', async function () {
2377
+ await this.manager.connect(this.caller).cancel(this.caller, this.target, this.calldata);
2378
+ });
2379
+ });
2380
+
2381
+ describe('when caller is an admin', function () {
2382
+ it('succeeds', async function () {
2383
+ await this.manager.connect(this.roles.ADMIN.members[0]).cancel(this.caller, this.target, this.calldata);
2384
+ });
2385
+ });
2386
+
2387
+ describe('when caller is the role guardian', function () {
2388
+ it('succeeds', async function () {
2389
+ await this.manager
2390
+ .connect(this.roles.SOME_GUARDIAN.members[0])
2391
+ .cancel(this.caller, this.target, this.calldata);
2392
+ });
2393
+ });
2394
+
2395
+ describe('when caller is any other account', function () {
2396
+ it('reverts as AccessManagerUnauthorizedCancel', async function () {
2397
+ await expect(this.manager.connect(this.other).cancel(this.caller, this.target, this.calldata))
2398
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerUnauthorizedCancel')
2399
+ .withArgs(this.other, this.caller, this.target, this.method.selector);
2400
+ });
2401
+ });
2402
+ },
2403
+ after() {
2404
+ it('succeeds', async function () {
2405
+ await this.manager.connect(this.caller).cancel(this.caller, this.target, this.calldata);
2406
+ });
2407
+ },
2408
+ expired() {
2409
+ it('succeeds', async function () {
2410
+ await this.manager.connect(this.caller).cancel(this.caller, this.target, this.calldata);
2411
+ });
2412
+ },
2413
+ },
2414
+ notScheduled() {
2415
+ it('reverts as AccessManagerNotScheduled', async function () {
2416
+ await expect(this.manager.cancel(this.caller, this.target, this.calldata))
2417
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerNotScheduled')
2418
+ .withArgs(this.operationId);
2419
+ });
2420
+ },
2421
+ });
2422
+
2423
+ it('cancels an operation and resets schedule', async function () {
2424
+ const { operationId, schedule } = await prepareOperation(this.manager, {
2425
+ caller: this.caller,
2426
+ target: this.target,
2427
+ calldata: this.calldata,
2428
+ delay: this.scheduleIn,
2429
+ });
2430
+ await schedule();
2431
+ await expect(this.manager.connect(this.caller).cancel(this.caller, this.target, this.calldata))
2432
+ .to.emit(this.manager, 'OperationCanceled')
2433
+ .withArgs(operationId, 1n);
2434
+ expect(await this.manager.getSchedule(operationId)).to.equal('0');
2435
+ });
2436
+ });
2437
+
2438
+ describe('with Ownable target contract', function () {
2439
+ const roleId = 1n;
2440
+
2441
+ beforeEach(async function () {
2442
+ this.ownable = await ethers.deployContract('$Ownable', [this.manager]);
2443
+
2444
+ // add user to role
2445
+ await this.manager.$_grantRole(roleId, this.user, 0, 0);
2446
+ });
2447
+
2448
+ it('initial state', async function () {
2449
+ expect(await this.ownable.owner()).to.equal(this.manager);
2450
+ });
2451
+
2452
+ describe('Contract is closed', function () {
2453
+ beforeEach(async function () {
2454
+ await this.manager.$_setTargetClosed(this.ownable, true);
2455
+ });
2456
+
2457
+ it('directly call: reverts', async function () {
2458
+ await expect(this.ownable.connect(this.user).$_checkOwner())
2459
+ .to.be.revertedWithCustomError(this.ownable, 'OwnableUnauthorizedAccount')
2460
+ .withArgs(this.user);
2461
+ });
2462
+
2463
+ it('relayed call (with role): reverts', async function () {
2464
+ await expect(
2465
+ this.manager.connect(this.user).execute(this.ownable, this.ownable.$_checkOwner.getFragment().selector),
2466
+ )
2467
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerUnauthorizedCall')
2468
+ .withArgs(this.user, this.ownable, this.ownable.$_checkOwner.getFragment().selector);
2469
+ });
2470
+
2471
+ it('relayed call (without role): reverts', async function () {
2472
+ await expect(
2473
+ this.manager.connect(this.other).execute(this.ownable, this.ownable.$_checkOwner.getFragment().selector),
2474
+ )
2475
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerUnauthorizedCall')
2476
+ .withArgs(this.other, this.ownable, this.ownable.$_checkOwner.getFragment().selector);
2477
+ });
2478
+ });
2479
+
2480
+ describe('Contract is managed', function () {
2481
+ describe('function is open to specific role', function () {
2482
+ beforeEach(async function () {
2483
+ await this.manager.$_setTargetFunctionRole(
2484
+ this.ownable,
2485
+ this.ownable.$_checkOwner.getFragment().selector,
2486
+ roleId,
2487
+ );
2488
+ });
2489
+
2490
+ it('directly call: reverts', async function () {
2491
+ await expect(this.ownable.connect(this.user).$_checkOwner())
2492
+ .to.be.revertedWithCustomError(this.ownable, 'OwnableUnauthorizedAccount')
2493
+ .withArgs(this.user);
2494
+ });
2495
+
2496
+ it('relayed call (with role): success', async function () {
2497
+ await this.manager.connect(this.user).execute(this.ownable, this.ownable.$_checkOwner.getFragment().selector);
2498
+ });
2499
+
2500
+ it('relayed call (without role): reverts', async function () {
2501
+ await expect(
2502
+ this.manager.connect(this.other).execute(this.ownable, this.ownable.$_checkOwner.getFragment().selector),
2503
+ )
2504
+ .to.be.revertedWithCustomError(this.manager, 'AccessManagerUnauthorizedCall')
2505
+ .withArgs(this.other, this.ownable, this.ownable.$_checkOwner.getFragment().selector);
2506
+ });
2507
+ });
2508
+
2509
+ describe('function is open to public role', function () {
2510
+ beforeEach(async function () {
2511
+ await this.manager.$_setTargetFunctionRole(
2512
+ this.ownable,
2513
+ this.ownable.$_checkOwner.getFragment().selector,
2514
+ this.roles.PUBLIC.id,
2515
+ );
2516
+ });
2517
+
2518
+ it('directly call: reverts', async function () {
2519
+ await expect(this.ownable.connect(this.user).$_checkOwner())
2520
+ .to.be.revertedWithCustomError(this.ownable, 'OwnableUnauthorizedAccount')
2521
+ .withArgs(this.user);
2522
+ });
2523
+
2524
+ it('relayed call (with role): success', async function () {
2525
+ await this.manager.connect(this.user).execute(this.ownable, this.ownable.$_checkOwner.getFragment().selector);
2526
+ });
2527
+
2528
+ it('relayed call (without role): success', async function () {
2529
+ await this.manager
2530
+ .connect(this.other)
2531
+ .execute(this.ownable, this.ownable.$_checkOwner.getFragment().selector);
2532
+ });
2533
+ });
2534
+ });
2535
+ });
2536
+ });