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.
- package/README.md +121 -0
- package/access/AccessControl.sol +206 -0
- package/access/IAccessControl.sol +98 -0
- package/access/Ownable.sol +100 -0
- package/access/Ownable2Step.sol +67 -0
- package/access/extensions/AccessControlDefaultAdminRules.sol +372 -0
- package/access/extensions/AccessControlEnumerable.sol +81 -0
- package/access/extensions/IAccessControlDefaultAdminRules.sol +192 -0
- package/access/extensions/IAccessControlEnumerable.sol +31 -0
- package/access/manager/AccessManaged.sol +118 -0
- package/access/manager/AccessManager.sol +781 -0
- package/access/manager/AuthorityUtils.sol +36 -0
- package/access/manager/IAccessManaged.sol +32 -0
- package/access/manager/IAccessManager.sol +410 -0
- package/access/manager/IAuthority.sol +14 -0
- package/account/Account.sol +151 -0
- package/account/extensions/draft-AccountERC7579.sol +430 -0
- package/account/extensions/draft-AccountERC7579Hooked.sol +113 -0
- package/account/extensions/draft-ERC7821.sol +70 -0
- package/account/paymaster/Paymaster.sol +170 -0
- package/account/paymaster/extensions/PaymasterERC20.sol +394 -0
- package/account/paymaster/extensions/PaymasterERC20Guarantor.sol +190 -0
- package/account/paymaster/extensions/PaymasterERC721Owner.sol +54 -0
- package/account/paymaster/extensions/PaymasterSigner.sol +125 -0
- package/account/utils/EIP7702Utils.sol +25 -0
- package/account/utils/ERC4337Utils.sol +317 -0
- package/account/utils/draft-ERC7579Utils.sol +314 -0
- package/build/contracts/AbstractSigner.json +13 -0
- package/build/contracts/AccessControl.json +239 -0
- package/build/contracts/AccessControlDefaultAdminRules.json +467 -0
- package/build/contracts/AccessControlEnumerable.json +301 -0
- package/build/contracts/AccessManaged.json +104 -0
- package/build/contracts/AccessManager.json +1189 -0
- package/build/contracts/Account.json +150 -0
- package/build/contracts/AccountERC7579.json +515 -0
- package/build/contracts/AccountERC7579Hooked.json +539 -0
- package/build/contracts/Accumulators.json +13 -0
- package/build/contracts/Address.json +25 -0
- package/build/contracts/Arrays.json +13 -0
- package/build/contracts/AuthorityUtils.json +13 -0
- package/build/contracts/Base58.json +25 -0
- package/build/contracts/Base64.json +25 -0
- package/build/contracts/BeaconProxy.json +97 -0
- package/build/contracts/BitMaps.json +13 -0
- package/build/contracts/BlockHeader.json +25 -0
- package/build/contracts/Blockhash.json +13 -0
- package/build/contracts/BridgeERC1155.json +508 -0
- package/build/contracts/BridgeERC20.json +260 -0
- package/build/contracts/BridgeERC721.json +270 -0
- package/build/contracts/BridgeERC7802.json +249 -0
- package/build/contracts/BridgeFungible.json +236 -0
- package/build/contracts/BridgeMultiToken.json +236 -0
- package/build/contracts/BridgeNonFungible.json +212 -0
- package/build/contracts/Bytes.json +13 -0
- package/build/contracts/CAIP10.json +13 -0
- package/build/contracts/CAIP2.json +13 -0
- package/build/contracts/Calldata.json +13 -0
- package/build/contracts/Checkpoints.json +19 -0
- package/build/contracts/CircularBuffer.json +19 -0
- package/build/contracts/Clones.json +19 -0
- package/build/contracts/Comparators.json +13 -0
- package/build/contracts/Context.json +13 -0
- package/build/contracts/Create2.json +19 -0
- package/build/contracts/Create3.json +19 -0
- package/build/contracts/CrosschainLinked.json +145 -0
- package/build/contracts/CrosschainRemoteExecutor.json +199 -0
- package/build/contracts/DoubleEndedQueue.json +13 -0
- package/build/contracts/ECDSA.json +41 -0
- package/build/contracts/EIP712.json +79 -0
- package/build/contracts/EIP7702Utils.json +13 -0
- package/build/contracts/ERC1155.json +428 -0
- package/build/contracts/ERC1155Burnable.json +474 -0
- package/build/contracts/ERC1155Crosschain.json +796 -0
- package/build/contracts/ERC1155Holder.json +111 -0
- package/build/contracts/ERC1155Pausable.json +477 -0
- package/build/contracts/ERC1155Supply.json +479 -0
- package/build/contracts/ERC1155URIStorage.json +428 -0
- package/build/contracts/ERC1155Utils.json +13 -0
- package/build/contracts/ERC1363.json +585 -0
- package/build/contracts/ERC1363Utils.json +36 -0
- package/build/contracts/ERC165.json +33 -0
- package/build/contracts/ERC165Checker.json +13 -0
- package/build/contracts/ERC1967Clones.json +13 -0
- package/build/contracts/ERC1967Proxy.json +84 -0
- package/build/contracts/ERC1967Utils.json +52 -0
- package/build/contracts/ERC20.json +322 -0
- package/build/contracts/ERC20Bridgeable.json +427 -0
- package/build/contracts/ERC20Burnable.json +353 -0
- package/build/contracts/ERC20Capped.json +362 -0
- package/build/contracts/ERC20Crosschain.json +573 -0
- package/build/contracts/ERC20FlashMint.json +432 -0
- package/build/contracts/ERC20Pausable.json +371 -0
- package/build/contracts/ERC20Permit.json +532 -0
- package/build/contracts/ERC20TemporaryApproval.json +346 -0
- package/build/contracts/ERC20TransferAuthorization.json +836 -0
- package/build/contracts/ERC20Votes.json +781 -0
- package/build/contracts/ERC20Wrapper.json +405 -0
- package/build/contracts/ERC2771Context.json +46 -0
- package/build/contracts/ERC2771Forwarder.json +439 -0
- package/build/contracts/ERC2981.json +126 -0
- package/build/contracts/ERC3009.json +668 -0
- package/build/contracts/ERC4337Utils.json +13 -0
- package/build/contracts/ERC4626.json +807 -0
- package/build/contracts/ERC6372Utils.json +19 -0
- package/build/contracts/ERC6909.json +415 -0
- package/build/contracts/ERC6909ContentURI.json +472 -0
- package/build/contracts/ERC6909Metadata.json +529 -0
- package/build/contracts/ERC6909TokenSupply.json +434 -0
- package/build/contracts/ERC721.json +447 -0
- package/build/contracts/ERC721Burnable.json +460 -0
- package/build/contracts/ERC721Consecutive.json +509 -0
- package/build/contracts/ERC721Crosschain.json +674 -0
- package/build/contracts/ERC721Enumerable.json +524 -0
- package/build/contracts/ERC721Holder.json +48 -0
- package/build/contracts/ERC721Pausable.json +496 -0
- package/build/contracts/ERC721Royalty.json +540 -0
- package/build/contracts/ERC721URIStorage.json +479 -0
- package/build/contracts/ERC721Utils.json +13 -0
- package/build/contracts/ERC721Votes.json +835 -0
- package/build/contracts/ERC721Wrapper.json +553 -0
- package/build/contracts/ERC7579Utils.json +119 -0
- package/build/contracts/ERC7739.json +103 -0
- package/build/contracts/ERC7739Utils.json +13 -0
- package/build/contracts/ERC7786Recipient.json +59 -0
- package/build/contracts/ERC7821.json +112 -0
- package/build/contracts/ERC7913P256Verifier.json +43 -0
- package/build/contracts/ERC7913RSAVerifier.json +43 -0
- package/build/contracts/ERC7913WebAuthnVerifier.json +43 -0
- package/build/contracts/EnumerableMap.json +36 -0
- package/build/contracts/EnumerableSet.json +13 -0
- package/build/contracts/Errors.json +51 -0
- package/build/contracts/Governor.json +1381 -0
- package/build/contracts/GovernorCountingFractional.json +1455 -0
- package/build/contracts/GovernorCountingOverridable.json +1612 -0
- package/build/contracts/GovernorCountingSimple.json +1410 -0
- package/build/contracts/GovernorCrosschain.json +1409 -0
- package/build/contracts/GovernorNoncesKeyed.json +1405 -0
- package/build/contracts/GovernorPreventLateQuorum.json +1461 -0
- package/build/contracts/GovernorProposalGuardian.json +1426 -0
- package/build/contracts/GovernorSequentialProposalId.json +1399 -0
- package/build/contracts/GovernorSettings.json +1477 -0
- package/build/contracts/GovernorStorage.json +1506 -0
- package/build/contracts/GovernorSuperQuorum.json +1429 -0
- package/build/contracts/GovernorTimelockAccess.json +1582 -0
- package/build/contracts/GovernorTimelockCompound.json +1449 -0
- package/build/contracts/GovernorTimelockControl.json +1426 -0
- package/build/contracts/GovernorVotes.json +1399 -0
- package/build/contracts/GovernorVotesQuorumFraction.json +1497 -0
- package/build/contracts/GovernorVotesSuperQuorumFraction.json +1657 -0
- package/build/contracts/Hashes.json +13 -0
- package/build/contracts/Heap.json +13 -0
- package/build/contracts/IAccessControl.json +207 -0
- package/build/contracts/IAccessControlDefaultAdminRules.json +406 -0
- package/build/contracts/IAccessControlEnumerable.json +250 -0
- package/build/contracts/IAccessManaged.json +104 -0
- package/build/contracts/IAccessManager.json +1085 -0
- package/build/contracts/IAccount.json +90 -0
- package/build/contracts/IAccountExecute.json +79 -0
- package/build/contracts/IAggregator.json +211 -0
- package/build/contracts/IAuthority.json +43 -0
- package/build/contracts/IBeacon.json +27 -0
- package/build/contracts/ICompoundTimelock.json +427 -0
- package/build/contracts/IERC1155.json +307 -0
- package/build/contracts/IERC1155Errors.json +116 -0
- package/build/contracts/IERC1155MetadataURI.json +326 -0
- package/build/contracts/IERC1155Receiver.json +111 -0
- package/build/contracts/IERC1271.json +38 -0
- package/build/contracts/IERC1363.json +385 -0
- package/build/contracts/IERC1363Receiver.json +48 -0
- package/build/contracts/IERC1363Spender.json +43 -0
- package/build/contracts/IERC165.json +33 -0
- package/build/contracts/IERC1820Implementer.json +38 -0
- package/build/contracts/IERC1820Registry.json +227 -0
- package/build/contracts/IERC1822Proxiable.json +27 -0
- package/build/contracts/IERC1967.json +59 -0
- package/build/contracts/IERC20.json +197 -0
- package/build/contracts/IERC20Errors.json +100 -0
- package/build/contracts/IERC20Metadata.json +236 -0
- package/build/contracts/IERC20Permit.json +89 -0
- package/build/contracts/IERC2309.json +45 -0
- package/build/contracts/IERC2612.json +89 -0
- package/build/contracts/IERC2981.json +62 -0
- package/build/contracts/IERC3009.json +163 -0
- package/build/contracts/IERC3009Cancel.json +66 -0
- package/build/contracts/IERC3156FlashBorrower.json +53 -0
- package/build/contracts/IERC3156FlashLender.json +91 -0
- package/build/contracts/IERC4626.json +626 -0
- package/build/contracts/IERC4906.json +331 -0
- package/build/contracts/IERC5267.json +63 -0
- package/build/contracts/IERC5313.json +27 -0
- package/build/contracts/IERC5805.json +233 -0
- package/build/contracts/IERC6372.json +40 -0
- package/build/contracts/IERC6909.json +319 -0
- package/build/contracts/IERC6909ContentURI.json +351 -0
- package/build/contracts/IERC6909Metadata.json +376 -0
- package/build/contracts/IERC6909TokenSupply.json +338 -0
- package/build/contracts/IERC721.json +299 -0
- package/build/contracts/IERC721Enumerable.json +355 -0
- package/build/contracts/IERC721Errors.json +117 -0
- package/build/contracts/IERC721Metadata.json +344 -0
- package/build/contracts/IERC721Receiver.json +48 -0
- package/build/contracts/IERC7579AccountConfig.json +65 -0
- package/build/contracts/IERC7579Execution.json +56 -0
- package/build/contracts/IERC7579Hook.json +101 -0
- package/build/contracts/IERC7579Module.json +59 -0
- package/build/contracts/IERC7579ModuleConfig.json +127 -0
- package/build/contracts/IERC7579Validator.json +159 -0
- package/build/contracts/IERC7674.json +221 -0
- package/build/contracts/IERC7751.json +40 -0
- package/build/contracts/IERC777.json +405 -0
- package/build/contracts/IERC777Recipient.json +52 -0
- package/build/contracts/IERC777Sender.json +52 -0
- package/build/contracts/IERC7786GatewaySource.json +116 -0
- package/build/contracts/IERC7786Recipient.json +43 -0
- package/build/contracts/IERC7802.json +119 -0
- package/build/contracts/IERC7821.json +51 -0
- package/build/contracts/IERC7913SignatureVerifier.json +43 -0
- package/build/contracts/IEntryPoint.json +305 -0
- package/build/contracts/IEntryPointExtra.json +80 -0
- package/build/contracts/IEntryPointNonces.json +38 -0
- package/build/contracts/IEntryPointStake.json +97 -0
- package/build/contracts/IGovernor.json +1095 -0
- package/build/contracts/IPaymaster.json +123 -0
- package/build/contracts/ITransparentUpgradeableProxy.json +77 -0
- package/build/contracts/IVotes.json +207 -0
- package/build/contracts/Initializable.json +37 -0
- package/build/contracts/InteroperableAddress.json +30 -0
- package/build/contracts/LowLevelCall.json +13 -0
- package/build/contracts/Math.json +13 -0
- package/build/contracts/Memory.json +13 -0
- package/build/contracts/MerkleProof.json +19 -0
- package/build/contracts/MerkleTree.json +35 -0
- package/build/contracts/MessageHashUtils.json +19 -0
- package/build/contracts/MultiSignerERC7913.json +176 -0
- package/build/contracts/MultiSignerERC7913Weighted.json +264 -0
- package/build/contracts/Multicall.json +49 -0
- package/build/contracts/Nonces.json +49 -0
- package/build/contracts/NoncesKeyed.json +73 -0
- package/build/contracts/Ownable.json +88 -0
- package/build/contracts/Ownable2Step.json +127 -0
- package/build/contracts/P256.json +13 -0
- package/build/contracts/Packing.json +19 -0
- package/build/contracts/Panic.json +13 -0
- package/build/contracts/Pausable.json +63 -0
- package/build/contracts/Paymaster.json +147 -0
- package/build/contracts/PaymasterERC20.json +209 -0
- package/build/contracts/PaymasterERC20Guarantor.json +234 -0
- package/build/contracts/PaymasterERC721Owner.json +160 -0
- package/build/contracts/PaymasterSigner.json +212 -0
- package/build/contracts/Proxy.json +18 -0
- package/build/contracts/ProxyAdmin.json +135 -0
- package/build/contracts/RLP.json +19 -0
- package/build/contracts/RSA.json +13 -0
- package/build/contracts/RateLimiter.json +19 -0
- package/build/contracts/ReentrancyGuard.json +19 -0
- package/build/contracts/ReentrancyGuardTransient.json +19 -0
- package/build/contracts/RelayedCall.json +13 -0
- package/build/contracts/SafeCast.json +68 -0
- package/build/contracts/SafeERC20.json +46 -0
- package/build/contracts/ShortStrings.json +30 -0
- package/build/contracts/SignatureChecker.json +13 -0
- package/build/contracts/SignedMath.json +13 -0
- package/build/contracts/SignerECDSA.json +27 -0
- package/build/contracts/SignerEIP7702.json +13 -0
- package/build/contracts/SignerERC7913.json +27 -0
- package/build/contracts/SignerP256.json +48 -0
- package/build/contracts/SignerRSA.json +32 -0
- package/build/contracts/SignerWebAuthn.json +48 -0
- package/build/contracts/SimulateCall.json +13 -0
- package/build/contracts/SlotDerivation.json +13 -0
- package/build/contracts/StorageSlot.json +13 -0
- package/build/contracts/Strings.json +40 -0
- package/build/contracts/Time.json +13 -0
- package/build/contracts/TimelockController.json +1010 -0
- package/build/contracts/TransientSlot.json +13 -0
- package/build/contracts/TransparentUpgradeableProxy.json +131 -0
- package/build/contracts/TrieProof.json +25 -0
- package/build/contracts/UUPSUpgradeable.json +119 -0
- package/build/contracts/UpgradeableBeacon.json +154 -0
- package/build/contracts/VestingWallet.json +364 -0
- package/build/contracts/VestingWalletCliff.json +367 -0
- package/build/contracts/Votes.json +402 -0
- package/build/contracts/VotesExtended.json +450 -0
- package/build/contracts/WebAuthn.json +13 -0
- package/crosschain/CrosschainLinked.sol +114 -0
- package/crosschain/CrosschainRemoteExecutor.sol +99 -0
- package/crosschain/ERC7786Recipient.sol +66 -0
- package/crosschain/bridges/BridgeERC1155.sol +131 -0
- package/crosschain/bridges/BridgeERC20.sol +42 -0
- package/crosschain/bridges/BridgeERC721.sol +62 -0
- package/crosschain/bridges/BridgeERC7802.sol +34 -0
- package/crosschain/bridges/abstract/BridgeFungible.sol +86 -0
- package/crosschain/bridges/abstract/BridgeMultiToken.sol +99 -0
- package/crosschain/bridges/abstract/BridgeNonFungible.sol +79 -0
- package/finance/VestingWallet.sol +160 -0
- package/finance/VestingWalletCliff.sol +55 -0
- package/governance/Governor.sol +825 -0
- package/governance/IGovernor.sol +454 -0
- package/governance/TimelockController.sol +470 -0
- package/governance/extensions/GovernorCountingFractional.sol +190 -0
- package/governance/extensions/GovernorCountingOverridable.sol +226 -0
- package/governance/extensions/GovernorCountingSimple.sol +96 -0
- package/governance/extensions/GovernorCrosschain.sol +31 -0
- package/governance/extensions/GovernorNoncesKeyed.sol +91 -0
- package/governance/extensions/GovernorPreventLateQuorum.sol +119 -0
- package/governance/extensions/GovernorProposalGuardian.sol +59 -0
- package/governance/extensions/GovernorSequentialProposalId.sol +75 -0
- package/governance/extensions/GovernorSettings.sol +106 -0
- package/governance/extensions/GovernorStorage.sol +134 -0
- package/governance/extensions/GovernorSuperQuorum.sol +59 -0
- package/governance/extensions/GovernorTimelockAccess.sol +346 -0
- package/governance/extensions/GovernorTimelockCompound.sol +162 -0
- package/governance/extensions/GovernorTimelockControl.sol +167 -0
- package/governance/extensions/GovernorVotes.sol +64 -0
- package/governance/extensions/GovernorVotesQuorumFraction.sol +113 -0
- package/governance/extensions/GovernorVotesSuperQuorumFraction.sol +135 -0
- package/governance/utils/IVotes.sol +60 -0
- package/governance/utils/Votes.sol +245 -0
- package/governance/utils/VotesExtended.sol +85 -0
- package/interfaces/IERC1155.sol +6 -0
- package/interfaces/IERC1155MetadataURI.sol +6 -0
- package/interfaces/IERC1155Receiver.sol +6 -0
- package/interfaces/IERC1271.sol +17 -0
- package/interfaces/IERC1363.sol +86 -0
- package/interfaces/IERC1363Receiver.sol +32 -0
- package/interfaces/IERC1363Spender.sol +26 -0
- package/interfaces/IERC165.sol +6 -0
- package/interfaces/IERC1820Implementer.sol +20 -0
- package/interfaces/IERC1820Registry.sol +112 -0
- package/interfaces/IERC1967.sol +24 -0
- package/interfaces/IERC20.sol +6 -0
- package/interfaces/IERC20Metadata.sol +6 -0
- package/interfaces/IERC2309.sol +19 -0
- package/interfaces/IERC2612.sol +8 -0
- package/interfaces/IERC2981.sol +26 -0
- package/interfaces/IERC3156.sol +7 -0
- package/interfaces/IERC3156FlashBorrower.sol +27 -0
- package/interfaces/IERC3156FlashLender.sol +41 -0
- package/interfaces/IERC4337.sol +255 -0
- package/interfaces/IERC4626.sol +230 -0
- package/interfaces/IERC4906.sol +20 -0
- package/interfaces/IERC5267.sol +28 -0
- package/interfaces/IERC5313.sol +16 -0
- package/interfaces/IERC5805.sol +9 -0
- package/interfaces/IERC6093.sol +162 -0
- package/interfaces/IERC6372.sol +19 -0
- package/interfaces/IERC6909.sol +131 -0
- package/interfaces/IERC721.sol +6 -0
- package/interfaces/IERC721Enumerable.sol +6 -0
- package/interfaces/IERC721Metadata.sol +6 -0
- package/interfaces/IERC721Receiver.sol +6 -0
- package/interfaces/IERC7751.sol +12 -0
- package/interfaces/IERC777.sol +200 -0
- package/interfaces/IERC777Recipient.sol +35 -0
- package/interfaces/IERC777Sender.sol +35 -0
- package/interfaces/IERC7786.sol +64 -0
- package/interfaces/IERC7913.sol +18 -0
- package/interfaces/draft-IERC1822.sol +20 -0
- package/interfaces/draft-IERC3009.sol +87 -0
- package/interfaces/draft-IERC7579.sol +227 -0
- package/interfaces/draft-IERC7674.sol +17 -0
- package/interfaces/draft-IERC7802.sol +32 -0
- package/interfaces/draft-IERC7821.sol +44 -0
- package/metatx/ERC2771Context.sol +90 -0
- package/metatx/ERC2771Forwarder.sol +376 -0
- package/package.json +29 -1
- package/proxy/Clones.sol +294 -0
- package/proxy/ERC1967/ERC1967Clones.sol +219 -0
- package/proxy/ERC1967/ERC1967Proxy.sol +62 -0
- package/proxy/ERC1967/ERC1967Utils.sol +177 -0
- package/proxy/Proxy.sol +69 -0
- package/proxy/beacon/BeaconProxy.sol +57 -0
- package/proxy/beacon/IBeacon.sol +16 -0
- package/proxy/beacon/UpgradeableBeacon.sol +70 -0
- package/proxy/transparent/ProxyAdmin.sol +45 -0
- package/proxy/transparent/TransparentUpgradeableProxy.sol +118 -0
- package/proxy/utils/Initializable.sol +238 -0
- package/proxy/utils/UUPSUpgradeable.sol +148 -0
- package/token/ERC1155/ERC1155.sol +417 -0
- package/token/ERC1155/IERC1155.sol +123 -0
- package/token/ERC1155/IERC1155Receiver.sol +59 -0
- package/token/ERC1155/extensions/ERC1155Burnable.sol +22 -0
- package/token/ERC1155/extensions/ERC1155Crosschain.sol +87 -0
- package/token/ERC1155/extensions/ERC1155Pausable.sol +38 -0
- package/token/ERC1155/extensions/ERC1155Supply.sol +88 -0
- package/token/ERC1155/extensions/ERC1155URIStorage.sol +58 -0
- package/token/ERC1155/extensions/IERC1155MetadataURI.sol +20 -0
- package/token/ERC1155/utils/ERC1155Holder.sol +42 -0
- package/token/ERC1155/utils/ERC1155Utils.sol +88 -0
- package/token/ERC20/ERC20.sol +305 -0
- package/token/ERC20/IERC20.sol +79 -0
- package/token/ERC20/extensions/ERC1363.sol +135 -0
- package/token/ERC20/extensions/ERC20Burnable.sol +38 -0
- package/token/ERC20/extensions/ERC20Capped.sol +54 -0
- package/token/ERC20/extensions/ERC20Crosschain.sol +39 -0
- package/token/ERC20/extensions/ERC20FlashMint.sol +130 -0
- package/token/ERC20/extensions/ERC20Pausable.sol +33 -0
- package/token/ERC20/extensions/ERC20Permit.sol +77 -0
- package/token/ERC20/extensions/ERC20TransferAuthorization.sol +91 -0
- package/token/ERC20/extensions/ERC20Votes.sol +83 -0
- package/token/ERC20/extensions/ERC20Wrapper.sol +93 -0
- package/token/ERC20/extensions/ERC4626.sol +304 -0
- package/token/ERC20/extensions/IERC20Metadata.sol +26 -0
- package/token/ERC20/extensions/IERC20Permit.sol +90 -0
- package/token/ERC20/extensions/draft-ERC20Bridgeable.sol +51 -0
- package/token/ERC20/extensions/draft-ERC20TemporaryApproval.sol +119 -0
- package/token/ERC20/extensions/draft-ERC3009.sol +152 -0
- package/token/ERC20/utils/ERC1363Utils.sol +95 -0
- package/token/ERC20/utils/SafeERC20.sol +292 -0
- package/token/ERC6909/ERC6909.sol +224 -0
- package/token/ERC6909/extensions/ERC6909ContentURI.sol +59 -0
- package/token/ERC6909/extensions/ERC6909Metadata.sol +83 -0
- package/token/ERC6909/extensions/ERC6909TokenSupply.sol +41 -0
- package/token/ERC721/ERC721.sol +433 -0
- package/token/ERC721/IERC721.sol +135 -0
- package/token/ERC721/IERC721Receiver.sol +28 -0
- package/token/ERC721/extensions/ERC721Burnable.sol +26 -0
- package/token/ERC721/extensions/ERC721Consecutive.sol +176 -0
- package/token/ERC721/extensions/ERC721Crosschain.sol +38 -0
- package/token/ERC721/extensions/ERC721Enumerable.sol +165 -0
- package/token/ERC721/extensions/ERC721Pausable.sol +37 -0
- package/token/ERC721/extensions/ERC721Royalty.sol +26 -0
- package/token/ERC721/extensions/ERC721URIStorage.sol +62 -0
- package/token/ERC721/extensions/ERC721Votes.sol +47 -0
- package/token/ERC721/extensions/ERC721Wrapper.sol +102 -0
- package/token/ERC721/extensions/IERC721Enumerable.sol +29 -0
- package/token/ERC721/extensions/IERC721Metadata.sol +27 -0
- package/token/ERC721/utils/ERC721Holder.sol +26 -0
- package/token/ERC721/utils/ERC721Utils.sol +50 -0
- package/token/common/ERC2981.sol +140 -0
- package/utils/Address.sol +167 -0
- package/utils/Arrays.sol +905 -0
- package/utils/Base58.sol +240 -0
- package/utils/Base64.sol +234 -0
- package/utils/BlockHeader.sol +312 -0
- package/utils/Blockhash.sol +54 -0
- package/utils/Bytes.sol +329 -0
- package/utils/CAIP10.sol +54 -0
- package/utils/CAIP2.sol +51 -0
- package/utils/Calldata.sol +25 -0
- package/utils/Comparators.sol +19 -0
- package/utils/Context.sol +28 -0
- package/utils/Create2.sol +91 -0
- package/utils/Create3.sol +133 -0
- package/utils/ERC6372Utils.sol +53 -0
- package/utils/Errors.sol +34 -0
- package/utils/LowLevelCall.sol +127 -0
- package/utils/Memory.sol +151 -0
- package/utils/Multicall.sol +37 -0
- package/utils/Nonces.sol +47 -0
- package/utils/NoncesKeyed.sol +75 -0
- package/utils/Packing.sol +1656 -0
- package/utils/Panic.sol +57 -0
- package/utils/Pausable.sol +112 -0
- package/utils/RLP.sol +487 -0
- package/utils/RateLimiter.sol +310 -0
- package/utils/ReentrancyGuard.sol +119 -0
- package/utils/ReentrancyGuardTransient.sol +84 -0
- package/utils/RelayedCall.sol +145 -0
- package/utils/ShortStrings.sol +122 -0
- package/utils/SimulateCall.sol +114 -0
- package/utils/SlotDerivation.sol +155 -0
- package/utils/StorageSlot.sol +143 -0
- package/utils/Strings.sol +532 -0
- package/utils/TransientSlot.sol +183 -0
- package/utils/cryptography/ECDSA.sol +284 -0
- package/utils/cryptography/EIP712.sol +168 -0
- package/utils/cryptography/Hashes.sol +31 -0
- package/utils/cryptography/MerkleProof.sol +510 -0
- package/utils/cryptography/MessageHashUtils.sol +228 -0
- package/utils/cryptography/P256.sol +409 -0
- package/utils/cryptography/RSA.sol +159 -0
- package/utils/cryptography/SignatureChecker.sol +199 -0
- package/utils/cryptography/TrieProof.sol +256 -0
- package/utils/cryptography/WebAuthn.sol +269 -0
- package/utils/cryptography/draft-ERC7739Utils.sol +215 -0
- package/utils/cryptography/signers/AbstractSigner.sol +23 -0
- package/utils/cryptography/signers/MultiSignerERC7913.sol +336 -0
- package/utils/cryptography/signers/MultiSignerERC7913Weighted.sol +208 -0
- package/utils/cryptography/signers/SignerECDSA.sol +56 -0
- package/utils/cryptography/signers/SignerEIP7702.sol +25 -0
- package/utils/cryptography/signers/SignerERC7913.sol +63 -0
- package/utils/cryptography/signers/SignerP256.sol +64 -0
- package/utils/cryptography/signers/SignerRSA.sol +65 -0
- package/utils/cryptography/signers/SignerWebAuthn.sol +45 -0
- package/utils/cryptography/signers/draft-ERC7739.sol +99 -0
- package/utils/cryptography/verifiers/ERC7913P256Verifier.sol +29 -0
- package/utils/cryptography/verifiers/ERC7913RSAVerifier.sol +23 -0
- package/utils/cryptography/verifiers/ERC7913WebAuthnVerifier.sol +45 -0
- package/utils/draft-InteroperableAddress.sol +245 -0
- package/utils/introspection/ERC165.sol +25 -0
- package/utils/introspection/ERC165Checker.sol +142 -0
- package/utils/introspection/IERC165.sol +25 -0
- package/utils/math/Math.sol +763 -0
- package/utils/math/SafeCast.sol +1162 -0
- package/utils/math/SignedMath.sol +68 -0
- package/utils/structs/Accumulators.sol +135 -0
- package/utils/structs/BitMaps.sol +61 -0
- package/utils/structs/Checkpoints.sol +881 -0
- package/utils/structs/CircularBuffer.sol +152 -0
- package/utils/structs/DoubleEndedQueue.sol +280 -0
- package/utils/structs/EnumerableMap.sol +1870 -0
- package/utils/structs/EnumerableSet.sol +1177 -0
- package/utils/structs/Heap.sol +259 -0
- package/utils/structs/MerkleTree.sol +267 -0
- package/utils/types/Time.sol +133 -0
- package/vendor/compound/ICompoundTimelock.sol +86 -0
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// OpenZeppelin Contracts (last updated v5.3.0) (proxy/utils/Initializable.sol)
|
|
3
|
+
|
|
4
|
+
pragma solidity ^0.8.20;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
|
|
8
|
+
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
|
|
9
|
+
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
|
|
10
|
+
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
|
|
11
|
+
*
|
|
12
|
+
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
|
|
13
|
+
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
|
|
14
|
+
* case an upgrade adds a module that needs to be initialized.
|
|
15
|
+
*
|
|
16
|
+
* For example:
|
|
17
|
+
*
|
|
18
|
+
* [.hljs-theme-light.nopadding]
|
|
19
|
+
* ```solidity
|
|
20
|
+
* contract MyToken is ERC20Upgradeable {
|
|
21
|
+
* function initialize() initializer public {
|
|
22
|
+
* __ERC20_init("MyToken", "MTK");
|
|
23
|
+
* }
|
|
24
|
+
* }
|
|
25
|
+
*
|
|
26
|
+
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
|
|
27
|
+
* function initializeV2() reinitializer(2) public {
|
|
28
|
+
* __ERC20Permit_init("MyToken");
|
|
29
|
+
* }
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
|
|
34
|
+
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
|
|
35
|
+
*
|
|
36
|
+
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
|
|
37
|
+
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
|
|
38
|
+
*
|
|
39
|
+
* [CAUTION]
|
|
40
|
+
* ====
|
|
41
|
+
* Avoid leaving a contract uninitialized.
|
|
42
|
+
*
|
|
43
|
+
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
|
|
44
|
+
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
|
|
45
|
+
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
|
|
46
|
+
*
|
|
47
|
+
* [.hljs-theme-light.nopadding]
|
|
48
|
+
* ```
|
|
49
|
+
* /// @custom:oz-upgrades-unsafe-allow constructor
|
|
50
|
+
* constructor() {
|
|
51
|
+
* _disableInitializers();
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
* ====
|
|
55
|
+
*/
|
|
56
|
+
abstract contract Initializable {
|
|
57
|
+
/**
|
|
58
|
+
* @dev Storage of the initializable contract.
|
|
59
|
+
*
|
|
60
|
+
* It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
|
|
61
|
+
* when using with upgradeable contracts.
|
|
62
|
+
*
|
|
63
|
+
* @custom:storage-location erc7201:openzeppelin.storage.Initializable
|
|
64
|
+
*/
|
|
65
|
+
struct InitializableStorage {
|
|
66
|
+
/**
|
|
67
|
+
* @dev Indicates that the contract has been initialized.
|
|
68
|
+
*/
|
|
69
|
+
uint64 _initialized;
|
|
70
|
+
/**
|
|
71
|
+
* @dev Indicates that the contract is in the process of being initialized.
|
|
72
|
+
*/
|
|
73
|
+
bool _initializing;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
|
|
77
|
+
bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* @dev The contract is already initialized.
|
|
81
|
+
*/
|
|
82
|
+
error InvalidInitialization();
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @dev The contract is not initializing.
|
|
86
|
+
*/
|
|
87
|
+
error NotInitializing();
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @dev Triggered when the contract has been initialized or reinitialized.
|
|
91
|
+
*/
|
|
92
|
+
event Initialized(uint64 version);
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
|
|
96
|
+
* `onlyInitializing` functions can be used to initialize parent contracts.
|
|
97
|
+
*
|
|
98
|
+
* Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
|
|
99
|
+
* number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
|
|
100
|
+
* production.
|
|
101
|
+
*
|
|
102
|
+
* Emits an {Initialized} event.
|
|
103
|
+
*/
|
|
104
|
+
modifier initializer() {
|
|
105
|
+
// solhint-disable-next-line var-name-mixedcase
|
|
106
|
+
InitializableStorage storage $ = _getInitializableStorage();
|
|
107
|
+
|
|
108
|
+
// Cache values to avoid duplicated sloads
|
|
109
|
+
bool isTopLevelCall = !$._initializing;
|
|
110
|
+
uint64 initialized = $._initialized;
|
|
111
|
+
|
|
112
|
+
// Allowed calls:
|
|
113
|
+
// - initialSetup: the contract is not in the initializing state and no previous version was
|
|
114
|
+
// initialized
|
|
115
|
+
// - construction: the contract is initialized at version 1 (no reinitialization) and the
|
|
116
|
+
// current contract is just being deployed
|
|
117
|
+
bool initialSetup = initialized == 0 && isTopLevelCall;
|
|
118
|
+
bool construction = initialized == 1 && address(this).code.length == 0;
|
|
119
|
+
|
|
120
|
+
if (!initialSetup && !construction) {
|
|
121
|
+
revert InvalidInitialization();
|
|
122
|
+
}
|
|
123
|
+
$._initialized = 1;
|
|
124
|
+
if (isTopLevelCall) {
|
|
125
|
+
$._initializing = true;
|
|
126
|
+
}
|
|
127
|
+
_;
|
|
128
|
+
if (isTopLevelCall) {
|
|
129
|
+
$._initializing = false;
|
|
130
|
+
emit Initialized(1);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
|
|
136
|
+
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
|
|
137
|
+
* used to initialize parent contracts.
|
|
138
|
+
*
|
|
139
|
+
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
|
|
140
|
+
* are added through upgrades and that require initialization.
|
|
141
|
+
*
|
|
142
|
+
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
|
|
143
|
+
* cannot be nested. If one is invoked in the context of another, execution will revert.
|
|
144
|
+
*
|
|
145
|
+
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
|
|
146
|
+
* a contract, executing them in the right order is up to the developer or operator.
|
|
147
|
+
*
|
|
148
|
+
* WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
|
|
149
|
+
*
|
|
150
|
+
* Emits an {Initialized} event.
|
|
151
|
+
*/
|
|
152
|
+
modifier reinitializer(uint64 version) {
|
|
153
|
+
// solhint-disable-next-line var-name-mixedcase
|
|
154
|
+
InitializableStorage storage $ = _getInitializableStorage();
|
|
155
|
+
|
|
156
|
+
if ($._initializing || $._initialized >= version) {
|
|
157
|
+
revert InvalidInitialization();
|
|
158
|
+
}
|
|
159
|
+
$._initialized = version;
|
|
160
|
+
$._initializing = true;
|
|
161
|
+
_;
|
|
162
|
+
$._initializing = false;
|
|
163
|
+
emit Initialized(version);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
|
|
168
|
+
* {initializer} and {reinitializer} modifiers, directly or indirectly.
|
|
169
|
+
*/
|
|
170
|
+
modifier onlyInitializing() {
|
|
171
|
+
_checkInitializing();
|
|
172
|
+
_;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
|
|
177
|
+
*/
|
|
178
|
+
function _checkInitializing() internal view virtual {
|
|
179
|
+
if (!_isInitializing()) {
|
|
180
|
+
revert NotInitializing();
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
|
|
186
|
+
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
|
|
187
|
+
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
|
|
188
|
+
* through proxies.
|
|
189
|
+
*
|
|
190
|
+
* Emits an {Initialized} event the first time it is successfully executed.
|
|
191
|
+
*/
|
|
192
|
+
function _disableInitializers() internal virtual {
|
|
193
|
+
// solhint-disable-next-line var-name-mixedcase
|
|
194
|
+
InitializableStorage storage $ = _getInitializableStorage();
|
|
195
|
+
|
|
196
|
+
if ($._initializing) {
|
|
197
|
+
revert InvalidInitialization();
|
|
198
|
+
}
|
|
199
|
+
if ($._initialized != type(uint64).max) {
|
|
200
|
+
$._initialized = type(uint64).max;
|
|
201
|
+
emit Initialized(type(uint64).max);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* @dev Returns the highest version that has been initialized. See {reinitializer}.
|
|
207
|
+
*/
|
|
208
|
+
function _getInitializedVersion() internal view returns (uint64) {
|
|
209
|
+
return _getInitializableStorage()._initialized;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
|
|
214
|
+
*/
|
|
215
|
+
function _isInitializing() internal view returns (bool) {
|
|
216
|
+
return _getInitializableStorage()._initializing;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* @dev Pointer to storage slot. Allows integrators to override it with a custom storage location.
|
|
221
|
+
*
|
|
222
|
+
* NOTE: Consider following the ERC-7201 formula to derive storage locations.
|
|
223
|
+
*/
|
|
224
|
+
function _initializableStorageSlot() internal pure virtual returns (bytes32) {
|
|
225
|
+
return INITIALIZABLE_STORAGE;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* @dev Returns a pointer to the storage namespace.
|
|
230
|
+
*/
|
|
231
|
+
// solhint-disable-next-line var-name-mixedcase
|
|
232
|
+
function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
|
|
233
|
+
bytes32 slot = _initializableStorageSlot();
|
|
234
|
+
assembly {
|
|
235
|
+
$.slot := slot
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// OpenZeppelin Contracts (last updated v5.5.0) (proxy/utils/UUPSUpgradeable.sol)
|
|
3
|
+
|
|
4
|
+
pragma solidity ^0.8.22;
|
|
5
|
+
|
|
6
|
+
import {IERC1822Proxiable} from "../../interfaces/draft-IERC1822.sol";
|
|
7
|
+
import {ERC1967Utils} from "../ERC1967/ERC1967Utils.sol";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an
|
|
11
|
+
* {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy.
|
|
12
|
+
*
|
|
13
|
+
* A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is
|
|
14
|
+
* reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing
|
|
15
|
+
* `UUPSUpgradeable` with a custom implementation of upgrades.
|
|
16
|
+
*
|
|
17
|
+
* The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism.
|
|
18
|
+
*
|
|
19
|
+
* @custom:stateless
|
|
20
|
+
*/
|
|
21
|
+
abstract contract UUPSUpgradeable is IERC1822Proxiable {
|
|
22
|
+
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
|
|
23
|
+
address private immutable __self = address(this);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @dev The version of the upgrade interface of the contract. If this getter is missing, both `upgradeTo(address)`
|
|
27
|
+
* and `upgradeToAndCall(address,bytes)` are present, and `upgradeTo` must be used if no function should be called,
|
|
28
|
+
* while `upgradeToAndCall` will invoke the `receive` function if the second argument is the empty byte string.
|
|
29
|
+
* If the getter returns `"5.0.0"`, only `upgradeToAndCall(address,bytes)` is present, and the second argument must
|
|
30
|
+
* be the empty byte string if no function should be called, making it impossible to invoke the `receive` function
|
|
31
|
+
* during an upgrade.
|
|
32
|
+
*/
|
|
33
|
+
string public constant UPGRADE_INTERFACE_VERSION = "5.0.0";
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @dev The call is from an unauthorized context.
|
|
37
|
+
*/
|
|
38
|
+
error UUPSUnauthorizedCallContext();
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @dev The storage `slot` is unsupported as a UUID.
|
|
42
|
+
*/
|
|
43
|
+
error UUPSUnsupportedProxiableUUID(bytes32 slot);
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @dev Check that the execution is being performed through a delegatecall call and that the execution context is
|
|
47
|
+
* a proxy contract with an implementation (as defined in ERC-1967) pointing to self. This should only be the case
|
|
48
|
+
* for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a
|
|
49
|
+
* function through ERC-1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to
|
|
50
|
+
* fail.
|
|
51
|
+
*/
|
|
52
|
+
modifier onlyProxy() {
|
|
53
|
+
_checkProxy();
|
|
54
|
+
_;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @dev Check that the execution is not being performed through a delegate call. This allows a function to be
|
|
59
|
+
* callable on the implementing contract but not through proxies.
|
|
60
|
+
*/
|
|
61
|
+
modifier notDelegated() {
|
|
62
|
+
_checkNotDelegated();
|
|
63
|
+
_;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @dev Implementation of the ERC-1822 {proxiableUUID} function. This returns the storage slot used by the
|
|
68
|
+
* implementation. It is used to validate the implementation's compatibility when performing an upgrade.
|
|
69
|
+
*
|
|
70
|
+
* IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
|
|
71
|
+
* bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
|
|
72
|
+
* function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier.
|
|
73
|
+
*/
|
|
74
|
+
function proxiableUUID() external view notDelegated returns (bytes32) {
|
|
75
|
+
return ERC1967Utils.IMPLEMENTATION_SLOT;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call
|
|
80
|
+
* encoded in `data`.
|
|
81
|
+
*
|
|
82
|
+
* Calls {_authorizeUpgrade}.
|
|
83
|
+
*
|
|
84
|
+
* Emits an {Upgraded} event.
|
|
85
|
+
*
|
|
86
|
+
* @custom:oz-upgrades-unsafe-allow-reachable delegatecall
|
|
87
|
+
*/
|
|
88
|
+
function upgradeToAndCall(address newImplementation, bytes memory data) public payable virtual onlyProxy {
|
|
89
|
+
_authorizeUpgrade(newImplementation);
|
|
90
|
+
_upgradeToAndCallUUPS(newImplementation, data);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @dev Reverts if the execution is not performed via delegatecall or the execution
|
|
95
|
+
* context is not of a proxy with an ERC-1967 compliant implementation pointing to self.
|
|
96
|
+
*/
|
|
97
|
+
function _checkProxy() internal view virtual {
|
|
98
|
+
if (
|
|
99
|
+
address(this) == __self || // Must be called through delegatecall
|
|
100
|
+
ERC1967Utils.getImplementation() != __self // Must be called through an active proxy
|
|
101
|
+
) {
|
|
102
|
+
revert UUPSUnauthorizedCallContext();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @dev Reverts if the execution is performed via delegatecall.
|
|
108
|
+
* See {notDelegated}.
|
|
109
|
+
*/
|
|
110
|
+
function _checkNotDelegated() internal view virtual {
|
|
111
|
+
if (address(this) != __self) {
|
|
112
|
+
// Must not be called through delegatecall
|
|
113
|
+
revert UUPSUnauthorizedCallContext();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by
|
|
119
|
+
* {upgradeToAndCall}.
|
|
120
|
+
*
|
|
121
|
+
* Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}.
|
|
122
|
+
*
|
|
123
|
+
* ```solidity
|
|
124
|
+
* function _authorizeUpgrade(address) internal onlyOwner {}
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
function _authorizeUpgrade(address newImplementation) internal virtual;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* @dev Performs an implementation upgrade with a security check for UUPS proxies, and additional setup call.
|
|
131
|
+
*
|
|
132
|
+
* As a security check, {proxiableUUID} is invoked in the new implementation, and the return value
|
|
133
|
+
* is expected to be the implementation slot in ERC-1967.
|
|
134
|
+
*
|
|
135
|
+
* Emits an {IERC1967-Upgraded} event.
|
|
136
|
+
*/
|
|
137
|
+
function _upgradeToAndCallUUPS(address newImplementation, bytes memory data) private {
|
|
138
|
+
try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {
|
|
139
|
+
if (slot != ERC1967Utils.IMPLEMENTATION_SLOT) {
|
|
140
|
+
revert UUPSUnsupportedProxiableUUID(slot);
|
|
141
|
+
}
|
|
142
|
+
ERC1967Utils.upgradeToAndCall(newImplementation, data);
|
|
143
|
+
} catch {
|
|
144
|
+
// The implementation is not UUPS
|
|
145
|
+
revert ERC1967Utils.ERC1967InvalidImplementation(newImplementation);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|