arr00-testing-oz-contracts 0.0.0 → 5.8.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 (507) hide show
  1. package/README.md +121 -0
  2. package/access/AccessControl.sol +206 -0
  3. package/access/IAccessControl.sol +98 -0
  4. package/access/Ownable.sol +100 -0
  5. package/access/Ownable2Step.sol +67 -0
  6. package/access/extensions/AccessControlDefaultAdminRules.sol +372 -0
  7. package/access/extensions/AccessControlEnumerable.sol +81 -0
  8. package/access/extensions/IAccessControlDefaultAdminRules.sol +192 -0
  9. package/access/extensions/IAccessControlEnumerable.sol +31 -0
  10. package/access/manager/AccessManaged.sol +118 -0
  11. package/access/manager/AccessManager.sol +781 -0
  12. package/access/manager/AuthorityUtils.sol +36 -0
  13. package/access/manager/IAccessManaged.sol +32 -0
  14. package/access/manager/IAccessManager.sol +410 -0
  15. package/access/manager/IAuthority.sol +14 -0
  16. package/account/Account.sol +151 -0
  17. package/account/extensions/draft-AccountERC7579.sol +430 -0
  18. package/account/extensions/draft-AccountERC7579Hooked.sol +113 -0
  19. package/account/extensions/draft-ERC7821.sol +70 -0
  20. package/account/paymaster/Paymaster.sol +170 -0
  21. package/account/paymaster/extensions/PaymasterERC20.sol +394 -0
  22. package/account/paymaster/extensions/PaymasterERC20Guarantor.sol +190 -0
  23. package/account/paymaster/extensions/PaymasterERC721Owner.sol +54 -0
  24. package/account/paymaster/extensions/PaymasterSigner.sol +125 -0
  25. package/account/utils/EIP7702Utils.sol +25 -0
  26. package/account/utils/ERC4337Utils.sol +317 -0
  27. package/account/utils/draft-ERC7579Utils.sol +314 -0
  28. package/build/contracts/AbstractSigner.json +13 -0
  29. package/build/contracts/AccessControl.json +239 -0
  30. package/build/contracts/AccessControlDefaultAdminRules.json +467 -0
  31. package/build/contracts/AccessControlEnumerable.json +301 -0
  32. package/build/contracts/AccessManaged.json +104 -0
  33. package/build/contracts/AccessManager.json +1189 -0
  34. package/build/contracts/Account.json +150 -0
  35. package/build/contracts/AccountERC7579.json +515 -0
  36. package/build/contracts/AccountERC7579Hooked.json +539 -0
  37. package/build/contracts/Accumulators.json +13 -0
  38. package/build/contracts/Address.json +25 -0
  39. package/build/contracts/Arrays.json +13 -0
  40. package/build/contracts/AuthorityUtils.json +13 -0
  41. package/build/contracts/Base58.json +25 -0
  42. package/build/contracts/Base64.json +25 -0
  43. package/build/contracts/BeaconProxy.json +97 -0
  44. package/build/contracts/BitMaps.json +13 -0
  45. package/build/contracts/BlockHeader.json +25 -0
  46. package/build/contracts/Blockhash.json +13 -0
  47. package/build/contracts/BridgeERC1155.json +508 -0
  48. package/build/contracts/BridgeERC20.json +260 -0
  49. package/build/contracts/BridgeERC721.json +270 -0
  50. package/build/contracts/BridgeERC7802.json +249 -0
  51. package/build/contracts/BridgeFungible.json +236 -0
  52. package/build/contracts/BridgeMultiToken.json +236 -0
  53. package/build/contracts/BridgeNonFungible.json +212 -0
  54. package/build/contracts/Bytes.json +13 -0
  55. package/build/contracts/CAIP10.json +13 -0
  56. package/build/contracts/CAIP2.json +13 -0
  57. package/build/contracts/Calldata.json +13 -0
  58. package/build/contracts/Checkpoints.json +19 -0
  59. package/build/contracts/CircularBuffer.json +19 -0
  60. package/build/contracts/Clones.json +19 -0
  61. package/build/contracts/Comparators.json +13 -0
  62. package/build/contracts/Context.json +13 -0
  63. package/build/contracts/Create2.json +19 -0
  64. package/build/contracts/Create3.json +19 -0
  65. package/build/contracts/CrosschainLinked.json +145 -0
  66. package/build/contracts/CrosschainRemoteExecutor.json +199 -0
  67. package/build/contracts/DoubleEndedQueue.json +13 -0
  68. package/build/contracts/ECDSA.json +41 -0
  69. package/build/contracts/EIP712.json +79 -0
  70. package/build/contracts/EIP7702Utils.json +13 -0
  71. package/build/contracts/ERC1155.json +428 -0
  72. package/build/contracts/ERC1155Burnable.json +474 -0
  73. package/build/contracts/ERC1155Crosschain.json +796 -0
  74. package/build/contracts/ERC1155Holder.json +111 -0
  75. package/build/contracts/ERC1155Pausable.json +477 -0
  76. package/build/contracts/ERC1155Supply.json +479 -0
  77. package/build/contracts/ERC1155URIStorage.json +428 -0
  78. package/build/contracts/ERC1155Utils.json +13 -0
  79. package/build/contracts/ERC1363.json +585 -0
  80. package/build/contracts/ERC1363Utils.json +36 -0
  81. package/build/contracts/ERC165.json +33 -0
  82. package/build/contracts/ERC165Checker.json +13 -0
  83. package/build/contracts/ERC1967Clones.json +13 -0
  84. package/build/contracts/ERC1967Proxy.json +84 -0
  85. package/build/contracts/ERC1967Utils.json +52 -0
  86. package/build/contracts/ERC20.json +322 -0
  87. package/build/contracts/ERC20Bridgeable.json +427 -0
  88. package/build/contracts/ERC20Burnable.json +353 -0
  89. package/build/contracts/ERC20Capped.json +362 -0
  90. package/build/contracts/ERC20Crosschain.json +573 -0
  91. package/build/contracts/ERC20FlashMint.json +432 -0
  92. package/build/contracts/ERC20Pausable.json +371 -0
  93. package/build/contracts/ERC20Permit.json +532 -0
  94. package/build/contracts/ERC20TemporaryApproval.json +346 -0
  95. package/build/contracts/ERC20TransferAuthorization.json +836 -0
  96. package/build/contracts/ERC20Votes.json +781 -0
  97. package/build/contracts/ERC20Wrapper.json +405 -0
  98. package/build/contracts/ERC2771Context.json +46 -0
  99. package/build/contracts/ERC2771Forwarder.json +439 -0
  100. package/build/contracts/ERC2981.json +126 -0
  101. package/build/contracts/ERC3009.json +668 -0
  102. package/build/contracts/ERC4337Utils.json +13 -0
  103. package/build/contracts/ERC4626.json +807 -0
  104. package/build/contracts/ERC6372Utils.json +19 -0
  105. package/build/contracts/ERC6909.json +415 -0
  106. package/build/contracts/ERC6909ContentURI.json +472 -0
  107. package/build/contracts/ERC6909Metadata.json +529 -0
  108. package/build/contracts/ERC6909TokenSupply.json +434 -0
  109. package/build/contracts/ERC721.json +447 -0
  110. package/build/contracts/ERC721Burnable.json +460 -0
  111. package/build/contracts/ERC721Consecutive.json +509 -0
  112. package/build/contracts/ERC721Crosschain.json +674 -0
  113. package/build/contracts/ERC721Enumerable.json +524 -0
  114. package/build/contracts/ERC721Holder.json +48 -0
  115. package/build/contracts/ERC721Pausable.json +496 -0
  116. package/build/contracts/ERC721Royalty.json +540 -0
  117. package/build/contracts/ERC721URIStorage.json +479 -0
  118. package/build/contracts/ERC721Utils.json +13 -0
  119. package/build/contracts/ERC721Votes.json +835 -0
  120. package/build/contracts/ERC721Wrapper.json +553 -0
  121. package/build/contracts/ERC7579Utils.json +119 -0
  122. package/build/contracts/ERC7739.json +103 -0
  123. package/build/contracts/ERC7739Utils.json +13 -0
  124. package/build/contracts/ERC7786Recipient.json +59 -0
  125. package/build/contracts/ERC7821.json +112 -0
  126. package/build/contracts/ERC7913P256Verifier.json +43 -0
  127. package/build/contracts/ERC7913RSAVerifier.json +43 -0
  128. package/build/contracts/ERC7913WebAuthnVerifier.json +43 -0
  129. package/build/contracts/EnumerableMap.json +36 -0
  130. package/build/contracts/EnumerableSet.json +13 -0
  131. package/build/contracts/Errors.json +51 -0
  132. package/build/contracts/Governor.json +1381 -0
  133. package/build/contracts/GovernorCountingFractional.json +1455 -0
  134. package/build/contracts/GovernorCountingOverridable.json +1612 -0
  135. package/build/contracts/GovernorCountingSimple.json +1410 -0
  136. package/build/contracts/GovernorCrosschain.json +1409 -0
  137. package/build/contracts/GovernorNoncesKeyed.json +1405 -0
  138. package/build/contracts/GovernorPreventLateQuorum.json +1461 -0
  139. package/build/contracts/GovernorProposalGuardian.json +1426 -0
  140. package/build/contracts/GovernorSequentialProposalId.json +1399 -0
  141. package/build/contracts/GovernorSettings.json +1477 -0
  142. package/build/contracts/GovernorStorage.json +1506 -0
  143. package/build/contracts/GovernorSuperQuorum.json +1429 -0
  144. package/build/contracts/GovernorTimelockAccess.json +1582 -0
  145. package/build/contracts/GovernorTimelockCompound.json +1449 -0
  146. package/build/contracts/GovernorTimelockControl.json +1426 -0
  147. package/build/contracts/GovernorVotes.json +1399 -0
  148. package/build/contracts/GovernorVotesQuorumFraction.json +1497 -0
  149. package/build/contracts/GovernorVotesSuperQuorumFraction.json +1657 -0
  150. package/build/contracts/Hashes.json +13 -0
  151. package/build/contracts/Heap.json +13 -0
  152. package/build/contracts/IAccessControl.json +207 -0
  153. package/build/contracts/IAccessControlDefaultAdminRules.json +406 -0
  154. package/build/contracts/IAccessControlEnumerable.json +250 -0
  155. package/build/contracts/IAccessManaged.json +104 -0
  156. package/build/contracts/IAccessManager.json +1085 -0
  157. package/build/contracts/IAccount.json +90 -0
  158. package/build/contracts/IAccountExecute.json +79 -0
  159. package/build/contracts/IAggregator.json +211 -0
  160. package/build/contracts/IAuthority.json +43 -0
  161. package/build/contracts/IBeacon.json +27 -0
  162. package/build/contracts/ICompoundTimelock.json +427 -0
  163. package/build/contracts/IERC1155.json +307 -0
  164. package/build/contracts/IERC1155Errors.json +116 -0
  165. package/build/contracts/IERC1155MetadataURI.json +326 -0
  166. package/build/contracts/IERC1155Receiver.json +111 -0
  167. package/build/contracts/IERC1271.json +38 -0
  168. package/build/contracts/IERC1363.json +385 -0
  169. package/build/contracts/IERC1363Receiver.json +48 -0
  170. package/build/contracts/IERC1363Spender.json +43 -0
  171. package/build/contracts/IERC165.json +33 -0
  172. package/build/contracts/IERC1820Implementer.json +38 -0
  173. package/build/contracts/IERC1820Registry.json +227 -0
  174. package/build/contracts/IERC1822Proxiable.json +27 -0
  175. package/build/contracts/IERC1967.json +59 -0
  176. package/build/contracts/IERC20.json +197 -0
  177. package/build/contracts/IERC20Errors.json +100 -0
  178. package/build/contracts/IERC20Metadata.json +236 -0
  179. package/build/contracts/IERC20Permit.json +89 -0
  180. package/build/contracts/IERC2309.json +45 -0
  181. package/build/contracts/IERC2612.json +89 -0
  182. package/build/contracts/IERC2981.json +62 -0
  183. package/build/contracts/IERC3009.json +163 -0
  184. package/build/contracts/IERC3009Cancel.json +66 -0
  185. package/build/contracts/IERC3156FlashBorrower.json +53 -0
  186. package/build/contracts/IERC3156FlashLender.json +91 -0
  187. package/build/contracts/IERC4626.json +626 -0
  188. package/build/contracts/IERC4906.json +331 -0
  189. package/build/contracts/IERC5267.json +63 -0
  190. package/build/contracts/IERC5313.json +27 -0
  191. package/build/contracts/IERC5805.json +233 -0
  192. package/build/contracts/IERC6372.json +40 -0
  193. package/build/contracts/IERC6909.json +319 -0
  194. package/build/contracts/IERC6909ContentURI.json +351 -0
  195. package/build/contracts/IERC6909Metadata.json +376 -0
  196. package/build/contracts/IERC6909TokenSupply.json +338 -0
  197. package/build/contracts/IERC721.json +299 -0
  198. package/build/contracts/IERC721Enumerable.json +355 -0
  199. package/build/contracts/IERC721Errors.json +117 -0
  200. package/build/contracts/IERC721Metadata.json +344 -0
  201. package/build/contracts/IERC721Receiver.json +48 -0
  202. package/build/contracts/IERC7579AccountConfig.json +65 -0
  203. package/build/contracts/IERC7579Execution.json +56 -0
  204. package/build/contracts/IERC7579Hook.json +101 -0
  205. package/build/contracts/IERC7579Module.json +59 -0
  206. package/build/contracts/IERC7579ModuleConfig.json +127 -0
  207. package/build/contracts/IERC7579Validator.json +159 -0
  208. package/build/contracts/IERC7674.json +221 -0
  209. package/build/contracts/IERC7751.json +40 -0
  210. package/build/contracts/IERC777.json +405 -0
  211. package/build/contracts/IERC777Recipient.json +52 -0
  212. package/build/contracts/IERC777Sender.json +52 -0
  213. package/build/contracts/IERC7786GatewaySource.json +116 -0
  214. package/build/contracts/IERC7786Recipient.json +43 -0
  215. package/build/contracts/IERC7802.json +119 -0
  216. package/build/contracts/IERC7821.json +51 -0
  217. package/build/contracts/IERC7913SignatureVerifier.json +43 -0
  218. package/build/contracts/IEntryPoint.json +305 -0
  219. package/build/contracts/IEntryPointExtra.json +80 -0
  220. package/build/contracts/IEntryPointNonces.json +38 -0
  221. package/build/contracts/IEntryPointStake.json +97 -0
  222. package/build/contracts/IGovernor.json +1095 -0
  223. package/build/contracts/IPaymaster.json +123 -0
  224. package/build/contracts/ITransparentUpgradeableProxy.json +77 -0
  225. package/build/contracts/IVotes.json +207 -0
  226. package/build/contracts/Initializable.json +37 -0
  227. package/build/contracts/InteroperableAddress.json +30 -0
  228. package/build/contracts/LowLevelCall.json +13 -0
  229. package/build/contracts/Math.json +13 -0
  230. package/build/contracts/Memory.json +13 -0
  231. package/build/contracts/MerkleProof.json +19 -0
  232. package/build/contracts/MerkleTree.json +35 -0
  233. package/build/contracts/MessageHashUtils.json +19 -0
  234. package/build/contracts/MultiSignerERC7913.json +176 -0
  235. package/build/contracts/MultiSignerERC7913Weighted.json +264 -0
  236. package/build/contracts/Multicall.json +49 -0
  237. package/build/contracts/Nonces.json +49 -0
  238. package/build/contracts/NoncesKeyed.json +73 -0
  239. package/build/contracts/Ownable.json +88 -0
  240. package/build/contracts/Ownable2Step.json +127 -0
  241. package/build/contracts/P256.json +13 -0
  242. package/build/contracts/Packing.json +19 -0
  243. package/build/contracts/Panic.json +13 -0
  244. package/build/contracts/Pausable.json +63 -0
  245. package/build/contracts/Paymaster.json +147 -0
  246. package/build/contracts/PaymasterERC20.json +209 -0
  247. package/build/contracts/PaymasterERC20Guarantor.json +234 -0
  248. package/build/contracts/PaymasterERC721Owner.json +160 -0
  249. package/build/contracts/PaymasterSigner.json +212 -0
  250. package/build/contracts/Proxy.json +18 -0
  251. package/build/contracts/ProxyAdmin.json +135 -0
  252. package/build/contracts/RLP.json +19 -0
  253. package/build/contracts/RSA.json +13 -0
  254. package/build/contracts/RateLimiter.json +19 -0
  255. package/build/contracts/ReentrancyGuard.json +19 -0
  256. package/build/contracts/ReentrancyGuardTransient.json +19 -0
  257. package/build/contracts/RelayedCall.json +13 -0
  258. package/build/contracts/SafeCast.json +68 -0
  259. package/build/contracts/SafeERC20.json +46 -0
  260. package/build/contracts/ShortStrings.json +30 -0
  261. package/build/contracts/SignatureChecker.json +13 -0
  262. package/build/contracts/SignedMath.json +13 -0
  263. package/build/contracts/SignerECDSA.json +27 -0
  264. package/build/contracts/SignerEIP7702.json +13 -0
  265. package/build/contracts/SignerERC7913.json +27 -0
  266. package/build/contracts/SignerP256.json +48 -0
  267. package/build/contracts/SignerRSA.json +32 -0
  268. package/build/contracts/SignerWebAuthn.json +48 -0
  269. package/build/contracts/SimulateCall.json +13 -0
  270. package/build/contracts/SlotDerivation.json +13 -0
  271. package/build/contracts/StorageSlot.json +13 -0
  272. package/build/contracts/Strings.json +40 -0
  273. package/build/contracts/Time.json +13 -0
  274. package/build/contracts/TimelockController.json +1010 -0
  275. package/build/contracts/TransientSlot.json +13 -0
  276. package/build/contracts/TransparentUpgradeableProxy.json +131 -0
  277. package/build/contracts/TrieProof.json +25 -0
  278. package/build/contracts/UUPSUpgradeable.json +119 -0
  279. package/build/contracts/UpgradeableBeacon.json +154 -0
  280. package/build/contracts/VestingWallet.json +364 -0
  281. package/build/contracts/VestingWalletCliff.json +367 -0
  282. package/build/contracts/Votes.json +402 -0
  283. package/build/contracts/VotesExtended.json +450 -0
  284. package/build/contracts/WebAuthn.json +13 -0
  285. package/crosschain/CrosschainLinked.sol +114 -0
  286. package/crosschain/CrosschainRemoteExecutor.sol +99 -0
  287. package/crosschain/ERC7786Recipient.sol +66 -0
  288. package/crosschain/bridges/BridgeERC1155.sol +131 -0
  289. package/crosschain/bridges/BridgeERC20.sol +42 -0
  290. package/crosschain/bridges/BridgeERC721.sol +62 -0
  291. package/crosschain/bridges/BridgeERC7802.sol +34 -0
  292. package/crosschain/bridges/abstract/BridgeFungible.sol +86 -0
  293. package/crosschain/bridges/abstract/BridgeMultiToken.sol +99 -0
  294. package/crosschain/bridges/abstract/BridgeNonFungible.sol +79 -0
  295. package/finance/VestingWallet.sol +160 -0
  296. package/finance/VestingWalletCliff.sol +55 -0
  297. package/governance/Governor.sol +825 -0
  298. package/governance/IGovernor.sol +454 -0
  299. package/governance/TimelockController.sol +470 -0
  300. package/governance/extensions/GovernorCountingFractional.sol +190 -0
  301. package/governance/extensions/GovernorCountingOverridable.sol +226 -0
  302. package/governance/extensions/GovernorCountingSimple.sol +96 -0
  303. package/governance/extensions/GovernorCrosschain.sol +31 -0
  304. package/governance/extensions/GovernorNoncesKeyed.sol +91 -0
  305. package/governance/extensions/GovernorPreventLateQuorum.sol +119 -0
  306. package/governance/extensions/GovernorProposalGuardian.sol +59 -0
  307. package/governance/extensions/GovernorSequentialProposalId.sol +75 -0
  308. package/governance/extensions/GovernorSettings.sol +106 -0
  309. package/governance/extensions/GovernorStorage.sol +134 -0
  310. package/governance/extensions/GovernorSuperQuorum.sol +59 -0
  311. package/governance/extensions/GovernorTimelockAccess.sol +346 -0
  312. package/governance/extensions/GovernorTimelockCompound.sol +162 -0
  313. package/governance/extensions/GovernorTimelockControl.sol +167 -0
  314. package/governance/extensions/GovernorVotes.sol +64 -0
  315. package/governance/extensions/GovernorVotesQuorumFraction.sol +113 -0
  316. package/governance/extensions/GovernorVotesSuperQuorumFraction.sol +135 -0
  317. package/governance/utils/IVotes.sol +60 -0
  318. package/governance/utils/Votes.sol +245 -0
  319. package/governance/utils/VotesExtended.sol +85 -0
  320. package/interfaces/IERC1155.sol +6 -0
  321. package/interfaces/IERC1155MetadataURI.sol +6 -0
  322. package/interfaces/IERC1155Receiver.sol +6 -0
  323. package/interfaces/IERC1271.sol +17 -0
  324. package/interfaces/IERC1363.sol +86 -0
  325. package/interfaces/IERC1363Receiver.sol +32 -0
  326. package/interfaces/IERC1363Spender.sol +26 -0
  327. package/interfaces/IERC165.sol +6 -0
  328. package/interfaces/IERC1820Implementer.sol +20 -0
  329. package/interfaces/IERC1820Registry.sol +112 -0
  330. package/interfaces/IERC1967.sol +24 -0
  331. package/interfaces/IERC20.sol +6 -0
  332. package/interfaces/IERC20Metadata.sol +6 -0
  333. package/interfaces/IERC2309.sol +19 -0
  334. package/interfaces/IERC2612.sol +8 -0
  335. package/interfaces/IERC2981.sol +26 -0
  336. package/interfaces/IERC3156.sol +7 -0
  337. package/interfaces/IERC3156FlashBorrower.sol +27 -0
  338. package/interfaces/IERC3156FlashLender.sol +41 -0
  339. package/interfaces/IERC4337.sol +255 -0
  340. package/interfaces/IERC4626.sol +230 -0
  341. package/interfaces/IERC4906.sol +20 -0
  342. package/interfaces/IERC5267.sol +28 -0
  343. package/interfaces/IERC5313.sol +16 -0
  344. package/interfaces/IERC5805.sol +9 -0
  345. package/interfaces/IERC6093.sol +162 -0
  346. package/interfaces/IERC6372.sol +19 -0
  347. package/interfaces/IERC6909.sol +131 -0
  348. package/interfaces/IERC721.sol +6 -0
  349. package/interfaces/IERC721Enumerable.sol +6 -0
  350. package/interfaces/IERC721Metadata.sol +6 -0
  351. package/interfaces/IERC721Receiver.sol +6 -0
  352. package/interfaces/IERC7751.sol +12 -0
  353. package/interfaces/IERC777.sol +200 -0
  354. package/interfaces/IERC777Recipient.sol +35 -0
  355. package/interfaces/IERC777Sender.sol +35 -0
  356. package/interfaces/IERC7786.sol +64 -0
  357. package/interfaces/IERC7913.sol +18 -0
  358. package/interfaces/draft-IERC1822.sol +20 -0
  359. package/interfaces/draft-IERC3009.sol +87 -0
  360. package/interfaces/draft-IERC7579.sol +227 -0
  361. package/interfaces/draft-IERC7674.sol +17 -0
  362. package/interfaces/draft-IERC7802.sol +32 -0
  363. package/interfaces/draft-IERC7821.sol +44 -0
  364. package/metatx/ERC2771Context.sol +90 -0
  365. package/metatx/ERC2771Forwarder.sol +376 -0
  366. package/package.json +29 -1
  367. package/proxy/Clones.sol +294 -0
  368. package/proxy/ERC1967/ERC1967Clones.sol +219 -0
  369. package/proxy/ERC1967/ERC1967Proxy.sol +62 -0
  370. package/proxy/ERC1967/ERC1967Utils.sol +177 -0
  371. package/proxy/Proxy.sol +69 -0
  372. package/proxy/beacon/BeaconProxy.sol +57 -0
  373. package/proxy/beacon/IBeacon.sol +16 -0
  374. package/proxy/beacon/UpgradeableBeacon.sol +70 -0
  375. package/proxy/transparent/ProxyAdmin.sol +45 -0
  376. package/proxy/transparent/TransparentUpgradeableProxy.sol +118 -0
  377. package/proxy/utils/Initializable.sol +238 -0
  378. package/proxy/utils/UUPSUpgradeable.sol +148 -0
  379. package/token/ERC1155/ERC1155.sol +417 -0
  380. package/token/ERC1155/IERC1155.sol +123 -0
  381. package/token/ERC1155/IERC1155Receiver.sol +59 -0
  382. package/token/ERC1155/extensions/ERC1155Burnable.sol +22 -0
  383. package/token/ERC1155/extensions/ERC1155Crosschain.sol +87 -0
  384. package/token/ERC1155/extensions/ERC1155Pausable.sol +38 -0
  385. package/token/ERC1155/extensions/ERC1155Supply.sol +88 -0
  386. package/token/ERC1155/extensions/ERC1155URIStorage.sol +58 -0
  387. package/token/ERC1155/extensions/IERC1155MetadataURI.sol +20 -0
  388. package/token/ERC1155/utils/ERC1155Holder.sol +42 -0
  389. package/token/ERC1155/utils/ERC1155Utils.sol +88 -0
  390. package/token/ERC20/ERC20.sol +305 -0
  391. package/token/ERC20/IERC20.sol +79 -0
  392. package/token/ERC20/extensions/ERC1363.sol +135 -0
  393. package/token/ERC20/extensions/ERC20Burnable.sol +38 -0
  394. package/token/ERC20/extensions/ERC20Capped.sol +54 -0
  395. package/token/ERC20/extensions/ERC20Crosschain.sol +39 -0
  396. package/token/ERC20/extensions/ERC20FlashMint.sol +130 -0
  397. package/token/ERC20/extensions/ERC20Pausable.sol +33 -0
  398. package/token/ERC20/extensions/ERC20Permit.sol +77 -0
  399. package/token/ERC20/extensions/ERC20TransferAuthorization.sol +91 -0
  400. package/token/ERC20/extensions/ERC20Votes.sol +83 -0
  401. package/token/ERC20/extensions/ERC20Wrapper.sol +93 -0
  402. package/token/ERC20/extensions/ERC4626.sol +304 -0
  403. package/token/ERC20/extensions/IERC20Metadata.sol +26 -0
  404. package/token/ERC20/extensions/IERC20Permit.sol +90 -0
  405. package/token/ERC20/extensions/draft-ERC20Bridgeable.sol +51 -0
  406. package/token/ERC20/extensions/draft-ERC20TemporaryApproval.sol +119 -0
  407. package/token/ERC20/extensions/draft-ERC3009.sol +152 -0
  408. package/token/ERC20/utils/ERC1363Utils.sol +95 -0
  409. package/token/ERC20/utils/SafeERC20.sol +292 -0
  410. package/token/ERC6909/ERC6909.sol +224 -0
  411. package/token/ERC6909/extensions/ERC6909ContentURI.sol +59 -0
  412. package/token/ERC6909/extensions/ERC6909Metadata.sol +83 -0
  413. package/token/ERC6909/extensions/ERC6909TokenSupply.sol +41 -0
  414. package/token/ERC721/ERC721.sol +433 -0
  415. package/token/ERC721/IERC721.sol +135 -0
  416. package/token/ERC721/IERC721Receiver.sol +28 -0
  417. package/token/ERC721/extensions/ERC721Burnable.sol +26 -0
  418. package/token/ERC721/extensions/ERC721Consecutive.sol +176 -0
  419. package/token/ERC721/extensions/ERC721Crosschain.sol +38 -0
  420. package/token/ERC721/extensions/ERC721Enumerable.sol +165 -0
  421. package/token/ERC721/extensions/ERC721Pausable.sol +37 -0
  422. package/token/ERC721/extensions/ERC721Royalty.sol +26 -0
  423. package/token/ERC721/extensions/ERC721URIStorage.sol +62 -0
  424. package/token/ERC721/extensions/ERC721Votes.sol +47 -0
  425. package/token/ERC721/extensions/ERC721Wrapper.sol +102 -0
  426. package/token/ERC721/extensions/IERC721Enumerable.sol +29 -0
  427. package/token/ERC721/extensions/IERC721Metadata.sol +27 -0
  428. package/token/ERC721/utils/ERC721Holder.sol +26 -0
  429. package/token/ERC721/utils/ERC721Utils.sol +50 -0
  430. package/token/common/ERC2981.sol +140 -0
  431. package/utils/Address.sol +167 -0
  432. package/utils/Arrays.sol +905 -0
  433. package/utils/Base58.sol +240 -0
  434. package/utils/Base64.sol +234 -0
  435. package/utils/BlockHeader.sol +312 -0
  436. package/utils/Blockhash.sol +54 -0
  437. package/utils/Bytes.sol +329 -0
  438. package/utils/CAIP10.sol +54 -0
  439. package/utils/CAIP2.sol +51 -0
  440. package/utils/Calldata.sol +25 -0
  441. package/utils/Comparators.sol +19 -0
  442. package/utils/Context.sol +28 -0
  443. package/utils/Create2.sol +91 -0
  444. package/utils/Create3.sol +133 -0
  445. package/utils/ERC6372Utils.sol +53 -0
  446. package/utils/Errors.sol +34 -0
  447. package/utils/LowLevelCall.sol +127 -0
  448. package/utils/Memory.sol +151 -0
  449. package/utils/Multicall.sol +37 -0
  450. package/utils/Nonces.sol +47 -0
  451. package/utils/NoncesKeyed.sol +75 -0
  452. package/utils/Packing.sol +1656 -0
  453. package/utils/Panic.sol +57 -0
  454. package/utils/Pausable.sol +112 -0
  455. package/utils/RLP.sol +487 -0
  456. package/utils/RateLimiter.sol +310 -0
  457. package/utils/ReentrancyGuard.sol +119 -0
  458. package/utils/ReentrancyGuardTransient.sol +84 -0
  459. package/utils/RelayedCall.sol +145 -0
  460. package/utils/ShortStrings.sol +122 -0
  461. package/utils/SimulateCall.sol +114 -0
  462. package/utils/SlotDerivation.sol +155 -0
  463. package/utils/StorageSlot.sol +143 -0
  464. package/utils/Strings.sol +532 -0
  465. package/utils/TransientSlot.sol +183 -0
  466. package/utils/cryptography/ECDSA.sol +284 -0
  467. package/utils/cryptography/EIP712.sol +168 -0
  468. package/utils/cryptography/Hashes.sol +31 -0
  469. package/utils/cryptography/MerkleProof.sol +510 -0
  470. package/utils/cryptography/MessageHashUtils.sol +228 -0
  471. package/utils/cryptography/P256.sol +409 -0
  472. package/utils/cryptography/RSA.sol +159 -0
  473. package/utils/cryptography/SignatureChecker.sol +199 -0
  474. package/utils/cryptography/TrieProof.sol +256 -0
  475. package/utils/cryptography/WebAuthn.sol +269 -0
  476. package/utils/cryptography/draft-ERC7739Utils.sol +215 -0
  477. package/utils/cryptography/signers/AbstractSigner.sol +23 -0
  478. package/utils/cryptography/signers/MultiSignerERC7913.sol +336 -0
  479. package/utils/cryptography/signers/MultiSignerERC7913Weighted.sol +208 -0
  480. package/utils/cryptography/signers/SignerECDSA.sol +56 -0
  481. package/utils/cryptography/signers/SignerEIP7702.sol +25 -0
  482. package/utils/cryptography/signers/SignerERC7913.sol +63 -0
  483. package/utils/cryptography/signers/SignerP256.sol +64 -0
  484. package/utils/cryptography/signers/SignerRSA.sol +65 -0
  485. package/utils/cryptography/signers/SignerWebAuthn.sol +45 -0
  486. package/utils/cryptography/signers/draft-ERC7739.sol +99 -0
  487. package/utils/cryptography/verifiers/ERC7913P256Verifier.sol +29 -0
  488. package/utils/cryptography/verifiers/ERC7913RSAVerifier.sol +23 -0
  489. package/utils/cryptography/verifiers/ERC7913WebAuthnVerifier.sol +45 -0
  490. package/utils/draft-InteroperableAddress.sol +245 -0
  491. package/utils/introspection/ERC165.sol +25 -0
  492. package/utils/introspection/ERC165Checker.sol +142 -0
  493. package/utils/introspection/IERC165.sol +25 -0
  494. package/utils/math/Math.sol +763 -0
  495. package/utils/math/SafeCast.sol +1162 -0
  496. package/utils/math/SignedMath.sol +68 -0
  497. package/utils/structs/Accumulators.sol +135 -0
  498. package/utils/structs/BitMaps.sol +61 -0
  499. package/utils/structs/Checkpoints.sol +881 -0
  500. package/utils/structs/CircularBuffer.sol +152 -0
  501. package/utils/structs/DoubleEndedQueue.sol +280 -0
  502. package/utils/structs/EnumerableMap.sol +1870 -0
  503. package/utils/structs/EnumerableSet.sol +1177 -0
  504. package/utils/structs/Heap.sol +259 -0
  505. package/utils/structs/MerkleTree.sol +267 -0
  506. package/utils/types/Time.sol +133 -0
  507. package/vendor/compound/ICompoundTimelock.sol +86 -0
