web3gbit-cli 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/--broadcast +0 -0
- package/--private-key +0 -0
- package/--rpc-url +0 -0
- package/.github/workflows/test.yml +38 -0
- package/.gitmodules +3 -0
- package/GbitToken_flat.sol +2 -0
- package/GbitToken_flat.solnpx +0 -0
- package/README.md +72 -0
- package/admin-cli.js +413 -0
- package/cache/solidity-files-cache.json +1 -0
- package/foundry.lock +8 -0
- package/foundry.toml +6 -0
- package/lib/forge-std/.gitattributes +1 -0
- package/lib/forge-std/.github/CODEOWNERS +1 -0
- package/lib/forge-std/.github/dependabot.yml +6 -0
- package/lib/forge-std/.github/workflows/ci.yml +125 -0
- package/lib/forge-std/.github/workflows/sync.yml +36 -0
- package/lib/forge-std/CONTRIBUTING.md +193 -0
- package/lib/forge-std/LICENSE-APACHE +203 -0
- package/lib/forge-std/LICENSE-MIT +25 -0
- package/lib/forge-std/README.md +268 -0
- package/lib/forge-std/RELEASE_CHECKLIST.md +12 -0
- package/lib/forge-std/foundry.toml +18 -0
- package/lib/forge-std/package.json +16 -0
- package/lib/forge-std/scripts/vm.py +636 -0
- package/lib/forge-std/src/Base.sol +48 -0
- package/lib/forge-std/src/Config.sol +60 -0
- package/lib/forge-std/src/LibVariable.sol +477 -0
- package/lib/forge-std/src/Script.sol +28 -0
- package/lib/forge-std/src/StdAssertions.sol +779 -0
- package/lib/forge-std/src/StdChains.sol +295 -0
- package/lib/forge-std/src/StdCheats.sol +825 -0
- package/lib/forge-std/src/StdConfig.sol +632 -0
- package/lib/forge-std/src/StdConstants.sol +30 -0
- package/lib/forge-std/src/StdError.sol +15 -0
- package/lib/forge-std/src/StdInvariant.sol +120 -0
- package/lib/forge-std/src/StdJson.sol +275 -0
- package/lib/forge-std/src/StdMath.sol +47 -0
- package/lib/forge-std/src/StdStorage.sol +475 -0
- package/lib/forge-std/src/StdStyle.sol +333 -0
- package/lib/forge-std/src/StdToml.sol +275 -0
- package/lib/forge-std/src/StdUtils.sol +200 -0
- package/lib/forge-std/src/Test.sol +32 -0
- package/lib/forge-std/src/Vm.sol +2500 -0
- package/lib/forge-std/src/console.sol +1551 -0
- package/lib/forge-std/src/console2.sol +4 -0
- package/lib/forge-std/src/interfaces/IERC1155.sol +105 -0
- package/lib/forge-std/src/interfaces/IERC165.sol +12 -0
- package/lib/forge-std/src/interfaces/IERC20.sol +43 -0
- package/lib/forge-std/src/interfaces/IERC4626.sol +190 -0
- package/lib/forge-std/src/interfaces/IERC6909.sol +72 -0
- package/lib/forge-std/src/interfaces/IERC721.sol +164 -0
- package/lib/forge-std/src/interfaces/IERC7540.sol +144 -0
- package/lib/forge-std/src/interfaces/IERC7575.sol +241 -0
- package/lib/forge-std/src/interfaces/IMulticall3.sol +68 -0
- package/lib/forge-std/src/safeconsole.sol +13248 -0
- package/lib/forge-std/test/CommonBase.t.sol +44 -0
- package/lib/forge-std/test/Config.t.sol +381 -0
- package/lib/forge-std/test/LibVariable.t.sol +452 -0
- package/lib/forge-std/test/StdAssertions.t.sol +141 -0
- package/lib/forge-std/test/StdChains.t.sol +227 -0
- package/lib/forge-std/test/StdCheats.t.sol +638 -0
- package/lib/forge-std/test/StdConstants.t.sol +38 -0
- package/lib/forge-std/test/StdError.t.sol +119 -0
- package/lib/forge-std/test/StdJson.t.sol +49 -0
- package/lib/forge-std/test/StdMath.t.sol +202 -0
- package/lib/forge-std/test/StdStorage.t.sol +485 -0
- package/lib/forge-std/test/StdStyle.t.sol +110 -0
- package/lib/forge-std/test/StdToml.t.sol +49 -0
- package/lib/forge-std/test/StdUtils.t.sol +342 -0
- package/lib/forge-std/test/Vm.t.sol +18 -0
- package/lib/forge-std/test/compilation/CompilationScript.sol +8 -0
- package/lib/forge-std/test/compilation/CompilationScriptBase.sol +8 -0
- package/lib/forge-std/test/compilation/CompilationTest.sol +8 -0
- package/lib/forge-std/test/compilation/CompilationTestBase.sol +8 -0
- package/lib/forge-std/test/fixtures/broadcast.log.json +187 -0
- package/lib/forge-std/test/fixtures/config.toml +81 -0
- package/lib/forge-std/test/fixtures/test.json +8 -0
- package/lib/forge-std/test/fixtures/test.toml +6 -0
- package/lib/openzeppelin-contracts/.changeset/blue-mirrors-agree.md +5 -0
- package/lib/openzeppelin-contracts/.changeset/bright-webs-create.md +5 -0
- package/lib/openzeppelin-contracts/.changeset/clean-worlds-end.md +5 -0
- package/lib/openzeppelin-contracts/.changeset/config.json +12 -0
- package/lib/openzeppelin-contracts/.changeset/curly-pandas-flow.md +5 -0
- package/lib/openzeppelin-contracts/.changeset/flat-ideas-count.md +5 -0
- package/lib/openzeppelin-contracts/.changeset/fluffy-facts-brake.md +5 -0
- package/lib/openzeppelin-contracts/.changeset/forty-ads-design.md +5 -0
- package/lib/openzeppelin-contracts/.changeset/full-emus-hear.md +5 -0
- package/lib/openzeppelin-contracts/.changeset/fuzzy-lizards-do.md +5 -0
- package/lib/openzeppelin-contracts/.changeset/grumpy-cats-brake.md +5 -0
- package/lib/openzeppelin-contracts/.changeset/khaki-crews-join.md +5 -0
- package/lib/openzeppelin-contracts/.changeset/new-socks-deny.md +5 -0
- package/lib/openzeppelin-contracts/.changeset/shaky-phones-mix.md +5 -0
- package/lib/openzeppelin-contracts/.changeset/social-tools-sniff.md +5 -0
- package/lib/openzeppelin-contracts/.changeset/spotty-plums-brush.md +5 -0
- package/lib/openzeppelin-contracts/.changeset/stale-lizards-cheat.md +5 -0
- package/lib/openzeppelin-contracts/.changeset/swift-planets-juggle.md +5 -0
- package/lib/openzeppelin-contracts/.changeset/tame-monkeys-make.md +5 -0
- package/lib/openzeppelin-contracts/.changeset/tender-pans-yawn.md +5 -0
- package/lib/openzeppelin-contracts/.changeset/thick-banks-relate.md +5 -0
- package/lib/openzeppelin-contracts/.changeset/vast-worlds-pull.md +5 -0
- package/lib/openzeppelin-contracts/.changeset/whole-turkeys-swim.md +5 -0
- package/lib/openzeppelin-contracts/.changeset/yellow-clowns-mate.md +5 -0
- package/lib/openzeppelin-contracts/.changeset/young-corners-help.md +5 -0
- package/lib/openzeppelin-contracts/.codecov.yml +16 -0
- package/lib/openzeppelin-contracts/.editorconfig +21 -0
- package/lib/openzeppelin-contracts/.gitattributes +3 -0
- package/lib/openzeppelin-contracts/.github/CODEOWNERS +10 -0
- package/lib/openzeppelin-contracts/.github/ISSUE_TEMPLATE/bug_report.md +21 -0
- package/lib/openzeppelin-contracts/.github/ISSUE_TEMPLATE/config.yml +4 -0
- package/lib/openzeppelin-contracts/.github/ISSUE_TEMPLATE/feature_request.md +14 -0
- package/lib/openzeppelin-contracts/.github/PULL_REQUEST_TEMPLATE.md +20 -0
- package/lib/openzeppelin-contracts/.github/actions/gas-compare/action.yml +51 -0
- package/lib/openzeppelin-contracts/.github/actions/setup/action.yml +108 -0
- package/lib/openzeppelin-contracts/.github/actions/storage-layout/action.yml +57 -0
- package/lib/openzeppelin-contracts/.github/workflows/actionlint.yml +18 -0
- package/lib/openzeppelin-contracts/.github/workflows/changeset.yml +28 -0
- package/lib/openzeppelin-contracts/.github/workflows/checks.yml +132 -0
- package/lib/openzeppelin-contracts/.github/workflows/docs.yml +19 -0
- package/lib/openzeppelin-contracts/.github/workflows/formal-verification.yml +63 -0
- package/lib/openzeppelin-contracts/.github/workflows/release-cycle.yml +212 -0
- package/lib/openzeppelin-contracts/.github/workflows/release-upgradeable.yml +95 -0
- package/lib/openzeppelin-contracts/.github/workflows/upgradeable.yml +35 -0
- package/lib/openzeppelin-contracts/.gitmodules +10 -0
- package/lib/openzeppelin-contracts/.husky/pre-commit +2 -0
- package/lib/openzeppelin-contracts/.mocharc.js +4 -0
- package/lib/openzeppelin-contracts/.prettierrc +15 -0
- package/lib/openzeppelin-contracts/.solcover.js +21 -0
- package/lib/openzeppelin-contracts/CHANGELOG.md +1364 -0
- package/lib/openzeppelin-contracts/CODE_OF_CONDUCT.md +73 -0
- package/lib/openzeppelin-contracts/CONTRIBUTING.md +36 -0
- package/lib/openzeppelin-contracts/FUNDING.json +10 -0
- package/lib/openzeppelin-contracts/GUIDELINES.md +170 -0
- package/lib/openzeppelin-contracts/LICENSE +22 -0
- package/lib/openzeppelin-contracts/README.md +122 -0
- package/lib/openzeppelin-contracts/RELEASING.md +45 -0
- package/lib/openzeppelin-contracts/SECURITY.md +43 -0
- package/lib/openzeppelin-contracts/audits/2017-03.md +292 -0
- package/lib/openzeppelin-contracts/audits/2018-10.pdf +0 -0
- package/lib/openzeppelin-contracts/audits/2022-10-Checkpoints.pdf +0 -0
- package/lib/openzeppelin-contracts/audits/2022-10-ERC4626.pdf +0 -0
- package/lib/openzeppelin-contracts/audits/2023-05-v4.9.pdf +0 -0
- package/lib/openzeppelin-contracts/audits/2023-10-v5.0.pdf +0 -0
- package/lib/openzeppelin-contracts/audits/2024-10-v5.1.pdf +0 -0
- package/lib/openzeppelin-contracts/audits/2024-12-v5.2.pdf +0 -0
- package/lib/openzeppelin-contracts/audits/2025-04-v5.3.pdf +0 -0
- package/lib/openzeppelin-contracts/audits/2025-07-v5.4.pdf +0 -0
- package/lib/openzeppelin-contracts/audits/2025-10-v5.5.pdf +0 -0
- package/lib/openzeppelin-contracts/audits/README.md +22 -0
- package/lib/openzeppelin-contracts/contracts/access/AccessControl.sol +207 -0
- package/lib/openzeppelin-contracts/contracts/access/IAccessControl.sol +98 -0
- package/lib/openzeppelin-contracts/contracts/access/Ownable.sol +100 -0
- package/lib/openzeppelin-contracts/contracts/access/Ownable2Step.sol +67 -0
- package/lib/openzeppelin-contracts/contracts/access/README.adoc +45 -0
- package/lib/openzeppelin-contracts/contracts/access/extensions/AccessControlDefaultAdminRules.sol +372 -0
- package/lib/openzeppelin-contracts/contracts/access/extensions/AccessControlEnumerable.sol +81 -0
- package/lib/openzeppelin-contracts/contracts/access/extensions/IAccessControlDefaultAdminRules.sol +192 -0
- package/lib/openzeppelin-contracts/contracts/access/extensions/IAccessControlEnumerable.sol +31 -0
- package/lib/openzeppelin-contracts/contracts/access/manager/AccessManaged.sol +112 -0
- package/lib/openzeppelin-contracts/contracts/access/manager/AccessManager.sol +741 -0
- package/lib/openzeppelin-contracts/contracts/access/manager/AuthorityUtils.sol +36 -0
- package/lib/openzeppelin-contracts/contracts/access/manager/IAccessManaged.sol +32 -0
- package/lib/openzeppelin-contracts/contracts/access/manager/IAccessManager.sol +403 -0
- package/lib/openzeppelin-contracts/contracts/access/manager/IAuthority.sol +14 -0
- package/lib/openzeppelin-contracts/contracts/account/Account.sol +151 -0
- package/lib/openzeppelin-contracts/contracts/account/README.adoc +30 -0
- package/lib/openzeppelin-contracts/contracts/account/extensions/draft-AccountERC7579.sol +420 -0
- package/lib/openzeppelin-contracts/contracts/account/extensions/draft-AccountERC7579Hooked.sol +107 -0
- package/lib/openzeppelin-contracts/contracts/account/extensions/draft-ERC7821.sol +70 -0
- package/lib/openzeppelin-contracts/contracts/account/utils/EIP7702Utils.sol +21 -0
- package/lib/openzeppelin-contracts/contracts/account/utils/draft-ERC4337Utils.sol +279 -0
- package/lib/openzeppelin-contracts/contracts/account/utils/draft-ERC7579Utils.sol +280 -0
- package/lib/openzeppelin-contracts/contracts/crosschain/CrosschainLinked.sol +108 -0
- package/lib/openzeppelin-contracts/contracts/crosschain/ERC7786Recipient.sol +70 -0
- package/lib/openzeppelin-contracts/contracts/crosschain/README.adoc +29 -0
- package/lib/openzeppelin-contracts/contracts/crosschain/bridges/BridgeERC20.sol +36 -0
- package/lib/openzeppelin-contracts/contracts/crosschain/bridges/BridgeERC20Core.sol +79 -0
- package/lib/openzeppelin-contracts/contracts/crosschain/bridges/BridgeERC7802.sol +33 -0
- package/lib/openzeppelin-contracts/contracts/finance/README.adoc +14 -0
- package/lib/openzeppelin-contracts/contracts/finance/VestingWallet.sol +160 -0
- package/lib/openzeppelin-contracts/contracts/finance/VestingWalletCliff.sol +54 -0
- package/lib/openzeppelin-contracts/contracts/governance/Governor.sol +819 -0
- package/lib/openzeppelin-contracts/contracts/governance/IGovernor.sol +454 -0
- package/lib/openzeppelin-contracts/contracts/governance/README.adoc +197 -0
- package/lib/openzeppelin-contracts/contracts/governance/TimelockController.sol +470 -0
- package/lib/openzeppelin-contracts/contracts/governance/extensions/GovernorCountingFractional.sol +190 -0
- package/lib/openzeppelin-contracts/contracts/governance/extensions/GovernorCountingOverridable.sol +222 -0
- package/lib/openzeppelin-contracts/contracts/governance/extensions/GovernorCountingSimple.sol +96 -0
- package/lib/openzeppelin-contracts/contracts/governance/extensions/GovernorNoncesKeyed.sol +91 -0
- package/lib/openzeppelin-contracts/contracts/governance/extensions/GovernorPreventLateQuorum.sol +92 -0
- package/lib/openzeppelin-contracts/contracts/governance/extensions/GovernorProposalGuardian.sol +59 -0
- package/lib/openzeppelin-contracts/contracts/governance/extensions/GovernorSequentialProposalId.sol +75 -0
- package/lib/openzeppelin-contracts/contracts/governance/extensions/GovernorSettings.sol +106 -0
- package/lib/openzeppelin-contracts/contracts/governance/extensions/GovernorStorage.sol +134 -0
- package/lib/openzeppelin-contracts/contracts/governance/extensions/GovernorSuperQuorum.sol +59 -0
- package/lib/openzeppelin-contracts/contracts/governance/extensions/GovernorTimelockAccess.sol +346 -0
- package/lib/openzeppelin-contracts/contracts/governance/extensions/GovernorTimelockCompound.sol +165 -0
- package/lib/openzeppelin-contracts/contracts/governance/extensions/GovernorTimelockControl.sol +167 -0
- package/lib/openzeppelin-contracts/contracts/governance/extensions/GovernorVotes.sol +63 -0
- package/lib/openzeppelin-contracts/contracts/governance/extensions/GovernorVotesQuorumFraction.sol +113 -0
- package/lib/openzeppelin-contracts/contracts/governance/extensions/GovernorVotesSuperQuorumFraction.sol +135 -0
- package/lib/openzeppelin-contracts/contracts/governance/utils/IVotes.sol +60 -0
- package/lib/openzeppelin-contracts/contracts/governance/utils/Votes.sol +253 -0
- package/lib/openzeppelin-contracts/contracts/governance/utils/VotesExtended.sol +85 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC1155.sol +6 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC1155MetadataURI.sol +6 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC1155Receiver.sol +6 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC1271.sol +17 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC1363.sol +86 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC1363Receiver.sol +32 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC1363Spender.sol +26 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC165.sol +6 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC1820Implementer.sol +20 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC1820Registry.sol +112 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC1967.sol +24 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC20.sol +6 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC20Metadata.sol +6 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC2309.sol +19 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC2612.sol +8 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC2981.sol +26 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC3156.sol +7 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC3156FlashBorrower.sol +27 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC3156FlashLender.sol +41 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC4626.sol +230 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC4906.sol +20 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC5267.sol +28 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC5313.sol +16 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC5805.sol +9 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC6372.sol +17 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC6909.sol +125 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC721.sol +6 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC721Enumerable.sol +6 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC721Metadata.sol +6 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC721Receiver.sol +6 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC7751.sol +12 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC777.sol +200 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC777Recipient.sol +35 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC777Sender.sol +35 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/IERC7913.sol +18 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/README.adoc +138 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/draft-IERC1822.sol +20 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/draft-IERC4337.sol +255 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/draft-IERC6093.sol +162 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/draft-IERC7579.sol +227 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/draft-IERC7674.sol +17 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/draft-IERC7786.sol +64 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/draft-IERC7802.sol +32 -0
- package/lib/openzeppelin-contracts/contracts/interfaces/draft-IERC7821.sol +44 -0
- package/lib/openzeppelin-contracts/contracts/metatx/ERC2771Context.sol +90 -0
- package/lib/openzeppelin-contracts/contracts/metatx/ERC2771Forwarder.sol +372 -0
- package/lib/openzeppelin-contracts/contracts/metatx/README.adoc +17 -0
- package/lib/openzeppelin-contracts/contracts/mocks/AccessManagedTarget.sol +34 -0
- package/lib/openzeppelin-contracts/contracts/mocks/AccessManagerMock.sol +20 -0
- package/lib/openzeppelin-contracts/contracts/mocks/ArraysMock.sol +171 -0
- package/lib/openzeppelin-contracts/contracts/mocks/AuthorityMock.sol +69 -0
- package/lib/openzeppelin-contracts/contracts/mocks/Base64Dirty.sol +19 -0
- package/lib/openzeppelin-contracts/contracts/mocks/BatchCaller.sol +20 -0
- package/lib/openzeppelin-contracts/contracts/mocks/CallReceiverMock.sol +106 -0
- package/lib/openzeppelin-contracts/contracts/mocks/ConstructorMock.sol +34 -0
- package/lib/openzeppelin-contracts/contracts/mocks/ContextMock.sol +35 -0
- package/lib/openzeppelin-contracts/contracts/mocks/DummyImplementation.sol +61 -0
- package/lib/openzeppelin-contracts/contracts/mocks/EIP712Verifier.sol +16 -0
- package/lib/openzeppelin-contracts/contracts/mocks/ERC1271WalletMock.sol +24 -0
- package/lib/openzeppelin-contracts/contracts/mocks/ERC165Mock.sol +100 -0
- package/lib/openzeppelin-contracts/contracts/mocks/ERC2771ContextMock.sol +28 -0
- package/lib/openzeppelin-contracts/contracts/mocks/ERC3156FlashBorrowerMock.sol +53 -0
- package/lib/openzeppelin-contracts/contracts/mocks/EtherReceiverMock.sol +17 -0
- package/lib/openzeppelin-contracts/contracts/mocks/InitializableMock.sol +130 -0
- package/lib/openzeppelin-contracts/contracts/mocks/MerkleProofCustomHashMock.sol +62 -0
- package/lib/openzeppelin-contracts/contracts/mocks/MerkleTreeMock.sol +52 -0
- package/lib/openzeppelin-contracts/contracts/mocks/MulticallHelper.sol +23 -0
- package/lib/openzeppelin-contracts/contracts/mocks/MultipleInheritanceInitializableMocks.sol +131 -0
- package/lib/openzeppelin-contracts/contracts/mocks/PausableMock.sol +31 -0
- package/lib/openzeppelin-contracts/contracts/mocks/ReentrancyAttack.sol +17 -0
- package/lib/openzeppelin-contracts/contracts/mocks/ReentrancyMock.sol +59 -0
- package/lib/openzeppelin-contracts/contracts/mocks/ReentrancyTransientMock.sol +59 -0
- package/lib/openzeppelin-contracts/contracts/mocks/RegressionImplementation.sol +61 -0
- package/lib/openzeppelin-contracts/contracts/mocks/SingleInheritanceInitializableMocks.sol +49 -0
- package/lib/openzeppelin-contracts/contracts/mocks/Stateless.sol +62 -0
- package/lib/openzeppelin-contracts/contracts/mocks/StorageSlotMock.sol +87 -0
- package/lib/openzeppelin-contracts/contracts/mocks/TimelockReentrant.sol +26 -0
- package/lib/openzeppelin-contracts/contracts/mocks/TransientSlotMock.sol +61 -0
- package/lib/openzeppelin-contracts/contracts/mocks/UpgradeableBeaconMock.sol +27 -0
- package/lib/openzeppelin-contracts/contracts/mocks/VotesExtendedMock.sol +42 -0
- package/lib/openzeppelin-contracts/contracts/mocks/VotesMock.sol +42 -0
- package/lib/openzeppelin-contracts/contracts/mocks/account/AccountMock.sol +181 -0
- package/lib/openzeppelin-contracts/contracts/mocks/account/modules/ERC7579Mock.sol +128 -0
- package/lib/openzeppelin-contracts/contracts/mocks/account/utils/ERC7579UtilsMock.sol +23 -0
- package/lib/openzeppelin-contracts/contracts/mocks/compound/CompTimelock.sol +174 -0
- package/lib/openzeppelin-contracts/contracts/mocks/crosschain/ERC7786GatewayMock.sol +56 -0
- package/lib/openzeppelin-contracts/contracts/mocks/crosschain/ERC7786RecipientMock.sol +31 -0
- package/lib/openzeppelin-contracts/contracts/mocks/docs/AccessManagerEnumerable.sol +161 -0
- package/lib/openzeppelin-contracts/contracts/mocks/docs/ERC20WithAutoMinerReward.sol +22 -0
- package/lib/openzeppelin-contracts/contracts/mocks/docs/ERC4626Fees.sol +109 -0
- package/lib/openzeppelin-contracts/contracts/mocks/docs/MyNFT.sol +9 -0
- package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintBase.sol +25 -0
- package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintMissing.sol +24 -0
- package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlERC20MintOnlyRole.sol +23 -0
- package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessControlModified.sol +14 -0
- package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/AccessManagedERC20MintBase.sol +16 -0
- package/lib/openzeppelin-contracts/contracts/mocks/docs/access-control/MyContractOwnable.sol +17 -0
- package/lib/openzeppelin-contracts/contracts/mocks/docs/account/MyAccountEIP7702.sol +20 -0
- package/lib/openzeppelin-contracts/contracts/mocks/docs/account/MyFactoryAccount.sol +37 -0
- package/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyGovernor.sol +80 -0
- package/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyToken.sol +21 -0
- package/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyTokenTimestampBased.sol +32 -0
- package/lib/openzeppelin-contracts/contracts/mocks/docs/governance/MyTokenWrapped.sol +28 -0
- package/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC1155/GameItems.sol +21 -0
- package/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC1155/MyERC115HolderContract.sol +7 -0
- package/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC20/GLDToken.sol +11 -0
- package/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC6909/ERC6909GameItems.sol +26 -0
- package/lib/openzeppelin-contracts/contracts/mocks/docs/token/ERC721/GameItem.sol +19 -0
- package/lib/openzeppelin-contracts/contracts/mocks/docs/utilities/Base64NFT.sol +27 -0
- package/lib/openzeppelin-contracts/contracts/mocks/docs/utilities/Multicall.sol +15 -0
- package/lib/openzeppelin-contracts/contracts/mocks/governance/GovernorCountingOverridableMock.sol +18 -0
- package/lib/openzeppelin-contracts/contracts/mocks/governance/GovernorFractionalMock.sol +14 -0
- package/lib/openzeppelin-contracts/contracts/mocks/governance/GovernorMock.sol +14 -0
- package/lib/openzeppelin-contracts/contracts/mocks/governance/GovernorNoncesKeyedMock.sol +44 -0
- package/lib/openzeppelin-contracts/contracts/mocks/governance/GovernorPreventLateQuorumMock.sol +40 -0
- package/lib/openzeppelin-contracts/contracts/mocks/governance/GovernorProposalGuardianMock.sol +27 -0
- package/lib/openzeppelin-contracts/contracts/mocks/governance/GovernorSequentialProposalIdMock.sol +39 -0
- package/lib/openzeppelin-contracts/contracts/mocks/governance/GovernorStorageMock.sol +79 -0
- package/lib/openzeppelin-contracts/contracts/mocks/governance/GovernorSuperQuorumMock.sol +95 -0
- package/lib/openzeppelin-contracts/contracts/mocks/governance/GovernorTimelockAccessMock.sol +70 -0
- package/lib/openzeppelin-contracts/contracts/mocks/governance/GovernorTimelockCompoundMock.sol +69 -0
- package/lib/openzeppelin-contracts/contracts/mocks/governance/GovernorTimelockControlMock.sol +69 -0
- package/lib/openzeppelin-contracts/contracts/mocks/governance/GovernorVoteMock.sol +20 -0
- package/lib/openzeppelin-contracts/contracts/mocks/governance/GovernorVotesSuperQuorumFractionMock.sol +37 -0
- package/lib/openzeppelin-contracts/contracts/mocks/governance/GovernorWithParamsMock.sol +51 -0
- package/lib/openzeppelin-contracts/contracts/mocks/proxy/BadBeacon.sol +11 -0
- package/lib/openzeppelin-contracts/contracts/mocks/proxy/ClashingImplementation.sol +19 -0
- package/lib/openzeppelin-contracts/contracts/mocks/proxy/ERC1967ProxyUnsafe.sol +13 -0
- package/lib/openzeppelin-contracts/contracts/mocks/proxy/UUPSUpgradeableMock.sol +35 -0
- package/lib/openzeppelin-contracts/contracts/mocks/token/ERC1155ReceiverMock.sol +74 -0
- package/lib/openzeppelin-contracts/contracts/mocks/token/ERC1363ForceApproveMock.sol +13 -0
- package/lib/openzeppelin-contracts/contracts/mocks/token/ERC1363NoReturnMock.sol +33 -0
- package/lib/openzeppelin-contracts/contracts/mocks/token/ERC1363ReceiverMock.sol +52 -0
- package/lib/openzeppelin-contracts/contracts/mocks/token/ERC1363ReturnFalseMock.sol +34 -0
- package/lib/openzeppelin-contracts/contracts/mocks/token/ERC1363SpenderMock.sol +47 -0
- package/lib/openzeppelin-contracts/contracts/mocks/token/ERC20ApprovalMock.sol +10 -0
- package/lib/openzeppelin-contracts/contracts/mocks/token/ERC20BridgeableMock.sol +30 -0
- package/lib/openzeppelin-contracts/contracts/mocks/token/ERC20DecimalsMock.sol +17 -0
- package/lib/openzeppelin-contracts/contracts/mocks/token/ERC20ExcessDecimalsMock.sol +9 -0
- package/lib/openzeppelin-contracts/contracts/mocks/token/ERC20FlashMintMock.sol +26 -0
- package/lib/openzeppelin-contracts/contracts/mocks/token/ERC20ForceApproveMock.sol +13 -0
- package/lib/openzeppelin-contracts/contracts/mocks/token/ERC20GetterHelper.sol +38 -0
- package/lib/openzeppelin-contracts/contracts/mocks/token/ERC20Mock.sol +16 -0
- package/lib/openzeppelin-contracts/contracts/mocks/token/ERC20MulticallMock.sol +8 -0
- package/lib/openzeppelin-contracts/contracts/mocks/token/ERC20NoReturnMock.sol +30 -0
- package/lib/openzeppelin-contracts/contracts/mocks/token/ERC20Reentrant.sol +39 -0
- package/lib/openzeppelin-contracts/contracts/mocks/token/ERC20ReturnFalseMock.sol +19 -0
- package/lib/openzeppelin-contracts/contracts/mocks/token/ERC20VotesAdditionalCheckpointsMock.sol +31 -0
- package/lib/openzeppelin-contracts/contracts/mocks/token/ERC20VotesLegacyMock.sol +253 -0
- package/lib/openzeppelin-contracts/contracts/mocks/token/ERC20VotesTimestampMock.sol +29 -0
- package/lib/openzeppelin-contracts/contracts/mocks/token/ERC4626LimitsMock.sol +23 -0
- package/lib/openzeppelin-contracts/contracts/mocks/token/ERC4626Mock.sol +17 -0
- package/lib/openzeppelin-contracts/contracts/mocks/token/ERC4626OffsetMock.sol +17 -0
- package/lib/openzeppelin-contracts/contracts/mocks/token/ERC4646FeesMock.sol +40 -0
- package/lib/openzeppelin-contracts/contracts/mocks/token/ERC721ConsecutiveEnumerableMock.sol +42 -0
- package/lib/openzeppelin-contracts/contracts/mocks/token/ERC721ConsecutiveMock.sol +61 -0
- package/lib/openzeppelin-contracts/contracts/mocks/token/ERC721ReceiverMock.sol +47 -0
- package/lib/openzeppelin-contracts/contracts/mocks/token/ERC721URIStorageMock.sol +17 -0
- package/lib/openzeppelin-contracts/contracts/mocks/utils/cryptography/ERC7739Mock.sol +12 -0
- package/lib/openzeppelin-contracts/contracts/package.json +32 -0
- package/lib/openzeppelin-contracts/contracts/proxy/Clones.sol +294 -0
- package/lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Proxy.sol +62 -0
- package/lib/openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Utils.sol +177 -0
- package/lib/openzeppelin-contracts/contracts/proxy/Proxy.sol +69 -0
- package/lib/openzeppelin-contracts/contracts/proxy/README.adoc +87 -0
- package/lib/openzeppelin-contracts/contracts/proxy/beacon/BeaconProxy.sol +57 -0
- package/lib/openzeppelin-contracts/contracts/proxy/beacon/IBeacon.sol +16 -0
- package/lib/openzeppelin-contracts/contracts/proxy/beacon/UpgradeableBeacon.sol +70 -0
- package/lib/openzeppelin-contracts/contracts/proxy/transparent/ProxyAdmin.sol +45 -0
- package/lib/openzeppelin-contracts/contracts/proxy/transparent/TransparentUpgradeableProxy.sol +118 -0
- package/lib/openzeppelin-contracts/contracts/proxy/utils/Initializable.sol +238 -0
- package/lib/openzeppelin-contracts/contracts/proxy/utils/UUPSUpgradeable.sol +148 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC1155/ERC1155.sol +416 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC1155/IERC1155.sol +123 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC1155/IERC1155Receiver.sol +59 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC1155/README.adoc +43 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC1155/extensions/ERC1155Burnable.sol +28 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC1155/extensions/ERC1155Pausable.sol +38 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC1155/extensions/ERC1155Supply.sol +88 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC1155/extensions/ERC1155URIStorage.sol +58 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol +20 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC1155/utils/ERC1155Holder.sol +42 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC1155/utils/ERC1155Utils.sol +88 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol +305 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol +79 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC20/README.adoc +81 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC1363.sol +135 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Burnable.sol +39 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Capped.sol +54 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Crosschain.sol +38 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20FlashMint.sol +130 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Pausable.sol +33 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Permit.sol +77 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Votes.sol +83 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Wrapper.sol +89 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC4626.sol +315 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol +26 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol +90 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/draft-ERC20Bridgeable.sol +51 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/draft-ERC20TemporaryApproval.sol +119 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC20/utils/ERC1363Utils.sol +95 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol +280 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC6909/ERC6909.sol +224 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC6909/README.adoc +27 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC6909/extensions/ERC6909ContentURI.sol +59 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC6909/extensions/ERC6909Metadata.sol +83 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC6909/extensions/ERC6909TokenSupply.sol +41 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC721/ERC721.sol +433 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC721/IERC721.sol +135 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC721/IERC721Receiver.sol +28 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC721/README.adoc +69 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721Burnable.sol +26 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721Consecutive.sol +176 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721Enumerable.sol +165 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721Pausable.sol +37 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721Royalty.sol +26 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721URIStorage.sol +62 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721Votes.sol +47 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721Wrapper.sol +102 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC721/extensions/IERC721Enumerable.sol +29 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC721/extensions/IERC721Metadata.sol +27 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC721/utils/ERC721Holder.sol +26 -0
- package/lib/openzeppelin-contracts/contracts/token/ERC721/utils/ERC721Utils.sol +50 -0
- package/lib/openzeppelin-contracts/contracts/token/common/ERC2981.sol +139 -0
- package/lib/openzeppelin-contracts/contracts/token/common/README.adoc +10 -0
- package/lib/openzeppelin-contracts/contracts/utils/Address.sol +167 -0
- package/lib/openzeppelin-contracts/contracts/utils/Arrays.sol +888 -0
- package/lib/openzeppelin-contracts/contracts/utils/Base58.sol +240 -0
- package/lib/openzeppelin-contracts/contracts/utils/Base64.sol +234 -0
- package/lib/openzeppelin-contracts/contracts/utils/Blockhash.sol +54 -0
- package/lib/openzeppelin-contracts/contracts/utils/Bytes.sol +332 -0
- package/lib/openzeppelin-contracts/contracts/utils/CAIP10.sol +54 -0
- package/lib/openzeppelin-contracts/contracts/utils/CAIP2.sol +51 -0
- package/lib/openzeppelin-contracts/contracts/utils/Calldata.sol +25 -0
- package/lib/openzeppelin-contracts/contracts/utils/Comparators.sol +19 -0
- package/lib/openzeppelin-contracts/contracts/utils/Context.sol +28 -0
- package/lib/openzeppelin-contracts/contracts/utils/Create2.sol +91 -0
- package/lib/openzeppelin-contracts/contracts/utils/Errors.sol +34 -0
- package/lib/openzeppelin-contracts/contracts/utils/LowLevelCall.sol +127 -0
- package/lib/openzeppelin-contracts/contracts/utils/Memory.sol +146 -0
- package/lib/openzeppelin-contracts/contracts/utils/Multicall.sol +37 -0
- package/lib/openzeppelin-contracts/contracts/utils/Nonces.sol +46 -0
- package/lib/openzeppelin-contracts/contracts/utils/NoncesKeyed.sol +74 -0
- package/lib/openzeppelin-contracts/contracts/utils/Packing.sol +1656 -0
- package/lib/openzeppelin-contracts/contracts/utils/Panic.sol +57 -0
- package/lib/openzeppelin-contracts/contracts/utils/Pausable.sol +112 -0
- package/lib/openzeppelin-contracts/contracts/utils/README.adoc +160 -0
- package/lib/openzeppelin-contracts/contracts/utils/RLP.sol +476 -0
- package/lib/openzeppelin-contracts/contracts/utils/ReentrancyGuard.sol +119 -0
- package/lib/openzeppelin-contracts/contracts/utils/ReentrancyGuardTransient.sol +84 -0
- package/lib/openzeppelin-contracts/contracts/utils/RelayedCall.sol +133 -0
- package/lib/openzeppelin-contracts/contracts/utils/ShortStrings.sol +122 -0
- package/lib/openzeppelin-contracts/contracts/utils/SlotDerivation.sol +155 -0
- package/lib/openzeppelin-contracts/contracts/utils/StorageSlot.sol +143 -0
- package/lib/openzeppelin-contracts/contracts/utils/Strings.sol +508 -0
- package/lib/openzeppelin-contracts/contracts/utils/TransientSlot.sol +183 -0
- package/lib/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol +284 -0
- package/lib/openzeppelin-contracts/contracts/utils/cryptography/EIP712.sol +160 -0
- package/lib/openzeppelin-contracts/contracts/utils/cryptography/Hashes.sol +31 -0
- package/lib/openzeppelin-contracts/contracts/utils/cryptography/MerkleProof.sol +510 -0
- package/lib/openzeppelin-contracts/contracts/utils/cryptography/MessageHashUtils.sol +228 -0
- package/lib/openzeppelin-contracts/contracts/utils/cryptography/P256.sol +408 -0
- package/lib/openzeppelin-contracts/contracts/utils/cryptography/README.adoc +76 -0
- package/lib/openzeppelin-contracts/contracts/utils/cryptography/RSA.sol +154 -0
- package/lib/openzeppelin-contracts/contracts/utils/cryptography/SignatureChecker.sol +191 -0
- package/lib/openzeppelin-contracts/contracts/utils/cryptography/TrieProof.sol +230 -0
- package/lib/openzeppelin-contracts/contracts/utils/cryptography/WebAuthn.sol +261 -0
- package/lib/openzeppelin-contracts/contracts/utils/cryptography/draft-ERC7739Utils.sol +207 -0
- package/lib/openzeppelin-contracts/contracts/utils/cryptography/signers/AbstractSigner.sol +23 -0
- package/lib/openzeppelin-contracts/contracts/utils/cryptography/signers/MultiSignerERC7913.sol +259 -0
- package/lib/openzeppelin-contracts/contracts/utils/cryptography/signers/MultiSignerERC7913Weighted.sol +208 -0
- package/lib/openzeppelin-contracts/contracts/utils/cryptography/signers/SignerECDSA.sol +56 -0
- package/lib/openzeppelin-contracts/contracts/utils/cryptography/signers/SignerEIP7702.sol +25 -0
- package/lib/openzeppelin-contracts/contracts/utils/cryptography/signers/SignerERC7913.sol +63 -0
- package/lib/openzeppelin-contracts/contracts/utils/cryptography/signers/SignerP256.sol +64 -0
- package/lib/openzeppelin-contracts/contracts/utils/cryptography/signers/SignerRSA.sol +65 -0
- package/lib/openzeppelin-contracts/contracts/utils/cryptography/signers/SignerWebAuthn.sol +51 -0
- package/lib/openzeppelin-contracts/contracts/utils/cryptography/signers/draft-ERC7739.sol +98 -0
- package/lib/openzeppelin-contracts/contracts/utils/cryptography/verifiers/ERC7913P256Verifier.sol +29 -0
- package/lib/openzeppelin-contracts/contracts/utils/cryptography/verifiers/ERC7913RSAVerifier.sol +23 -0
- package/lib/openzeppelin-contracts/contracts/utils/cryptography/verifiers/ERC7913WebAuthnVerifier.sol +35 -0
- package/lib/openzeppelin-contracts/contracts/utils/draft-InteroperableAddress.sol +235 -0
- package/lib/openzeppelin-contracts/contracts/utils/introspection/ERC165.sol +25 -0
- package/lib/openzeppelin-contracts/contracts/utils/introspection/ERC165Checker.sol +142 -0
- package/lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol +25 -0
- package/lib/openzeppelin-contracts/contracts/utils/math/Math.sol +763 -0
- package/lib/openzeppelin-contracts/contracts/utils/math/SafeCast.sol +1162 -0
- package/lib/openzeppelin-contracts/contracts/utils/math/SignedMath.sol +68 -0
- package/lib/openzeppelin-contracts/contracts/utils/structs/Accumulators.sol +130 -0
- package/lib/openzeppelin-contracts/contracts/utils/structs/BitMaps.sol +60 -0
- package/lib/openzeppelin-contracts/contracts/utils/structs/Checkpoints.sol +833 -0
- package/lib/openzeppelin-contracts/contracts/utils/structs/CircularBuffer.sol +152 -0
- package/lib/openzeppelin-contracts/contracts/utils/structs/DoubleEndedQueue.sol +237 -0
- package/lib/openzeppelin-contracts/contracts/utils/structs/EnumerableMap.sol +1443 -0
- package/lib/openzeppelin-contracts/contracts/utils/structs/EnumerableSet.sol +895 -0
- package/lib/openzeppelin-contracts/contracts/utils/structs/Heap.sol +259 -0
- package/lib/openzeppelin-contracts/contracts/utils/structs/MerkleTree.sol +267 -0
- package/lib/openzeppelin-contracts/contracts/utils/types/Time.sol +133 -0
- package/lib/openzeppelin-contracts/contracts/vendor/compound/ICompoundTimelock.sol +86 -0
- package/lib/openzeppelin-contracts/contracts/vendor/compound/LICENSE +11 -0
- package/lib/openzeppelin-contracts/docs/README.md +16 -0
- package/lib/openzeppelin-contracts/docs/antora.yml +7 -0
- package/lib/openzeppelin-contracts/docs/config.js +21 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-control-multiple.svg +97 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-manager-functions.svg +47 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/images/access-manager.svg +99 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-3a.png +0 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-3b.png +0 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack-6.png +0 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-attack.png +0 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-deposit.png +0 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-mint.png +0 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-linear.png +0 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-loglog.png +0 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/images/erc4626-rate-loglogext.png +0 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-exec.png +0 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-vote.png +0 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/nav.adoc +29 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/access-control.adoc +339 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/account-abstraction.adoc +100 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/accounts.adoc +354 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/backwards-compatibility.adoc +50 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/eoa-delegation.adoc +143 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc1155.adoc +118 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc20-supply.adoc +71 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc20.adoc +67 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc4626.adoc +214 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc6909.adoc +47 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/erc721.adoc +58 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/extending-contracts.adoc +51 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/faq.adoc +13 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/governance.adoc +242 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/index.adoc +100 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/multisig.adoc +308 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/tokens.adoc +31 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/upgradeable.adoc +77 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/utilities.adoc +634 -0
- package/lib/openzeppelin-contracts/docs/modules/ROOT/pages/wizard.adoc +15 -0
- package/lib/openzeppelin-contracts/docs/templates/contract.hbs +141 -0
- package/lib/openzeppelin-contracts/docs/templates/helpers.js +46 -0
- package/lib/openzeppelin-contracts/docs/templates/page.hbs +4 -0
- package/lib/openzeppelin-contracts/docs/templates/properties.js +88 -0
- package/lib/openzeppelin-contracts/eslint.config.mjs +29 -0
- package/lib/openzeppelin-contracts/foundry.toml +20 -0
- package/lib/openzeppelin-contracts/fv/Makefile +54 -0
- package/lib/openzeppelin-contracts/fv/README.md +60 -0
- package/lib/openzeppelin-contracts/fv/diff/access_manager_AccessManager.sol.patch +97 -0
- package/lib/openzeppelin-contracts/fv/diff/account_extensions_draft-AccountERC7579.sol.patch +25 -0
- package/lib/openzeppelin-contracts/fv/diff/token_ERC721_ERC721.sol.patch +11 -0
- package/lib/openzeppelin-contracts/fv/harnesses/AccessControlDefaultAdminRulesHarness.sol +46 -0
- package/lib/openzeppelin-contracts/fv/harnesses/AccessControlHarness.sol +6 -0
- package/lib/openzeppelin-contracts/fv/harnesses/AccessManagedHarness.sol +36 -0
- package/lib/openzeppelin-contracts/fv/harnesses/AccessManagerHarness.sol +116 -0
- package/lib/openzeppelin-contracts/fv/harnesses/AccountHarness.sol +60 -0
- package/lib/openzeppelin-contracts/fv/harnesses/DoubleEndedQueueHarness.sol +58 -0
- package/lib/openzeppelin-contracts/fv/harnesses/ERC20FlashMintHarness.sol +36 -0
- package/lib/openzeppelin-contracts/fv/harnesses/ERC20PermitHarness.sol +16 -0
- package/lib/openzeppelin-contracts/fv/harnesses/ERC20WrapperHarness.sol +22 -0
- package/lib/openzeppelin-contracts/fv/harnesses/ERC3156FlashBorrowerHarness.sol +13 -0
- package/lib/openzeppelin-contracts/fv/harnesses/ERC721Harness.sol +37 -0
- package/lib/openzeppelin-contracts/fv/harnesses/ERC721ReceiverHarness.sol +11 -0
- package/lib/openzeppelin-contracts/fv/harnesses/EnumerableMapHarness.sol +55 -0
- package/lib/openzeppelin-contracts/fv/harnesses/EnumerableSetHarness.sol +35 -0
- package/lib/openzeppelin-contracts/fv/harnesses/InitializableHarness.sol +23 -0
- package/lib/openzeppelin-contracts/fv/harnesses/NoncesHarness.sol +14 -0
- package/lib/openzeppelin-contracts/fv/harnesses/Ownable2StepHarness.sol +10 -0
- package/lib/openzeppelin-contracts/fv/harnesses/OwnableHarness.sol +10 -0
- package/lib/openzeppelin-contracts/fv/harnesses/PausableHarness.sol +18 -0
- package/lib/openzeppelin-contracts/fv/harnesses/TimelockControllerHarness.sol +13 -0
- package/lib/openzeppelin-contracts/fv/reports/2021-10.pdf +0 -0
- package/lib/openzeppelin-contracts/fv/reports/2022-03.pdf +0 -0
- package/lib/openzeppelin-contracts/fv/reports/2022-05.pdf +0 -0
- package/lib/openzeppelin-contracts/fv/run.js +68 -0
- package/lib/openzeppelin-contracts/fv/specs/AccessControl.conf +8 -0
- package/lib/openzeppelin-contracts/fv/specs/AccessControl.spec +119 -0
- package/lib/openzeppelin-contracts/fv/specs/AccessControlDefaultAdminRules.conf +8 -0
- package/lib/openzeppelin-contracts/fv/specs/AccessControlDefaultAdminRules.spec +467 -0
- package/lib/openzeppelin-contracts/fv/specs/AccessManaged.conf +14 -0
- package/lib/openzeppelin-contracts/fv/specs/AccessManaged.spec +49 -0
- package/lib/openzeppelin-contracts/fv/specs/AccessManager.conf +10 -0
- package/lib/openzeppelin-contracts/fv/specs/AccessManager.spec +837 -0
- package/lib/openzeppelin-contracts/fv/specs/Account.conf +9 -0
- package/lib/openzeppelin-contracts/fv/specs/Account.spec +490 -0
- package/lib/openzeppelin-contracts/fv/specs/DoubleEndedQueue.conf +8 -0
- package/lib/openzeppelin-contracts/fv/specs/DoubleEndedQueue.spec +300 -0
- package/lib/openzeppelin-contracts/fv/specs/ERC20.conf +9 -0
- package/lib/openzeppelin-contracts/fv/specs/ERC20.spec +352 -0
- package/lib/openzeppelin-contracts/fv/specs/ERC20FlashMint.conf +10 -0
- package/lib/openzeppelin-contracts/fv/specs/ERC20FlashMint.spec +55 -0
- package/lib/openzeppelin-contracts/fv/specs/ERC20Wrapper.conf +13 -0
- package/lib/openzeppelin-contracts/fv/specs/ERC20Wrapper.spec +226 -0
- package/lib/openzeppelin-contracts/fv/specs/ERC721.conf +10 -0
- package/lib/openzeppelin-contracts/fv/specs/ERC721.spec +695 -0
- package/lib/openzeppelin-contracts/fv/specs/EnumerableMap.conf +8 -0
- package/lib/openzeppelin-contracts/fv/specs/EnumerableMap.spec +364 -0
- package/lib/openzeppelin-contracts/fv/specs/EnumerableSet.conf +8 -0
- package/lib/openzeppelin-contracts/fv/specs/EnumerableSet.spec +272 -0
- package/lib/openzeppelin-contracts/fv/specs/Initializable.conf +8 -0
- package/lib/openzeppelin-contracts/fv/specs/Initializable.spec +176 -0
- package/lib/openzeppelin-contracts/fv/specs/Nonces.conf +8 -0
- package/lib/openzeppelin-contracts/fv/specs/Nonces.spec +92 -0
- package/lib/openzeppelin-contracts/fv/specs/Ownable.conf +8 -0
- package/lib/openzeppelin-contracts/fv/specs/Ownable.spec +77 -0
- package/lib/openzeppelin-contracts/fv/specs/Ownable2Step.conf +8 -0
- package/lib/openzeppelin-contracts/fv/specs/Ownable2Step.spec +108 -0
- package/lib/openzeppelin-contracts/fv/specs/Pausable.conf +8 -0
- package/lib/openzeppelin-contracts/fv/specs/Pausable.spec +96 -0
- package/lib/openzeppelin-contracts/fv/specs/TimelockController.conf +10 -0
- package/lib/openzeppelin-contracts/fv/specs/TimelockController.spec +299 -0
- package/lib/openzeppelin-contracts/fv/specs/helpers/helpers.spec +13 -0
- package/lib/openzeppelin-contracts/fv/specs/methods/IAccessControl.spec +8 -0
- package/lib/openzeppelin-contracts/fv/specs/methods/IAccessControlDefaultAdminRules.spec +36 -0
- package/lib/openzeppelin-contracts/fv/specs/methods/IAccessManaged.spec +5 -0
- package/lib/openzeppelin-contracts/fv/specs/methods/IAccessManager.spec +33 -0
- package/lib/openzeppelin-contracts/fv/specs/methods/IAccount.spec +34 -0
- package/lib/openzeppelin-contracts/fv/specs/methods/IERC20.spec +11 -0
- package/lib/openzeppelin-contracts/fv/specs/methods/IERC2612.spec +5 -0
- package/lib/openzeppelin-contracts/fv/specs/methods/IERC3156FlashBorrower.spec +3 -0
- package/lib/openzeppelin-contracts/fv/specs/methods/IERC3156FlashLender.spec +5 -0
- package/lib/openzeppelin-contracts/fv/specs/methods/IERC5313.spec +3 -0
- package/lib/openzeppelin-contracts/fv/specs/methods/IERC721.spec +17 -0
- package/lib/openzeppelin-contracts/fv/specs/methods/IERC721Receiver.spec +3 -0
- package/lib/openzeppelin-contracts/fv/specs/methods/IOwnable.spec +5 -0
- package/lib/openzeppelin-contracts/fv/specs/methods/IOwnable2Step.spec +7 -0
- package/lib/openzeppelin-contracts/fv-requirements.txt +4 -0
- package/lib/openzeppelin-contracts/hardhat/async-test-sanity.js +10 -0
- package/lib/openzeppelin-contracts/hardhat/env-artifacts.js +29 -0
- package/lib/openzeppelin-contracts/hardhat/ignore-unreachable-warnings.js +45 -0
- package/lib/openzeppelin-contracts/hardhat/remappings.js +18 -0
- package/lib/openzeppelin-contracts/hardhat/skip-foundry-tests.js +6 -0
- package/lib/openzeppelin-contracts/hardhat/task-test-get-files.js +25 -0
- package/lib/openzeppelin-contracts/hardhat.config.js +124 -0
- package/lib/openzeppelin-contracts/logo.svg +15 -0
- package/lib/openzeppelin-contracts/netlify.toml +3 -0
- package/lib/openzeppelin-contracts/package-lock.json +11140 -0
- package/lib/openzeppelin-contracts/package.json +108 -0
- package/lib/openzeppelin-contracts/remappings.txt +1 -0
- package/lib/openzeppelin-contracts/renovate.json +4 -0
- package/lib/openzeppelin-contracts/scripts/checks/compare-layout.js +28 -0
- package/lib/openzeppelin-contracts/scripts/checks/compareGasReports.js +249 -0
- package/lib/openzeppelin-contracts/scripts/checks/coverage.sh +24 -0
- package/lib/openzeppelin-contracts/scripts/checks/extract-layout.js +39 -0
- package/lib/openzeppelin-contracts/scripts/checks/generation.sh +6 -0
- package/lib/openzeppelin-contracts/scripts/checks/inheritance-ordering.js +55 -0
- package/lib/openzeppelin-contracts/scripts/checks/pragma-validity.js +45 -0
- package/lib/openzeppelin-contracts/scripts/fetch-common-contracts.js +50 -0
- package/lib/openzeppelin-contracts/scripts/gen-nav.js +81 -0
- package/lib/openzeppelin-contracts/scripts/generate/format-lines.js +16 -0
- package/lib/openzeppelin-contracts/scripts/generate/helpers/sanitize.js +5 -0
- package/lib/openzeppelin-contracts/scripts/generate/run.js +61 -0
- package/lib/openzeppelin-contracts/scripts/generate/templates/Arrays.js +505 -0
- package/lib/openzeppelin-contracts/scripts/generate/templates/Arrays.opts.js +9 -0
- package/lib/openzeppelin-contracts/scripts/generate/templates/Checkpoints.js +242 -0
- package/lib/openzeppelin-contracts/scripts/generate/templates/Checkpoints.opts.js +18 -0
- package/lib/openzeppelin-contracts/scripts/generate/templates/Checkpoints.t.js +141 -0
- package/lib/openzeppelin-contracts/scripts/generate/templates/Enumerable.opts.js +56 -0
- package/lib/openzeppelin-contracts/scripts/generate/templates/EnumerableMap.js +464 -0
- package/lib/openzeppelin-contracts/scripts/generate/templates/EnumerableSet.js +470 -0
- package/lib/openzeppelin-contracts/scripts/generate/templates/MerkleProof.js +186 -0
- package/lib/openzeppelin-contracts/scripts/generate/templates/MerkleProof.opts.js +11 -0
- package/lib/openzeppelin-contracts/scripts/generate/templates/Packing.js +92 -0
- package/lib/openzeppelin-contracts/scripts/generate/templates/Packing.opts.js +3 -0
- package/lib/openzeppelin-contracts/scripts/generate/templates/Packing.t.js +48 -0
- package/lib/openzeppelin-contracts/scripts/generate/templates/SafeCast.js +136 -0
- package/lib/openzeppelin-contracts/scripts/generate/templates/Slot.opts.js +15 -0
- package/lib/openzeppelin-contracts/scripts/generate/templates/SlotDerivation.js +119 -0
- package/lib/openzeppelin-contracts/scripts/generate/templates/SlotDerivation.t.js +127 -0
- package/lib/openzeppelin-contracts/scripts/generate/templates/StorageSlot.js +77 -0
- package/lib/openzeppelin-contracts/scripts/generate/templates/StorageSlotMock.js +57 -0
- package/lib/openzeppelin-contracts/scripts/generate/templates/TransientSlot.js +80 -0
- package/lib/openzeppelin-contracts/scripts/generate/templates/TransientSlotMock.js +35 -0
- package/lib/openzeppelin-contracts/scripts/generate/templates/conversion.js +34 -0
- package/lib/openzeppelin-contracts/scripts/get-contracts-metadata.js +55 -0
- package/lib/openzeppelin-contracts/scripts/git-user-config.sh +6 -0
- package/lib/openzeppelin-contracts/scripts/helpers.js +7 -0
- package/lib/openzeppelin-contracts/scripts/minimize-pragma.js +140 -0
- package/lib/openzeppelin-contracts/scripts/prepack.sh +23 -0
- package/lib/openzeppelin-contracts/scripts/prepare-docs.sh +26 -0
- package/lib/openzeppelin-contracts/scripts/release/format-changelog.js +33 -0
- package/lib/openzeppelin-contracts/scripts/release/synchronize-versions.js +15 -0
- package/lib/openzeppelin-contracts/scripts/release/update-comment.js +34 -0
- package/lib/openzeppelin-contracts/scripts/release/version.sh +11 -0
- package/lib/openzeppelin-contracts/scripts/release/workflow/check-upgradeable.sh +27 -0
- package/lib/openzeppelin-contracts/scripts/release/workflow/exit-prerelease.sh +8 -0
- package/lib/openzeppelin-contracts/scripts/release/workflow/github-release.js +48 -0
- package/lib/openzeppelin-contracts/scripts/release/workflow/integrity-check.sh +20 -0
- package/lib/openzeppelin-contracts/scripts/release/workflow/pack.sh +26 -0
- package/lib/openzeppelin-contracts/scripts/release/workflow/publish.sh +26 -0
- package/lib/openzeppelin-contracts/scripts/release/workflow/rerun.js +7 -0
- package/lib/openzeppelin-contracts/scripts/release/workflow/set-changesets-pr-title.js +17 -0
- package/lib/openzeppelin-contracts/scripts/release/workflow/start.sh +35 -0
- package/lib/openzeppelin-contracts/scripts/release/workflow/state.js +112 -0
- package/lib/openzeppelin-contracts/scripts/remove-ignored-artifacts.js +45 -0
- package/lib/openzeppelin-contracts/scripts/set-max-old-space-size.sh +10 -0
- package/lib/openzeppelin-contracts/scripts/solc-versions.js +15 -0
- package/lib/openzeppelin-contracts/scripts/solhint-custom/index.js +118 -0
- package/lib/openzeppelin-contracts/scripts/solhint-custom/package.json +8 -0
- package/lib/openzeppelin-contracts/scripts/update-docs-branch.js +65 -0
- package/lib/openzeppelin-contracts/scripts/upgradeable/README.md +21 -0
- package/lib/openzeppelin-contracts/scripts/upgradeable/alias/Initializable.sol +5 -0
- package/lib/openzeppelin-contracts/scripts/upgradeable/alias/UUPSUpgradeable.sol +5 -0
- package/lib/openzeppelin-contracts/scripts/upgradeable/patch-apply.sh +19 -0
- package/lib/openzeppelin-contracts/scripts/upgradeable/patch-save.sh +18 -0
- package/lib/openzeppelin-contracts/scripts/upgradeable/transpile-onto.sh +54 -0
- package/lib/openzeppelin-contracts/scripts/upgradeable/transpile.sh +50 -0
- package/lib/openzeppelin-contracts/scripts/upgradeable/upgradeable.patch +390 -0
- package/lib/openzeppelin-contracts/slither.config.json +4 -0
- package/lib/openzeppelin-contracts/solhint.config.js +29 -0
- package/lib/openzeppelin-contracts/test/TESTING.md +3 -0
- package/lib/openzeppelin-contracts/test/access/AccessControl.behavior.js +874 -0
- package/lib/openzeppelin-contracts/test/access/AccessControl.test.js +19 -0
- package/lib/openzeppelin-contracts/test/access/Ownable.test.js +79 -0
- package/lib/openzeppelin-contracts/test/access/Ownable2Step.test.js +102 -0
- package/lib/openzeppelin-contracts/test/access/extensions/AccessControlDefaultAdminRules.test.js +32 -0
- package/lib/openzeppelin-contracts/test/access/extensions/AccessControlEnumerable.test.js +24 -0
- package/lib/openzeppelin-contracts/test/access/manager/AccessManaged.test.js +146 -0
- package/lib/openzeppelin-contracts/test/access/manager/AccessManager.behavior.js +257 -0
- package/lib/openzeppelin-contracts/test/access/manager/AccessManager.predicate.js +456 -0
- package/lib/openzeppelin-contracts/test/access/manager/AccessManager.test.js +2489 -0
- package/lib/openzeppelin-contracts/test/access/manager/AuthorityUtils.test.js +112 -0
- package/lib/openzeppelin-contracts/test/account/Account.behavior.js +144 -0
- package/lib/openzeppelin-contracts/test/account/Account.test.js +48 -0
- package/lib/openzeppelin-contracts/test/account/AccountECDSA.test.js +52 -0
- package/lib/openzeppelin-contracts/test/account/AccountEIP7702.t.sol +116 -0
- package/lib/openzeppelin-contracts/test/account/AccountEIP7702.test.js +52 -0
- package/lib/openzeppelin-contracts/test/account/AccountERC7913.test.js +138 -0
- package/lib/openzeppelin-contracts/test/account/AccountMultiSigner.test.js +326 -0
- package/lib/openzeppelin-contracts/test/account/AccountMultiSignerWeighted.test.js +312 -0
- package/lib/openzeppelin-contracts/test/account/AccountP256.test.js +58 -0
- package/lib/openzeppelin-contracts/test/account/AccountRSA.test.js +58 -0
- package/lib/openzeppelin-contracts/test/account/AccountWebAuthn.test.js +88 -0
- package/lib/openzeppelin-contracts/test/account/examples/AccountEIP7702WithModulesMock.test.js +99 -0
- package/lib/openzeppelin-contracts/test/account/extensions/AccountERC7579.behavior.js +621 -0
- package/lib/openzeppelin-contracts/test/account/extensions/AccountERC7579.test.js +60 -0
- package/lib/openzeppelin-contracts/test/account/extensions/AccountERC7579Hooked.test.js +60 -0
- package/lib/openzeppelin-contracts/test/account/extensions/ERC7821.behavior.js +145 -0
- package/lib/openzeppelin-contracts/test/account/utils/EIP7702Utils.test.js +53 -0
- package/lib/openzeppelin-contracts/test/account/utils/draft-ERC4337Utils.test.js +594 -0
- package/lib/openzeppelin-contracts/test/account/utils/draft-ERC7579Utils.t.sol +434 -0
- package/lib/openzeppelin-contracts/test/account/utils/draft-ERC7579Utils.test.js +399 -0
- package/lib/openzeppelin-contracts/test/crosschain/BridgeERC20.behavior.js +163 -0
- package/lib/openzeppelin-contracts/test/crosschain/BridgeERC20.test.js +46 -0
- package/lib/openzeppelin-contracts/test/crosschain/ERC7786Recipient.test.js +73 -0
- package/lib/openzeppelin-contracts/test/finance/VestingWallet.behavior.js +87 -0
- package/lib/openzeppelin-contracts/test/finance/VestingWallet.test.js +65 -0
- package/lib/openzeppelin-contracts/test/finance/VestingWalletCliff.test.js +70 -0
- package/lib/openzeppelin-contracts/test/governance/Governor.t.sol +59 -0
- package/lib/openzeppelin-contracts/test/governance/Governor.test.js +980 -0
- package/lib/openzeppelin-contracts/test/governance/TimelockController.test.js +1279 -0
- package/lib/openzeppelin-contracts/test/governance/extensions/GovernorCountingFractional.test.js +248 -0
- package/lib/openzeppelin-contracts/test/governance/extensions/GovernorCountingOverridable.test.js +346 -0
- package/lib/openzeppelin-contracts/test/governance/extensions/GovernorERC721.test.js +131 -0
- package/lib/openzeppelin-contracts/test/governance/extensions/GovernorNoncesKeyed.test.js +243 -0
- package/lib/openzeppelin-contracts/test/governance/extensions/GovernorPreventLateQuorum.test.js +185 -0
- package/lib/openzeppelin-contracts/test/governance/extensions/GovernorProposalGuardian.test.js +132 -0
- package/lib/openzeppelin-contracts/test/governance/extensions/GovernorSequentialProposalId.test.js +202 -0
- package/lib/openzeppelin-contracts/test/governance/extensions/GovernorStorage.test.js +175 -0
- package/lib/openzeppelin-contracts/test/governance/extensions/GovernorSuperQuorum.test.js +168 -0
- package/lib/openzeppelin-contracts/test/governance/extensions/GovernorSuperQuorumGreaterThanQuorum.t.sol +83 -0
- package/lib/openzeppelin-contracts/test/governance/extensions/GovernorTimelockAccess.test.js +864 -0
- package/lib/openzeppelin-contracts/test/governance/extensions/GovernorTimelockCompound.test.js +448 -0
- package/lib/openzeppelin-contracts/test/governance/extensions/GovernorTimelockControl.test.js +504 -0
- package/lib/openzeppelin-contracts/test/governance/extensions/GovernorVotesQuorumFraction.test.js +165 -0
- package/lib/openzeppelin-contracts/test/governance/extensions/GovernorVotesSuperQuorumFraction.test.js +160 -0
- package/lib/openzeppelin-contracts/test/governance/extensions/GovernorWithParams.test.js +245 -0
- package/lib/openzeppelin-contracts/test/governance/utils/ERC6372.behavior.js +28 -0
- package/lib/openzeppelin-contracts/test/governance/utils/Votes.behavior.js +325 -0
- package/lib/openzeppelin-contracts/test/governance/utils/Votes.test.js +102 -0
- package/lib/openzeppelin-contracts/test/governance/utils/VotesExtended.test.js +152 -0
- package/lib/openzeppelin-contracts/test/helpers/access-manager.js +85 -0
- package/lib/openzeppelin-contracts/test/helpers/account.js +16 -0
- package/lib/openzeppelin-contracts/test/helpers/chains.js +56 -0
- package/lib/openzeppelin-contracts/test/helpers/constants.js +7 -0
- package/lib/openzeppelin-contracts/test/helpers/deploy.js +14 -0
- package/lib/openzeppelin-contracts/test/helpers/eip712-types.js +61 -0
- package/lib/openzeppelin-contracts/test/helpers/eip712.js +45 -0
- package/lib/openzeppelin-contracts/test/helpers/enums.js +15 -0
- package/lib/openzeppelin-contracts/test/helpers/erc4337.js +244 -0
- package/lib/openzeppelin-contracts/test/helpers/erc7579.js +58 -0
- package/lib/openzeppelin-contracts/test/helpers/erc7739.js +118 -0
- package/lib/openzeppelin-contracts/test/helpers/governance.js +218 -0
- package/lib/openzeppelin-contracts/test/helpers/iterate.js +41 -0
- package/lib/openzeppelin-contracts/test/helpers/math.js +33 -0
- package/lib/openzeppelin-contracts/test/helpers/methods.js +14 -0
- package/lib/openzeppelin-contracts/test/helpers/precompiles.js +12 -0
- package/lib/openzeppelin-contracts/test/helpers/random.js +26 -0
- package/lib/openzeppelin-contracts/test/helpers/signers.js +222 -0
- package/lib/openzeppelin-contracts/test/helpers/storage.js +48 -0
- package/lib/openzeppelin-contracts/test/helpers/strings.js +5 -0
- package/lib/openzeppelin-contracts/test/helpers/time.js +33 -0
- package/lib/openzeppelin-contracts/test/helpers/trie.js +79 -0
- package/lib/openzeppelin-contracts/test/helpers/txpool.js +28 -0
- package/lib/openzeppelin-contracts/test/metatx/ERC2771Context.test.js +109 -0
- package/lib/openzeppelin-contracts/test/metatx/ERC2771Forwarder.t.sol +279 -0
- package/lib/openzeppelin-contracts/test/metatx/ERC2771Forwarder.test.js +384 -0
- package/lib/openzeppelin-contracts/test/proxy/Clones.behaviour.js +160 -0
- package/lib/openzeppelin-contracts/test/proxy/Clones.t.sol +91 -0
- package/lib/openzeppelin-contracts/test/proxy/Clones.test.js +177 -0
- package/lib/openzeppelin-contracts/test/proxy/ERC1967/ERC1967Proxy.test.js +36 -0
- package/lib/openzeppelin-contracts/test/proxy/ERC1967/ERC1967Utils.test.js +162 -0
- package/lib/openzeppelin-contracts/test/proxy/Proxy.behaviour.js +198 -0
- package/lib/openzeppelin-contracts/test/proxy/beacon/BeaconProxy.test.js +141 -0
- package/lib/openzeppelin-contracts/test/proxy/beacon/UpgradeableBeacon.test.js +55 -0
- package/lib/openzeppelin-contracts/test/proxy/transparent/ProxyAdmin.test.js +82 -0
- package/lib/openzeppelin-contracts/test/proxy/transparent/TransparentUpgradeableProxy.behaviour.js +367 -0
- package/lib/openzeppelin-contracts/test/proxy/transparent/TransparentUpgradeableProxy.test.js +28 -0
- package/lib/openzeppelin-contracts/test/proxy/utils/Initializable.test.js +216 -0
- package/lib/openzeppelin-contracts/test/proxy/utils/UUPSUpgradeable.test.js +120 -0
- package/lib/openzeppelin-contracts/test/sanity.test.js +27 -0
- package/lib/openzeppelin-contracts/test/token/ERC1155/ERC1155.behavior.js +865 -0
- package/lib/openzeppelin-contracts/test/token/ERC1155/ERC1155.test.js +258 -0
- package/lib/openzeppelin-contracts/test/token/ERC1155/extensions/ERC1155Burnable.test.js +66 -0
- package/lib/openzeppelin-contracts/test/token/ERC1155/extensions/ERC1155Pausable.test.js +105 -0
- package/lib/openzeppelin-contracts/test/token/ERC1155/extensions/ERC1155Supply.test.js +119 -0
- package/lib/openzeppelin-contracts/test/token/ERC1155/extensions/ERC1155URIStorage.test.js +70 -0
- package/lib/openzeppelin-contracts/test/token/ERC1155/utils/ERC1155Holder.test.js +56 -0
- package/lib/openzeppelin-contracts/test/token/ERC1155/utils/ERC1155Utils.test.js +299 -0
- package/lib/openzeppelin-contracts/test/token/ERC20/ERC20.behavior.js +269 -0
- package/lib/openzeppelin-contracts/test/token/ERC20/ERC20.test.js +199 -0
- package/lib/openzeppelin-contracts/test/token/ERC20/extensions/ERC1363.test.js +370 -0
- package/lib/openzeppelin-contracts/test/token/ERC20/extensions/ERC20Burnable.test.js +105 -0
- package/lib/openzeppelin-contracts/test/token/ERC20/extensions/ERC20Capped.test.js +55 -0
- package/lib/openzeppelin-contracts/test/token/ERC20/extensions/ERC20Crosschain.test.js +83 -0
- package/lib/openzeppelin-contracts/test/token/ERC20/extensions/ERC20FlashMint.test.js +164 -0
- package/lib/openzeppelin-contracts/test/token/ERC20/extensions/ERC20Pausable.test.js +129 -0
- package/lib/openzeppelin-contracts/test/token/ERC20/extensions/ERC20Permit.test.js +109 -0
- package/lib/openzeppelin-contracts/test/token/ERC20/extensions/ERC20Votes.test.js +546 -0
- package/lib/openzeppelin-contracts/test/token/ERC20/extensions/ERC20Wrapper.test.js +203 -0
- package/lib/openzeppelin-contracts/test/token/ERC20/extensions/ERC4626.t.sol +41 -0
- package/lib/openzeppelin-contracts/test/token/ERC20/extensions/ERC4626.test.js +888 -0
- package/lib/openzeppelin-contracts/test/token/ERC20/extensions/draft-ERC20Bridgeable.test.js +89 -0
- package/lib/openzeppelin-contracts/test/token/ERC20/extensions/draft-ERC20TemporaryApproval.test.js +142 -0
- package/lib/openzeppelin-contracts/test/token/ERC20/utils/SafeERC20.test.js +463 -0
- package/lib/openzeppelin-contracts/test/token/ERC6909/ERC6909.behavior.js +216 -0
- package/lib/openzeppelin-contracts/test/token/ERC6909/ERC6909.test.js +104 -0
- package/lib/openzeppelin-contracts/test/token/ERC6909/extensions/ERC6909ContentURI.test.js +52 -0
- package/lib/openzeppelin-contracts/test/token/ERC6909/extensions/ERC6909Metadata.test.js +62 -0
- package/lib/openzeppelin-contracts/test/token/ERC6909/extensions/ERC6909TokenSupply.test.js +56 -0
- package/lib/openzeppelin-contracts/test/token/ERC721/ERC721.behavior.js +954 -0
- package/lib/openzeppelin-contracts/test/token/ERC721/ERC721.test.js +23 -0
- package/lib/openzeppelin-contracts/test/token/ERC721/ERC721Enumerable.test.js +28 -0
- package/lib/openzeppelin-contracts/test/token/ERC721/extensions/ERC721Burnable.test.js +77 -0
- package/lib/openzeppelin-contracts/test/token/ERC721/extensions/ERC721Consecutive.t.sol +187 -0
- package/lib/openzeppelin-contracts/test/token/ERC721/extensions/ERC721Consecutive.test.js +228 -0
- package/lib/openzeppelin-contracts/test/token/ERC721/extensions/ERC721Pausable.test.js +81 -0
- package/lib/openzeppelin-contracts/test/token/ERC721/extensions/ERC721Royalty.test.js +57 -0
- package/lib/openzeppelin-contracts/test/token/ERC721/extensions/ERC721URIStorage.test.js +134 -0
- package/lib/openzeppelin-contracts/test/token/ERC721/extensions/ERC721Votes.test.js +194 -0
- package/lib/openzeppelin-contracts/test/token/ERC721/extensions/ERC721Wrapper.test.js +201 -0
- package/lib/openzeppelin-contracts/test/token/ERC721/utils/ERC721Holder.test.js +20 -0
- package/lib/openzeppelin-contracts/test/token/ERC721/utils/ERC721Utils.test.js +94 -0
- package/lib/openzeppelin-contracts/test/token/common/ERC2981.behavior.js +152 -0
- package/lib/openzeppelin-contracts/test/utils/Address.test.js +332 -0
- package/lib/openzeppelin-contracts/test/utils/Arrays.t.sol +416 -0
- package/lib/openzeppelin-contracts/test/utils/Arrays.test.js +284 -0
- package/lib/openzeppelin-contracts/test/utils/Base58.t.sol +24 -0
- package/lib/openzeppelin-contracts/test/utils/Base58.test.js +65 -0
- package/lib/openzeppelin-contracts/test/utils/Base64.t.sol +36 -0
- package/lib/openzeppelin-contracts/test/utils/Base64.test.js +79 -0
- package/lib/openzeppelin-contracts/test/utils/Blockhash.t.sol +101 -0
- package/lib/openzeppelin-contracts/test/utils/Blockhash.test.js +59 -0
- package/lib/openzeppelin-contracts/test/utils/Bytes.t.sol +322 -0
- package/lib/openzeppelin-contracts/test/utils/Bytes.test.js +371 -0
- package/lib/openzeppelin-contracts/test/utils/CAIP.test.js +56 -0
- package/lib/openzeppelin-contracts/test/utils/Calldata.test.js +22 -0
- package/lib/openzeppelin-contracts/test/utils/Context.behavior.js +48 -0
- package/lib/openzeppelin-contracts/test/utils/Context.test.js +18 -0
- package/lib/openzeppelin-contracts/test/utils/Create2.t.sol +17 -0
- package/lib/openzeppelin-contracts/test/utils/Create2.test.js +190 -0
- package/lib/openzeppelin-contracts/test/utils/LowLevelCall.test.js +257 -0
- package/lib/openzeppelin-contracts/test/utils/Memory.t.sol +63 -0
- package/lib/openzeppelin-contracts/test/utils/Memory.test.js +106 -0
- package/lib/openzeppelin-contracts/test/utils/Multicall.test.js +72 -0
- package/lib/openzeppelin-contracts/test/utils/Nonces.behavior.js +189 -0
- package/lib/openzeppelin-contracts/test/utils/Nonces.test.js +16 -0
- package/lib/openzeppelin-contracts/test/utils/NoncesKeyed.t.sol +51 -0
- package/lib/openzeppelin-contracts/test/utils/NoncesKeyed.test.js +17 -0
- package/lib/openzeppelin-contracts/test/utils/Packing.t.sol +993 -0
- package/lib/openzeppelin-contracts/test/utils/Packing.test.js +70 -0
- package/lib/openzeppelin-contracts/test/utils/Panic.test.js +37 -0
- package/lib/openzeppelin-contracts/test/utils/Pausable.test.js +90 -0
- package/lib/openzeppelin-contracts/test/utils/RLP.t.sol +144 -0
- package/lib/openzeppelin-contracts/test/utils/RLP.test.js +224 -0
- package/lib/openzeppelin-contracts/test/utils/ReentrancyGuard.test.js +58 -0
- package/lib/openzeppelin-contracts/test/utils/RelayedCall.test.js +217 -0
- package/lib/openzeppelin-contracts/test/utils/ShortStrings.t.sol +109 -0
- package/lib/openzeppelin-contracts/test/utils/ShortStrings.test.js +64 -0
- package/lib/openzeppelin-contracts/test/utils/SlotDerivation.t.sol +248 -0
- package/lib/openzeppelin-contracts/test/utils/SlotDerivation.test.js +58 -0
- package/lib/openzeppelin-contracts/test/utils/StorageSlot.test.js +73 -0
- package/lib/openzeppelin-contracts/test/utils/Strings.t.sol +50 -0
- package/lib/openzeppelin-contracts/test/utils/Strings.test.js +360 -0
- package/lib/openzeppelin-contracts/test/utils/TransientSlot.test.js +59 -0
- package/lib/openzeppelin-contracts/test/utils/cryptography/ECDSA.test.js +322 -0
- package/lib/openzeppelin-contracts/test/utils/cryptography/EIP712.test.js +105 -0
- package/lib/openzeppelin-contracts/test/utils/cryptography/ERC1271.behavior.js +111 -0
- package/lib/openzeppelin-contracts/test/utils/cryptography/ERC7739.test.js +42 -0
- package/lib/openzeppelin-contracts/test/utils/cryptography/ERC7739Utils.test.js +203 -0
- package/lib/openzeppelin-contracts/test/utils/cryptography/MerkleProof.test.js +216 -0
- package/lib/openzeppelin-contracts/test/utils/cryptography/MessageHashUtils.t.sol +33 -0
- package/lib/openzeppelin-contracts/test/utils/cryptography/MessageHashUtils.test.js +149 -0
- package/lib/openzeppelin-contracts/test/utils/cryptography/P256.t.sol +45 -0
- package/lib/openzeppelin-contracts/test/utils/cryptography/P256.test.js +182 -0
- package/lib/openzeppelin-contracts/test/utils/cryptography/RSA.helper.js +17 -0
- package/lib/openzeppelin-contracts/test/utils/cryptography/RSA.test.js +102 -0
- package/lib/openzeppelin-contracts/test/utils/cryptography/SigVer15_186-3.rsp +3850 -0
- package/lib/openzeppelin-contracts/test/utils/cryptography/SignatureChecker.test.js +427 -0
- package/lib/openzeppelin-contracts/test/utils/cryptography/TrieProof.test.js +659 -0
- package/lib/openzeppelin-contracts/test/utils/cryptography/WebAuthn.t.sol +298 -0
- package/lib/openzeppelin-contracts/test/utils/cryptography/ecdsa_secp256r1_sha256_p1363_test.json +3719 -0
- package/lib/openzeppelin-contracts/test/utils/draft-InteroperableAddress.t.sol +99 -0
- package/lib/openzeppelin-contracts/test/utils/draft-InteroperableAddress.test.js +170 -0
- package/lib/openzeppelin-contracts/test/utils/introspection/ERC165.test.js +18 -0
- package/lib/openzeppelin-contracts/test/utils/introspection/ERC165Checker.test.js +272 -0
- package/lib/openzeppelin-contracts/test/utils/introspection/SupportsInterface.behavior.js +169 -0
- package/lib/openzeppelin-contracts/test/utils/math/Math.t.sol +370 -0
- package/lib/openzeppelin-contracts/test/utils/math/Math.test.js +746 -0
- package/lib/openzeppelin-contracts/test/utils/math/SafeCast.test.js +159 -0
- package/lib/openzeppelin-contracts/test/utils/math/SignedMath.t.sol +81 -0
- package/lib/openzeppelin-contracts/test/utils/math/SignedMath.test.js +53 -0
- package/lib/openzeppelin-contracts/test/utils/structs/Accumulators.t.sol +35 -0
- package/lib/openzeppelin-contracts/test/utils/structs/BitMap.test.js +149 -0
- package/lib/openzeppelin-contracts/test/utils/structs/Checkpoints.t.sol +440 -0
- package/lib/openzeppelin-contracts/test/utils/structs/Checkpoints.test.js +147 -0
- package/lib/openzeppelin-contracts/test/utils/structs/CircularBuffer.test.js +83 -0
- package/lib/openzeppelin-contracts/test/utils/structs/DoubleEndedQueue.test.js +144 -0
- package/lib/openzeppelin-contracts/test/utils/structs/EnumerableMap.behavior.js +214 -0
- package/lib/openzeppelin-contracts/test/utils/structs/EnumerableMap.test.js +83 -0
- package/lib/openzeppelin-contracts/test/utils/structs/EnumerableSet.behavior.js +175 -0
- package/lib/openzeppelin-contracts/test/utils/structs/EnumerableSet.test.js +66 -0
- package/lib/openzeppelin-contracts/test/utils/structs/Heap.t.sol +74 -0
- package/lib/openzeppelin-contracts/test/utils/structs/Heap.test.js +113 -0
- package/lib/openzeppelin-contracts/test/utils/structs/MerkleTree.test.js +180 -0
- package/lib/openzeppelin-contracts/test/utils/types/Time.test.js +135 -0
- package/lucro.txt +1 -0
- package/out/Base.sol/CommonBase.json +1 -0
- package/out/Base.sol/ScriptBase.json +1 -0
- package/out/Base.sol/TestBase.json +1 -0
- package/out/Context.sol/Context.json +1 -0
- package/out/Counter.s.sol/CounterScript.json +1 -0
- package/out/Counter.sol/Counter.json +1 -0
- package/out/Counter.t.sol/CounterTest.json +1 -0
- package/out/ERC20.sol/ERC20.json +1 -0
- package/out/GbitToken.sol/GbitToken.json +1 -0
- package/out/Guestbook.sol/Guestbook.json +1 -0
- package/out/IERC20.sol/IERC20.json +1 -0
- package/out/IERC20Metadata.sol/IERC20Metadata.json +1 -0
- package/out/IMulticall3.sol/IMulticall3.json +1 -0
- package/out/Script.sol/Script.json +1 -0
- package/out/StdAssertions.sol/StdAssertions.json +1 -0
- package/out/StdChains.sol/StdChains.json +1 -0
- package/out/StdCheats.sol/StdCheats.json +1 -0
- package/out/StdCheats.sol/StdCheatsSafe.json +1 -0
- package/out/StdConstants.sol/StdConstants.json +1 -0
- package/out/StdError.sol/stdError.json +1 -0
- package/out/StdInvariant.sol/StdInvariant.json +1 -0
- package/out/StdJson.sol/stdJson.json +1 -0
- package/out/StdMath.sol/stdMath.json +1 -0
- package/out/StdStorage.sol/stdStorage.json +1 -0
- package/out/StdStorage.sol/stdStorageSafe.json +1 -0
- package/out/StdStyle.sol/StdStyle.json +1 -0
- package/out/StdToml.sol/stdToml.json +1 -0
- package/out/StdUtils.sol/StdUtils.json +1 -0
- package/out/Test.sol/Test.json +1 -0
- package/out/Vm.sol/Vm.json +1 -0
- package/out/Vm.sol/VmSafe.json +1 -0
- package/out/Web3HubCore.sol/Web3HubCore.json +1 -0
- package/out/build-info/8a1d781106536b7b.json +1 -0
- package/out/build-info/aac4797350a36a99.json +1 -0
- package/out/build-info/c34d5a7881e6beba.json +1 -0
- package/out/build-info/ce38d811b8078146.json +1 -0
- package/out/build-info/db34a3531e47e196.json +1 -0
- package/out/console.sol/console.json +1 -0
- package/out/draft-IERC6093.sol/IERC1155Errors.json +1 -0
- package/out/draft-IERC6093.sol/IERC20Errors.json +1 -0
- package/out/draft-IERC6093.sol/IERC721Errors.json +1 -0
- package/out/safeconsole.sol/safeconsole.json +1 -0
- package/package.json +25 -0
- package/remappings.txt +1 -0
- package/script/Counter.s.sol +19 -0
- package/src/Counter.sol +14 -0
- package/src/GbitToken.sol +72 -0
- package/src/Guestbook.sol +28 -0
- package/src/Web3HubCore.sol +42 -0
- package/test/Counter.t.sol +24 -0
|
@@ -0,0 +1,1443 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
// OpenZeppelin Contracts (last updated v5.5.0) (utils/structs/EnumerableMap.sol)
|
|
3
|
+
// This file was procedurally generated from scripts/generate/templates/EnumerableMap.js.
|
|
4
|
+
|
|
5
|
+
pragma solidity ^0.8.24;
|
|
6
|
+
|
|
7
|
+
import {EnumerableSet} from "./EnumerableSet.sol";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @dev Library for managing an enumerable variant of Solidity's
|
|
11
|
+
* https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]
|
|
12
|
+
* type.
|
|
13
|
+
*
|
|
14
|
+
* Maps have the following properties:
|
|
15
|
+
*
|
|
16
|
+
* - Entries are added, removed, and checked for existence in constant time
|
|
17
|
+
* (O(1)).
|
|
18
|
+
* - Entries are enumerated in O(n). No guarantees are made on the ordering.
|
|
19
|
+
* - Map can be cleared (all entries removed) in O(n).
|
|
20
|
+
*
|
|
21
|
+
* ```solidity
|
|
22
|
+
* contract Example {
|
|
23
|
+
* // Add the library methods
|
|
24
|
+
* using EnumerableMap for EnumerableMap.UintToAddressMap;
|
|
25
|
+
*
|
|
26
|
+
* // Declare a set state variable
|
|
27
|
+
* EnumerableMap.UintToAddressMap private myMap;
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* The following map types are supported:
|
|
32
|
+
*
|
|
33
|
+
* - `uint256 -> address` (`UintToAddressMap`) since v3.0.0
|
|
34
|
+
* - `address -> uint256` (`AddressToUintMap`) since v4.6.0
|
|
35
|
+
* - `bytes32 -> bytes32` (`Bytes32ToBytes32Map`) since v4.6.0
|
|
36
|
+
* - `uint256 -> uint256` (`UintToUintMap`) since v4.7.0
|
|
37
|
+
* - `bytes32 -> uint256` (`Bytes32ToUintMap`) since v4.7.0
|
|
38
|
+
* - `uint256 -> bytes32` (`UintToBytes32Map`) since v5.1.0
|
|
39
|
+
* - `address -> address` (`AddressToAddressMap`) since v5.1.0
|
|
40
|
+
* - `address -> bytes32` (`AddressToBytes32Map`) since v5.1.0
|
|
41
|
+
* - `bytes32 -> address` (`Bytes32ToAddressMap`) since v5.1.0
|
|
42
|
+
* - `bytes -> bytes` (`BytesToBytesMap`) since v5.4.0
|
|
43
|
+
* - `bytes4 -> address` (`Bytes4ToAddressMap`) since v5.6.0
|
|
44
|
+
*
|
|
45
|
+
* [WARNING]
|
|
46
|
+
* ====
|
|
47
|
+
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
|
|
48
|
+
* unusable.
|
|
49
|
+
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
|
|
50
|
+
*
|
|
51
|
+
* In order to clean an EnumerableMap, you can either remove all elements one by one or create a fresh instance using an
|
|
52
|
+
* array of EnumerableMap.
|
|
53
|
+
* ====
|
|
54
|
+
*/
|
|
55
|
+
library EnumerableMap {
|
|
56
|
+
using EnumerableSet for *;
|
|
57
|
+
|
|
58
|
+
// To implement this library for multiple types with as little code repetition as possible, we write it in
|
|
59
|
+
// terms of a generic Map type with bytes32 keys and values. The Map implementation uses private functions,
|
|
60
|
+
// and user-facing implementations such as `UintToAddressMap` are just wrappers around the underlying Map.
|
|
61
|
+
// This means that we can only create new EnumerableMaps for types that fit in bytes32.
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @dev Query for a nonexistent map key.
|
|
65
|
+
*/
|
|
66
|
+
error EnumerableMapNonexistentKey(bytes32 key);
|
|
67
|
+
|
|
68
|
+
struct Bytes32ToBytes32Map {
|
|
69
|
+
// Storage of keys
|
|
70
|
+
EnumerableSet.Bytes32Set _keys;
|
|
71
|
+
mapping(bytes32 key => bytes32) _values;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @dev Adds a key-value pair to a map, or updates the value for an existing
|
|
76
|
+
* key. O(1).
|
|
77
|
+
*
|
|
78
|
+
* Returns true if the key was added to the map, that is if it was not
|
|
79
|
+
* already present.
|
|
80
|
+
*/
|
|
81
|
+
function set(Bytes32ToBytes32Map storage map, bytes32 key, bytes32 value) internal returns (bool) {
|
|
82
|
+
map._values[key] = value;
|
|
83
|
+
return map._keys.add(key);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* @dev Removes a key-value pair from a map. O(1).
|
|
88
|
+
*
|
|
89
|
+
* Returns true if the key was removed from the map, that is if it was present.
|
|
90
|
+
*/
|
|
91
|
+
function remove(Bytes32ToBytes32Map storage map, bytes32 key) internal returns (bool) {
|
|
92
|
+
delete map._values[key];
|
|
93
|
+
return map._keys.remove(key);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @dev Removes all the entries from a map. O(n).
|
|
98
|
+
*
|
|
99
|
+
* WARNING: Developers should keep in mind that this function has an unbounded cost and using it may render the
|
|
100
|
+
* function uncallable if the map grows to the point where clearing it consumes too much gas to fit in a block.
|
|
101
|
+
*/
|
|
102
|
+
function clear(Bytes32ToBytes32Map storage map) internal {
|
|
103
|
+
uint256 len = length(map);
|
|
104
|
+
for (uint256 i = 0; i < len; ++i) {
|
|
105
|
+
delete map._values[map._keys.at(i)];
|
|
106
|
+
}
|
|
107
|
+
map._keys.clear();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* @dev Returns true if the key is in the map. O(1).
|
|
112
|
+
*/
|
|
113
|
+
function contains(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool) {
|
|
114
|
+
return map._keys.contains(key);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* @dev Returns the number of key-value pairs in the map. O(1).
|
|
119
|
+
*/
|
|
120
|
+
function length(Bytes32ToBytes32Map storage map) internal view returns (uint256) {
|
|
121
|
+
return map._keys.length();
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @dev Returns the key-value pair stored at position `index` in the map. O(1).
|
|
126
|
+
*
|
|
127
|
+
* Note that there are no guarantees on the ordering of entries inside the
|
|
128
|
+
* array, and it may change when more entries are added or removed.
|
|
129
|
+
*
|
|
130
|
+
* Requirements:
|
|
131
|
+
*
|
|
132
|
+
* - `index` must be strictly less than {length}.
|
|
133
|
+
*/
|
|
134
|
+
function at(Bytes32ToBytes32Map storage map, uint256 index) internal view returns (bytes32 key, bytes32 value) {
|
|
135
|
+
bytes32 atKey = map._keys.at(index);
|
|
136
|
+
return (atKey, map._values[atKey]);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* @dev Tries to return the value associated with `key`. O(1).
|
|
141
|
+
* Does not revert if `key` is not in the map.
|
|
142
|
+
*/
|
|
143
|
+
function tryGet(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool exists, bytes32 value) {
|
|
144
|
+
bytes32 val = map._values[key];
|
|
145
|
+
if (val == bytes32(0)) {
|
|
146
|
+
return (contains(map, key), bytes32(0));
|
|
147
|
+
} else {
|
|
148
|
+
return (true, val);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* @dev Returns the value associated with `key`. O(1).
|
|
154
|
+
*
|
|
155
|
+
* Requirements:
|
|
156
|
+
*
|
|
157
|
+
* - `key` must be in the map.
|
|
158
|
+
*/
|
|
159
|
+
function get(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bytes32) {
|
|
160
|
+
bytes32 value = map._values[key];
|
|
161
|
+
if (value == 0 && !contains(map, key)) {
|
|
162
|
+
revert EnumerableMapNonexistentKey(key);
|
|
163
|
+
}
|
|
164
|
+
return value;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* @dev Returns an array containing all the keys
|
|
169
|
+
*
|
|
170
|
+
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
|
|
171
|
+
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
|
|
172
|
+
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
|
|
173
|
+
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
|
|
174
|
+
*/
|
|
175
|
+
function keys(Bytes32ToBytes32Map storage map) internal view returns (bytes32[] memory) {
|
|
176
|
+
return map._keys.values();
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* @dev Returns an array containing a slice of the keys
|
|
181
|
+
*
|
|
182
|
+
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
|
|
183
|
+
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
|
|
184
|
+
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
|
|
185
|
+
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
|
|
186
|
+
*/
|
|
187
|
+
function keys(
|
|
188
|
+
Bytes32ToBytes32Map storage map,
|
|
189
|
+
uint256 start,
|
|
190
|
+
uint256 end
|
|
191
|
+
) internal view returns (bytes32[] memory) {
|
|
192
|
+
return map._keys.values(start, end);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// UintToUintMap
|
|
196
|
+
|
|
197
|
+
struct UintToUintMap {
|
|
198
|
+
Bytes32ToBytes32Map _inner;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* @dev Adds a key-value pair to a map, or updates the value for an existing
|
|
203
|
+
* key. O(1).
|
|
204
|
+
*
|
|
205
|
+
* Returns true if the key was added to the map, that is if it was not
|
|
206
|
+
* already present.
|
|
207
|
+
*/
|
|
208
|
+
function set(UintToUintMap storage map, uint256 key, uint256 value) internal returns (bool) {
|
|
209
|
+
return set(map._inner, bytes32(key), bytes32(value));
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* @dev Removes a value from a map. O(1).
|
|
214
|
+
*
|
|
215
|
+
* Returns true if the key was removed from the map, that is if it was present.
|
|
216
|
+
*/
|
|
217
|
+
function remove(UintToUintMap storage map, uint256 key) internal returns (bool) {
|
|
218
|
+
return remove(map._inner, bytes32(key));
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* @dev Removes all the entries from a map. O(n).
|
|
223
|
+
*
|
|
224
|
+
* WARNING: This function has an unbounded cost that scales with map size. Developers should keep in mind that
|
|
225
|
+
* using it may render the function uncallable if the map grows to the point where clearing it consumes too much
|
|
226
|
+
* gas to fit in a block.
|
|
227
|
+
*/
|
|
228
|
+
function clear(UintToUintMap storage map) internal {
|
|
229
|
+
clear(map._inner);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* @dev Returns true if the key is in the map. O(1).
|
|
234
|
+
*/
|
|
235
|
+
function contains(UintToUintMap storage map, uint256 key) internal view returns (bool) {
|
|
236
|
+
return contains(map._inner, bytes32(key));
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* @dev Returns the number of elements in the map. O(1).
|
|
241
|
+
*/
|
|
242
|
+
function length(UintToUintMap storage map) internal view returns (uint256) {
|
|
243
|
+
return length(map._inner);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* @dev Returns the element stored at position `index` in the map. O(1).
|
|
248
|
+
* Note that there are no guarantees on the ordering of values inside the
|
|
249
|
+
* array, and it may change when more values are added or removed.
|
|
250
|
+
*
|
|
251
|
+
* Requirements:
|
|
252
|
+
*
|
|
253
|
+
* - `index` must be strictly less than {length}.
|
|
254
|
+
*/
|
|
255
|
+
function at(UintToUintMap storage map, uint256 index) internal view returns (uint256 key, uint256 value) {
|
|
256
|
+
(bytes32 atKey, bytes32 val) = at(map._inner, index);
|
|
257
|
+
return (uint256(atKey), uint256(val));
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* @dev Tries to return the value associated with `key`. O(1).
|
|
262
|
+
* Does not revert if `key` is not in the map.
|
|
263
|
+
*/
|
|
264
|
+
function tryGet(UintToUintMap storage map, uint256 key) internal view returns (bool exists, uint256 value) {
|
|
265
|
+
(bool success, bytes32 val) = tryGet(map._inner, bytes32(key));
|
|
266
|
+
return (success, uint256(val));
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* @dev Returns the value associated with `key`. O(1).
|
|
271
|
+
*
|
|
272
|
+
* Requirements:
|
|
273
|
+
*
|
|
274
|
+
* - `key` must be in the map.
|
|
275
|
+
*/
|
|
276
|
+
function get(UintToUintMap storage map, uint256 key) internal view returns (uint256) {
|
|
277
|
+
return uint256(get(map._inner, bytes32(key)));
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* @dev Returns an array containing all the keys
|
|
282
|
+
*
|
|
283
|
+
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
|
|
284
|
+
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
|
|
285
|
+
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
|
|
286
|
+
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
|
|
287
|
+
*/
|
|
288
|
+
function keys(UintToUintMap storage map) internal view returns (uint256[] memory) {
|
|
289
|
+
bytes32[] memory store = keys(map._inner);
|
|
290
|
+
uint256[] memory result;
|
|
291
|
+
|
|
292
|
+
assembly ("memory-safe") {
|
|
293
|
+
result := store
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
return result;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* @dev Returns an array containing a slice of the keys
|
|
301
|
+
*
|
|
302
|
+
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
|
|
303
|
+
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
|
|
304
|
+
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
|
|
305
|
+
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
|
|
306
|
+
*/
|
|
307
|
+
function keys(UintToUintMap storage map, uint256 start, uint256 end) internal view returns (uint256[] memory) {
|
|
308
|
+
bytes32[] memory store = keys(map._inner, start, end);
|
|
309
|
+
uint256[] memory result;
|
|
310
|
+
|
|
311
|
+
assembly ("memory-safe") {
|
|
312
|
+
result := store
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
return result;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// UintToAddressMap
|
|
319
|
+
|
|
320
|
+
struct UintToAddressMap {
|
|
321
|
+
Bytes32ToBytes32Map _inner;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* @dev Adds a key-value pair to a map, or updates the value for an existing
|
|
326
|
+
* key. O(1).
|
|
327
|
+
*
|
|
328
|
+
* Returns true if the key was added to the map, that is if it was not
|
|
329
|
+
* already present.
|
|
330
|
+
*/
|
|
331
|
+
function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) {
|
|
332
|
+
return set(map._inner, bytes32(key), bytes32(uint256(uint160(value))));
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* @dev Removes a value from a map. O(1).
|
|
337
|
+
*
|
|
338
|
+
* Returns true if the key was removed from the map, that is if it was present.
|
|
339
|
+
*/
|
|
340
|
+
function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) {
|
|
341
|
+
return remove(map._inner, bytes32(key));
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* @dev Removes all the entries from a map. O(n).
|
|
346
|
+
*
|
|
347
|
+
* WARNING: This function has an unbounded cost that scales with map size. Developers should keep in mind that
|
|
348
|
+
* using it may render the function uncallable if the map grows to the point where clearing it consumes too much
|
|
349
|
+
* gas to fit in a block.
|
|
350
|
+
*/
|
|
351
|
+
function clear(UintToAddressMap storage map) internal {
|
|
352
|
+
clear(map._inner);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* @dev Returns true if the key is in the map. O(1).
|
|
357
|
+
*/
|
|
358
|
+
function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) {
|
|
359
|
+
return contains(map._inner, bytes32(key));
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* @dev Returns the number of elements in the map. O(1).
|
|
364
|
+
*/
|
|
365
|
+
function length(UintToAddressMap storage map) internal view returns (uint256) {
|
|
366
|
+
return length(map._inner);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* @dev Returns the element stored at position `index` in the map. O(1).
|
|
371
|
+
* Note that there are no guarantees on the ordering of values inside the
|
|
372
|
+
* array, and it may change when more values are added or removed.
|
|
373
|
+
*
|
|
374
|
+
* Requirements:
|
|
375
|
+
*
|
|
376
|
+
* - `index` must be strictly less than {length}.
|
|
377
|
+
*/
|
|
378
|
+
function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256 key, address value) {
|
|
379
|
+
(bytes32 atKey, bytes32 val) = at(map._inner, index);
|
|
380
|
+
return (uint256(atKey), address(uint160(uint256(val))));
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* @dev Tries to return the value associated with `key`. O(1).
|
|
385
|
+
* Does not revert if `key` is not in the map.
|
|
386
|
+
*/
|
|
387
|
+
function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool exists, address value) {
|
|
388
|
+
(bool success, bytes32 val) = tryGet(map._inner, bytes32(key));
|
|
389
|
+
return (success, address(uint160(uint256(val))));
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* @dev Returns the value associated with `key`. O(1).
|
|
394
|
+
*
|
|
395
|
+
* Requirements:
|
|
396
|
+
*
|
|
397
|
+
* - `key` must be in the map.
|
|
398
|
+
*/
|
|
399
|
+
function get(UintToAddressMap storage map, uint256 key) internal view returns (address) {
|
|
400
|
+
return address(uint160(uint256(get(map._inner, bytes32(key)))));
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* @dev Returns an array containing all the keys
|
|
405
|
+
*
|
|
406
|
+
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
|
|
407
|
+
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
|
|
408
|
+
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
|
|
409
|
+
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
|
|
410
|
+
*/
|
|
411
|
+
function keys(UintToAddressMap storage map) internal view returns (uint256[] memory) {
|
|
412
|
+
bytes32[] memory store = keys(map._inner);
|
|
413
|
+
uint256[] memory result;
|
|
414
|
+
|
|
415
|
+
assembly ("memory-safe") {
|
|
416
|
+
result := store
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
return result;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* @dev Returns an array containing a slice of the keys
|
|
424
|
+
*
|
|
425
|
+
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
|
|
426
|
+
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
|
|
427
|
+
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
|
|
428
|
+
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
|
|
429
|
+
*/
|
|
430
|
+
function keys(UintToAddressMap storage map, uint256 start, uint256 end) internal view returns (uint256[] memory) {
|
|
431
|
+
bytes32[] memory store = keys(map._inner, start, end);
|
|
432
|
+
uint256[] memory result;
|
|
433
|
+
|
|
434
|
+
assembly ("memory-safe") {
|
|
435
|
+
result := store
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
return result;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
// UintToBytes32Map
|
|
442
|
+
|
|
443
|
+
struct UintToBytes32Map {
|
|
444
|
+
Bytes32ToBytes32Map _inner;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* @dev Adds a key-value pair to a map, or updates the value for an existing
|
|
449
|
+
* key. O(1).
|
|
450
|
+
*
|
|
451
|
+
* Returns true if the key was added to the map, that is if it was not
|
|
452
|
+
* already present.
|
|
453
|
+
*/
|
|
454
|
+
function set(UintToBytes32Map storage map, uint256 key, bytes32 value) internal returns (bool) {
|
|
455
|
+
return set(map._inner, bytes32(key), value);
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* @dev Removes a value from a map. O(1).
|
|
460
|
+
*
|
|
461
|
+
* Returns true if the key was removed from the map, that is if it was present.
|
|
462
|
+
*/
|
|
463
|
+
function remove(UintToBytes32Map storage map, uint256 key) internal returns (bool) {
|
|
464
|
+
return remove(map._inner, bytes32(key));
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* @dev Removes all the entries from a map. O(n).
|
|
469
|
+
*
|
|
470
|
+
* WARNING: This function has an unbounded cost that scales with map size. Developers should keep in mind that
|
|
471
|
+
* using it may render the function uncallable if the map grows to the point where clearing it consumes too much
|
|
472
|
+
* gas to fit in a block.
|
|
473
|
+
*/
|
|
474
|
+
function clear(UintToBytes32Map storage map) internal {
|
|
475
|
+
clear(map._inner);
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* @dev Returns true if the key is in the map. O(1).
|
|
480
|
+
*/
|
|
481
|
+
function contains(UintToBytes32Map storage map, uint256 key) internal view returns (bool) {
|
|
482
|
+
return contains(map._inner, bytes32(key));
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* @dev Returns the number of elements in the map. O(1).
|
|
487
|
+
*/
|
|
488
|
+
function length(UintToBytes32Map storage map) internal view returns (uint256) {
|
|
489
|
+
return length(map._inner);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* @dev Returns the element stored at position `index` in the map. O(1).
|
|
494
|
+
* Note that there are no guarantees on the ordering of values inside the
|
|
495
|
+
* array, and it may change when more values are added or removed.
|
|
496
|
+
*
|
|
497
|
+
* Requirements:
|
|
498
|
+
*
|
|
499
|
+
* - `index` must be strictly less than {length}.
|
|
500
|
+
*/
|
|
501
|
+
function at(UintToBytes32Map storage map, uint256 index) internal view returns (uint256 key, bytes32 value) {
|
|
502
|
+
(bytes32 atKey, bytes32 val) = at(map._inner, index);
|
|
503
|
+
return (uint256(atKey), val);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* @dev Tries to return the value associated with `key`. O(1).
|
|
508
|
+
* Does not revert if `key` is not in the map.
|
|
509
|
+
*/
|
|
510
|
+
function tryGet(UintToBytes32Map storage map, uint256 key) internal view returns (bool exists, bytes32 value) {
|
|
511
|
+
(bool success, bytes32 val) = tryGet(map._inner, bytes32(key));
|
|
512
|
+
return (success, val);
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* @dev Returns the value associated with `key`. O(1).
|
|
517
|
+
*
|
|
518
|
+
* Requirements:
|
|
519
|
+
*
|
|
520
|
+
* - `key` must be in the map.
|
|
521
|
+
*/
|
|
522
|
+
function get(UintToBytes32Map storage map, uint256 key) internal view returns (bytes32) {
|
|
523
|
+
return get(map._inner, bytes32(key));
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* @dev Returns an array containing all the keys
|
|
528
|
+
*
|
|
529
|
+
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
|
|
530
|
+
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
|
|
531
|
+
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
|
|
532
|
+
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
|
|
533
|
+
*/
|
|
534
|
+
function keys(UintToBytes32Map storage map) internal view returns (uint256[] memory) {
|
|
535
|
+
bytes32[] memory store = keys(map._inner);
|
|
536
|
+
uint256[] memory result;
|
|
537
|
+
|
|
538
|
+
assembly ("memory-safe") {
|
|
539
|
+
result := store
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
return result;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* @dev Returns an array containing a slice of the keys
|
|
547
|
+
*
|
|
548
|
+
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
|
|
549
|
+
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
|
|
550
|
+
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
|
|
551
|
+
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
|
|
552
|
+
*/
|
|
553
|
+
function keys(UintToBytes32Map storage map, uint256 start, uint256 end) internal view returns (uint256[] memory) {
|
|
554
|
+
bytes32[] memory store = keys(map._inner, start, end);
|
|
555
|
+
uint256[] memory result;
|
|
556
|
+
|
|
557
|
+
assembly ("memory-safe") {
|
|
558
|
+
result := store
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
return result;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
// AddressToUintMap
|
|
565
|
+
|
|
566
|
+
struct AddressToUintMap {
|
|
567
|
+
Bytes32ToBytes32Map _inner;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* @dev Adds a key-value pair to a map, or updates the value for an existing
|
|
572
|
+
* key. O(1).
|
|
573
|
+
*
|
|
574
|
+
* Returns true if the key was added to the map, that is if it was not
|
|
575
|
+
* already present.
|
|
576
|
+
*/
|
|
577
|
+
function set(AddressToUintMap storage map, address key, uint256 value) internal returns (bool) {
|
|
578
|
+
return set(map._inner, bytes32(uint256(uint160(key))), bytes32(value));
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* @dev Removes a value from a map. O(1).
|
|
583
|
+
*
|
|
584
|
+
* Returns true if the key was removed from the map, that is if it was present.
|
|
585
|
+
*/
|
|
586
|
+
function remove(AddressToUintMap storage map, address key) internal returns (bool) {
|
|
587
|
+
return remove(map._inner, bytes32(uint256(uint160(key))));
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* @dev Removes all the entries from a map. O(n).
|
|
592
|
+
*
|
|
593
|
+
* WARNING: This function has an unbounded cost that scales with map size. Developers should keep in mind that
|
|
594
|
+
* using it may render the function uncallable if the map grows to the point where clearing it consumes too much
|
|
595
|
+
* gas to fit in a block.
|
|
596
|
+
*/
|
|
597
|
+
function clear(AddressToUintMap storage map) internal {
|
|
598
|
+
clear(map._inner);
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* @dev Returns true if the key is in the map. O(1).
|
|
603
|
+
*/
|
|
604
|
+
function contains(AddressToUintMap storage map, address key) internal view returns (bool) {
|
|
605
|
+
return contains(map._inner, bytes32(uint256(uint160(key))));
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
/**
|
|
609
|
+
* @dev Returns the number of elements in the map. O(1).
|
|
610
|
+
*/
|
|
611
|
+
function length(AddressToUintMap storage map) internal view returns (uint256) {
|
|
612
|
+
return length(map._inner);
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* @dev Returns the element stored at position `index` in the map. O(1).
|
|
617
|
+
* Note that there are no guarantees on the ordering of values inside the
|
|
618
|
+
* array, and it may change when more values are added or removed.
|
|
619
|
+
*
|
|
620
|
+
* Requirements:
|
|
621
|
+
*
|
|
622
|
+
* - `index` must be strictly less than {length}.
|
|
623
|
+
*/
|
|
624
|
+
function at(AddressToUintMap storage map, uint256 index) internal view returns (address key, uint256 value) {
|
|
625
|
+
(bytes32 atKey, bytes32 val) = at(map._inner, index);
|
|
626
|
+
return (address(uint160(uint256(atKey))), uint256(val));
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* @dev Tries to return the value associated with `key`. O(1).
|
|
631
|
+
* Does not revert if `key` is not in the map.
|
|
632
|
+
*/
|
|
633
|
+
function tryGet(AddressToUintMap storage map, address key) internal view returns (bool exists, uint256 value) {
|
|
634
|
+
(bool success, bytes32 val) = tryGet(map._inner, bytes32(uint256(uint160(key))));
|
|
635
|
+
return (success, uint256(val));
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* @dev Returns the value associated with `key`. O(1).
|
|
640
|
+
*
|
|
641
|
+
* Requirements:
|
|
642
|
+
*
|
|
643
|
+
* - `key` must be in the map.
|
|
644
|
+
*/
|
|
645
|
+
function get(AddressToUintMap storage map, address key) internal view returns (uint256) {
|
|
646
|
+
return uint256(get(map._inner, bytes32(uint256(uint160(key)))));
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* @dev Returns an array containing all the keys
|
|
651
|
+
*
|
|
652
|
+
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
|
|
653
|
+
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
|
|
654
|
+
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
|
|
655
|
+
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
|
|
656
|
+
*/
|
|
657
|
+
function keys(AddressToUintMap storage map) internal view returns (address[] memory) {
|
|
658
|
+
bytes32[] memory store = keys(map._inner);
|
|
659
|
+
address[] memory result;
|
|
660
|
+
|
|
661
|
+
assembly ("memory-safe") {
|
|
662
|
+
result := store
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
return result;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* @dev Returns an array containing a slice of the keys
|
|
670
|
+
*
|
|
671
|
+
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
|
|
672
|
+
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
|
|
673
|
+
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
|
|
674
|
+
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
|
|
675
|
+
*/
|
|
676
|
+
function keys(AddressToUintMap storage map, uint256 start, uint256 end) internal view returns (address[] memory) {
|
|
677
|
+
bytes32[] memory store = keys(map._inner, start, end);
|
|
678
|
+
address[] memory result;
|
|
679
|
+
|
|
680
|
+
assembly ("memory-safe") {
|
|
681
|
+
result := store
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
return result;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
// AddressToAddressMap
|
|
688
|
+
|
|
689
|
+
struct AddressToAddressMap {
|
|
690
|
+
Bytes32ToBytes32Map _inner;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
/**
|
|
694
|
+
* @dev Adds a key-value pair to a map, or updates the value for an existing
|
|
695
|
+
* key. O(1).
|
|
696
|
+
*
|
|
697
|
+
* Returns true if the key was added to the map, that is if it was not
|
|
698
|
+
* already present.
|
|
699
|
+
*/
|
|
700
|
+
function set(AddressToAddressMap storage map, address key, address value) internal returns (bool) {
|
|
701
|
+
return set(map._inner, bytes32(uint256(uint160(key))), bytes32(uint256(uint160(value))));
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
/**
|
|
705
|
+
* @dev Removes a value from a map. O(1).
|
|
706
|
+
*
|
|
707
|
+
* Returns true if the key was removed from the map, that is if it was present.
|
|
708
|
+
*/
|
|
709
|
+
function remove(AddressToAddressMap storage map, address key) internal returns (bool) {
|
|
710
|
+
return remove(map._inner, bytes32(uint256(uint160(key))));
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
/**
|
|
714
|
+
* @dev Removes all the entries from a map. O(n).
|
|
715
|
+
*
|
|
716
|
+
* WARNING: This function has an unbounded cost that scales with map size. Developers should keep in mind that
|
|
717
|
+
* using it may render the function uncallable if the map grows to the point where clearing it consumes too much
|
|
718
|
+
* gas to fit in a block.
|
|
719
|
+
*/
|
|
720
|
+
function clear(AddressToAddressMap storage map) internal {
|
|
721
|
+
clear(map._inner);
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
/**
|
|
725
|
+
* @dev Returns true if the key is in the map. O(1).
|
|
726
|
+
*/
|
|
727
|
+
function contains(AddressToAddressMap storage map, address key) internal view returns (bool) {
|
|
728
|
+
return contains(map._inner, bytes32(uint256(uint160(key))));
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* @dev Returns the number of elements in the map. O(1).
|
|
733
|
+
*/
|
|
734
|
+
function length(AddressToAddressMap storage map) internal view returns (uint256) {
|
|
735
|
+
return length(map._inner);
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
/**
|
|
739
|
+
* @dev Returns the element stored at position `index` in the map. O(1).
|
|
740
|
+
* Note that there are no guarantees on the ordering of values inside the
|
|
741
|
+
* array, and it may change when more values are added or removed.
|
|
742
|
+
*
|
|
743
|
+
* Requirements:
|
|
744
|
+
*
|
|
745
|
+
* - `index` must be strictly less than {length}.
|
|
746
|
+
*/
|
|
747
|
+
function at(AddressToAddressMap storage map, uint256 index) internal view returns (address key, address value) {
|
|
748
|
+
(bytes32 atKey, bytes32 val) = at(map._inner, index);
|
|
749
|
+
return (address(uint160(uint256(atKey))), address(uint160(uint256(val))));
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
/**
|
|
753
|
+
* @dev Tries to return the value associated with `key`. O(1).
|
|
754
|
+
* Does not revert if `key` is not in the map.
|
|
755
|
+
*/
|
|
756
|
+
function tryGet(AddressToAddressMap storage map, address key) internal view returns (bool exists, address value) {
|
|
757
|
+
(bool success, bytes32 val) = tryGet(map._inner, bytes32(uint256(uint160(key))));
|
|
758
|
+
return (success, address(uint160(uint256(val))));
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
/**
|
|
762
|
+
* @dev Returns the value associated with `key`. O(1).
|
|
763
|
+
*
|
|
764
|
+
* Requirements:
|
|
765
|
+
*
|
|
766
|
+
* - `key` must be in the map.
|
|
767
|
+
*/
|
|
768
|
+
function get(AddressToAddressMap storage map, address key) internal view returns (address) {
|
|
769
|
+
return address(uint160(uint256(get(map._inner, bytes32(uint256(uint160(key)))))));
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* @dev Returns an array containing all the keys
|
|
774
|
+
*
|
|
775
|
+
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
|
|
776
|
+
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
|
|
777
|
+
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
|
|
778
|
+
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
|
|
779
|
+
*/
|
|
780
|
+
function keys(AddressToAddressMap storage map) internal view returns (address[] memory) {
|
|
781
|
+
bytes32[] memory store = keys(map._inner);
|
|
782
|
+
address[] memory result;
|
|
783
|
+
|
|
784
|
+
assembly ("memory-safe") {
|
|
785
|
+
result := store
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
return result;
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
/**
|
|
792
|
+
* @dev Returns an array containing a slice of the keys
|
|
793
|
+
*
|
|
794
|
+
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
|
|
795
|
+
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
|
|
796
|
+
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
|
|
797
|
+
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
|
|
798
|
+
*/
|
|
799
|
+
function keys(
|
|
800
|
+
AddressToAddressMap storage map,
|
|
801
|
+
uint256 start,
|
|
802
|
+
uint256 end
|
|
803
|
+
) internal view returns (address[] memory) {
|
|
804
|
+
bytes32[] memory store = keys(map._inner, start, end);
|
|
805
|
+
address[] memory result;
|
|
806
|
+
|
|
807
|
+
assembly ("memory-safe") {
|
|
808
|
+
result := store
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
return result;
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
// AddressToBytes32Map
|
|
815
|
+
|
|
816
|
+
struct AddressToBytes32Map {
|
|
817
|
+
Bytes32ToBytes32Map _inner;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
/**
|
|
821
|
+
* @dev Adds a key-value pair to a map, or updates the value for an existing
|
|
822
|
+
* key. O(1).
|
|
823
|
+
*
|
|
824
|
+
* Returns true if the key was added to the map, that is if it was not
|
|
825
|
+
* already present.
|
|
826
|
+
*/
|
|
827
|
+
function set(AddressToBytes32Map storage map, address key, bytes32 value) internal returns (bool) {
|
|
828
|
+
return set(map._inner, bytes32(uint256(uint160(key))), value);
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
/**
|
|
832
|
+
* @dev Removes a value from a map. O(1).
|
|
833
|
+
*
|
|
834
|
+
* Returns true if the key was removed from the map, that is if it was present.
|
|
835
|
+
*/
|
|
836
|
+
function remove(AddressToBytes32Map storage map, address key) internal returns (bool) {
|
|
837
|
+
return remove(map._inner, bytes32(uint256(uint160(key))));
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
/**
|
|
841
|
+
* @dev Removes all the entries from a map. O(n).
|
|
842
|
+
*
|
|
843
|
+
* WARNING: This function has an unbounded cost that scales with map size. Developers should keep in mind that
|
|
844
|
+
* using it may render the function uncallable if the map grows to the point where clearing it consumes too much
|
|
845
|
+
* gas to fit in a block.
|
|
846
|
+
*/
|
|
847
|
+
function clear(AddressToBytes32Map storage map) internal {
|
|
848
|
+
clear(map._inner);
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
/**
|
|
852
|
+
* @dev Returns true if the key is in the map. O(1).
|
|
853
|
+
*/
|
|
854
|
+
function contains(AddressToBytes32Map storage map, address key) internal view returns (bool) {
|
|
855
|
+
return contains(map._inner, bytes32(uint256(uint160(key))));
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
/**
|
|
859
|
+
* @dev Returns the number of elements in the map. O(1).
|
|
860
|
+
*/
|
|
861
|
+
function length(AddressToBytes32Map storage map) internal view returns (uint256) {
|
|
862
|
+
return length(map._inner);
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
/**
|
|
866
|
+
* @dev Returns the element stored at position `index` in the map. O(1).
|
|
867
|
+
* Note that there are no guarantees on the ordering of values inside the
|
|
868
|
+
* array, and it may change when more values are added or removed.
|
|
869
|
+
*
|
|
870
|
+
* Requirements:
|
|
871
|
+
*
|
|
872
|
+
* - `index` must be strictly less than {length}.
|
|
873
|
+
*/
|
|
874
|
+
function at(AddressToBytes32Map storage map, uint256 index) internal view returns (address key, bytes32 value) {
|
|
875
|
+
(bytes32 atKey, bytes32 val) = at(map._inner, index);
|
|
876
|
+
return (address(uint160(uint256(atKey))), val);
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
/**
|
|
880
|
+
* @dev Tries to return the value associated with `key`. O(1).
|
|
881
|
+
* Does not revert if `key` is not in the map.
|
|
882
|
+
*/
|
|
883
|
+
function tryGet(AddressToBytes32Map storage map, address key) internal view returns (bool exists, bytes32 value) {
|
|
884
|
+
(bool success, bytes32 val) = tryGet(map._inner, bytes32(uint256(uint160(key))));
|
|
885
|
+
return (success, val);
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
/**
|
|
889
|
+
* @dev Returns the value associated with `key`. O(1).
|
|
890
|
+
*
|
|
891
|
+
* Requirements:
|
|
892
|
+
*
|
|
893
|
+
* - `key` must be in the map.
|
|
894
|
+
*/
|
|
895
|
+
function get(AddressToBytes32Map storage map, address key) internal view returns (bytes32) {
|
|
896
|
+
return get(map._inner, bytes32(uint256(uint160(key))));
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
/**
|
|
900
|
+
* @dev Returns an array containing all the keys
|
|
901
|
+
*
|
|
902
|
+
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
|
|
903
|
+
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
|
|
904
|
+
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
|
|
905
|
+
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
|
|
906
|
+
*/
|
|
907
|
+
function keys(AddressToBytes32Map storage map) internal view returns (address[] memory) {
|
|
908
|
+
bytes32[] memory store = keys(map._inner);
|
|
909
|
+
address[] memory result;
|
|
910
|
+
|
|
911
|
+
assembly ("memory-safe") {
|
|
912
|
+
result := store
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
return result;
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
/**
|
|
919
|
+
* @dev Returns an array containing a slice of the keys
|
|
920
|
+
*
|
|
921
|
+
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
|
|
922
|
+
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
|
|
923
|
+
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
|
|
924
|
+
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
|
|
925
|
+
*/
|
|
926
|
+
function keys(
|
|
927
|
+
AddressToBytes32Map storage map,
|
|
928
|
+
uint256 start,
|
|
929
|
+
uint256 end
|
|
930
|
+
) internal view returns (address[] memory) {
|
|
931
|
+
bytes32[] memory store = keys(map._inner, start, end);
|
|
932
|
+
address[] memory result;
|
|
933
|
+
|
|
934
|
+
assembly ("memory-safe") {
|
|
935
|
+
result := store
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
return result;
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
// Bytes32ToUintMap
|
|
942
|
+
|
|
943
|
+
struct Bytes32ToUintMap {
|
|
944
|
+
Bytes32ToBytes32Map _inner;
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
/**
|
|
948
|
+
* @dev Adds a key-value pair to a map, or updates the value for an existing
|
|
949
|
+
* key. O(1).
|
|
950
|
+
*
|
|
951
|
+
* Returns true if the key was added to the map, that is if it was not
|
|
952
|
+
* already present.
|
|
953
|
+
*/
|
|
954
|
+
function set(Bytes32ToUintMap storage map, bytes32 key, uint256 value) internal returns (bool) {
|
|
955
|
+
return set(map._inner, key, bytes32(value));
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
/**
|
|
959
|
+
* @dev Removes a value from a map. O(1).
|
|
960
|
+
*
|
|
961
|
+
* Returns true if the key was removed from the map, that is if it was present.
|
|
962
|
+
*/
|
|
963
|
+
function remove(Bytes32ToUintMap storage map, bytes32 key) internal returns (bool) {
|
|
964
|
+
return remove(map._inner, key);
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
/**
|
|
968
|
+
* @dev Removes all the entries from a map. O(n).
|
|
969
|
+
*
|
|
970
|
+
* WARNING: This function has an unbounded cost that scales with map size. Developers should keep in mind that
|
|
971
|
+
* using it may render the function uncallable if the map grows to the point where clearing it consumes too much
|
|
972
|
+
* gas to fit in a block.
|
|
973
|
+
*/
|
|
974
|
+
function clear(Bytes32ToUintMap storage map) internal {
|
|
975
|
+
clear(map._inner);
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
/**
|
|
979
|
+
* @dev Returns true if the key is in the map. O(1).
|
|
980
|
+
*/
|
|
981
|
+
function contains(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool) {
|
|
982
|
+
return contains(map._inner, key);
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
/**
|
|
986
|
+
* @dev Returns the number of elements in the map. O(1).
|
|
987
|
+
*/
|
|
988
|
+
function length(Bytes32ToUintMap storage map) internal view returns (uint256) {
|
|
989
|
+
return length(map._inner);
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
/**
|
|
993
|
+
* @dev Returns the element stored at position `index` in the map. O(1).
|
|
994
|
+
* Note that there are no guarantees on the ordering of values inside the
|
|
995
|
+
* array, and it may change when more values are added or removed.
|
|
996
|
+
*
|
|
997
|
+
* Requirements:
|
|
998
|
+
*
|
|
999
|
+
* - `index` must be strictly less than {length}.
|
|
1000
|
+
*/
|
|
1001
|
+
function at(Bytes32ToUintMap storage map, uint256 index) internal view returns (bytes32 key, uint256 value) {
|
|
1002
|
+
(bytes32 atKey, bytes32 val) = at(map._inner, index);
|
|
1003
|
+
return (atKey, uint256(val));
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
/**
|
|
1007
|
+
* @dev Tries to return the value associated with `key`. O(1).
|
|
1008
|
+
* Does not revert if `key` is not in the map.
|
|
1009
|
+
*/
|
|
1010
|
+
function tryGet(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool exists, uint256 value) {
|
|
1011
|
+
(bool success, bytes32 val) = tryGet(map._inner, key);
|
|
1012
|
+
return (success, uint256(val));
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
/**
|
|
1016
|
+
* @dev Returns the value associated with `key`. O(1).
|
|
1017
|
+
*
|
|
1018
|
+
* Requirements:
|
|
1019
|
+
*
|
|
1020
|
+
* - `key` must be in the map.
|
|
1021
|
+
*/
|
|
1022
|
+
function get(Bytes32ToUintMap storage map, bytes32 key) internal view returns (uint256) {
|
|
1023
|
+
return uint256(get(map._inner, key));
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* @dev Returns an array containing all the keys
|
|
1028
|
+
*
|
|
1029
|
+
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
|
|
1030
|
+
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
|
|
1031
|
+
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
|
|
1032
|
+
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
|
|
1033
|
+
*/
|
|
1034
|
+
function keys(Bytes32ToUintMap storage map) internal view returns (bytes32[] memory) {
|
|
1035
|
+
bytes32[] memory store = keys(map._inner);
|
|
1036
|
+
bytes32[] memory result;
|
|
1037
|
+
|
|
1038
|
+
assembly ("memory-safe") {
|
|
1039
|
+
result := store
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
return result;
|
|
1043
|
+
}
|
|
1044
|
+
|
|
1045
|
+
/**
|
|
1046
|
+
* @dev Returns an array containing a slice of the keys
|
|
1047
|
+
*
|
|
1048
|
+
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
|
|
1049
|
+
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
|
|
1050
|
+
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
|
|
1051
|
+
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
|
|
1052
|
+
*/
|
|
1053
|
+
function keys(Bytes32ToUintMap storage map, uint256 start, uint256 end) internal view returns (bytes32[] memory) {
|
|
1054
|
+
bytes32[] memory store = keys(map._inner, start, end);
|
|
1055
|
+
bytes32[] memory result;
|
|
1056
|
+
|
|
1057
|
+
assembly ("memory-safe") {
|
|
1058
|
+
result := store
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
return result;
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
// Bytes32ToAddressMap
|
|
1065
|
+
|
|
1066
|
+
struct Bytes32ToAddressMap {
|
|
1067
|
+
Bytes32ToBytes32Map _inner;
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
/**
|
|
1071
|
+
* @dev Adds a key-value pair to a map, or updates the value for an existing
|
|
1072
|
+
* key. O(1).
|
|
1073
|
+
*
|
|
1074
|
+
* Returns true if the key was added to the map, that is if it was not
|
|
1075
|
+
* already present.
|
|
1076
|
+
*/
|
|
1077
|
+
function set(Bytes32ToAddressMap storage map, bytes32 key, address value) internal returns (bool) {
|
|
1078
|
+
return set(map._inner, key, bytes32(uint256(uint160(value))));
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
/**
|
|
1082
|
+
* @dev Removes a value from a map. O(1).
|
|
1083
|
+
*
|
|
1084
|
+
* Returns true if the key was removed from the map, that is if it was present.
|
|
1085
|
+
*/
|
|
1086
|
+
function remove(Bytes32ToAddressMap storage map, bytes32 key) internal returns (bool) {
|
|
1087
|
+
return remove(map._inner, key);
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
/**
|
|
1091
|
+
* @dev Removes all the entries from a map. O(n).
|
|
1092
|
+
*
|
|
1093
|
+
* WARNING: This function has an unbounded cost that scales with map size. Developers should keep in mind that
|
|
1094
|
+
* using it may render the function uncallable if the map grows to the point where clearing it consumes too much
|
|
1095
|
+
* gas to fit in a block.
|
|
1096
|
+
*/
|
|
1097
|
+
function clear(Bytes32ToAddressMap storage map) internal {
|
|
1098
|
+
clear(map._inner);
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
/**
|
|
1102
|
+
* @dev Returns true if the key is in the map. O(1).
|
|
1103
|
+
*/
|
|
1104
|
+
function contains(Bytes32ToAddressMap storage map, bytes32 key) internal view returns (bool) {
|
|
1105
|
+
return contains(map._inner, key);
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
/**
|
|
1109
|
+
* @dev Returns the number of elements in the map. O(1).
|
|
1110
|
+
*/
|
|
1111
|
+
function length(Bytes32ToAddressMap storage map) internal view returns (uint256) {
|
|
1112
|
+
return length(map._inner);
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
* @dev Returns the element stored at position `index` in the map. O(1).
|
|
1117
|
+
* Note that there are no guarantees on the ordering of values inside the
|
|
1118
|
+
* array, and it may change when more values are added or removed.
|
|
1119
|
+
*
|
|
1120
|
+
* Requirements:
|
|
1121
|
+
*
|
|
1122
|
+
* - `index` must be strictly less than {length}.
|
|
1123
|
+
*/
|
|
1124
|
+
function at(Bytes32ToAddressMap storage map, uint256 index) internal view returns (bytes32 key, address value) {
|
|
1125
|
+
(bytes32 atKey, bytes32 val) = at(map._inner, index);
|
|
1126
|
+
return (atKey, address(uint160(uint256(val))));
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
/**
|
|
1130
|
+
* @dev Tries to return the value associated with `key`. O(1).
|
|
1131
|
+
* Does not revert if `key` is not in the map.
|
|
1132
|
+
*/
|
|
1133
|
+
function tryGet(Bytes32ToAddressMap storage map, bytes32 key) internal view returns (bool exists, address value) {
|
|
1134
|
+
(bool success, bytes32 val) = tryGet(map._inner, key);
|
|
1135
|
+
return (success, address(uint160(uint256(val))));
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
/**
|
|
1139
|
+
* @dev Returns the value associated with `key`. O(1).
|
|
1140
|
+
*
|
|
1141
|
+
* Requirements:
|
|
1142
|
+
*
|
|
1143
|
+
* - `key` must be in the map.
|
|
1144
|
+
*/
|
|
1145
|
+
function get(Bytes32ToAddressMap storage map, bytes32 key) internal view returns (address) {
|
|
1146
|
+
return address(uint160(uint256(get(map._inner, key))));
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
/**
|
|
1150
|
+
* @dev Returns an array containing all the keys
|
|
1151
|
+
*
|
|
1152
|
+
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
|
|
1153
|
+
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
|
|
1154
|
+
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
|
|
1155
|
+
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
|
|
1156
|
+
*/
|
|
1157
|
+
function keys(Bytes32ToAddressMap storage map) internal view returns (bytes32[] memory) {
|
|
1158
|
+
bytes32[] memory store = keys(map._inner);
|
|
1159
|
+
bytes32[] memory result;
|
|
1160
|
+
|
|
1161
|
+
assembly ("memory-safe") {
|
|
1162
|
+
result := store
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
return result;
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
/**
|
|
1169
|
+
* @dev Returns an array containing a slice of the keys
|
|
1170
|
+
*
|
|
1171
|
+
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
|
|
1172
|
+
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
|
|
1173
|
+
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
|
|
1174
|
+
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
|
|
1175
|
+
*/
|
|
1176
|
+
function keys(
|
|
1177
|
+
Bytes32ToAddressMap storage map,
|
|
1178
|
+
uint256 start,
|
|
1179
|
+
uint256 end
|
|
1180
|
+
) internal view returns (bytes32[] memory) {
|
|
1181
|
+
bytes32[] memory store = keys(map._inner, start, end);
|
|
1182
|
+
bytes32[] memory result;
|
|
1183
|
+
|
|
1184
|
+
assembly ("memory-safe") {
|
|
1185
|
+
result := store
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
return result;
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
// Bytes4ToAddressMap
|
|
1192
|
+
|
|
1193
|
+
struct Bytes4ToAddressMap {
|
|
1194
|
+
Bytes32ToBytes32Map _inner;
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
/**
|
|
1198
|
+
* @dev Adds a key-value pair to a map, or updates the value for an existing
|
|
1199
|
+
* key. O(1).
|
|
1200
|
+
*
|
|
1201
|
+
* Returns true if the key was added to the map, that is if it was not
|
|
1202
|
+
* already present.
|
|
1203
|
+
*/
|
|
1204
|
+
function set(Bytes4ToAddressMap storage map, bytes4 key, address value) internal returns (bool) {
|
|
1205
|
+
return set(map._inner, bytes32(key), bytes32(uint256(uint160(value))));
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
/**
|
|
1209
|
+
* @dev Removes a value from a map. O(1).
|
|
1210
|
+
*
|
|
1211
|
+
* Returns true if the key was removed from the map, that is if it was present.
|
|
1212
|
+
*/
|
|
1213
|
+
function remove(Bytes4ToAddressMap storage map, bytes4 key) internal returns (bool) {
|
|
1214
|
+
return remove(map._inner, bytes32(key));
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
/**
|
|
1218
|
+
* @dev Removes all the entries from a map. O(n).
|
|
1219
|
+
*
|
|
1220
|
+
* WARNING: This function has an unbounded cost that scales with map size. Developers should keep in mind that
|
|
1221
|
+
* using it may render the function uncallable if the map grows to the point where clearing it consumes too much
|
|
1222
|
+
* gas to fit in a block.
|
|
1223
|
+
*/
|
|
1224
|
+
function clear(Bytes4ToAddressMap storage map) internal {
|
|
1225
|
+
clear(map._inner);
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
/**
|
|
1229
|
+
* @dev Returns true if the key is in the map. O(1).
|
|
1230
|
+
*/
|
|
1231
|
+
function contains(Bytes4ToAddressMap storage map, bytes4 key) internal view returns (bool) {
|
|
1232
|
+
return contains(map._inner, bytes32(key));
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
/**
|
|
1236
|
+
* @dev Returns the number of elements in the map. O(1).
|
|
1237
|
+
*/
|
|
1238
|
+
function length(Bytes4ToAddressMap storage map) internal view returns (uint256) {
|
|
1239
|
+
return length(map._inner);
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
/**
|
|
1243
|
+
* @dev Returns the element stored at position `index` in the map. O(1).
|
|
1244
|
+
* Note that there are no guarantees on the ordering of values inside the
|
|
1245
|
+
* array, and it may change when more values are added or removed.
|
|
1246
|
+
*
|
|
1247
|
+
* Requirements:
|
|
1248
|
+
*
|
|
1249
|
+
* - `index` must be strictly less than {length}.
|
|
1250
|
+
*/
|
|
1251
|
+
function at(Bytes4ToAddressMap storage map, uint256 index) internal view returns (bytes4 key, address value) {
|
|
1252
|
+
(bytes32 atKey, bytes32 val) = at(map._inner, index);
|
|
1253
|
+
return (bytes4(atKey), address(uint160(uint256(val))));
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
/**
|
|
1257
|
+
* @dev Tries to return the value associated with `key`. O(1).
|
|
1258
|
+
* Does not revert if `key` is not in the map.
|
|
1259
|
+
*/
|
|
1260
|
+
function tryGet(Bytes4ToAddressMap storage map, bytes4 key) internal view returns (bool exists, address value) {
|
|
1261
|
+
(bool success, bytes32 val) = tryGet(map._inner, bytes32(key));
|
|
1262
|
+
return (success, address(uint160(uint256(val))));
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
/**
|
|
1266
|
+
* @dev Returns the value associated with `key`. O(1).
|
|
1267
|
+
*
|
|
1268
|
+
* Requirements:
|
|
1269
|
+
*
|
|
1270
|
+
* - `key` must be in the map.
|
|
1271
|
+
*/
|
|
1272
|
+
function get(Bytes4ToAddressMap storage map, bytes4 key) internal view returns (address) {
|
|
1273
|
+
return address(uint160(uint256(get(map._inner, bytes32(key)))));
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
/**
|
|
1277
|
+
* @dev Returns an array containing all the keys
|
|
1278
|
+
*
|
|
1279
|
+
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
|
|
1280
|
+
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
|
|
1281
|
+
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
|
|
1282
|
+
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
|
|
1283
|
+
*/
|
|
1284
|
+
function keys(Bytes4ToAddressMap storage map) internal view returns (bytes4[] memory) {
|
|
1285
|
+
bytes32[] memory store = keys(map._inner);
|
|
1286
|
+
bytes4[] memory result;
|
|
1287
|
+
|
|
1288
|
+
assembly ("memory-safe") {
|
|
1289
|
+
result := store
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
return result;
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
/**
|
|
1296
|
+
* @dev Returns an array containing a slice of the keys
|
|
1297
|
+
*
|
|
1298
|
+
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
|
|
1299
|
+
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
|
|
1300
|
+
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
|
|
1301
|
+
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
|
|
1302
|
+
*/
|
|
1303
|
+
function keys(Bytes4ToAddressMap storage map, uint256 start, uint256 end) internal view returns (bytes4[] memory) {
|
|
1304
|
+
bytes32[] memory store = keys(map._inner, start, end);
|
|
1305
|
+
bytes4[] memory result;
|
|
1306
|
+
|
|
1307
|
+
assembly ("memory-safe") {
|
|
1308
|
+
result := store
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
return result;
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
/**
|
|
1315
|
+
* @dev Query for a nonexistent map key.
|
|
1316
|
+
*/
|
|
1317
|
+
error EnumerableMapNonexistentBytesKey(bytes key);
|
|
1318
|
+
|
|
1319
|
+
struct BytesToBytesMap {
|
|
1320
|
+
// Storage of keys
|
|
1321
|
+
EnumerableSet.BytesSet _keys;
|
|
1322
|
+
mapping(bytes key => bytes) _values;
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
/**
|
|
1326
|
+
* @dev Adds a key-value pair to a map, or updates the value for an existing
|
|
1327
|
+
* key. O(1).
|
|
1328
|
+
*
|
|
1329
|
+
* Returns true if the key was added to the map, that is if it was not
|
|
1330
|
+
* already present.
|
|
1331
|
+
*/
|
|
1332
|
+
function set(BytesToBytesMap storage map, bytes memory key, bytes memory value) internal returns (bool) {
|
|
1333
|
+
map._values[key] = value;
|
|
1334
|
+
return map._keys.add(key);
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
/**
|
|
1338
|
+
* @dev Removes a key-value pair from a map. O(1).
|
|
1339
|
+
*
|
|
1340
|
+
* Returns true if the key was removed from the map, that is if it was present.
|
|
1341
|
+
*/
|
|
1342
|
+
function remove(BytesToBytesMap storage map, bytes memory key) internal returns (bool) {
|
|
1343
|
+
delete map._values[key];
|
|
1344
|
+
return map._keys.remove(key);
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
/**
|
|
1348
|
+
* @dev Removes all the entries from a map. O(n).
|
|
1349
|
+
*
|
|
1350
|
+
* WARNING: Developers should keep in mind that this function has an unbounded cost and using it may render the
|
|
1351
|
+
* function uncallable if the map grows to the point where clearing it consumes too much gas to fit in a block.
|
|
1352
|
+
*/
|
|
1353
|
+
function clear(BytesToBytesMap storage map) internal {
|
|
1354
|
+
uint256 len = length(map);
|
|
1355
|
+
for (uint256 i = 0; i < len; ++i) {
|
|
1356
|
+
delete map._values[map._keys.at(i)];
|
|
1357
|
+
}
|
|
1358
|
+
map._keys.clear();
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
/**
|
|
1362
|
+
* @dev Returns true if the key is in the map. O(1).
|
|
1363
|
+
*/
|
|
1364
|
+
function contains(BytesToBytesMap storage map, bytes memory key) internal view returns (bool) {
|
|
1365
|
+
return map._keys.contains(key);
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
/**
|
|
1369
|
+
* @dev Returns the number of key-value pairs in the map. O(1).
|
|
1370
|
+
*/
|
|
1371
|
+
function length(BytesToBytesMap storage map) internal view returns (uint256) {
|
|
1372
|
+
return map._keys.length();
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
/**
|
|
1376
|
+
* @dev Returns the key-value pair stored at position `index` in the map. O(1).
|
|
1377
|
+
*
|
|
1378
|
+
* Note that there are no guarantees on the ordering of entries inside the
|
|
1379
|
+
* array, and it may change when more entries are added or removed.
|
|
1380
|
+
*
|
|
1381
|
+
* Requirements:
|
|
1382
|
+
*
|
|
1383
|
+
* - `index` must be strictly less than {length}.
|
|
1384
|
+
*/
|
|
1385
|
+
function at(
|
|
1386
|
+
BytesToBytesMap storage map,
|
|
1387
|
+
uint256 index
|
|
1388
|
+
) internal view returns (bytes memory key, bytes memory value) {
|
|
1389
|
+
key = map._keys.at(index);
|
|
1390
|
+
value = map._values[key];
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
/**
|
|
1394
|
+
* @dev Tries to return the value associated with `key`. O(1).
|
|
1395
|
+
* Does not revert if `key` is not in the map.
|
|
1396
|
+
*/
|
|
1397
|
+
function tryGet(
|
|
1398
|
+
BytesToBytesMap storage map,
|
|
1399
|
+
bytes memory key
|
|
1400
|
+
) internal view returns (bool exists, bytes memory value) {
|
|
1401
|
+
value = map._values[key];
|
|
1402
|
+
exists = bytes(value).length != 0 || contains(map, key);
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
/**
|
|
1406
|
+
* @dev Returns the value associated with `key`. O(1).
|
|
1407
|
+
*
|
|
1408
|
+
* Requirements:
|
|
1409
|
+
*
|
|
1410
|
+
* - `key` must be in the map.
|
|
1411
|
+
*/
|
|
1412
|
+
function get(BytesToBytesMap storage map, bytes memory key) internal view returns (bytes memory value) {
|
|
1413
|
+
bool exists;
|
|
1414
|
+
(exists, value) = tryGet(map, key);
|
|
1415
|
+
if (!exists) {
|
|
1416
|
+
revert EnumerableMapNonexistentBytesKey(key);
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1420
|
+
/**
|
|
1421
|
+
* @dev Returns an array containing all the keys
|
|
1422
|
+
*
|
|
1423
|
+
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
|
|
1424
|
+
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
|
|
1425
|
+
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
|
|
1426
|
+
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
|
|
1427
|
+
*/
|
|
1428
|
+
function keys(BytesToBytesMap storage map) internal view returns (bytes[] memory) {
|
|
1429
|
+
return map._keys.values();
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
/**
|
|
1433
|
+
* @dev Returns an array containing a slice of the keys
|
|
1434
|
+
*
|
|
1435
|
+
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
|
|
1436
|
+
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
|
|
1437
|
+
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
|
|
1438
|
+
* uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
|
|
1439
|
+
*/
|
|
1440
|
+
function keys(BytesToBytesMap storage map, uint256 start, uint256 end) internal view returns (bytes[] memory) {
|
|
1441
|
+
return map._keys.values(start, end);
|
|
1442
|
+
}
|
|
1443
|
+
}
|