@@ -0,0 +1,176 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // OpenZeppelin Contracts (last updated v5.8.0) (token/ERC721/extensions/ERC721Consecutive.sol)
3
+
4
+ pragma solidity ^0.8.24;
5
+
6
+ import {IERC2309} from "../../../interfaces/IERC2309.sol";
7
+ import {BitMaps} from "../../../utils/structs/BitMaps.sol";
8
+ import {Checkpoints} from "../../../utils/structs/Checkpoints.sol";
9
+ import {ERC721} from "../ERC721.sol";
10
+
11
+ /**
12
+ * @dev Implementation of the ERC-2309 "Consecutive Transfer Extension" as defined in
13
+ * https://eips.ethereum.org/EIPS/eip-2309[ERC-2309].
14
+ *
15
+ * This extension allows the minting of large batches of tokens, during contract construction only. For upgradeable
16
+ * contracts this implies that batch minting is only available during proxy deployment, and not in subsequent upgrades.
17
+ * These batches are limited to 5000 tokens at a time by default to accommodate off-chain indexers.
18
+ *
19
+ * Using this extension removes the ability to mint single tokens during contract construction. This ability is
20
+ * regained after construction. During construction, only batch minting is allowed.
21
+ *
22
+ * IMPORTANT: This extension does not call the {_update} function for tokens minted in batch. Any logic added to this
23
+ * function through overrides will not be triggered when tokens are minted in batch. You may want to also override
24
+ * {_increaseBalance} or {_mintConsecutive} to account for these mints.
25
+ *
26
+ * IMPORTANT: When overriding {_mintConsecutive}, be careful about call ordering. {ownerOf} may return invalid
27
+ * values during the {_mintConsecutive} execution if the super call is not called first. To be safe, execute the
28
+ * super call before your custom logic.
29
+ */
30
+ abstract contract ERC721Consecutive is IERC2309, ERC721 {
31
+ using BitMaps for BitMaps.BitMap;
32
+ using Checkpoints for Checkpoints.Trace160;
33
+
34
+ Checkpoints.Trace160 private _sequentialOwnership;
35
+ BitMaps.BitMap private _sequentialBurn;
36
+
37
+ /**
38
+ * @dev Batch mint is restricted to the constructor.
39
+ * Any batch mint not emitting the {IERC721-Transfer} event outside of the constructor
40
+ * is non ERC-721 compliant.
41
+ */
42
+ error ERC721ForbiddenBatchMint();
43
+
44
+ /**
45
+ * @dev Exceeds the max amount of mints per batch.
46
+ */
47
+ error ERC721ExceededMaxBatchMint(uint256 batchSize, uint256 maxBatch);
48
+
49
+ /**
50
+ * @dev Individual minting is not allowed.
51
+ */
52
+ error ERC721ForbiddenMint();
53
+
54
+ /**
55
+ * @dev Batch burn is not supported.
56
+ */
57
+ error ERC721ForbiddenBatchBurn();
58
+
59
+ /**
60
+ * @dev Maximum size of a batch of consecutive tokens. This is designed to limit stress on off-chain indexing
61
+ * services that have to record one entry per token, and have protections against "unreasonably large" batches of
62
+ * tokens.
63
+ *
64
+ * NOTE: Overriding the default value of 5000 will not cause on-chain issues, but may result in the asset not being
65
+ * correctly supported by off-chain indexing services (including marketplaces).
66
+ */
67
+ function _maxBatchSize() internal view virtual returns (uint96) {
68
+ return 5000;
69
+ }
70
+
71
+ /**
72
+ * @dev See {ERC721-_ownerOf}. Override that checks the sequential ownership structure for tokens that have
73
+ * been minted as part of a batch, and not yet transferred.
74
+ */
75
+ function _ownerOf(uint256 tokenId) internal view virtual override returns (address) {
76
+ address owner = super._ownerOf(tokenId);
77
+
78
+ // If token is owned by the core, or beyond consecutive range, return base value
79
+ if (owner != address(0) || tokenId > type(uint96).max || tokenId < _firstConsecutiveId()) {
80
+ return owner;
81
+ }
82
+
83
+ // Otherwise, check the token was not burned, and fetch ownership from the anchors
84
+ // Note: no need for safe cast, we know that tokenId <= type(uint96).max
85
+ return _sequentialBurn.get(tokenId) ? address(0) : address(_sequentialOwnership.lowerLookup(uint96(tokenId)));
86
+ }
87
+
88
+ /**
89
+ * @dev Mint a batch of tokens of length `batchSize` for `to`. Returns the token id of the first token minted in the
90
+ * batch; if `batchSize` is 0, returns the next token id to be minted consecutively.
91
+ *
92
+ * Requirements:
93
+ *
94
+ * - `batchSize` must not be greater than {_maxBatchSize}.
95
+ * - The function is called in the constructor of the contract (directly or indirectly).
96
+ *
97
+ * CAUTION: Does not emit a `Transfer` event. This is ERC-721 compliant as long as it is done inside of the
98
+ * constructor, which is enforced by this function.
99
+ *
100
+ * CAUTION: Does not invoke `onERC721Received` on the receiver.
101
+ *
102
+ * Emits a {IERC2309-ConsecutiveTransfer} event.
103
+ */
104
+ function _mintConsecutive(address to, uint96 batchSize) internal virtual returns (uint96) {
105
+ uint96 next = _nextConsecutiveId();
106
+
107
+ // minting a batch of size 0 is a no-op
108
+ if (batchSize > 0) {
109
+ if (address(this).code.length > 0) {
110
+ revert ERC721ForbiddenBatchMint();
111
+ }
112
+ if (to == address(0)) {
113
+ revert ERC721InvalidReceiver(address(0));
114
+ }
115
+
116
+ uint256 maxBatchSize = _maxBatchSize();
117
+ if (batchSize > maxBatchSize) {
118
+ revert ERC721ExceededMaxBatchMint(batchSize, maxBatchSize);
119
+ }
120
+
121
+ // push an ownership checkpoint & emit event
122
+ uint96 last = next + batchSize - 1;
123
+ _sequentialOwnership.push(last, uint160(to));
124
+
125
+ // The invariant required by this function is preserved because the new sequentialOwnership checkpoint
126
+ // is attributing ownership of `batchSize` new tokens to account `to`.
127
+ _increaseBalance(to, batchSize);
128
+
129
+ emit ConsecutiveTransfer(next, last, address(0), to);
130
+ }
131
+
132
+ return next;
133
+ }
134
+
135
+ /**
136
+ * @dev See {ERC721-_update}. Override version that restricts normal minting to after construction.
137
+ *
138
+ * WARNING: Using {ERC721Consecutive} prevents minting during construction in favor of {_mintConsecutive}.
139
+ * After construction, {_mintConsecutive} is no longer available and minting through {_update} becomes available.
140
+ */
141
+ function _update(address to, uint256 tokenId, address auth) internal virtual override returns (address) {
142
+ address previousOwner = super._update(to, tokenId, auth);
143
+
144
+ // only mint after construction
145
+ if (previousOwner == address(0) && address(this).code.length == 0) {
146
+ revert ERC721ForbiddenMint();
147
+ }
148
+
149
+ // record burn
150
+ if (
151
+ to == address(0) && // if we burn
152
+ tokenId < _nextConsecutiveId() && // and the tokenId was minted in a batch
153
+ !_sequentialBurn.get(tokenId) // and the token was never marked as burnt
154
+ ) {
155
+ _sequentialBurn.set(tokenId);
156
+ }
157
+
158
+ return previousOwner;
159
+ }
160
+
161
+ /**
162
+ * @dev Used to offset the first token id in `_nextConsecutiveId`
163
+ */
164
+ function _firstConsecutiveId() internal view virtual returns (uint96) {
165
+ return 0;
166
+ }
167
+
168
+ /**
169
+ * @dev Returns the next tokenId to mint using {_mintConsecutive}. It will return {_firstConsecutiveId}
170
+ * if no consecutive tokenId has been minted before.
171
+ */
172
+ function _nextConsecutiveId() private view returns (uint96) {
173
+ (bool exists, uint96 latestId, ) = _sequentialOwnership.latestCheckpoint();
174
+ return exists ? latestId + 1 : _firstConsecutiveId();
175
+ }
176
+ }
@@ -0,0 +1,38 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // OpenZeppelin Contracts (last updated v5.8.0) (token/ERC721/extensions/ERC721Crosschain.sol)
3
+
4
+ pragma solidity ^0.8.26;
5
+
6
+ import {BridgeNonFungible} from "../../../crosschain/bridges/abstract/BridgeNonFungible.sol";
7
+ import {ERC721} from "../ERC721.sol";
8
+
9
+ /**
10
+ * @dev Extension of {ERC721} that makes it natively cross-chain using the ERC-7786 based {BridgeNonFungible}.
11
+ *
12
+ * This extension makes the token compatible with:
13
+ * * {ERC721Crosschain} instances on other chains,
14
+ * * {ERC721} instances on other chains that are bridged using {BridgeERC721},
15
+ */
16
+ // slither-disable-next-line locked-ether
17
+ abstract contract ERC721Crosschain is BridgeNonFungible, ERC721 {
18
+ /// @dev Crosschain variant of {transferFrom}, using the allowance system from the underlying ERC-721 token.
19
+ function crosschainTransferFrom(address from, bytes memory to, uint256 tokenId) public virtual returns (bytes32) {
20
+ // operator (_msgSender) permission over `from` is checked in `_onSend`
21
+ return _crosschainTransfer(from, to, tokenId);
22
+ }
23
+
24
+ /// @dev "Locking" tokens is achieved through burning
25
+ function _onSend(address from, uint256 tokenId) internal virtual override {
26
+ address previousOwner = _update(address(0), tokenId, _msgSender());
27
+ if (previousOwner == address(0)) {
28
+ revert ERC721NonexistentToken(tokenId);
29
+ } else if (previousOwner != from) {
30
+ revert ERC721IncorrectOwner(from, tokenId, previousOwner);
31
+ }
32
+ }
33
+
34
+ /// @dev "Unlocking" tokens is achieved through minting
35
+ function _onReceive(address to, uint256 tokenId) internal virtual override {
36
+ _mint(to, tokenId);
37
+ }
38
+ }
@@ -0,0 +1,165 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // OpenZeppelin Contracts (last updated v5.8.0) (token/ERC721/extensions/ERC721Enumerable.sol)
3
+
4
+ pragma solidity ^0.8.24;
5
+
6
+ import {IERC165} from "../../../utils/introspection/ERC165.sol";
7
+ import {ERC721} from "../ERC721.sol";
8
+ import {IERC721Enumerable} from "./IERC721Enumerable.sol";
9
+
10
+ /**
11
+ * @dev This implements an optional extension of {ERC721} defined in the ERC that adds enumerability
12
+ * of all the token ids in the contract as well as all token ids owned by each account.
13
+ *
14
+ * CAUTION: {ERC721} extensions that implement custom `balanceOf` logic, such as {ERC721Consecutive},
15
+ * interfere with enumerability and should not be used together with {ERC721Enumerable}.
16
+ */
17
+ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
18
+ mapping(address owner => mapping(uint256 index => uint256)) private _ownedTokens;
19
+ mapping(uint256 tokenId => uint256) private _ownedTokensIndex;
20
+
21
+ uint256[] private _allTokens;
22
+ mapping(uint256 tokenId => uint256) private _allTokensIndex;
23
+
24
+ /**
25
+ * @dev An `owner`'s token query was out of bounds for `index`.
26
+ *
27
+ * NOTE: The owner being `address(0)` indicates a global out of bounds index.
28
+ */
29
+ error ERC721OutOfBoundsIndex(address owner, uint256 index);
30
+
31
+ /**
32
+ * @dev Batch mint is not allowed.
33
+ */
34
+ error ERC721EnumerableForbiddenBatchMint();
35
+
36
+ /// @inheritdoc IERC165
37
+ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
38
+ return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
39
+ }
40
+
41
+ /// @inheritdoc IERC721Enumerable
42
+ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual returns (uint256) {
43
+ if (index >= balanceOf(owner)) {
44
+ revert ERC721OutOfBoundsIndex(owner, index);
45
+ }
46
+ return _ownedTokens[owner][index];
47
+ }
48
+
49
+ /// @inheritdoc IERC721Enumerable
50
+ function totalSupply() public view virtual returns (uint256) {
51
+ return _allTokens.length;
52
+ }
53
+
54
+ /// @inheritdoc IERC721Enumerable
55
+ function tokenByIndex(uint256 index) public view virtual returns (uint256) {
56
+ if (index >= totalSupply()) {
57
+ revert ERC721OutOfBoundsIndex(address(0), index);
58
+ }
59
+ return _allTokens[index];
60
+ }
61
+
62
+ /// @inheritdoc ERC721
63
+ function _update(address to, uint256 tokenId, address auth) internal virtual override returns (address) {
64
+ address previousOwner = super._update(to, tokenId, auth);
65
+
66
+ if (previousOwner == address(0)) {
67
+ _addTokenToAllTokensEnumeration(tokenId);
68
+ } else if (previousOwner != to) {
69
+ _removeTokenFromOwnerEnumeration(previousOwner, tokenId);
70
+ }
71
+ if (to == address(0)) {
72
+ _removeTokenFromAllTokensEnumeration(tokenId);
73
+ } else if (previousOwner != to) {
74
+ _addTokenToOwnerEnumeration(to, tokenId);
75
+ }
76
+
77
+ return previousOwner;
78
+ }
79
+
80
+ /**
81
+ * @dev Private function to add a token to this extension's ownership-tracking data structures.
82
+ * @param to address representing the new owner of the given token ID
83
+ * @param tokenId uint256 ID of the token to be added to the tokens list of the given address
84
+ */
85
+ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
86
+ uint256 length = balanceOf(to) - 1;
87
+ _ownedTokens[to][length] = tokenId;
88
+ _ownedTokensIndex[tokenId] = length;
89
+ }
90
+
91
+ /**
92
+ * @dev Private function to add a token to this extension's token tracking data structures.
93
+ * @param tokenId uint256 ID of the token to be added to the tokens list
94
+ */
95
+ function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
96
+ _allTokensIndex[tokenId] = _allTokens.length;
97
+ _allTokens.push(tokenId);
98
+ }
99
+
100
+ /**
101
+ * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
102
+ * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
103
+ * gas optimizations e.g. when performing a transfer operation (avoiding double writes).
104
+ * This has O(1) time complexity, but alters the order of the _ownedTokens array.
105
+ * @param from address representing the previous owner of the given token ID
106
+ * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
107
+ */
108
+ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
109
+ // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
110
+ // then delete the last slot (swap and pop).
111
+
112
+ uint256 lastTokenIndex = balanceOf(from);
113
+ uint256 tokenIndex = _ownedTokensIndex[tokenId];
114
+
115
+ mapping(uint256 index => uint256) storage _ownedTokensByOwner = _ownedTokens[from];
116
+
117
+ // When the token to delete is the last token, the swap operation is unnecessary
118
+ if (tokenIndex != lastTokenIndex) {
119
+ uint256 lastTokenId = _ownedTokensByOwner[lastTokenIndex];
120
+
121
+ _ownedTokensByOwner[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
122
+ _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
123
+ }
124
+
125
+ // This also deletes the contents at the last position of the array
126
+ delete _ownedTokensIndex[tokenId];
127
+ delete _ownedTokensByOwner[lastTokenIndex];
128
+ }
129
+
130
+ /**
131
+ * @dev Private function to remove a token from this extension's token tracking data structures.
132
+ * This has O(1) time complexity, but alters the order of the _allTokens array.
133
+ * @param tokenId uint256 ID of the token to be removed from the tokens list
134
+ */
135
+ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
136
+ // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
137
+ // then delete the last slot (swap and pop).
138
+
139
+ uint256 lastTokenIndex = _allTokens.length - 1;
140
+ uint256 tokenIndex = _allTokensIndex[tokenId];
141
+
142
+ // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
143
+ // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
144
+ // an 'if' statement (like in _removeTokenFromOwnerEnumeration)
145
+ uint256 lastTokenId = _allTokens[lastTokenIndex];
146
+
147
+ _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
148
+ _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
149
+
150
+ // This also deletes the contents at the last position of the array
151
+ delete _allTokensIndex[tokenId];
152
+ _allTokens.pop();
153
+ }
154
+
155
+ /**
156
+ * See {ERC721-_increaseBalance}. We need to forbid batch minting because the enumeration
157
+ * extension does not support it.
158
+ */
159
+ function _increaseBalance(address account, uint128 amount) internal virtual override {
160
+ if (amount > 0) {
161
+ revert ERC721EnumerableForbiddenBatchMint();
162
+ }
163
+ super._increaseBalance(account, amount);
164
+ }
165
+ }
@@ -0,0 +1,37 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // OpenZeppelin Contracts (last updated v5.8.0) (token/ERC721/extensions/ERC721Pausable.sol)
3
+
4
+ pragma solidity ^0.8.24;
5
+
6
+ import {Pausable} from "../../../utils/Pausable.sol";
7
+ import {ERC721} from "../ERC721.sol";
8
+
9
+ /**
10
+ * @dev ERC-721 token with pausable token transfers, minting and burning.
11
+ *
12
+ * Useful for scenarios such as preventing trades until the end of an evaluation
13
+ * period, or having an emergency switch for freezing all token transfers in the
14
+ * event of a large bug.
15
+ *
16
+ * IMPORTANT: This contract does not include public pause and unpause functions. In
17
+ * addition to inheriting this contract, you must define both functions, invoking the
18
+ * {Pausable-_pause} and {Pausable-_unpause} internal functions, with appropriate
19
+ * access control, e.g. using {AccessControl} or {Ownable}. Not doing so will
20
+ * make the contract pause mechanism of the contract unreachable, and thus unusable.
21
+ */
22
+ abstract contract ERC721Pausable is ERC721, Pausable {
23
+ /**
24
+ * @dev See {ERC721-_update}.
25
+ *
26
+ * Requirements:
27
+ *
28
+ * - the contract must not be paused.
29
+ */
30
+ function _update(
31
+ address to,
32
+ uint256 tokenId,
33
+ address auth
34
+ ) internal virtual override whenNotPaused returns (address) {
35
+ return super._update(to, tokenId, auth);
36
+ }
37
+ }
@@ -0,0 +1,26 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // OpenZeppelin Contracts (last updated v5.8.0) (token/ERC721/extensions/ERC721Royalty.sol)
3
+
4
+ pragma solidity ^0.8.24;
5
+
6
+ import {IERC165} from "../../../utils/introspection/ERC165.sol";
7
+ import {ERC2981} from "../../common/ERC2981.sol";
8
+ import {ERC721} from "../ERC721.sol";
9
+
10
+ /**
11
+ * @dev Extension of ERC-721 with the ERC-2981 NFT Royalty Standard, a standardized way to retrieve royalty payment
12
+ * information.
13
+ *
14
+ * Royalty information can be specified globally for all token ids via {ERC2981-_setDefaultRoyalty}, and/or individually
15
+ * for specific token ids via {ERC2981-_setTokenRoyalty}. The latter takes precedence over the first.
16
+ *
17
+ * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See
18
+ * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the ERC. Marketplaces are expected to
19
+ * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported.
20
+ */
21
+ abstract contract ERC721Royalty is ERC2981, ERC721 {
22
+ /// @inheritdoc IERC165
23
+ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, ERC2981) returns (bool) {
24
+ return super.supportsInterface(interfaceId);
25
+ }
26
+ }
@@ -0,0 +1,62 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // OpenZeppelin Contracts (last updated v5.8.0) (token/ERC721/extensions/ERC721URIStorage.sol)
3
+
4
+ pragma solidity ^0.8.24;
5
+
6
+ import {IERC165} from "../../../interfaces/IERC165.sol";
7
+ import {IERC4906} from "../../../interfaces/IERC4906.sol";
8
+ import {ERC721} from "../ERC721.sol";
9
+ import {IERC721Metadata} from "./IERC721Metadata.sol";
10
+
11
+ /**
12
+ * @dev ERC-721 token with storage based token URI management.
13
+ */
14
+ abstract contract ERC721URIStorage is IERC4906, ERC721 {
15
+ // Interface ID as defined in ERC-4906. This does not correspond to a traditional interface ID as ERC-4906 only
16
+ // defines events and does not include any external function.
17
+ bytes4 private constant ERC4906_INTERFACE_ID = bytes4(0x49064906);
18
+
19
+ // Optional mapping for token URIs
20
+ mapping(uint256 tokenId => string) private _tokenURIs;
21
+
22
+ /// @inheritdoc IERC165
23
+ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, IERC165) returns (bool) {
24
+ return interfaceId == ERC4906_INTERFACE_ID || super.supportsInterface(interfaceId);
25
+ }
26
+
27
+ /// @inheritdoc IERC721Metadata
28
+ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
29
+ _requireOwned(tokenId);
30
+
31
+ string memory base = _baseURI();
32
+ string memory suffix = _suffixURI(tokenId);
33
+
34
+ // If there is no base URI, return the token URI.
35
+ if (bytes(base).length == 0) {
36
+ return suffix;
37
+ }
38
+ // If both are set, concatenate the baseURI and tokenURI (via string.concat).
39
+ if (bytes(suffix).length > 0) {
40
+ return string.concat(base, suffix);
41
+ }
42
+
43
+ return super.tokenURI(tokenId);
44
+ }
45
+
46
+ /**
47
+ * @dev Sets `_tokenURI` as the tokenURI of `tokenId`.
48
+ *
49
+ * Emits {IERC4906-MetadataUpdate}.
50
+ */
51
+ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
52
+ _tokenURIs[tokenId] = _tokenURI;
53
+ emit MetadataUpdate(tokenId);
54
+ }
55
+
56
+ /**
57
+ * @dev Returns the suffix part of the tokenURI for `tokenId`.
58
+ */
59
+ function _suffixURI(uint256 tokenId) internal view virtual returns (string memory) {
60
+ return _tokenURIs[tokenId];
61
+ }
62
+ }
@@ -0,0 +1,47 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // OpenZeppelin Contracts (last updated v5.8.0) (token/ERC721/extensions/ERC721Votes.sol)
3
+
4
+ pragma solidity ^0.8.24;
5
+
6
+ import {Votes} from "../../../governance/utils/Votes.sol";
7
+ import {ERC721} from "../ERC721.sol";
8
+
9
+ /**
10
+ * @dev Extension of ERC-721 to support voting and delegation as implemented by {Votes}, where each individual NFT counts
11
+ * as 1 vote unit.
12
+ *
13
+ * Tokens do not count as votes until they are delegated, because votes must be tracked which incurs an additional cost
14
+ * on every transfer. Token holders can either delegate to a trusted representative who will decide how to make use of
15
+ * the votes in governance decisions, or they can delegate to themselves to be their own representative.
16
+ */
17
+ abstract contract ERC721Votes is ERC721, Votes {
18
+ /**
19
+ * @dev See {ERC721-_update}. Adjusts votes when tokens are transferred.
20
+ *
21
+ * Emits a {IVotes-DelegateVotesChanged} event.
22
+ */
23
+ function _update(address to, uint256 tokenId, address auth) internal virtual override returns (address) {
24
+ address previousOwner = super._update(to, tokenId, auth);
25
+
26
+ _transferVotingUnits(previousOwner, to, 1);
27
+
28
+ return previousOwner;
29
+ }
30
+
31
+ /**
32
+ * @dev Returns the balance of `account`.
33
+ *
34
+ * WARNING: Overriding this function will likely result in incorrect vote tracking.
35
+ */
36
+ function _getVotingUnits(address account) internal view virtual override returns (uint256) {
37
+ return balanceOf(account);
38
+ }
39
+
40
+ /**
41
+ * @dev See {ERC721-_increaseBalance}. We need that to account tokens that were minted in batch.
42
+ */
43
+ function _increaseBalance(address account, uint128 amount) internal virtual override {
44
+ super._increaseBalance(account, amount);
45
+ _transferVotingUnits(address(0), account, amount);
46
+ }
47
+ }
@@ -0,0 +1,102 @@
1
+ // SPDX-License-Identifier: MIT
2
+ // OpenZeppelin Contracts (last updated v5.5.0) (token/ERC721/extensions/ERC721Wrapper.sol)
3
+
4
+ pragma solidity ^0.8.24;
5
+
6
+ import {IERC721, ERC721} from "../ERC721.sol";
7
+ import {IERC721Receiver} from "../IERC721Receiver.sol";
8
+
9
+ /**
10
+ * @dev Extension of the ERC-721 token contract to support token wrapping.
11
+ *
12
+ * Users can deposit and withdraw an "underlying token" and receive a "wrapped token" with a matching tokenId. This is
13
+ * useful in conjunction with other modules. For example, combining this wrapping mechanism with {ERC721Votes} will allow
14
+ * the wrapping of an existing "basic" ERC-721 into a governance token.
15
+ */
16
+ abstract contract ERC721Wrapper is ERC721, IERC721Receiver {
17
+ IERC721 private immutable _underlying;
18
+
19
+ /**
20
+ * @dev The received ERC-721 token couldn't be wrapped.
21
+ */
22
+ error ERC721UnsupportedToken(address token);
23
+
24
+ constructor(IERC721 underlyingToken) {
25
+ _underlying = underlyingToken;
26
+ }
27
+
28
+ /**
29
+ * @dev Allow a user to deposit underlying tokens and mint the corresponding tokenIds.
30
+ */
31
+ function depositFor(address account, uint256[] memory tokenIds) public virtual returns (bool) {
32
+ uint256 length = tokenIds.length;
33
+ for (uint256 i = 0; i < length; ++i) {
34
+ uint256 tokenId = tokenIds[i];
35
+
36
+ // This is an "unsafe" transfer that doesn't call any hook on the receiver. With underlying() being trusted
37
+ // (by design of this contract) and no other contracts expected to be called from there, we are safe.
38
+ // slither-disable-next-line reentrancy-no-eth
39
+ underlying().transferFrom(_msgSender(), address(this), tokenId); // forge-lint: disable-line(erc20-unchecked-transfer)
40
+ _safeMint(account, tokenId);
41
+ }
42
+
43
+ return true;
44
+ }
45
+
46
+ /**
47
+ * @dev Allow a user to burn wrapped tokens and withdraw the corresponding tokenIds of the underlying tokens.
48
+ */
49
+ function withdrawTo(address account, uint256[] memory tokenIds) public virtual returns (bool) {
50
+ uint256 length = tokenIds.length;
51
+ for (uint256 i = 0; i < length; ++i) {
52
+ uint256 tokenId = tokenIds[i];
53
+ // Setting an "auth" arguments enables the `_isAuthorized` check which verifies that the token exists
54
+ // (from != 0). Therefore, it is not needed to verify that the return value is not 0 here.
55
+ _update(address(0), tokenId, _msgSender());
56
+ // Checks were already performed at this point, and there's no way to retake ownership or approval from
57
+ // the wrapped tokenId after this point, so it's safe to remove the reentrancy check for the next line.
58
+ // slither-disable-next-line reentrancy-no-eth
59
+ underlying().safeTransferFrom(address(this), account, tokenId);
60
+ }
61
+
62
+ return true;
63
+ }
64
+
65
+ /**
66
+ * @dev Overrides {IERC721Receiver-onERC721Received} to allow minting on direct ERC-721 transfers to
67
+ * this contract.
68
+ *
69
+ * In case there's data attached, it validates that the operator is this contract, so only trusted data
70
+ * is accepted from {depositFor}.
71
+ *
72
+ * WARNING: Doesn't work with unsafe transfers (eg. {IERC721-transferFrom}). Use {ERC721Wrapper-_recover}
73
+ * for recovering in that scenario.
74
+ */
75
+ function onERC721Received(address, address from, uint256 tokenId, bytes memory) public virtual returns (bytes4) {
76
+ if (address(underlying()) != _msgSender()) {
77
+ revert ERC721UnsupportedToken(_msgSender());
78
+ }
79
+ _safeMint(from, tokenId);
80
+ return IERC721Receiver.onERC721Received.selector;
81
+ }
82
+
83
+ /**
84
+ * @dev Mint a wrapped token to cover any underlyingToken that would have been transferred by mistake. Internal
85
+ * function that can be exposed with access control if desired.
86
+ */
87
+ function _recover(address account, uint256 tokenId) internal virtual returns (uint256) {
88
+ address owner = underlying().ownerOf(tokenId);
89
+ if (owner != address(this)) {
90
+ revert ERC721IncorrectOwner(address(this), tokenId, owner);
91
+ }
92
+ _safeMint(account, tokenId);
93
+ return tokenId;
94
+ }
95
+
96
+ /**
97
+ * @dev Returns the underlying token.
98
+ */
99
+ function underlying() public view virtual returns (IERC721) {
100
+ return _underlying;
101
+ }
102
+ }