├── .env.example ├── .eslintrc.js ├── .gitignore ├── .gitmodules ├── .prettierignore ├── .prettierrc ├── .solhint.json ├── README.md ├── addDelegate.py ├── contracts └── mock │ └── MockERC20Pausable.sol ├── foundry.toml ├── hardhat.config.ts ├── lib ├── forge-std │ ├── .github │ │ └── workflows │ │ │ ├── ci.yml │ │ │ └── sync.yml │ ├── .gitignore │ ├── .gitmodules │ ├── LICENSE-APACHE │ ├── LICENSE-MIT │ ├── README.md │ ├── foundry.toml │ ├── lib │ │ └── ds-test │ │ │ ├── .github │ │ │ └── workflows │ │ │ │ └── build.yml │ │ │ ├── .gitignore │ │ │ ├── LICENSE │ │ │ ├── Makefile │ │ │ ├── default.nix │ │ │ ├── demo │ │ │ └── demo.sol │ │ │ ├── package.json │ │ │ └── src │ │ │ ├── test.sol │ │ │ └── test.t.sol │ ├── package.json │ ├── src │ │ ├── Base.sol │ │ ├── Script.sol │ │ ├── StdAssertions.sol │ │ ├── StdChains.sol │ │ ├── StdCheats.sol │ │ ├── StdError.sol │ │ ├── StdInvariant.sol │ │ ├── StdJson.sol │ │ ├── StdMath.sol │ │ ├── StdStorage.sol │ │ ├── StdStyle.sol │ │ ├── StdUtils.sol │ │ ├── Test.sol │ │ ├── Vm.sol │ │ ├── console.sol │ │ ├── console2.sol │ │ ├── interfaces │ │ │ ├── IERC1155.sol │ │ │ ├── IERC165.sol │ │ │ ├── IERC20.sol │ │ │ ├── IERC4626.sol │ │ │ ├── IERC721.sol │ │ │ └── IMulticall3.sol │ │ └── safeconsole.sol │ └── test │ │ ├── StdAssertions.t.sol │ │ ├── StdChains.t.sol │ │ ├── StdCheats.t.sol │ │ ├── StdError.t.sol │ │ ├── StdMath.t.sol │ │ ├── StdStorage.t.sol │ │ ├── StdStyle.t.sol │ │ ├── StdUtils.t.sol │ │ ├── compilation │ │ ├── CompilationScript.sol │ │ ├── CompilationScriptBase.sol │ │ ├── CompilationTest.sol │ │ └── CompilationTestBase.sol │ │ └── fixtures │ │ └── broadcast.log.json ├── openzeppelin-contracts │ ├── .changeset │ │ └── new-ways-own.md │ ├── .codecov.yml │ ├── .editorconfig │ ├── .eslintrc │ ├── .gitattributes │ ├── .github │ │ ├── ISSUE_TEMPLATE │ │ │ ├── bug_report.md │ │ │ ├── config.yml │ │ │ └── feature_request.md │ │ ├── PULL_REQUEST_TEMPLATE.md │ │ ├── actions │ │ │ ├── gas-compare │ │ │ │ └── action.yml │ │ │ └── setup │ │ │ │ └── action.yml │ │ └── workflows │ │ │ ├── changelog.yml │ │ │ ├── checks.yml │ │ │ ├── docs.yml │ │ │ └── upgradeable.yml │ ├── .gitignore │ ├── .gitmodules │ ├── .mocharc.js │ ├── .prettierrc │ ├── .solcover.js │ ├── .solhint.json │ ├── CHANGELOG.md │ ├── CODE_OF_CONDUCT.md │ ├── CONTRIBUTING.md │ ├── DOCUMENTATION.md │ ├── GUIDELINES.md │ ├── LICENSE │ ├── README.md │ ├── RELEASING.md │ ├── SECURITY.md │ ├── audit │ │ ├── 2017-03.md │ │ └── 2018-10.pdf │ ├── certora │ │ ├── Makefile │ │ ├── README.md │ │ ├── applyHarness.patch │ │ ├── harnesses │ │ │ ├── ERC20VotesHarness.sol │ │ │ ├── WizardControlFirstPriority.sol │ │ │ └── WizardFirstTry.sol │ │ ├── munged │ │ │ └── .gitignore │ │ ├── scripts │ │ │ ├── Governor.sh │ │ │ ├── GovernorCountingSimple-counting.sh │ │ │ ├── WizardControlFirstPriority.sh │ │ │ ├── WizardFirstTry.sh │ │ │ ├── sanity.sh │ │ │ └── verifyAll.sh │ │ └── specs │ │ │ ├── GovernorBase.spec │ │ │ ├── GovernorCountingSimple.spec │ │ │ ├── RulesInProgress.spec │ │ │ └── sanity.spec │ ├── contracts │ │ ├── access │ │ │ ├── AccessControl.sol │ │ │ ├── AccessControlCrossChain.sol │ │ │ ├── AccessControlEnumerable.sol │ │ │ ├── IAccessControl.sol │ │ │ ├── IAccessControlEnumerable.sol │ │ │ ├── Ownable.sol │ │ │ ├── Ownable2Step.sol │ │ │ └── README.adoc │ │ ├── crosschain │ │ │ ├── CrossChainEnabled.sol │ │ │ ├── README.adoc │ │ │ ├── amb │ │ │ │ ├── CrossChainEnabledAMB.sol │ │ │ │ └── LibAMB.sol │ │ │ ├── arbitrum │ │ │ │ ├── CrossChainEnabledArbitrumL1.sol │ │ │ │ ├── CrossChainEnabledArbitrumL2.sol │ │ │ │ ├── LibArbitrumL1.sol │ │ │ │ └── LibArbitrumL2.sol │ │ │ ├── errors.sol │ │ │ ├── optimism │ │ │ │ ├── CrossChainEnabledOptimism.sol │ │ │ │ └── LibOptimism.sol │ │ │ └── polygon │ │ │ │ └── CrossChainEnabledPolygonChild.sol │ │ ├── finance │ │ │ ├── PaymentSplitter.sol │ │ │ ├── README.adoc │ │ │ └── VestingWallet.sol │ │ ├── governance │ │ │ ├── Governor.sol │ │ │ ├── IGovernor.sol │ │ │ ├── README.adoc │ │ │ ├── TimelockController.sol │ │ │ ├── compatibility │ │ │ │ ├── GovernorCompatibilityBravo.sol │ │ │ │ └── IGovernorCompatibilityBravo.sol │ │ │ ├── extensions │ │ │ │ ├── GovernorCountingSimple.sol │ │ │ │ ├── GovernorPreventLateQuorum.sol │ │ │ │ ├── GovernorProposalThreshold.sol │ │ │ │ ├── GovernorSettings.sol │ │ │ │ ├── GovernorTimelockCompound.sol │ │ │ │ ├── GovernorTimelockControl.sol │ │ │ │ ├── GovernorVotes.sol │ │ │ │ ├── GovernorVotesComp.sol │ │ │ │ ├── GovernorVotesQuorumFraction.sol │ │ │ │ └── IGovernorTimelock.sol │ │ │ └── utils │ │ │ │ ├── IVotes.sol │ │ │ │ └── Votes.sol │ │ ├── interfaces │ │ │ ├── IERC1155.sol │ │ │ ├── IERC1155MetadataURI.sol │ │ │ ├── IERC1155Receiver.sol │ │ │ ├── IERC1271.sol │ │ │ ├── IERC1363.sol │ │ │ ├── IERC1363Receiver.sol │ │ │ ├── IERC1363Spender.sol │ │ │ ├── IERC165.sol │ │ │ ├── IERC1820Implementer.sol │ │ │ ├── IERC1820Registry.sol │ │ │ ├── IERC1967.sol │ │ │ ├── IERC20.sol │ │ │ ├── IERC20Metadata.sol │ │ │ ├── IERC2309.sol │ │ │ ├── IERC2981.sol │ │ │ ├── IERC3156.sol │ │ │ ├── IERC3156FlashBorrower.sol │ │ │ ├── IERC3156FlashLender.sol │ │ │ ├── IERC4626.sol │ │ │ ├── IERC721.sol │ │ │ ├── IERC721Enumerable.sol │ │ │ ├── IERC721Metadata.sol │ │ │ ├── IERC721Receiver.sol │ │ │ ├── IERC777.sol │ │ │ ├── IERC777Recipient.sol │ │ │ ├── IERC777Sender.sol │ │ │ ├── README.adoc │ │ │ ├── draft-IERC1822.sol │ │ │ └── draft-IERC2612.sol │ │ ├── metatx │ │ │ ├── ERC2771Context.sol │ │ │ ├── MinimalForwarder.sol │ │ │ └── README.adoc │ │ ├── mocks │ │ │ ├── AccessControlCrossChainMock.sol │ │ │ ├── AccessControlEnumerableMock.sol │ │ │ ├── AccessControlMock.sol │ │ │ ├── AddressImpl.sol │ │ │ ├── ArraysMock.sol │ │ │ ├── BadBeacon.sol │ │ │ ├── Base64Mock.sol │ │ │ ├── BitmapMock.sol │ │ │ ├── CallReceiverMock.sol │ │ │ ├── CheckpointsMock.sol │ │ │ ├── ClashingImplementation.sol │ │ │ ├── ClonesMock.sol │ │ │ ├── ConditionalEscrowMock.sol │ │ │ ├── ContextMock.sol │ │ │ ├── CountersImpl.sol │ │ │ ├── Create2Impl.sol │ │ │ ├── DoubleEndedQueueMock.sol │ │ │ ├── DummyImplementation.sol │ │ │ ├── ECDSAMock.sol │ │ │ ├── EIP712External.sol │ │ │ ├── ERC1155BurnableMock.sol │ │ │ ├── ERC1155Mock.sol │ │ │ ├── ERC1155PausableMock.sol │ │ │ ├── ERC1155ReceiverMock.sol │ │ │ ├── ERC1155SupplyMock.sol │ │ │ ├── ERC1155URIStorageMock.sol │ │ │ ├── ERC1271WalletMock.sol │ │ │ ├── ERC165 │ │ │ │ ├── ERC165InterfacesSupported.sol │ │ │ │ ├── ERC165MaliciousData.sol │ │ │ │ ├── ERC165MissingData.sol │ │ │ │ ├── ERC165NotSupported.sol │ │ │ │ └── ERC165ReturnBomb.sol │ │ │ ├── ERC165CheckerMock.sol │ │ │ ├── ERC165Mock.sol │ │ │ ├── ERC165StorageMock.sol │ │ │ ├── ERC1820ImplementerMock.sol │ │ │ ├── ERC20BurnableMock.sol │ │ │ ├── ERC20CappedMock.sol │ │ │ ├── ERC20DecimalsMock.sol │ │ │ ├── ERC20FlashMintMock.sol │ │ │ ├── ERC20Mock.sol │ │ │ ├── ERC20PausableMock.sol │ │ │ ├── ERC20PermitMock.sol │ │ │ ├── ERC20SnapshotMock.sol │ │ │ ├── ERC20VotesCompMock.sol │ │ │ ├── ERC20VotesMock.sol │ │ │ ├── ERC20WrapperMock.sol │ │ │ ├── ERC2771ContextMock.sol │ │ │ ├── ERC3156FlashBorrowerMock.sol │ │ │ ├── ERC4626Mock.sol │ │ │ ├── ERC721BurnableMock.sol │ │ │ ├── ERC721ConsecutiveEnumerableMock.sol │ │ │ ├── ERC721ConsecutiveMock.sol │ │ │ ├── ERC721EnumerableMock.sol │ │ │ ├── ERC721Mock.sol │ │ │ ├── ERC721PausableMock.sol │ │ │ ├── ERC721ReceiverMock.sol │ │ │ ├── ERC721RoyaltyMock.sol │ │ │ ├── ERC721URIStorageMock.sol │ │ │ ├── ERC721VotesMock.sol │ │ │ ├── ERC777Mock.sol │ │ │ ├── ERC777SenderRecipientMock.sol │ │ │ ├── EnumerableMapMock.sol │ │ │ ├── EnumerableSetMock.sol │ │ │ ├── EtherReceiverMock.sol │ │ │ ├── GovernorCompMock.sol │ │ │ ├── GovernorCompatibilityBravoMock.sol │ │ │ ├── GovernorMock.sol │ │ │ ├── GovernorPreventLateQuorumMock.sol │ │ │ ├── GovernorTimelockCompoundMock.sol │ │ │ ├── GovernorTimelockControlMock.sol │ │ │ ├── GovernorVoteMock.sol │ │ │ ├── GovernorWithParamsMock.sol │ │ │ ├── InitializableMock.sol │ │ │ ├── MathMock.sol │ │ │ ├── MerkleProofWrapper.sol │ │ │ ├── MulticallTest.sol │ │ │ ├── MulticallTokenMock.sol │ │ │ ├── MultipleInheritanceInitializableMocks.sol │ │ │ ├── Ownable2StepMock.sol │ │ │ ├── OwnableMock.sol │ │ │ ├── PausableMock.sol │ │ │ ├── PullPaymentMock.sol │ │ │ ├── ReentrancyAttack.sol │ │ │ ├── ReentrancyMock.sol │ │ │ ├── RegressionImplementation.sol │ │ │ ├── SafeCastMock.sol │ │ │ ├── SafeERC20Helper.sol │ │ │ ├── SafeMathMock.sol │ │ │ ├── SignatureCheckerMock.sol │ │ │ ├── SignedMathMock.sol │ │ │ ├── SignedSafeMathMock.sol │ │ │ ├── SingleInheritanceInitializableMocks.sol │ │ │ ├── StorageSlotMock.sol │ │ │ ├── StringsMock.sol │ │ │ ├── TimersBlockNumberImpl.sol │ │ │ ├── TimersTimestampImpl.sol │ │ │ ├── UUPS │ │ │ │ ├── UUPSLegacy.sol │ │ │ │ └── UUPSUpgradeableMock.sol │ │ │ ├── VotesMock.sol │ │ │ ├── compound │ │ │ │ └── CompTimelock.sol │ │ │ ├── crosschain │ │ │ │ ├── bridges.sol │ │ │ │ └── receivers.sol │ │ │ └── wizard │ │ │ │ ├── MyGovernor1.sol │ │ │ │ ├── MyGovernor2.sol │ │ │ │ └── MyGovernor3.sol │ │ ├── package.json │ │ ├── proxy │ │ │ ├── Clones.sol │ │ │ ├── ERC1967 │ │ │ │ ├── ERC1967Proxy.sol │ │ │ │ └── ERC1967Upgrade.sol │ │ │ ├── Proxy.sol │ │ │ ├── README.adoc │ │ │ ├── beacon │ │ │ │ ├── BeaconProxy.sol │ │ │ │ ├── IBeacon.sol │ │ │ │ └── UpgradeableBeacon.sol │ │ │ ├── transparent │ │ │ │ ├── ProxyAdmin.sol │ │ │ │ └── TransparentUpgradeableProxy.sol │ │ │ └── utils │ │ │ │ ├── Initializable.sol │ │ │ │ └── UUPSUpgradeable.sol │ │ ├── security │ │ │ ├── Pausable.sol │ │ │ ├── PullPayment.sol │ │ │ ├── README.adoc │ │ │ └── ReentrancyGuard.sol │ │ ├── token │ │ │ ├── ERC1155 │ │ │ │ ├── ERC1155.sol │ │ │ │ ├── IERC1155.sol │ │ │ │ ├── IERC1155Receiver.sol │ │ │ │ ├── README.adoc │ │ │ │ ├── extensions │ │ │ │ │ ├── ERC1155Burnable.sol │ │ │ │ │ ├── ERC1155Pausable.sol │ │ │ │ │ ├── ERC1155Supply.sol │ │ │ │ │ ├── ERC1155URIStorage.sol │ │ │ │ │ └── IERC1155MetadataURI.sol │ │ │ │ ├── presets │ │ │ │ │ ├── ERC1155PresetMinterPauser.sol │ │ │ │ │ └── README.md │ │ │ │ └── utils │ │ │ │ │ ├── ERC1155Holder.sol │ │ │ │ │ └── ERC1155Receiver.sol │ │ │ ├── ERC20 │ │ │ │ ├── ERC20.sol │ │ │ │ ├── IERC20.sol │ │ │ │ ├── README.adoc │ │ │ │ ├── extensions │ │ │ │ │ ├── ERC20Burnable.sol │ │ │ │ │ ├── ERC20Capped.sol │ │ │ │ │ ├── ERC20FlashMint.sol │ │ │ │ │ ├── ERC20Pausable.sol │ │ │ │ │ ├── ERC20Snapshot.sol │ │ │ │ │ ├── ERC20Votes.sol │ │ │ │ │ ├── ERC20VotesComp.sol │ │ │ │ │ ├── ERC20Wrapper.sol │ │ │ │ │ ├── ERC4626.sol │ │ │ │ │ ├── IERC20Metadata.sol │ │ │ │ │ ├── draft-ERC20Permit.sol │ │ │ │ │ └── draft-IERC20Permit.sol │ │ │ │ ├── presets │ │ │ │ │ ├── ERC20PresetFixedSupply.sol │ │ │ │ │ ├── ERC20PresetMinterPauser.sol │ │ │ │ │ └── README.md │ │ │ │ └── utils │ │ │ │ │ ├── SafeERC20.sol │ │ │ │ │ └── TokenTimelock.sol │ │ │ ├── ERC721 │ │ │ │ ├── ERC721.sol │ │ │ │ ├── IERC721.sol │ │ │ │ ├── IERC721Receiver.sol │ │ │ │ ├── README.adoc │ │ │ │ ├── extensions │ │ │ │ │ ├── ERC721Burnable.sol │ │ │ │ │ ├── ERC721Consecutive.sol │ │ │ │ │ ├── ERC721Enumerable.sol │ │ │ │ │ ├── ERC721Pausable.sol │ │ │ │ │ ├── ERC721Royalty.sol │ │ │ │ │ ├── ERC721URIStorage.sol │ │ │ │ │ ├── ERC721Votes.sol │ │ │ │ │ ├── IERC721Enumerable.sol │ │ │ │ │ ├── IERC721Metadata.sol │ │ │ │ │ └── draft-ERC721Votes.sol │ │ │ │ ├── presets │ │ │ │ │ ├── ERC721PresetMinterPauserAutoId.sol │ │ │ │ │ └── README.md │ │ │ │ └── utils │ │ │ │ │ └── ERC721Holder.sol │ │ │ ├── ERC777 │ │ │ │ ├── ERC777.sol │ │ │ │ ├── IERC777.sol │ │ │ │ ├── IERC777Recipient.sol │ │ │ │ ├── IERC777Sender.sol │ │ │ │ ├── README.adoc │ │ │ │ └── presets │ │ │ │ │ └── ERC777PresetFixedSupply.sol │ │ │ └── common │ │ │ │ ├── ERC2981.sol │ │ │ │ └── README.adoc │ │ ├── utils │ │ │ ├── Address.sol │ │ │ ├── Arrays.sol │ │ │ ├── Base64.sol │ │ │ ├── Checkpoints.sol │ │ │ ├── Context.sol │ │ │ ├── Counters.sol │ │ │ ├── Create2.sol │ │ │ ├── Multicall.sol │ │ │ ├── README.adoc │ │ │ ├── StorageSlot.sol │ │ │ ├── Strings.sol │ │ │ ├── Timers.sol │ │ │ ├── cryptography │ │ │ │ ├── ECDSA.sol │ │ │ │ ├── EIP712.sol │ │ │ │ ├── MerkleProof.sol │ │ │ │ ├── SignatureChecker.sol │ │ │ │ └── draft-EIP712.sol │ │ │ ├── escrow │ │ │ │ ├── ConditionalEscrow.sol │ │ │ │ ├── Escrow.sol │ │ │ │ └── RefundEscrow.sol │ │ │ ├── introspection │ │ │ │ ├── ERC165.sol │ │ │ │ ├── ERC165Checker.sol │ │ │ │ ├── ERC165Storage.sol │ │ │ │ ├── ERC1820Implementer.sol │ │ │ │ ├── IERC165.sol │ │ │ │ ├── IERC1820Implementer.sol │ │ │ │ └── IERC1820Registry.sol │ │ │ ├── math │ │ │ │ ├── Math.sol │ │ │ │ ├── SafeCast.sol │ │ │ │ ├── SafeMath.sol │ │ │ │ ├── SignedMath.sol │ │ │ │ └── SignedSafeMath.sol │ │ │ └── structs │ │ │ │ ├── BitMaps.sol │ │ │ │ ├── DoubleEndedQueue.sol │ │ │ │ ├── EnumerableMap.sol │ │ │ │ └── EnumerableSet.sol │ │ └── vendor │ │ │ ├── amb │ │ │ └── IAMB.sol │ │ │ ├── arbitrum │ │ │ ├── IArbSys.sol │ │ │ ├── IBridge.sol │ │ │ ├── IDelayedMessageProvider.sol │ │ │ ├── IInbox.sol │ │ │ └── IOutbox.sol │ │ │ ├── compound │ │ │ ├── ICompoundTimelock.sol │ │ │ └── LICENSE │ │ │ ├── optimism │ │ │ ├── ICrossDomainMessenger.sol │ │ │ └── LICENSE │ │ │ └── polygon │ │ │ └── IFxMessageProcessor.sol │ ├── docs │ │ ├── antora.yml │ │ ├── config.js │ │ ├── modules │ │ │ └── ROOT │ │ │ │ ├── images │ │ │ │ ├── tally-exec.png │ │ │ │ └── tally-vote.png │ │ │ │ ├── nav.adoc │ │ │ │ └── pages │ │ │ │ ├── access-control.adoc │ │ │ │ ├── crosschain.adoc │ │ │ │ ├── crowdsales.adoc │ │ │ │ ├── drafts.adoc │ │ │ │ ├── erc1155.adoc │ │ │ │ ├── erc20-supply.adoc │ │ │ │ ├── erc20.adoc │ │ │ │ ├── erc721.adoc │ │ │ │ ├── erc777.adoc │ │ │ │ ├── extending-contracts.adoc │ │ │ │ ├── governance.adoc │ │ │ │ ├── index.adoc │ │ │ │ ├── releases-stability.adoc │ │ │ │ ├── tokens.adoc │ │ │ │ ├── upgradeable.adoc │ │ │ │ ├── utilities.adoc │ │ │ │ └── wizard.adoc │ │ └── templates │ │ │ ├── contract.hbs │ │ │ ├── helpers.js │ │ │ ├── page.hbs │ │ │ └── properties.js │ ├── hardhat.config.js │ ├── hardhat │ │ ├── env-contract.js │ │ ├── ignore-unreachable-warnings.js │ │ └── skip-foundry-tests.js │ ├── lib │ │ └── forge-std │ │ │ ├── .github │ │ │ └── workflows │ │ │ │ └── ci.yml │ │ │ ├── .gitignore │ │ │ ├── .gitmodules │ │ │ ├── LICENSE-APACHE │ │ │ ├── LICENSE-MIT │ │ │ ├── README.md │ │ │ ├── foundry.toml │ │ │ ├── lib │ │ │ └── ds-test │ │ │ │ ├── .github │ │ │ │ └── workflows │ │ │ │ │ └── build.yml │ │ │ │ ├── .gitignore │ │ │ │ ├── LICENSE │ │ │ │ ├── Makefile │ │ │ │ ├── default.nix │ │ │ │ ├── demo │ │ │ │ └── demo.sol │ │ │ │ ├── package.json │ │ │ │ └── src │ │ │ │ ├── test.sol │ │ │ │ └── test.t.sol │ │ │ ├── package.json │ │ │ ├── src │ │ │ ├── Base.sol │ │ │ ├── Script.sol │ │ │ ├── StdAssertions.sol │ │ │ ├── StdChains.sol │ │ │ ├── StdCheats.sol │ │ │ ├── StdError.sol │ │ │ ├── StdInvariant.sol │ │ │ ├── StdJson.sol │ │ │ ├── StdMath.sol │ │ │ ├── StdStorage.sol │ │ │ ├── StdStyle.sol │ │ │ ├── StdUtils.sol │ │ │ ├── Test.sol │ │ │ ├── Vm.sol │ │ │ ├── console.sol │ │ │ ├── console2.sol │ │ │ └── interfaces │ │ │ │ ├── IERC1155.sol │ │ │ │ ├── IERC165.sol │ │ │ │ ├── IERC20.sol │ │ │ │ ├── IERC4626.sol │ │ │ │ ├── IERC721.sol │ │ │ │ └── IMulticall3.sol │ │ │ └── test │ │ │ ├── StdAssertions.t.sol │ │ │ ├── StdChains.t.sol │ │ │ ├── StdCheats.t.sol │ │ │ ├── StdError.t.sol │ │ │ ├── StdMath.t.sol │ │ │ ├── StdStorage.t.sol │ │ │ ├── StdStyle.t.sol │ │ │ ├── StdUtils.t.sol │ │ │ ├── compilation │ │ │ ├── CompilationScript.sol │ │ │ ├── CompilationScriptBase.sol │ │ │ ├── CompilationTest.sol │ │ │ └── CompilationTestBase.sol │ │ │ └── fixtures │ │ │ └── broadcast.log.json │ ├── logo.svg │ ├── netlify.toml │ ├── package-lock.json │ ├── package.json │ ├── renovate.json │ ├── scripts │ │ ├── checks │ │ │ ├── compareGasReports.js │ │ │ ├── generation.sh │ │ │ └── inheritance-ordering.js │ │ ├── gen-nav.js │ │ ├── generate │ │ │ ├── format-lines.js │ │ │ ├── run.js │ │ │ └── templates │ │ │ │ ├── Checkpoints.js │ │ │ │ ├── CheckpointsMock.js │ │ │ │ ├── EnumerableMap.js │ │ │ │ ├── EnumerableMapMock.js │ │ │ │ ├── EnumerableSet.js │ │ │ │ ├── EnumerableSetMock.js │ │ │ │ ├── SafeCast.js │ │ │ │ ├── SafeCastMock.js │ │ │ │ └── conversion.js │ │ ├── git-user-config.sh │ │ ├── helpers.js │ │ ├── migrate-imports.js │ │ ├── prepack.sh │ │ ├── prepare-contracts-package.sh │ │ ├── prepare-docs.sh │ │ ├── prepare.sh │ │ ├── release │ │ │ ├── release.sh │ │ │ ├── synchronize-versions.js │ │ │ ├── update-changelog-release-date.js │ │ │ ├── update-comment.js │ │ │ └── version.sh │ │ ├── remove-ignored-artifacts.js │ │ └── update-docs-branch.js │ ├── slither.config.json │ └── test │ │ ├── TESTING.md │ │ ├── access │ │ ├── AccessControl.behavior.js │ │ ├── AccessControl.test.js │ │ ├── AccessControlCrossChain.test.js │ │ ├── AccessControlEnumerable.test.js │ │ ├── Ownable.test.js │ │ └── Ownable2Step.test.js │ │ ├── crosschain │ │ └── CrossChainEnabled.test.js │ │ ├── finance │ │ ├── PaymentSplitter.test.js │ │ ├── VestingWallet.behavior.js │ │ └── VestingWallet.test.js │ │ ├── governance │ │ ├── Governor.test.js │ │ ├── TimelockController.test.js │ │ ├── compatibility │ │ │ └── GovernorCompatibilityBravo.test.js │ │ ├── extensions │ │ │ ├── GovernorComp.test.js │ │ │ ├── GovernorERC721.test.js │ │ │ ├── GovernorPreventLateQuorum.test.js │ │ │ ├── GovernorTimelockCompound.test.js │ │ │ ├── GovernorTimelockControl.test.js │ │ │ ├── GovernorVotesQuorumFraction.test.js │ │ │ └── GovernorWithParams.test.js │ │ └── utils │ │ │ ├── Votes.behavior.js │ │ │ └── Votes.test.js │ │ ├── helpers │ │ ├── create2.js │ │ ├── crosschain.js │ │ ├── customError.js │ │ ├── eip712.js │ │ ├── enums.js │ │ ├── erc1967.js │ │ ├── governance.js │ │ ├── sign.js │ │ └── txpool.js │ │ ├── metatx │ │ ├── ERC2771Context.test.js │ │ └── MinimalForwarder.test.js │ │ ├── migrate-imports.test.js │ │ ├── proxy │ │ ├── Clones.behaviour.js │ │ ├── Clones.test.js │ │ ├── ERC1967 │ │ │ └── ERC1967Proxy.test.js │ │ ├── Proxy.behaviour.js │ │ ├── beacon │ │ │ ├── BeaconProxy.test.js │ │ │ └── UpgradeableBeacon.test.js │ │ ├── transparent │ │ │ ├── ProxyAdmin.test.js │ │ │ ├── TransparentUpgradeableProxy.behaviour.js │ │ │ └── TransparentUpgradeableProxy.test.js │ │ └── utils │ │ │ ├── Initializable.test.js │ │ │ └── UUPSUpgradeable.test.js │ │ ├── security │ │ ├── Pausable.test.js │ │ ├── PullPayment.test.js │ │ └── ReentrancyGuard.test.js │ │ ├── token │ │ ├── ERC1155 │ │ │ ├── ERC1155.behavior.js │ │ │ ├── ERC1155.test.js │ │ │ ├── extensions │ │ │ │ ├── ERC1155Burnable.test.js │ │ │ │ ├── ERC1155Pausable.test.js │ │ │ │ ├── ERC1155Supply.test.js │ │ │ │ └── ERC1155URIStorage.test.js │ │ │ ├── presets │ │ │ │ └── ERC1155PresetMinterPauser.test.js │ │ │ └── utils │ │ │ │ └── ERC1155Holder.test.js │ │ ├── ERC20 │ │ │ ├── ERC20.behavior.js │ │ │ ├── ERC20.test.js │ │ │ ├── extensions │ │ │ │ ├── ERC20Burnable.behavior.js │ │ │ │ ├── ERC20Burnable.test.js │ │ │ │ ├── ERC20Capped.behavior.js │ │ │ │ ├── ERC20Capped.test.js │ │ │ │ ├── ERC20FlashMint.test.js │ │ │ │ ├── ERC20Pausable.test.js │ │ │ │ ├── ERC20Snapshot.test.js │ │ │ │ ├── ERC20Votes.test.js │ │ │ │ ├── ERC20VotesComp.test.js │ │ │ │ ├── ERC20Wrapper.test.js │ │ │ │ ├── ERC4626.test.js │ │ │ │ └── draft-ERC20Permit.test.js │ │ │ ├── presets │ │ │ │ ├── ERC20PresetFixedSupply.test.js │ │ │ │ └── ERC20PresetMinterPauser.test.js │ │ │ └── utils │ │ │ │ ├── SafeERC20.test.js │ │ │ │ └── TokenTimelock.test.js │ │ ├── ERC721 │ │ │ ├── ERC721.behavior.js │ │ │ ├── ERC721.test.js │ │ │ ├── ERC721Enumerable.test.js │ │ │ ├── extensions │ │ │ │ ├── ERC721Burnable.test.js │ │ │ │ ├── ERC721Consecutive.t.sol │ │ │ │ ├── ERC721Consecutive.test.js │ │ │ │ ├── ERC721Pausable.test.js │ │ │ │ ├── ERC721Royalty.test.js │ │ │ │ ├── ERC721URIStorage.test.js │ │ │ │ └── ERC721Votes.test.js │ │ │ ├── presets │ │ │ │ └── ERC721PresetMinterPauserAutoId.test.js │ │ │ └── utils │ │ │ │ └── ERC721Holder.test.js │ │ ├── ERC777 │ │ │ ├── ERC777.behavior.js │ │ │ ├── ERC777.test.js │ │ │ └── presets │ │ │ │ └── ERC777PresetFixedSupply.test.js │ │ └── common │ │ │ └── ERC2981.behavior.js │ │ └── utils │ │ ├── Address.test.js │ │ ├── Arrays.test.js │ │ ├── Base64.test.js │ │ ├── Checkpoints.test.js │ │ ├── Context.behavior.js │ │ ├── Context.test.js │ │ ├── Counters.test.js │ │ ├── Create2.test.js │ │ ├── Multicall.test.js │ │ ├── StorageSlot.test.js │ │ ├── Strings.test.js │ │ ├── TimersBlockNumberImpl.test.js │ │ ├── TimersTimestamp.test.js │ │ ├── cryptography │ │ ├── ECDSA.test.js │ │ ├── EIP712.test.js │ │ ├── MerkleProof.test.js │ │ └── SignatureChecker.test.js │ │ ├── escrow │ │ ├── ConditionalEscrow.test.js │ │ ├── Escrow.behavior.js │ │ ├── Escrow.test.js │ │ └── RefundEscrow.test.js │ │ ├── introspection │ │ ├── ERC165.test.js │ │ ├── ERC165Checker.test.js │ │ ├── ERC165Storage.test.js │ │ ├── ERC1820Implementer.test.js │ │ └── SupportsInterface.behavior.js │ │ ├── math │ │ ├── Math.t.sol │ │ ├── Math.test.js │ │ ├── SafeCast.test.js │ │ ├── SafeMath.test.js │ │ ├── SignedMath.test.js │ │ └── SignedSafeMath.test.js │ │ └── structs │ │ ├── BitMap.test.js │ │ ├── DoubleEndedQueue.test.js │ │ ├── EnumerableMap.behavior.js │ │ ├── EnumerableMap.test.js │ │ ├── EnumerableSet.behavior.js │ │ └── EnumerableSet.test.js ├── safe-contracts │ ├── .env.sample │ ├── .eslintrc.js │ ├── .gitattributes │ ├── .github │ │ ├── ISSUE_TEMPLATE │ │ │ ├── bug_report.md │ │ │ └── feature_request.md │ │ └── workflows │ │ │ ├── certora.yml │ │ │ ├── ci.yml │ │ │ └── cla.yml │ ├── .gitignore │ ├── .husky │ │ ├── .gitignore │ │ └── pre-commit │ ├── .nvmrc │ ├── .prettierrc │ ├── .solcover.js │ ├── .solhint.json │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── benchmark │ │ ├── Safe.Creation.spec.ts │ │ ├── Safe.ERC1155.spec.ts │ │ ├── Safe.ERC20.spec.ts │ │ ├── Safe.Ether.spec.ts │ │ ├── Safe.Proxy.spec.ts │ │ └── utils │ │ │ └── setup.ts │ ├── certora │ │ ├── .gitignore │ │ ├── Makefile │ │ ├── applyHarness.patch │ │ ├── harnesses │ │ │ └── SafeHarness.sol │ │ ├── scripts │ │ │ ├── verifyModules.sh │ │ │ ├── verifyOwners.sh │ │ │ └── verifySafe.sh │ │ └── specs │ │ │ ├── ModuleReach.spec │ │ │ ├── OwnerReach.spec │ │ │ ├── Safe.spec │ │ │ └── properties.md │ ├── contracts │ │ ├── Safe.sol │ │ ├── SafeL2.sol │ │ ├── accessors │ │ │ └── SimulateTxAccessor.sol │ │ ├── base │ │ │ ├── Executor.sol │ │ │ ├── FallbackManager.sol │ │ │ ├── GuardManager.sol │ │ │ ├── ModuleManager.sol │ │ │ └── OwnerManager.sol │ │ ├── common │ │ │ ├── Enum.sol │ │ │ ├── NativeCurrencyPaymentFallback.sol │ │ │ ├── SecuredTokenTransfer.sol │ │ │ ├── SelfAuthorized.sol │ │ │ ├── SignatureDecoder.sol │ │ │ ├── Singleton.sol │ │ │ └── StorageAccessible.sol │ │ ├── examples │ │ │ ├── guards │ │ │ │ ├── DebugTransactionGuard.sol │ │ │ │ ├── DelegateCallTransactionGuard.sol │ │ │ │ ├── OnlyOwnersGuard.sol │ │ │ │ └── ReentrancyTransactionGuard.sol │ │ │ └── libraries │ │ │ │ └── Migrate_1_3_0_to_1_2_0.sol │ │ ├── external │ │ │ └── SafeMath.sol │ │ ├── handler │ │ │ ├── CompatibilityFallbackHandler.sol │ │ │ ├── HandlerContext.sol │ │ │ └── TokenCallbackHandler.sol │ │ ├── interfaces │ │ │ ├── ERC1155TokenReceiver.sol │ │ │ ├── ERC721TokenReceiver.sol │ │ │ ├── ERC777TokensRecipient.sol │ │ │ ├── IERC165.sol │ │ │ ├── ISignatureValidator.sol │ │ │ └── ViewStorageAccessible.sol │ │ ├── libraries │ │ │ ├── CreateCall.sol │ │ │ ├── MultiSend.sol │ │ │ ├── MultiSendCallOnly.sol │ │ │ ├── Safe130To141Migration.sol │ │ │ ├── SafeStorage.sol │ │ │ └── SignMessageLib.sol │ │ ├── proxies │ │ │ ├── IProxyCreationCallback.sol │ │ │ ├── SafeProxy.sol │ │ │ └── SafeProxyFactory.sol │ │ └── test │ │ │ ├── DelegateCaller.sol │ │ │ ├── ERC1155Token.sol │ │ │ ├── ERC20Token.sol │ │ │ ├── Test4337ModuleAndHandler.sol │ │ │ ├── TestHandler.sol │ │ │ ├── TestImports.sol │ │ │ ├── TestNativeTokenReceiver.sol │ │ │ └── Token.sol │ ├── docs │ │ ├── Gnosis_Safe_Audit_Report.pdf │ │ ├── Gnosis_Safe_Audit_Report_1_1_0.pdf │ │ ├── Gnosis_Safe_Audit_Report_1_1_1.pdf │ │ ├── Gnosis_Safe_Audit_Report_1_2_0.pdf │ │ ├── Gnosis_Safe_Audit_Report_1_3_0_Final.pdf │ │ ├── Gnosis_Safe_Audit_Report_1_3_0_Initial.pdf │ │ ├── Gnosis_Safe_Formal_Verification_Report_1_0_0.pdf │ │ ├── Gnosis_Safe_Symbolic_Execution.pdf │ │ ├── Safe_Audit_Report_1_4_0.pdf │ │ ├── alexey_audit.md │ │ ├── audit_1_1_1.md │ │ ├── audit_1_2_0.md │ │ ├── audit_1_3_0.md │ │ ├── audit_1_4_0.md │ │ ├── error_codes.md │ │ ├── guidelines.md │ │ ├── overview.md │ │ ├── rv_1_0_0.md │ │ ├── safe_tx_gas.md │ │ └── signatures.md │ ├── hardhat.config.ts │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── deploy │ │ │ ├── deploy_accessors.ts │ │ │ ├── deploy_factories.ts │ │ │ ├── deploy_handlers.ts │ │ │ ├── deploy_libraries.ts │ │ │ ├── deploy_safe_l2.ts │ │ │ └── deploy_safe_singleton.ts │ │ ├── index.ts │ │ ├── tasks │ │ │ ├── deploy_contracts.ts │ │ │ ├── local_verify.ts │ │ │ └── show_codesize.ts │ │ └── utils │ │ │ ├── constants.ts │ │ │ ├── execution.ts │ │ │ ├── multisend.ts │ │ │ ├── proxies.ts │ │ │ └── solc.ts │ ├── test │ │ ├── accessors │ │ │ └── SimulateTxAccessor.spec.ts │ │ ├── core │ │ │ ├── Safe.Execution.spec.ts │ │ │ ├── Safe.FallbackManager.spec.ts │ │ │ ├── Safe.GuardManager.spec.ts │ │ │ ├── Safe.Incoming.spec.ts │ │ │ ├── Safe.ModuleManager.spec.ts │ │ │ ├── Safe.OwnerManager.spec.ts │ │ │ ├── Safe.Setup.spec.ts │ │ │ ├── Safe.Signatures.spec.ts │ │ │ ├── Safe.Storage.spec.ts │ │ │ └── Safe.StorageAccessible.spec.ts │ │ ├── factory │ │ │ ├── Proxy.spec.ts │ │ │ └── ProxyFactory.spec.ts │ │ ├── guards │ │ │ ├── DebugTransactionGuard.spec.ts │ │ │ ├── DelegateCallTransactionGuard.spec.ts │ │ │ ├── OnlyOwnersGuard.spec.ts │ │ │ └── ReentrancyTransactionGuard.spec.ts │ │ ├── handlers │ │ │ ├── CompatibilityFallbackHandler.spec.ts │ │ │ ├── HandlerContext.spec.ts │ │ │ └── TokenCallbackHandler.spec.ts │ │ ├── integration │ │ │ ├── Safe.0xExploit.spec.ts │ │ │ ├── Safe.ERC1155.spec.ts │ │ │ ├── Safe.ERC4337.spec.ts │ │ │ └── Safe.ReservedAddresses.spec.ts │ │ ├── json │ │ │ ├── safeDeployment.json │ │ │ └── safeRuntimeBytecode.json │ │ ├── l2 │ │ │ └── Safe.Execution.spec.ts │ │ ├── libraries │ │ │ ├── CreateCall.spec.ts │ │ │ ├── Migration.spec.ts │ │ │ ├── MultiSend.spec.ts │ │ │ ├── MultiSendCallOnly.spec.ts │ │ │ ├── Safe.spec.ts │ │ │ ├── Safe130To141Migration.test.ts │ │ │ └── SignMessageLib.spec.ts │ │ ├── migration │ │ │ ├── UpgradeFromSafe111.spec.ts │ │ │ ├── UpgradeFromSafe120.spec.ts │ │ │ └── subTests.spec.ts │ │ └── utils │ │ │ ├── config.ts │ │ │ ├── contracts.ts │ │ │ ├── encoding.ts │ │ │ ├── numbers.ts │ │ │ ├── setup.ts │ │ │ └── storage.ts │ ├── tests_deprecated │ │ ├── gnosisSafeNestedSafes.js │ │ ├── gnosisSafeTransactionExecution.js │ │ └── utils │ │ │ ├── execution.js │ │ │ └── general.js │ ├── tsconfig.json │ ├── tsconfig.prod.json │ └── types │ │ └── solc.d.ts └── solidity-stringutils │ ├── .gitattributes │ ├── .github │ └── workflows │ │ └── ci.yml │ ├── .gitignore │ ├── .gitmodules │ ├── LICENSE │ ├── Makefile │ ├── README │ ├── README.md │ ├── dappfile │ ├── lib │ └── ds-test │ │ ├── .gitignore │ │ ├── LICENSE │ │ ├── Makefile │ │ ├── default.nix │ │ ├── demo │ │ └── demo.sol │ │ └── src │ │ └── test.sol │ ├── src │ ├── strings.sol │ └── strings.t.sol │ └── strings.sol ├── package.json ├── remappings.txt ├── requirements.txt ├── scripts ├── foundry │ ├── Constants.s.sol │ ├── Example.s.sol │ └── Utils.s.sol ├── submitFoundryTx.ts └── utils │ ├── constants.ts │ ├── index.ts │ └── submitTx.ts ├── test ├── Example.t.sol ├── Utils.s.sol └── mock │ └── MockSafe.sol ├── tsconfig.json ├── utils └── network.ts └── yarn.lock /.env.example: -------------------------------------------------------------------------------- 1 | ## Address of the safe to which a delegate must be added 2 | SAFE = "" 3 | ## Chain id of the safe to which a delegate must be added 4 | CHAIN_ID = "" 5 | ## Address of the delegator who will give the right to push transactions to the Safe interface 6 | ## to the delegate 7 | DELEGATOR_ADDRESS = "" 8 | ## Private key of the delegator 9 | DELEGATOR_PRIVATE_KEY = "" 10 | 11 | ## All the above fields are for the `addDelegate.py` Python script 12 | 13 | ## Address of the delegate which has been added to the safe 14 | DELEGATE_ADDRESS = "" 15 | ## Private key of the delegate address which will push transactions to the Gnosis Safe interface 16 | PRIVATE_KEY = "" 17 | 18 | ## All the below fields are for Foundry scripts 19 | ## You need to specify an URI associated to the network to make on chain calls when building the transaction via a script 20 | ETH_NODE_URI_MAINNET="" 21 | ETH_NODE_URI_POLYGON="" 22 | ETH_NODE_URI_OPTIMISM="" 23 | ETH_NODE_URI_ARBITRUM="" 24 | ETH_NODE_URI_AVALANCHE="" 25 | ETH_NODE_URI_FORK="" -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Defaults 2 | __pycache__ 3 | .idea 4 | .DS_Store 5 | .deps 6 | .vscode 7 | .env 8 | node_modules 9 | venv 10 | build 11 | dist 12 | scripts/foundry/transaction.json 13 | cache 14 | 15 | 16 | # foundry 17 | /out 18 | /cache-forge -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "lib/forge-std"] 2 | path = lib/forge-std 3 | url = https://github.com/foundry-rs/forge-std 4 | ignore = dirty 5 | [submodule "lib/solidity-stringutils"] 6 | path = lib/solidity-stringutils 7 | url = https://github.com/Arachnid/solidity-stringutils 8 | ignore = dirty 9 | [submodule "lib/safe-contracts"] 10 | path = lib/safe-contracts 11 | url = https://github.com/safe-global/safe-contracts 12 | [submodule "lib/openzeppelin-contracts"] 13 | path = lib/openzeppelin-contracts 14 | url = https://github.com/OpenZeppelin/openzeppelin-contracts 15 | branch = release-v4.8 16 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | contracts/transmuter/Storage.sol -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "arrowParens": "avoid", 3 | "jsxSingleQuote": true, 4 | "singleQuote": true, 5 | "printWidth": 120, 6 | "semi": true, 7 | "trailingComma": "all", 8 | "useTabs": false, 9 | "overrides": [ 10 | { 11 | "files": "*.sol", 12 | "options": { 13 | "printWidth": 120, 14 | "singleQuote": false, 15 | "bracketSpacing": true, 16 | "explicitTypes": "always" 17 | } 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /.solhint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "solhint:recommended", 3 | "plugins": ["prettier"], 4 | "rules": { 5 | "max-line-length": ["error", 120], 6 | "avoid-call-value": "warn", 7 | "avoid-low-level-calls": "off", 8 | "avoid-tx-origin": "warn", 9 | "const-name-snakecase": "warn", 10 | "contract-name-camelcase": "warn", 11 | "imports-on-top": "warn", 12 | "prettier/prettier": "off", 13 | "ordering": "off", 14 | "max-states-count": "off", 15 | "mark-callable-contracts": "off", 16 | "no-empty-blocks": "off", 17 | "no-global-import": "off", 18 | "not-rely-on-time": "off", 19 | "compiler-version": "off", 20 | "private-vars-leading-underscore": "warn", 21 | "reentrancy": "warn", 22 | "no-inline-assembly": "off", 23 | "no-complex-fallback": "off", 24 | "reason-string": "off", 25 | "func-visibility": ["warn", { "ignoreConstructors": true }] 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /contracts/mock/MockERC20Pausable.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity ^0.8.19; 3 | 4 | import { ERC20, ERC20Pausable, Pausable } from "oz/token/ERC20/extensions/ERC20Pausable.sol"; 5 | 6 | contract MockERC20Pausable is ERC20Pausable { 7 | constructor(string memory name_, string memory symbol_) ERC20(name_, symbol_) Pausable() {} 8 | 9 | function pause(uint256 uselessUint256) external { 10 | uselessUint256; 11 | _pause(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /foundry.toml: -------------------------------------------------------------------------------- 1 | [profile.default] 2 | src = 'contracts' 3 | out = 'out' 4 | test = 'test' 5 | libs = ['node_modules', 'lib'] 6 | script = 'scripts/foundry' 7 | cache_path = 'cache-forge' 8 | gas_reports = ["*"] 9 | via_ir = false 10 | sizes = true 11 | optimizer_runs=1000 12 | solc_version = '0.8.19' 13 | fs_permissions = [{ access = "read-write", path = "./scripts/foundry/transaction.json"}] 14 | 15 | ffi = true 16 | 17 | [rpc_endpoints] 18 | arbitrum = "${ETH_NODE_URI_ARBITRUM}" 19 | mainnet = "${ETH_NODE_URI_MAINNET}" 20 | optimism = "${ETH_NODE_URI_OPTIMISM}" 21 | polygon = "${ETH_NODE_URI_POLYGON}" 22 | fork = "${ETH_NODE_URI_FORK}" -------------------------------------------------------------------------------- /lib/forge-std/.github/workflows/sync.yml: -------------------------------------------------------------------------------- 1 | name: Sync Release Branch 2 | 3 | on: 4 | release: 5 | types: 6 | - created 7 | 8 | jobs: 9 | sync-release-branch: 10 | runs-on: ubuntu-latest 11 | if: startsWith(github.event.release.tag_name, 'v1') 12 | steps: 13 | - name: Check out the repo 14 | uses: actions/checkout@v3 15 | with: 16 | fetch-depth: 0 17 | ref: v1 18 | 19 | - name: Configure Git 20 | run: | 21 | git config user.name github-actions[bot] 22 | git config user.email 41898282+github-actions[bot]@users.noreply.github.com 23 | 24 | - name: Sync Release Branch 25 | run: | 26 | git fetch --tags 27 | git checkout v1 28 | git reset --hard ${GITHUB_REF} 29 | git push --force 30 | -------------------------------------------------------------------------------- /lib/forge-std/.gitignore: -------------------------------------------------------------------------------- 1 | cache/ 2 | out/ 3 | .vscode 4 | .idea 5 | -------------------------------------------------------------------------------- /lib/forge-std/.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "lib/ds-test"] 2 | path = lib/ds-test 3 | url = https://github.com/dapphub/ds-test 4 | -------------------------------------------------------------------------------- /lib/forge-std/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright Contributors to Forge Standard Library 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE O THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE.R 26 | -------------------------------------------------------------------------------- /lib/forge-std/foundry.toml: -------------------------------------------------------------------------------- 1 | [profile.default] 2 | fs_permissions = [{ access = "read-write", path = "./"}] 3 | 4 | [rpc_endpoints] 5 | # The RPC URLs are modified versions of the default for testing initialization. 6 | mainnet = "https://mainnet.infura.io/v3/b1d3925804e74152b316ca7da97060d3" # Different API key. 7 | optimism_goerli = "https://goerli.optimism.io/" # Adds a trailing slash. 8 | arbitrum_one_goerli = "https://goerli-rollup.arbitrum.io/rpc/" # Adds a trailing slash. 9 | needs_undefined_env_var = "${UNDEFINED_RPC_URL_PLACEHOLDER}" 10 | 11 | [fmt] 12 | # These are all the `forge fmt` defaults. 13 | line_length = 120 14 | tab_width = 4 15 | bracket_spacing = false 16 | int_types = 'long' 17 | multiline_func_header = 'attributes_first' 18 | quote_style = 'double' 19 | number_underscore = 'preserve' 20 | single_line_statement_blocks = 'preserve' 21 | ignore = ["src/console.sol", "src/console2.sol"] -------------------------------------------------------------------------------- /lib/forge-std/lib/ds-test/.gitignore: -------------------------------------------------------------------------------- 1 | /.dapple 2 | /build 3 | /out 4 | /cache/ 5 | -------------------------------------------------------------------------------- /lib/forge-std/lib/ds-test/Makefile: -------------------------------------------------------------------------------- 1 | all:; dapp build 2 | 3 | test: 4 | -dapp --use solc:0.4.23 build 5 | -dapp --use solc:0.4.26 build 6 | -dapp --use solc:0.5.17 build 7 | -dapp --use solc:0.6.12 build 8 | -dapp --use solc:0.7.5 build 9 | 10 | demo: 11 | DAPP_SRC=demo dapp --use solc:0.7.5 build 12 | -hevm dapp-test --verbose 3 13 | 14 | .PHONY: test demo 15 | -------------------------------------------------------------------------------- /lib/forge-std/lib/ds-test/default.nix: -------------------------------------------------------------------------------- 1 | { solidityPackage, dappsys }: solidityPackage { 2 | name = "ds-test"; 3 | src = ./src; 4 | } 5 | -------------------------------------------------------------------------------- /lib/forge-std/lib/ds-test/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ds-test", 3 | "version": "1.0.0", 4 | "description": "Assertions, equality checks and other test helpers ", 5 | "bugs": "https://github.com/dapphub/ds-test/issues", 6 | "license": "GPL-3.0", 7 | "author": "Contributors to ds-test", 8 | "files": [ 9 | "src/*" 10 | ], 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/dapphub/ds-test.git" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /lib/forge-std/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "forge-std", 3 | "version": "1.6.0", 4 | "description": "Forge Standard Library is a collection of helpful contracts and libraries for use with Forge and Foundry.", 5 | "homepage": "https://book.getfoundry.sh/forge/forge-std", 6 | "bugs": "https://github.com/foundry-rs/forge-std/issues", 7 | "license": "(Apache-2.0 OR MIT)", 8 | "author": "Contributors to Forge Standard Library", 9 | "files": [ 10 | "src/**/*" 11 | ], 12 | "repository": { 13 | "type": "git", 14 | "url": "https://github.com/foundry-rs/forge-std.git" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /lib/forge-std/src/Script.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.6.2 <0.9.0; 3 | 4 | // 💬 ABOUT 5 | // Forge Std's default Script. 6 | 7 | // 🧩 MODULES 8 | import {console} from "./console.sol"; 9 | import {console2} from "./console2.sol"; 10 | import {safeconsole} from "./safeconsole.sol"; 11 | import {StdChains} from "./StdChains.sol"; 12 | import {StdCheatsSafe} from "./StdCheats.sol"; 13 | import {stdJson} from "./StdJson.sol"; 14 | import {stdMath} from "./StdMath.sol"; 15 | import {StdStorage, stdStorageSafe} from "./StdStorage.sol"; 16 | import {StdStyle} from "./StdStyle.sol"; 17 | import {StdUtils} from "./StdUtils.sol"; 18 | import {VmSafe} from "./Vm.sol"; 19 | 20 | // 📦 BOILERPLATE 21 | import {ScriptBase} from "./Base.sol"; 22 | 23 | // ⭐️ SCRIPT 24 | abstract contract Script is ScriptBase, StdChains, StdCheatsSafe, StdUtils { 25 | // Note: IS_SCRIPT() must return true. 26 | bool public IS_SCRIPT = true; 27 | } 28 | -------------------------------------------------------------------------------- /lib/forge-std/src/StdError.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // Panics work for versions >=0.8.0, but we lowered the pragma to make this compatible with Test 3 | pragma solidity >=0.6.2 <0.9.0; 4 | 5 | library stdError { 6 | bytes public constant assertionError = abi.encodeWithSignature("Panic(uint256)", 0x01); 7 | bytes public constant arithmeticError = abi.encodeWithSignature("Panic(uint256)", 0x11); 8 | bytes public constant divisionError = abi.encodeWithSignature("Panic(uint256)", 0x12); 9 | bytes public constant enumConversionError = abi.encodeWithSignature("Panic(uint256)", 0x21); 10 | bytes public constant encodeStorageError = abi.encodeWithSignature("Panic(uint256)", 0x22); 11 | bytes public constant popError = abi.encodeWithSignature("Panic(uint256)", 0x31); 12 | bytes public constant indexOOBError = abi.encodeWithSignature("Panic(uint256)", 0x32); 13 | bytes public constant memOverflowError = abi.encodeWithSignature("Panic(uint256)", 0x41); 14 | bytes public constant zeroVarError = abi.encodeWithSignature("Panic(uint256)", 0x51); 15 | } 16 | -------------------------------------------------------------------------------- /lib/forge-std/src/interfaces/IERC165.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.6.2; 3 | 4 | interface IERC165 { 5 | /// @notice Query if a contract implements an interface 6 | /// @param interfaceID The interface identifier, as specified in ERC-165 7 | /// @dev Interface identification is specified in ERC-165. This function 8 | /// uses less than 30,000 gas. 9 | /// @return `true` if the contract implements `interfaceID` and 10 | /// `interfaceID` is not 0xffffffff, `false` otherwise 11 | function supportsInterface(bytes4 interfaceID) external view returns (bool); 12 | } 13 | -------------------------------------------------------------------------------- /lib/forge-std/test/compilation/CompilationScript.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.6.2 <0.9.0; 3 | 4 | pragma experimental ABIEncoderV2; 5 | 6 | import "../../src/Script.sol"; 7 | 8 | // The purpose of this contract is to benchmark compilation time to avoid accidentally introducing 9 | // a change that results in very long compilation times with via-ir. See https://github.com/foundry-rs/forge-std/issues/207 10 | contract CompilationScript is Script {} 11 | -------------------------------------------------------------------------------- /lib/forge-std/test/compilation/CompilationScriptBase.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.6.2 <0.9.0; 3 | 4 | pragma experimental ABIEncoderV2; 5 | 6 | import "../../src/Script.sol"; 7 | 8 | // The purpose of this contract is to benchmark compilation time to avoid accidentally introducing 9 | // a change that results in very long compilation times with via-ir. See https://github.com/foundry-rs/forge-std/issues/207 10 | contract CompilationScriptBase is ScriptBase {} 11 | -------------------------------------------------------------------------------- /lib/forge-std/test/compilation/CompilationTest.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.6.2 <0.9.0; 3 | 4 | pragma experimental ABIEncoderV2; 5 | 6 | import "../../src/Test.sol"; 7 | 8 | // The purpose of this contract is to benchmark compilation time to avoid accidentally introducing 9 | // a change that results in very long compilation times with via-ir. See https://github.com/foundry-rs/forge-std/issues/207 10 | contract CompilationTest is Test {} 11 | -------------------------------------------------------------------------------- /lib/forge-std/test/compilation/CompilationTestBase.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.6.2 <0.9.0; 3 | 4 | pragma experimental ABIEncoderV2; 5 | 6 | import "../../src/Test.sol"; 7 | 8 | // The purpose of this contract is to benchmark compilation time to avoid accidentally introducing 9 | // a change that results in very long compilation times with via-ir. See https://github.com/foundry-rs/forge-std/issues/207 10 | contract CompilationTestBase is TestBase {} 11 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/.changeset/new-ways-own.md: -------------------------------------------------------------------------------- 1 | --- 2 | 'openzeppelin-solidity': patch 3 | --- 4 | 5 | `ERC20Pausable`, `ERC721Pausable`, `ERC1155Pausable`: Add note regarding missing public pausing functionality 6 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/.codecov.yml: -------------------------------------------------------------------------------- 1 | comment: off 2 | github_checks: 3 | annotations: false 4 | coverage: 5 | status: 6 | patch: 7 | default: 8 | target: 95% 9 | only_pulls: true 10 | project: 11 | default: 12 | threshold: 1% 13 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: https://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | [*] 7 | charset = utf-8 8 | end_of_line = lf 9 | indent_style = space 10 | insert_final_newline = true 11 | trim_trailing_whitespace = false 12 | max_line_length = 120 13 | 14 | [*.sol] 15 | indent_size = 4 16 | 17 | [*.js] 18 | indent_size = 2 19 | 20 | [*.{adoc,md}] 21 | max_line_length = 0 22 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/.gitattributes: -------------------------------------------------------------------------------- 1 | *.sol linguist-language=Solidity 2 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Report a bug in OpenZeppelin Contracts 4 | 5 | --- 6 | 7 | 8 | 9 | 10 | 11 | **💻 Environment** 12 | 13 | 14 | 15 | **📝 Details** 16 | 17 | 18 | 19 | **🔢 Code to reproduce bug** 20 | 21 | 22 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | contact_links: 2 | - name: Questions & Support Requests 3 | url: https://forum.openzeppelin.com/c/support/contracts/18 4 | about: Ask in the OpenZeppelin Forum 5 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for OpenZeppelin Contracts 4 | 5 | --- 6 | 7 | **🧐 Motivation** 8 | 9 | 10 | **📝 Details** 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Fixes #???? 7 | 8 | 9 | 10 | 11 | 12 | #### PR Checklist 13 | 14 | 15 | 16 | 17 | 18 | - [ ] Tests 19 | - [ ] Documentation 20 | - [ ] Changelog entry 21 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/.github/actions/setup/action.yml: -------------------------------------------------------------------------------- 1 | name: Setup 2 | 3 | runs: 4 | using: composite 5 | steps: 6 | - uses: actions/setup-node@v3 7 | with: 8 | node-version: 14.x 9 | cache: npm 10 | - uses: actions/cache@v3 11 | id: cache 12 | with: 13 | path: '**/node_modules' 14 | key: npm-v3-${{ hashFiles('**/package-lock.json') }} 15 | - name: Install dependencies 16 | run: npm ci --prefer-offline 17 | shell: bash 18 | if: steps.cache.outputs.cache-hit != 'true' 19 | env: 20 | SKIP_COMPILE: true 21 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/.github/workflows/changelog.yml: -------------------------------------------------------------------------------- 1 | name: changelog 2 | 3 | on: 4 | pull_request: 5 | types: 6 | - opened 7 | - synchronize 8 | - labeled 9 | - unlabeled 10 | 11 | concurrency: 12 | group: changelog-${{ github.ref }} 13 | cancel-in-progress: true 14 | 15 | jobs: 16 | check: 17 | runs-on: ubuntu-latest 18 | if: ${{ !contains(github.event.pull_request.labels.*.name, 'ignore-changelog') }} 19 | steps: 20 | - uses: actions/checkout@v3 21 | - name: Check diff 22 | run: | 23 | git fetch origin ${{ github.base_ref }} --depth=1 24 | if git diff --exit-code origin/${{ github.base_ref }} -- CHANGELOG.md ; then 25 | echo 'Missing changelog entry' 26 | exit 1 27 | fi 28 | 29 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/.github/workflows/docs.yml: -------------------------------------------------------------------------------- 1 | name: Build Docs 2 | 3 | on: 4 | push: 5 | branches: [release-v*] 6 | 7 | permissions: 8 | contents: write 9 | 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v3 15 | - name: Set up environment 16 | uses: ./.github/actions/setup 17 | - run: bash scripts/git-user-config.sh 18 | - run: node scripts/update-docs-branch.js 19 | - run: git push --all origin 20 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/.github/workflows/upgradeable.yml: -------------------------------------------------------------------------------- 1 | name: Upgradeable Trigger 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | - release-v* 8 | 9 | jobs: 10 | trigger: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - id: app 14 | uses: getsentry/action-github-app-token@v1 15 | with: 16 | app_id: ${{ secrets.UPGRADEABLE_APP_ID }} 17 | private_key: ${{ secrets.UPGRADEABLE_APP_PK }} 18 | - run: | 19 | curl -X POST \ 20 | https://api.github.com/repos/OpenZeppelin/openzeppelin-contracts-upgradeable/dispatches \ 21 | -H 'Accept: application/vnd.github.v3+json' \ 22 | -H 'Authorization: token ${{ steps.app.outputs.token }}' \ 23 | -d '{ "event_type": "Update", "client_payload": { "ref": "${{ github.ref }}" } }' 24 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | *.swo 3 | 4 | # Logs 5 | logs 6 | *.log 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | allFiredEvents 13 | scTopics 14 | 15 | # Coverage directory used by tools like istanbul 16 | coverage 17 | coverage.json 18 | coverageEnv 19 | 20 | # node-waf configuration 21 | .lock-wscript 22 | 23 | # Dependency directory 24 | node_modules 25 | 26 | # Debug log from npm 27 | npm-debug.log 28 | 29 | # local env variables 30 | .env 31 | 32 | # truffle build directory 33 | build/ 34 | 35 | # macOS 36 | .DS_Store 37 | 38 | # truffle 39 | .node-xmlhttprequest-* 40 | 41 | # IntelliJ IDE 42 | .idea 43 | 44 | # docs artifacts 45 | docs/modules/api 46 | 47 | # only used to package @openzeppelin/contracts 48 | contracts/build/ 49 | contracts/README.md 50 | 51 | # temporary artifact from solidity-coverage 52 | allFiredEvents 53 | .coverage_artifacts 54 | .coverage_cache 55 | .coverage_contracts 56 | 57 | # hardhat 58 | cache 59 | artifacts 60 | 61 | # Certora 62 | .certora* 63 | .last_confs 64 | certora_* 65 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "lib/forge-std"] 2 | branch = v1 3 | path = lib/forge-std 4 | url = https://github.com/foundry-rs/forge-std 5 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/.mocharc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | require: 'hardhat/register', 3 | timeout: 4000, 4 | }; 5 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all", 4 | "overrides": [ 5 | { 6 | "files": "*.sol", 7 | "options": { 8 | "singleQuote": false, 9 | "printWidth": 120, 10 | "explicitTypes": "always" 11 | } 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/.solcover.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | norpc: true, 3 | testCommand: 'npm test', 4 | compileCommand: 'npm run compile', 5 | skipFiles: [ 6 | 'mocks', 7 | ], 8 | providerOptions: { 9 | default_balance_ether: '10000000000000000000000000', 10 | }, 11 | mocha: { 12 | fgrep: '[skip-on-coverage]', 13 | invert: true, 14 | }, 15 | } 16 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/.solhint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-unused-vars": "error", 4 | "const-name-snakecase": "error", 5 | "contract-name-camelcase": "error", 6 | "event-name-camelcase": "error", 7 | "func-name-mixedcase": "error", 8 | "func-param-name-mixedcase": "error", 9 | "modifier-name-mixedcase": "error", 10 | "private-vars-leading-underscore": "error", 11 | "var-name-mixedcase": "error", 12 | "imports-on-top": "error" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/DOCUMENTATION.md: -------------------------------------------------------------------------------- 1 | Documentation is hosted at https://docs.openzeppelin.com/contracts. 2 | 3 | All of the content for the site is in this repository. The guides are in the 4 | [docs](/docs) directory, and the API Reference is extracted from comments in 5 | the source code. If you want to help improve the content, this is the 6 | repository you should be contributing to. 7 | 8 | [`solidity-docgen`](https://github.com/OpenZeppelin/solidity-docgen) is the 9 | program that extracts the API Reference from source code. 10 | 11 | The [`docs.openzeppelin.com`](https://github.com/OpenZeppelin/docs.openzeppelin.com) 12 | repository hosts the configuration for the entire site, which includes 13 | documentation for all of the OpenZeppelin projects. 14 | 15 | To run the docs locally you should run `npm run docs:watch` on this 16 | repository. 17 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016-2022 zOS Global Limited and contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included 14 | in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Bug Bounty 4 | 5 | We have a [**bug bounty program** on Immunefi](https://www.immunefi.com/bounty/openzeppelin). Please report any security issues you find through the Immunefi dashboard, or reach out to security@openzeppelin.com. 6 | 7 | Critical bug fixes will be backported to past major releases. 8 | 9 | ## Supported Versions 10 | 11 | The recommendation is to use the latest version available. 12 | 13 | | Version | Supported | 14 | | ------- | ------------------------------------ | 15 | | 4.x | :white_check_mark::white_check_mark: | 16 | | 3.4 | :white_check_mark: | 17 | | 2.5 | :white_check_mark: | 18 | | < 2.0 | :x: | 19 | 20 | Note that the Solidity language itself only guarantees security updates for the latest release. 21 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/audit/2018-10.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngleProtocol/safe-multisig/967397ebb8da52d90e446ad8cf634548dc5d8814/lib/openzeppelin-contracts/audit/2018-10.pdf -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/certora/Makefile: -------------------------------------------------------------------------------- 1 | default: help 2 | 3 | PATCH = applyHarness.patch 4 | CONTRACTS_DIR = ../contracts 5 | MUNGED_DIR = munged 6 | 7 | help: 8 | @echo "usage:" 9 | @echo " make clean: remove all generated files (those ignored by git)" 10 | @echo " make $(MUNGED_DIR): create $(MUNGED_DIR) directory by applying the patch file to $(CONTRACTS_DIR)" 11 | @echo " make record: record a new patch file capturing the differences between $(CONTRACTS_DIR) and $(MUNGED_DIR)" 12 | 13 | munged: $(wildcard $(CONTRACTS_DIR)/*.sol) $(PATCH) 14 | rm -rf $@ 15 | cp -r $(CONTRACTS_DIR) $@ 16 | patch -p0 -d $@ < $(PATCH) 17 | 18 | record: 19 | diff -ruN $(CONTRACTS_DIR) $(MUNGED_DIR) | sed 's+../contracts/++g' | sed 's+munged/++g' > $(PATCH) 20 | 21 | clean: 22 | git clean -fdX 23 | touch $(PATCH) 24 | 25 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/certora/harnesses/ERC20VotesHarness.sol: -------------------------------------------------------------------------------- 1 | import "../munged/token/ERC20/extensions/ERC20Votes.sol"; 2 | 3 | contract ERC20VotesHarness is ERC20Votes { 4 | constructor(string memory name, string memory symbol) ERC20Permit(name) ERC20(name, symbol) {} 5 | 6 | mapping(address => mapping(uint256 => uint256)) public _getPastVotes; 7 | 8 | function _afterTokenTransfer( 9 | address from, 10 | address to, 11 | uint256 amount 12 | ) internal virtual override { 13 | super._afterTokenTransfer(from, to, amount); 14 | _getPastVotes[from][block.number] -= amount; 15 | _getPastVotes[to][block.number] += amount; 16 | } 17 | 18 | /** 19 | * @dev Change delegation for `delegator` to `delegatee`. 20 | * 21 | * Emits events {DelegateChanged} and {DelegateVotesChanged}. 22 | */ 23 | function _delegate(address delegator, address delegatee) internal virtual override{ 24 | super._delegate(delegator, delegatee); 25 | _getPastVotes[delegator][block.number] -= balanceOf(delegator); 26 | _getPastVotes[delegatee][block.number] += balanceOf(delegator); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/certora/munged/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/certora/scripts/Governor.sh: -------------------------------------------------------------------------------- 1 | make -C certora munged 2 | 3 | certoraRun certora/harnesses/ERC20VotesHarness.sol certora/harnesses/GovernorHarness.sol \ 4 | --verify GovernorHarness:certora/specs/GovernorBase.spec \ 5 | --solc solc8.0 \ 6 | --staging shelly/forSasha \ 7 | --optimistic_loop \ 8 | --settings -copyLoopUnroll=4 \ 9 | --rule voteStartBeforeVoteEnd \ 10 | --msg "$1" 11 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/certora/scripts/GovernorCountingSimple-counting.sh: -------------------------------------------------------------------------------- 1 | make -C certora munged 2 | 3 | certoraRun certora/harnesses/ERC20VotesHarness.sol certora/harnesses/GovernorBasicHarness.sol \ 4 | --verify GovernorBasicHarness:certora/specs/GovernorCountingSimple.spec \ 5 | --solc solc8.2 \ 6 | --staging shelly/forSasha \ 7 | --optimistic_loop \ 8 | --settings -copyLoopUnroll=4 \ 9 | --rule hasVotedCorrelation \ 10 | --msg "$1" 11 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/certora/scripts/WizardControlFirstPriority.sh: -------------------------------------------------------------------------------- 1 | make -C certora munged 2 | 3 | certoraRun certora/harnesses/ERC20VotesHarness.sol certora/harnesses/WizardControlFirstPriority.sol \ 4 | --link WizardControlFirstPriority:token=ERC20VotesHarness \ 5 | --verify WizardControlFirstPriority:certora/specs/GovernorBase.spec \ 6 | --solc solc8.2 \ 7 | --disableLocalTypeChecking \ 8 | --staging shelly/forSasha \ 9 | --optimistic_loop \ 10 | --settings -copyLoopUnroll=4 \ 11 | --rule canVoteDuringVotingPeriod \ 12 | --msg "$1" 13 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/certora/scripts/WizardFirstTry.sh: -------------------------------------------------------------------------------- 1 | make -C certora munged 2 | 3 | certoraRun certora/harnesses/ERC20VotesHarness.sol certora/harnesses/WizardFirstTry.sol \ 4 | --verify WizardFirstTry:certora/specs/GovernorBase.spec \ 5 | --solc solc8.2 \ 6 | --staging shelly/forSasha \ 7 | --optimistic_loop \ 8 | --disableLocalTypeChecking \ 9 | --settings -copyLoopUnroll=4 \ 10 | --msg "$1" 11 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/certora/scripts/sanity.sh: -------------------------------------------------------------------------------- 1 | make -C certora munged 2 | 3 | for f in certora/harnesses/Wizard*.sol 4 | do 5 | echo "Processing $f" 6 | file=$(basename $f) 7 | echo ${file%.*} 8 | certoraRun certora/harnesses/$file \ 9 | --verify ${file%.*}:certora/specs/sanity.spec "$@" \ 10 | --solc solc8.2 --staging shelly/forSasha \ 11 | --optimistic_loop \ 12 | --msg "checking sanity on ${file%.*}" 13 | --settings -copyLoopUnroll=4 14 | done 15 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/certora/specs/sanity.spec: -------------------------------------------------------------------------------- 1 | /* 2 | This rule looks for a non-reverting execution path to each method, including those overridden in the harness. 3 | A method has such an execution path if it violates this rule. 4 | How it works: 5 | - If there is a non-reverting execution path, we reach the false assertion, and the sanity fails. 6 | - If all execution paths are reverting, we never call the assertion, and the method will pass this rule vacuously. 7 | */ 8 | 9 | rule sanity(method f) { 10 | env e; 11 | calldataarg arg; 12 | f(e, arg); 13 | assert false; 14 | } -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/access/README.adoc: -------------------------------------------------------------------------------- 1 | = Access Control 2 | 3 | [.readme-notice] 4 | NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/access 5 | 6 | This directory provides ways to restrict who can access the functions of a contract or when they can do it. 7 | 8 | - {AccessControl} provides a general role based access control mechanism. Multiple hierarchical roles can be created and assigned each to multiple accounts. 9 | - {Ownable} is a simpler mechanism with a single owner "role" that can be assigned to a single account. This simpler mechanism can be useful for quick tests but projects with production concerns are likely to outgrow it. 10 | 11 | == Authorization 12 | 13 | {{Ownable}} 14 | 15 | {{Ownable2Step}} 16 | 17 | {{IAccessControl}} 18 | 19 | {{AccessControl}} 20 | 21 | {{AccessControlCrossChain}} 22 | 23 | {{IAccessControlEnumerable}} 24 | 25 | {{AccessControlEnumerable}} 26 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/crosschain/errors.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.6.0) (crosschain/errors.sol) 3 | 4 | pragma solidity ^0.8.4; 5 | 6 | error NotCrossChainCall(); 7 | error InvalidCrossChainSender(address actual, address expected); 8 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/finance/README.adoc: -------------------------------------------------------------------------------- 1 | = Finance 2 | 3 | [.readme-notice] 4 | NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/finance 5 | 6 | This directory includes primitives for financial systems: 7 | 8 | - {PaymentSplitter} allows to split Ether and ERC20 payments among a group of accounts. The sender does not need to be 9 | aware that the assets will be split in this way, since it is handled transparently by the contract. The split can be 10 | in equal parts or in any other arbitrary proportion. 11 | 12 | - {VestingWallet} handles the vesting of Ether and ERC20 tokens for a given beneficiary. Custody of multiple tokens can 13 | be given to this contract, which will release the token to the beneficiary following a given, customizable, vesting 14 | schedule. 15 | 16 | == Contracts 17 | 18 | {{PaymentSplitter}} 19 | 20 | {{VestingWallet}} 21 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/governance/extensions/GovernorProposalThreshold.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (governance/extensions/GovernorProposalThreshold.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../Governor.sol"; 7 | 8 | /** 9 | * @dev Extension of {Governor} for proposal restriction to token holders with a minimum balance. 10 | * 11 | * _Available since v4.3._ 12 | * _Deprecated since v4.4._ 13 | */ 14 | abstract contract GovernorProposalThreshold is Governor { 15 | function propose( 16 | address[] memory targets, 17 | uint256[] memory values, 18 | bytes[] memory calldatas, 19 | string memory description 20 | ) public virtual override returns (uint256) { 21 | return super.propose(targets, values, calldatas, description); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/governance/extensions/GovernorVotes.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.6.0) (governance/extensions/GovernorVotes.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../Governor.sol"; 7 | import "../utils/IVotes.sol"; 8 | 9 | /** 10 | * @dev Extension of {Governor} for voting weight extraction from an {ERC20Votes} token, or since v4.5 an {ERC721Votes} token. 11 | * 12 | * _Available since v4.3._ 13 | */ 14 | abstract contract GovernorVotes is Governor { 15 | IVotes public immutable token; 16 | 17 | constructor(IVotes tokenAddress) { 18 | token = tokenAddress; 19 | } 20 | 21 | /** 22 | * Read the voting weight from the token's built in snapshot mechanism (see {Governor-_getVotes}). 23 | */ 24 | function _getVotes( 25 | address account, 26 | uint256 blockNumber, 27 | bytes memory /*params*/ 28 | ) internal view virtual override returns (uint256) { 29 | return token.getPastVotes(account, blockNumber); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/governance/extensions/GovernorVotesComp.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.6.0) (governance/extensions/GovernorVotesComp.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../Governor.sol"; 7 | import "../../token/ERC20/extensions/ERC20VotesComp.sol"; 8 | 9 | /** 10 | * @dev Extension of {Governor} for voting weight extraction from a Comp token. 11 | * 12 | * _Available since v4.3._ 13 | */ 14 | abstract contract GovernorVotesComp is Governor { 15 | ERC20VotesComp public immutable token; 16 | 17 | constructor(ERC20VotesComp token_) { 18 | token = token_; 19 | } 20 | 21 | /** 22 | * Read the voting weight from the token's built in snapshot mechanism (see {Governor-_getVotes}). 23 | */ 24 | function _getVotes( 25 | address account, 26 | uint256 blockNumber, 27 | bytes memory /*params*/ 28 | ) internal view virtual override returns (uint256) { 29 | return token.getPriorVotes(account, blockNumber); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/governance/extensions/IGovernorTimelock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (governance/extensions/IGovernorTimelock.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../IGovernor.sol"; 7 | 8 | /** 9 | * @dev Extension of the {IGovernor} for timelock supporting modules. 10 | * 11 | * _Available since v4.3._ 12 | */ 13 | abstract contract IGovernorTimelock is IGovernor { 14 | event ProposalQueued(uint256 proposalId, uint256 eta); 15 | 16 | function timelock() public view virtual returns (address); 17 | 18 | function proposalEta(uint256 proposalId) public view virtual returns (uint256); 19 | 20 | function queue( 21 | address[] memory targets, 22 | uint256[] memory values, 23 | bytes[] memory calldatas, 24 | bytes32 descriptionHash 25 | ) public virtual returns (uint256 proposalId); 26 | } 27 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/interfaces/IERC1155.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1155.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../token/ERC1155/IERC1155.sol"; 7 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/interfaces/IERC1155MetadataURI.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1155MetadataURI.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../token/ERC1155/extensions/IERC1155MetadataURI.sol"; 7 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/interfaces/IERC1155Receiver.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1155Receiver.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../token/ERC1155/IERC1155Receiver.sol"; 7 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/interfaces/IERC1271.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | /** 7 | * @dev Interface of the ERC1271 standard signature validation method for 8 | * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271]. 9 | * 10 | * _Available since v4.1._ 11 | */ 12 | interface IERC1271 { 13 | /** 14 | * @dev Should return whether the signature provided is valid for the provided data 15 | * @param hash Hash of the data to be signed 16 | * @param signature Signature byte array associated with _data 17 | */ 18 | function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue); 19 | } 20 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/interfaces/IERC165.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../utils/introspection/IERC165.sol"; 7 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/interfaces/IERC1820Implementer.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1820Implementer.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../utils/introspection/IERC1820Implementer.sol"; 7 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/interfaces/IERC1820Registry.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1820Registry.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../utils/introspection/IERC1820Registry.sol"; 7 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/interfaces/IERC1967.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.8.3) (interfaces/IERC1967.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | /** 7 | * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC. 8 | * 9 | * _Available since v4.9._ 10 | */ 11 | interface IERC1967 { 12 | /** 13 | * @dev Emitted when the implementation is upgraded. 14 | */ 15 | event Upgraded(address indexed implementation); 16 | 17 | /** 18 | * @dev Emitted when the admin account has changed. 19 | */ 20 | event AdminChanged(address previousAdmin, address newAdmin); 21 | 22 | /** 23 | * @dev Emitted when the beacon is changed. 24 | */ 25 | event BeaconUpgraded(address indexed beacon); 26 | } 27 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/interfaces/IERC20.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../token/ERC20/IERC20.sol"; 7 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/interfaces/IERC20Metadata.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC20Metadata.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../token/ERC20/extensions/IERC20Metadata.sol"; 7 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/interfaces/IERC2309.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.8.0) (interfaces/IERC2309.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | /** 7 | * @dev ERC-2309: ERC-721 Consecutive Transfer Extension. 8 | * 9 | * _Available since v4.8._ 10 | */ 11 | interface IERC2309 { 12 | /** 13 | * @dev Emitted when the tokens from `fromTokenId` to `toTokenId` are transferred from `fromAddress` to `toAddress`. 14 | */ 15 | event ConsecutiveTransfer( 16 | uint256 indexed fromTokenId, 17 | uint256 toTokenId, 18 | address indexed fromAddress, 19 | address indexed toAddress 20 | ); 21 | } 22 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/interfaces/IERC2981.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../utils/introspection/IERC165.sol"; 7 | 8 | /** 9 | * @dev Interface for the NFT Royalty Standard. 10 | * 11 | * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal 12 | * support for royalty payments across all NFT marketplaces and ecosystem participants. 13 | * 14 | * _Available since v4.5._ 15 | */ 16 | interface IERC2981 is IERC165 { 17 | /** 18 | * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of 19 | * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. 20 | */ 21 | function royaltyInfo(uint256 tokenId, uint256 salePrice) 22 | external 23 | view 24 | returns (address receiver, uint256 royaltyAmount); 25 | } 26 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/interfaces/IERC3156.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC3156.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "./IERC3156FlashBorrower.sol"; 7 | import "./IERC3156FlashLender.sol"; 8 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/interfaces/IERC3156FlashBorrower.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC3156FlashBorrower.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | /** 7 | * @dev Interface of the ERC3156 FlashBorrower, as defined in 8 | * https://eips.ethereum.org/EIPS/eip-3156[ERC-3156]. 9 | * 10 | * _Available since v4.1._ 11 | */ 12 | interface IERC3156FlashBorrower { 13 | /** 14 | * @dev Receive a flash loan. 15 | * @param initiator The initiator of the loan. 16 | * @param token The loan currency. 17 | * @param amount The amount of tokens lent. 18 | * @param fee The additional amount of tokens to repay. 19 | * @param data Arbitrary data structure, intended to contain user-defined parameters. 20 | * @return The keccak256 hash of "IERC3156FlashBorrower.onFlashLoan" 21 | */ 22 | function onFlashLoan( 23 | address initiator, 24 | address token, 25 | uint256 amount, 26 | uint256 fee, 27 | bytes calldata data 28 | ) external returns (bytes32); 29 | } 30 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/interfaces/IERC721.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC721.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../token/ERC721/IERC721.sol"; 7 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/interfaces/IERC721Enumerable.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC721Enumerable.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../token/ERC721/extensions/IERC721Enumerable.sol"; 7 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/interfaces/IERC721Metadata.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC721Metadata.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../token/ERC721/extensions/IERC721Metadata.sol"; 7 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/interfaces/IERC721Receiver.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC721Receiver.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../token/ERC721/IERC721Receiver.sol"; 7 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/interfaces/IERC777.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC777.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../token/ERC777/IERC777.sol"; 7 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/interfaces/IERC777Recipient.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC777Recipient.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../token/ERC777/IERC777Recipient.sol"; 7 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/interfaces/IERC777Sender.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC777Sender.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../token/ERC777/IERC777Sender.sol"; 7 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/interfaces/draft-IERC1822.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | /** 7 | * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified 8 | * proxy whose upgrades are fully controlled by the current implementation. 9 | */ 10 | interface IERC1822Proxiable { 11 | /** 12 | * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation 13 | * address. 14 | * 15 | * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks 16 | * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this 17 | * function revert if invoked through a proxy. 18 | */ 19 | function proxiableUUID() external view returns (bytes32); 20 | } 21 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/interfaces/draft-IERC2612.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (interfaces/draft-IERC2612.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../token/ERC20/extensions/draft-IERC20Permit.sol"; 7 | 8 | interface IERC2612 is IERC20Permit {} 9 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/metatx/README.adoc: -------------------------------------------------------------------------------- 1 | = Meta Transactions 2 | 3 | [.readme-notice] 4 | NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/metatx 5 | 6 | == Core 7 | 8 | {{ERC2771Context}} 9 | 10 | == Utils 11 | 12 | {{MinimalForwarder}} 13 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/AccessControlCrossChainMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.4; 4 | 5 | import "../access/AccessControlCrossChain.sol"; 6 | import "../crosschain/arbitrum/CrossChainEnabledArbitrumL2.sol"; 7 | 8 | contract AccessControlCrossChainMock is AccessControlCrossChain, CrossChainEnabledArbitrumL2 { 9 | constructor() { 10 | _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); 11 | } 12 | 13 | function setRoleAdmin(bytes32 roleId, bytes32 adminRoleId) public { 14 | _setRoleAdmin(roleId, adminRoleId); 15 | } 16 | 17 | function senderProtected(bytes32 roleId) public onlyRole(roleId) {} 18 | 19 | function crossChainRoleAlias(bytes32 role) public pure returns (bytes32) { 20 | return _crossChainRoleAlias(role); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/AccessControlEnumerableMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../access/AccessControlEnumerable.sol"; 6 | 7 | contract AccessControlEnumerableMock is AccessControlEnumerable { 8 | constructor() { 9 | _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); 10 | } 11 | 12 | function setRoleAdmin(bytes32 roleId, bytes32 adminRoleId) public { 13 | _setRoleAdmin(roleId, adminRoleId); 14 | } 15 | 16 | function senderProtected(bytes32 roleId) public onlyRole(roleId) {} 17 | } 18 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/AccessControlMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../access/AccessControl.sol"; 6 | 7 | contract AccessControlMock is AccessControl { 8 | constructor() { 9 | _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); 10 | } 11 | 12 | function setRoleAdmin(bytes32 roleId, bytes32 adminRoleId) public { 13 | _setRoleAdmin(roleId, adminRoleId); 14 | } 15 | 16 | function senderProtected(bytes32 roleId) public onlyRole(roleId) {} 17 | } 18 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/BadBeacon.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | contract BadBeaconNoImpl {} 6 | 7 | contract BadBeaconNotContract { 8 | function implementation() external pure returns (address) { 9 | return address(0x1); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/Base64Mock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../utils/Base64.sol"; 6 | 7 | contract Base64Mock { 8 | function encode(bytes memory value) external pure returns (string memory) { 9 | return Base64.encode(value); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/BitmapMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../utils/structs/BitMaps.sol"; 6 | 7 | contract BitMapMock { 8 | using BitMaps for BitMaps.BitMap; 9 | 10 | BitMaps.BitMap private _bitmap; 11 | 12 | function get(uint256 index) public view returns (bool) { 13 | return _bitmap.get(index); 14 | } 15 | 16 | function setTo(uint256 index, bool value) public { 17 | _bitmap.setTo(index, value); 18 | } 19 | 20 | function set(uint256 index) public { 21 | _bitmap.set(index); 22 | } 23 | 24 | function unset(uint256 index) public { 25 | _bitmap.unset(index); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ClashingImplementation.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | /** 6 | * @dev Implementation contract with a payable admin() function made to clash with TransparentUpgradeableProxy's to 7 | * test correct functioning of the Transparent Proxy feature. 8 | */ 9 | contract ClashingImplementation { 10 | function admin() external payable returns (address) { 11 | return 0x0000000000000000000000000000000011111142; 12 | } 13 | 14 | function delegatedFunction() external pure returns (bool) { 15 | return true; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ConditionalEscrowMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../utils/escrow/ConditionalEscrow.sol"; 6 | 7 | // mock class using ConditionalEscrow 8 | contract ConditionalEscrowMock is ConditionalEscrow { 9 | mapping(address => bool) private _allowed; 10 | 11 | function setAllowed(address payee, bool allowed) public { 12 | _allowed[payee] = allowed; 13 | } 14 | 15 | function withdrawalAllowed(address payee) public view override returns (bool) { 16 | return _allowed[payee]; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ContextMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../utils/Context.sol"; 6 | 7 | contract ContextMock is Context { 8 | event Sender(address sender); 9 | 10 | function msgSender() public { 11 | emit Sender(_msgSender()); 12 | } 13 | 14 | event Data(bytes data, uint256 integerValue, string stringValue); 15 | 16 | function msgData(uint256 integerValue, string memory stringValue) public { 17 | emit Data(_msgData(), integerValue, stringValue); 18 | } 19 | } 20 | 21 | contract ContextMockCaller { 22 | function callSender(ContextMock context) public { 23 | context.msgSender(); 24 | } 25 | 26 | function callData( 27 | ContextMock context, 28 | uint256 integerValue, 29 | string memory stringValue 30 | ) public { 31 | context.msgData(integerValue, stringValue); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/CountersImpl.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../utils/Counters.sol"; 6 | 7 | contract CountersImpl { 8 | using Counters for Counters.Counter; 9 | 10 | Counters.Counter private _counter; 11 | 12 | function current() public view returns (uint256) { 13 | return _counter.current(); 14 | } 15 | 16 | function increment() public { 17 | _counter.increment(); 18 | } 19 | 20 | function decrement() public { 21 | _counter.decrement(); 22 | } 23 | 24 | function reset() public { 25 | _counter.reset(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/Create2Impl.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../utils/Create2.sol"; 6 | import "../utils/introspection/ERC1820Implementer.sol"; 7 | 8 | contract Create2Impl { 9 | function deploy( 10 | uint256 value, 11 | bytes32 salt, 12 | bytes memory code 13 | ) public { 14 | Create2.deploy(value, salt, code); 15 | } 16 | 17 | function deployERC1820Implementer(uint256 value, bytes32 salt) public { 18 | Create2.deploy(value, salt, type(ERC1820Implementer).creationCode); 19 | } 20 | 21 | function computeAddress(bytes32 salt, bytes32 codeHash) public view returns (address) { 22 | return Create2.computeAddress(salt, codeHash); 23 | } 24 | 25 | function computeAddressWithDeployer( 26 | bytes32 salt, 27 | bytes32 codeHash, 28 | address deployer 29 | ) public pure returns (address) { 30 | return Create2.computeAddress(salt, codeHash, deployer); 31 | } 32 | 33 | receive() external payable {} 34 | } 35 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/EIP712External.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../utils/cryptography/ECDSA.sol"; 6 | import "../utils/cryptography/EIP712.sol"; 7 | 8 | contract EIP712External is EIP712 { 9 | constructor(string memory name, string memory version) EIP712(name, version) {} 10 | 11 | function domainSeparator() external view returns (bytes32) { 12 | return _domainSeparatorV4(); 13 | } 14 | 15 | function verify( 16 | bytes memory signature, 17 | address signer, 18 | address mailTo, 19 | string memory mailContents 20 | ) external view { 21 | bytes32 digest = _hashTypedDataV4( 22 | keccak256(abi.encode(keccak256("Mail(address to,string contents)"), mailTo, keccak256(bytes(mailContents)))) 23 | ); 24 | address recoveredSigner = ECDSA.recover(digest, signature); 25 | require(recoveredSigner == signer); 26 | } 27 | 28 | function getChainId() external view returns (uint256) { 29 | return block.chainid; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ERC1155BurnableMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../token/ERC1155/extensions/ERC1155Burnable.sol"; 6 | 7 | contract ERC1155BurnableMock is ERC1155Burnable { 8 | constructor(string memory uri) ERC1155(uri) {} 9 | 10 | function mint( 11 | address to, 12 | uint256 id, 13 | uint256 value, 14 | bytes memory data 15 | ) public { 16 | _mint(to, id, value, data); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ERC1155PausableMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "./ERC1155Mock.sol"; 6 | import "../token/ERC1155/extensions/ERC1155Pausable.sol"; 7 | 8 | contract ERC1155PausableMock is ERC1155Mock, ERC1155Pausable { 9 | constructor(string memory uri) ERC1155Mock(uri) {} 10 | 11 | function pause() external { 12 | _pause(); 13 | } 14 | 15 | function unpause() external { 16 | _unpause(); 17 | } 18 | 19 | function _beforeTokenTransfer( 20 | address operator, 21 | address from, 22 | address to, 23 | uint256[] memory ids, 24 | uint256[] memory amounts, 25 | bytes memory data 26 | ) internal override(ERC1155, ERC1155Pausable) { 27 | super._beforeTokenTransfer(operator, from, to, ids, amounts, data); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ERC1155SupplyMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "./ERC1155Mock.sol"; 6 | import "../token/ERC1155/extensions/ERC1155Supply.sol"; 7 | 8 | contract ERC1155SupplyMock is ERC1155Mock, ERC1155Supply { 9 | constructor(string memory uri) ERC1155Mock(uri) {} 10 | 11 | function _beforeTokenTransfer( 12 | address operator, 13 | address from, 14 | address to, 15 | uint256[] memory ids, 16 | uint256[] memory amounts, 17 | bytes memory data 18 | ) internal override(ERC1155, ERC1155Supply) { 19 | super._beforeTokenTransfer(operator, from, to, ids, amounts, data); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ERC1155URIStorageMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "./ERC1155Mock.sol"; 6 | import "../token/ERC1155/extensions/ERC1155URIStorage.sol"; 7 | 8 | contract ERC1155URIStorageMock is ERC1155Mock, ERC1155URIStorage { 9 | constructor(string memory _uri) ERC1155Mock(_uri) {} 10 | 11 | function uri(uint256 tokenId) public view override(ERC1155, ERC1155URIStorage) returns (string memory) { 12 | return ERC1155URIStorage.uri(tokenId); 13 | } 14 | 15 | function setURI(uint256 tokenId, string memory _tokenURI) public { 16 | _setURI(tokenId, _tokenURI); 17 | } 18 | 19 | function setBaseURI(string memory baseURI) public { 20 | _setBaseURI(baseURI); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ERC1271WalletMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../access/Ownable.sol"; 6 | import "../interfaces/IERC1271.sol"; 7 | import "../utils/cryptography/ECDSA.sol"; 8 | 9 | contract ERC1271WalletMock is Ownable, IERC1271 { 10 | constructor(address originalOwner) { 11 | transferOwnership(originalOwner); 12 | } 13 | 14 | function isValidSignature(bytes32 hash, bytes memory signature) public view override returns (bytes4 magicValue) { 15 | return ECDSA.recover(hash, signature) == owner() ? this.isValidSignature.selector : bytes4(0); 16 | } 17 | } 18 | 19 | contract ERC1271MaliciousMock is IERC1271 { 20 | function isValidSignature(bytes32, bytes memory) public pure override returns (bytes4) { 21 | assembly { 22 | mstore(0, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) 23 | return(0, 32) 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ERC165/ERC165MaliciousData.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | contract ERC165MaliciousData { 6 | function supportsInterface(bytes4) public pure returns (bool) { 7 | assembly { 8 | mstore(0, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) 9 | return(0, 32) 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ERC165/ERC165MissingData.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | contract ERC165MissingData { 6 | function supportsInterface(bytes4 interfaceId) public view {} // missing return 7 | } 8 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ERC165/ERC165NotSupported.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | contract ERC165NotSupported {} 6 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ERC165/ERC165ReturnBomb.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../../utils/introspection/IERC165.sol"; 6 | 7 | contract ERC165ReturnBombMock is IERC165 { 8 | function supportsInterface(bytes4 interfaceId) public pure override returns (bool) { 9 | if (interfaceId == type(IERC165).interfaceId) { 10 | assembly { 11 | mstore(0, 1) 12 | } 13 | } 14 | assembly { 15 | return(0, 101500) 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ERC165CheckerMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../utils/introspection/ERC165Checker.sol"; 6 | 7 | contract ERC165CheckerMock { 8 | using ERC165Checker for address; 9 | 10 | function supportsERC165(address account) public view returns (bool) { 11 | return account.supportsERC165(); 12 | } 13 | 14 | function supportsInterface(address account, bytes4 interfaceId) public view returns (bool) { 15 | return account.supportsInterface(interfaceId); 16 | } 17 | 18 | function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) public view returns (bool) { 19 | return account.supportsAllInterfaces(interfaceIds); 20 | } 21 | 22 | function getSupportedInterfaces(address account, bytes4[] memory interfaceIds) public view returns (bool[] memory) { 23 | return account.getSupportedInterfaces(interfaceIds); 24 | } 25 | 26 | function supportsERC165InterfaceUnchecked(address account, bytes4 interfaceId) public view returns (bool) { 27 | return account.supportsERC165InterfaceUnchecked(interfaceId); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ERC165Mock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../utils/introspection/ERC165.sol"; 6 | 7 | contract ERC165Mock is ERC165 {} 8 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ERC165StorageMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../utils/introspection/ERC165Storage.sol"; 6 | 7 | contract ERC165StorageMock is ERC165Storage { 8 | function registerInterface(bytes4 interfaceId) public { 9 | _registerInterface(interfaceId); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ERC1820ImplementerMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../utils/introspection/ERC1820Implementer.sol"; 6 | 7 | contract ERC1820ImplementerMock is ERC1820Implementer { 8 | function registerInterfaceForAddress(bytes32 interfaceHash, address account) public { 9 | _registerInterfaceForAddress(interfaceHash, account); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ERC20BurnableMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../token/ERC20/extensions/ERC20Burnable.sol"; 6 | 7 | contract ERC20BurnableMock is ERC20Burnable { 8 | constructor( 9 | string memory name, 10 | string memory symbol, 11 | address initialAccount, 12 | uint256 initialBalance 13 | ) ERC20(name, symbol) { 14 | _mint(initialAccount, initialBalance); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ERC20CappedMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../token/ERC20/extensions/ERC20Capped.sol"; 6 | 7 | contract ERC20CappedMock is ERC20Capped { 8 | constructor( 9 | string memory name, 10 | string memory symbol, 11 | uint256 cap 12 | ) ERC20(name, symbol) ERC20Capped(cap) {} 13 | 14 | function mint(address to, uint256 tokenId) public { 15 | _mint(to, tokenId); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ERC20DecimalsMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../token/ERC20/ERC20.sol"; 6 | 7 | contract ERC20DecimalsMock is ERC20 { 8 | uint8 private immutable _decimals; 9 | 10 | constructor( 11 | string memory name_, 12 | string memory symbol_, 13 | uint8 decimals_ 14 | ) ERC20(name_, symbol_) { 15 | _decimals = decimals_; 16 | } 17 | 18 | function decimals() public view override returns (uint8) { 19 | return _decimals; 20 | } 21 | 22 | function mint(address account, uint256 amount) public { 23 | _mint(account, amount); 24 | } 25 | 26 | function burn(address account, uint256 amount) public { 27 | _burn(account, amount); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ERC20Mock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../token/ERC20/ERC20.sol"; 6 | 7 | // mock class using ERC20 8 | contract ERC20Mock is ERC20 { 9 | constructor( 10 | string memory name, 11 | string memory symbol, 12 | address initialAccount, 13 | uint256 initialBalance 14 | ) payable ERC20(name, symbol) { 15 | _mint(initialAccount, initialBalance); 16 | } 17 | 18 | function mint(address account, uint256 amount) public { 19 | _mint(account, amount); 20 | } 21 | 22 | function burn(address account, uint256 amount) public { 23 | _burn(account, amount); 24 | } 25 | 26 | function transferInternal( 27 | address from, 28 | address to, 29 | uint256 value 30 | ) public { 31 | _transfer(from, to, value); 32 | } 33 | 34 | function approveInternal( 35 | address owner, 36 | address spender, 37 | uint256 value 38 | ) public { 39 | _approve(owner, spender, value); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ERC20PausableMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../token/ERC20/extensions/ERC20Pausable.sol"; 6 | 7 | // mock class using ERC20Pausable 8 | contract ERC20PausableMock is ERC20Pausable { 9 | constructor( 10 | string memory name, 11 | string memory symbol, 12 | address initialAccount, 13 | uint256 initialBalance 14 | ) ERC20(name, symbol) { 15 | _mint(initialAccount, initialBalance); 16 | } 17 | 18 | function pause() external { 19 | _pause(); 20 | } 21 | 22 | function unpause() external { 23 | _unpause(); 24 | } 25 | 26 | function mint(address to, uint256 amount) public { 27 | _mint(to, amount); 28 | } 29 | 30 | function burn(address from, uint256 amount) public { 31 | _burn(from, amount); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ERC20PermitMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../token/ERC20/extensions/draft-ERC20Permit.sol"; 6 | 7 | contract ERC20PermitMock is ERC20Permit { 8 | constructor( 9 | string memory name, 10 | string memory symbol, 11 | address initialAccount, 12 | uint256 initialBalance 13 | ) payable ERC20(name, symbol) ERC20Permit(name) { 14 | _mint(initialAccount, initialBalance); 15 | } 16 | 17 | function getChainId() external view returns (uint256) { 18 | return block.chainid; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ERC20SnapshotMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../token/ERC20/extensions/ERC20Snapshot.sol"; 6 | 7 | contract ERC20SnapshotMock is ERC20Snapshot { 8 | constructor( 9 | string memory name, 10 | string memory symbol, 11 | address initialAccount, 12 | uint256 initialBalance 13 | ) ERC20(name, symbol) { 14 | _mint(initialAccount, initialBalance); 15 | } 16 | 17 | function snapshot() public { 18 | _snapshot(); 19 | } 20 | 21 | function mint(address account, uint256 amount) public { 22 | _mint(account, amount); 23 | } 24 | 25 | function burn(address account, uint256 amount) public { 26 | _burn(account, amount); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ERC20VotesCompMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../token/ERC20/extensions/ERC20VotesComp.sol"; 6 | 7 | contract ERC20VotesCompMock is ERC20VotesComp { 8 | constructor(string memory name, string memory symbol) ERC20(name, symbol) ERC20Permit(name) {} 9 | 10 | function mint(address account, uint256 amount) public { 11 | _mint(account, amount); 12 | } 13 | 14 | function burn(address account, uint256 amount) public { 15 | _burn(account, amount); 16 | } 17 | 18 | function getChainId() external view returns (uint256) { 19 | return block.chainid; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ERC20VotesMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../token/ERC20/extensions/ERC20Votes.sol"; 6 | 7 | contract ERC20VotesMock is ERC20Votes { 8 | constructor(string memory name, string memory symbol) ERC20(name, symbol) ERC20Permit(name) {} 9 | 10 | function mint(address account, uint256 amount) public { 11 | _mint(account, amount); 12 | } 13 | 14 | function burn(address account, uint256 amount) public { 15 | _burn(account, amount); 16 | } 17 | 18 | function getChainId() external view returns (uint256) { 19 | return block.chainid; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ERC20WrapperMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../token/ERC20/extensions/ERC20Wrapper.sol"; 6 | 7 | contract ERC20WrapperMock is ERC20Wrapper { 8 | constructor( 9 | IERC20 _underlyingToken, 10 | string memory name, 11 | string memory symbol 12 | ) ERC20(name, symbol) ERC20Wrapper(_underlyingToken) {} 13 | 14 | function recover(address account) public returns (uint256) { 15 | return _recover(account); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ERC2771ContextMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.9; 4 | 5 | import "./ContextMock.sol"; 6 | import "../metatx/ERC2771Context.sol"; 7 | 8 | // By inheriting from ERC2771Context, Context's internal functions are overridden automatically 9 | contract ERC2771ContextMock is ContextMock, ERC2771Context { 10 | /// @custom:oz-upgrades-unsafe-allow constructor 11 | constructor(address trustedForwarder) ERC2771Context(trustedForwarder) { 12 | emit Sender(_msgSender()); // _msgSender() should be accessible during construction 13 | } 14 | 15 | function _msgSender() internal view override(Context, ERC2771Context) returns (address) { 16 | return ERC2771Context._msgSender(); 17 | } 18 | 19 | function _msgData() internal view override(Context, ERC2771Context) returns (bytes calldata) { 20 | return ERC2771Context._msgData(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ERC721BurnableMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../token/ERC721/extensions/ERC721Burnable.sol"; 6 | 7 | contract ERC721BurnableMock is ERC721Burnable { 8 | constructor(string memory name, string memory symbol) ERC721(name, symbol) {} 9 | 10 | function exists(uint256 tokenId) public view returns (bool) { 11 | return _exists(tokenId); 12 | } 13 | 14 | function mint(address to, uint256 tokenId) public { 15 | _mint(to, tokenId); 16 | } 17 | 18 | function safeMint(address to, uint256 tokenId) public { 19 | _safeMint(to, tokenId); 20 | } 21 | 22 | function safeMint( 23 | address to, 24 | uint256 tokenId, 25 | bytes memory _data 26 | ) public { 27 | _safeMint(to, tokenId, _data); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ERC721Mock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../token/ERC721/ERC721.sol"; 6 | 7 | /** 8 | * @title ERC721Mock 9 | * This mock just provides a public safeMint, mint, and burn functions for testing purposes 10 | */ 11 | contract ERC721Mock is ERC721 { 12 | constructor(string memory name, string memory symbol) ERC721(name, symbol) {} 13 | 14 | function baseURI() public view returns (string memory) { 15 | return _baseURI(); 16 | } 17 | 18 | function exists(uint256 tokenId) public view returns (bool) { 19 | return _exists(tokenId); 20 | } 21 | 22 | function mint(address to, uint256 tokenId) public { 23 | _mint(to, tokenId); 24 | } 25 | 26 | function safeMint(address to, uint256 tokenId) public { 27 | _safeMint(to, tokenId); 28 | } 29 | 30 | function safeMint( 31 | address to, 32 | uint256 tokenId, 33 | bytes memory _data 34 | ) public { 35 | _safeMint(to, tokenId, _data); 36 | } 37 | 38 | function burn(uint256 tokenId) public { 39 | _burn(tokenId); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ERC721RoyaltyMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../token/ERC721/extensions/ERC721Royalty.sol"; 6 | 7 | contract ERC721RoyaltyMock is ERC721Royalty { 8 | constructor(string memory name, string memory symbol) ERC721(name, symbol) {} 9 | 10 | function setTokenRoyalty( 11 | uint256 tokenId, 12 | address recipient, 13 | uint96 fraction 14 | ) public { 15 | _setTokenRoyalty(tokenId, recipient, fraction); 16 | } 17 | 18 | function setDefaultRoyalty(address recipient, uint96 fraction) public { 19 | _setDefaultRoyalty(recipient, fraction); 20 | } 21 | 22 | function mint(address to, uint256 tokenId) public { 23 | _mint(to, tokenId); 24 | } 25 | 26 | function burn(uint256 tokenId) public { 27 | _burn(tokenId); 28 | } 29 | 30 | function deleteDefaultRoyalty() public { 31 | _deleteDefaultRoyalty(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ERC721VotesMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../token/ERC721/extensions/ERC721Votes.sol"; 6 | 7 | contract ERC721VotesMock is ERC721Votes { 8 | constructor(string memory name, string memory symbol) ERC721(name, symbol) EIP712(name, "1") {} 9 | 10 | function getTotalSupply() public view returns (uint256) { 11 | return _getTotalSupply(); 12 | } 13 | 14 | function mint(address account, uint256 tokenId) public { 15 | _mint(account, tokenId); 16 | } 17 | 18 | function burn(uint256 tokenId) public { 19 | _burn(tokenId); 20 | } 21 | 22 | function getChainId() external view returns (uint256) { 23 | return block.chainid; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/EtherReceiverMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | contract EtherReceiverMock { 6 | bool private _acceptEther; 7 | 8 | function setAcceptEther(bool acceptEther) public { 9 | _acceptEther = acceptEther; 10 | } 11 | 12 | receive() external payable { 13 | if (!_acceptEther) { 14 | revert(); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/GovernorCompMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../governance/extensions/GovernorCountingSimple.sol"; 6 | import "../governance/extensions/GovernorVotesComp.sol"; 7 | 8 | contract GovernorCompMock is GovernorVotesComp, GovernorCountingSimple { 9 | constructor(string memory name_, ERC20VotesComp token_) Governor(name_) GovernorVotesComp(token_) {} 10 | 11 | function quorum(uint256) public pure override returns (uint256) { 12 | return 0; 13 | } 14 | 15 | function votingDelay() public pure override returns (uint256) { 16 | return 4; 17 | } 18 | 19 | function votingPeriod() public pure override returns (uint256) { 20 | return 16; 21 | } 22 | 23 | function cancel( 24 | address[] memory targets, 25 | uint256[] memory values, 26 | bytes[] memory calldatas, 27 | bytes32 salt 28 | ) public returns (uint256 proposalId) { 29 | return _cancel(targets, values, calldatas, salt); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/GovernorVoteMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../governance/extensions/GovernorCountingSimple.sol"; 6 | import "../governance/extensions/GovernorVotes.sol"; 7 | 8 | contract GovernorVoteMocks is GovernorVotes, GovernorCountingSimple { 9 | constructor(string memory name_, IVotes token_) Governor(name_) GovernorVotes(token_) {} 10 | 11 | function quorum(uint256) public pure override returns (uint256) { 12 | return 0; 13 | } 14 | 15 | function votingDelay() public pure override returns (uint256) { 16 | return 4; 17 | } 18 | 19 | function votingPeriod() public pure override returns (uint256) { 20 | return 16; 21 | } 22 | 23 | function cancel( 24 | address[] memory targets, 25 | uint256[] memory values, 26 | bytes[] memory calldatas, 27 | bytes32 salt 28 | ) public returns (uint256 proposalId) { 29 | return _cancel(targets, values, calldatas, salt); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/MulticallTest.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "./MulticallTokenMock.sol"; 6 | 7 | contract MulticallTest { 8 | function checkReturnValues( 9 | MulticallTokenMock multicallToken, 10 | address[] calldata recipients, 11 | uint256[] calldata amounts 12 | ) external { 13 | bytes[] memory calls = new bytes[](recipients.length); 14 | for (uint256 i = 0; i < recipients.length; i++) { 15 | calls[i] = abi.encodeWithSignature("transfer(address,uint256)", recipients[i], amounts[i]); 16 | } 17 | 18 | bytes[] memory results = multicallToken.multicall(calls); 19 | for (uint256 i = 0; i < results.length; i++) { 20 | require(abi.decode(results[i], (bool))); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/MulticallTokenMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../utils/Multicall.sol"; 6 | import "./ERC20Mock.sol"; 7 | 8 | contract MulticallTokenMock is ERC20Mock, Multicall { 9 | constructor(uint256 initialBalance) ERC20Mock("MulticallToken", "BCT", msg.sender, initialBalance) {} 10 | } 11 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/Ownable2StepMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../access/Ownable2Step.sol"; 6 | 7 | contract Ownable2StepMock is Ownable2Step {} 8 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/OwnableMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../access/Ownable.sol"; 6 | 7 | contract OwnableMock is Ownable {} 8 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/PausableMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../security/Pausable.sol"; 6 | 7 | contract PausableMock is Pausable { 8 | bool public drasticMeasureTaken; 9 | uint256 public count; 10 | 11 | constructor() { 12 | drasticMeasureTaken = false; 13 | count = 0; 14 | } 15 | 16 | function normalProcess() external whenNotPaused { 17 | count++; 18 | } 19 | 20 | function drasticMeasure() external whenPaused { 21 | drasticMeasureTaken = true; 22 | } 23 | 24 | function pause() external { 25 | _pause(); 26 | } 27 | 28 | function unpause() external { 29 | _unpause(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/PullPaymentMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../security/PullPayment.sol"; 6 | 7 | // mock class using PullPayment 8 | contract PullPaymentMock is PullPayment { 9 | constructor() payable {} 10 | 11 | // test helper function to call asyncTransfer 12 | function callTransfer(address dest, uint256 amount) public { 13 | _asyncTransfer(dest, amount); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/ReentrancyAttack.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../utils/Context.sol"; 6 | 7 | contract ReentrancyAttack is Context { 8 | function callSender(bytes4 data) public { 9 | (bool success, ) = _msgSender().call(abi.encodeWithSelector(data)); 10 | require(success, "ReentrancyAttack: failed call"); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/SignatureCheckerMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../utils/cryptography/SignatureChecker.sol"; 6 | 7 | contract SignatureCheckerMock { 8 | using SignatureChecker for address; 9 | 10 | function isValidSignatureNow( 11 | address signer, 12 | bytes32 hash, 13 | bytes memory signature 14 | ) public view returns (bool) { 15 | return signer.isValidSignatureNow(hash, signature); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/SignedMathMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../utils/math/SignedMath.sol"; 6 | 7 | contract SignedMathMock { 8 | function max(int256 a, int256 b) public pure returns (int256) { 9 | return SignedMath.max(a, b); 10 | } 11 | 12 | function min(int256 a, int256 b) public pure returns (int256) { 13 | return SignedMath.min(a, b); 14 | } 15 | 16 | function average(int256 a, int256 b) public pure returns (int256) { 17 | return SignedMath.average(a, b); 18 | } 19 | 20 | function abs(int256 n) public pure returns (uint256) { 21 | return SignedMath.abs(n); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/SignedSafeMathMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../utils/math/SignedSafeMath.sol"; 6 | 7 | contract SignedSafeMathMock { 8 | function mul(int256 a, int256 b) public pure returns (int256) { 9 | return SignedSafeMath.mul(a, b); 10 | } 11 | 12 | function div(int256 a, int256 b) public pure returns (int256) { 13 | return SignedSafeMath.div(a, b); 14 | } 15 | 16 | function sub(int256 a, int256 b) public pure returns (int256) { 17 | return SignedSafeMath.sub(a, b); 18 | } 19 | 20 | function add(int256 a, int256 b) public pure returns (int256) { 21 | return SignedSafeMath.add(a, b); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/StringsMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../utils/Strings.sol"; 6 | 7 | contract StringsMock { 8 | function toString(uint256 value) public pure returns (string memory) { 9 | return Strings.toString(value); 10 | } 11 | 12 | function toHexString(uint256 value) public pure returns (string memory) { 13 | return Strings.toHexString(value); 14 | } 15 | 16 | function toHexString(uint256 value, uint256 length) public pure returns (string memory) { 17 | return Strings.toHexString(value, length); 18 | } 19 | 20 | function toHexString(address addr) public pure returns (string memory) { 21 | return Strings.toHexString(addr); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/TimersBlockNumberImpl.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../utils/Timers.sol"; 6 | 7 | contract TimersBlockNumberImpl { 8 | using Timers for Timers.BlockNumber; 9 | 10 | Timers.BlockNumber private _timer; 11 | 12 | function getDeadline() public view returns (uint64) { 13 | return _timer.getDeadline(); 14 | } 15 | 16 | function setDeadline(uint64 timestamp) public { 17 | _timer.setDeadline(timestamp); 18 | } 19 | 20 | function reset() public { 21 | _timer.reset(); 22 | } 23 | 24 | function isUnset() public view returns (bool) { 25 | return _timer.isUnset(); 26 | } 27 | 28 | function isStarted() public view returns (bool) { 29 | return _timer.isStarted(); 30 | } 31 | 32 | function isPending() public view returns (bool) { 33 | return _timer.isPending(); 34 | } 35 | 36 | function isExpired() public view returns (bool) { 37 | return _timer.isExpired(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/TimersTimestampImpl.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../utils/Timers.sol"; 6 | 7 | contract TimersTimestampImpl { 8 | using Timers for Timers.Timestamp; 9 | 10 | Timers.Timestamp private _timer; 11 | 12 | function getDeadline() public view returns (uint64) { 13 | return _timer.getDeadline(); 14 | } 15 | 16 | function setDeadline(uint64 timestamp) public { 17 | _timer.setDeadline(timestamp); 18 | } 19 | 20 | function reset() public { 21 | _timer.reset(); 22 | } 23 | 24 | function isUnset() public view returns (bool) { 25 | return _timer.isUnset(); 26 | } 27 | 28 | function isStarted() public view returns (bool) { 29 | return _timer.isStarted(); 30 | } 31 | 32 | function isPending() public view returns (bool) { 33 | return _timer.isPending(); 34 | } 35 | 36 | function isExpired() public view returns (bool) { 37 | return _timer.isExpired(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/mocks/UUPS/UUPSUpgradeableMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../CountersImpl.sol"; 6 | import "../../proxy/utils/UUPSUpgradeable.sol"; 7 | 8 | contract UUPSUpgradeableMock is CountersImpl, UUPSUpgradeable { 9 | // Not having any checks in this function is dangerous! Do not do this outside tests! 10 | function _authorizeUpgrade(address) internal override {} 11 | } 12 | 13 | contract UUPSUpgradeableUnsafeMock is UUPSUpgradeableMock { 14 | function upgradeTo(address newImplementation) external override { 15 | ERC1967Upgrade._upgradeToAndCall(newImplementation, bytes(""), false); 16 | } 17 | 18 | function upgradeToAndCall(address newImplementation, bytes memory data) external payable override { 19 | ERC1967Upgrade._upgradeToAndCall(newImplementation, data, false); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@openzeppelin/contracts", 3 | "description": "Secure Smart Contract library for Solidity", 4 | "version": "4.8.3", 5 | "files": [ 6 | "**/*.sol", 7 | "/build/contracts/*.json", 8 | "!/mocks/**/*" 9 | ], 10 | "scripts": { 11 | "prepare": "bash ../scripts/prepare-contracts-package.sh", 12 | "prepare-docs": "cd ..; npm run prepare-docs" 13 | }, 14 | "repository": { 15 | "type": "git", 16 | "url": "https://github.com/OpenZeppelin/openzeppelin-contracts.git" 17 | }, 18 | "keywords": [ 19 | "solidity", 20 | "ethereum", 21 | "smart", 22 | "contracts", 23 | "security", 24 | "zeppelin" 25 | ], 26 | "author": "OpenZeppelin Community ", 27 | "license": "MIT", 28 | "bugs": { 29 | "url": "https://github.com/OpenZeppelin/openzeppelin-contracts/issues" 30 | }, 31 | "homepage": "https://openzeppelin.com/contracts/" 32 | } 33 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/proxy/beacon/IBeacon.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | /** 7 | * @dev This is the interface that {BeaconProxy} expects of its beacon. 8 | */ 9 | interface IBeacon { 10 | /** 11 | * @dev Must return an address that can be used as a delegate call target. 12 | * 13 | * {BeaconProxy} will check that this address is a contract. 14 | */ 15 | function implementation() external view returns (address); 16 | } 17 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/security/README.adoc: -------------------------------------------------------------------------------- 1 | = Security 2 | 3 | [.readme-notice] 4 | NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/security 5 | 6 | These contracts aim to cover common security practices. 7 | 8 | * {PullPayment}: A pattern that can be used to avoid reentrancy attacks. 9 | * {ReentrancyGuard}: A modifier that can prevent reentrancy during certain functions. 10 | * {Pausable}: A common emergency response mechanism that can pause functionality while a remediation is pending. 11 | 12 | TIP: For an overview on reentrancy and the possible mechanisms to prevent it, read our article https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. 13 | 14 | == Contracts 15 | 16 | {{PullPayment}} 17 | 18 | {{ReentrancyGuard}} 19 | 20 | {{Pausable}} 21 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../IERC1155.sol"; 7 | 8 | /** 9 | * @dev Interface of the optional ERC1155MetadataExtension interface, as defined 10 | * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP]. 11 | * 12 | * _Available since v3.1._ 13 | */ 14 | interface IERC1155MetadataURI is IERC1155 { 15 | /** 16 | * @dev Returns the URI for token type `id`. 17 | * 18 | * If the `\{id\}` substring is present in the URI, it must be replaced by 19 | * clients with the actual token type ID. 20 | */ 21 | function uri(uint256 id) external view returns (string memory); 22 | } 23 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/token/ERC1155/presets/README.md: -------------------------------------------------------------------------------- 1 | Contract presets are now deprecated in favor of [Contracts Wizard](https://wizard.openzeppelin.com/) as a more powerful alternative. 2 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/token/ERC1155/utils/ERC1155Holder.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/utils/ERC1155Holder.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "./ERC1155Receiver.sol"; 7 | 8 | /** 9 | * Simple implementation of `ERC1155Receiver` that will allow a contract to hold ERC1155 tokens. 10 | * 11 | * IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be 12 | * stuck. 13 | * 14 | * @dev _Available since v3.1._ 15 | */ 16 | contract ERC1155Holder is ERC1155Receiver { 17 | function onERC1155Received( 18 | address, 19 | address, 20 | uint256, 21 | uint256, 22 | bytes memory 23 | ) public virtual override returns (bytes4) { 24 | return this.onERC1155Received.selector; 25 | } 26 | 27 | function onERC1155BatchReceived( 28 | address, 29 | address, 30 | uint256[] memory, 31 | uint256[] memory, 32 | bytes memory 33 | ) public virtual override returns (bytes4) { 34 | return this.onERC1155BatchReceived.selector; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/token/ERC1155/utils/ERC1155Receiver.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../IERC1155Receiver.sol"; 7 | import "../../../utils/introspection/ERC165.sol"; 8 | 9 | /** 10 | * @dev _Available since v3.1._ 11 | */ 12 | abstract contract ERC1155Receiver is ERC165, IERC1155Receiver { 13 | /** 14 | * @dev See {IERC165-supportsInterface}. 15 | */ 16 | function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { 17 | return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Capped.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Capped.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../ERC20.sol"; 7 | 8 | /** 9 | * @dev Extension of {ERC20} that adds a cap to the supply of tokens. 10 | */ 11 | abstract contract ERC20Capped is ERC20 { 12 | uint256 private immutable _cap; 13 | 14 | /** 15 | * @dev Sets the value of the `cap`. This value is immutable, it can only be 16 | * set once during construction. 17 | */ 18 | constructor(uint256 cap_) { 19 | require(cap_ > 0, "ERC20Capped: cap is 0"); 20 | _cap = cap_; 21 | } 22 | 23 | /** 24 | * @dev Returns the cap on the token's total supply. 25 | */ 26 | function cap() public view virtual returns (uint256) { 27 | return _cap; 28 | } 29 | 30 | /** 31 | * @dev See {ERC20-_mint}. 32 | */ 33 | function _mint(address account, uint256 amount) internal virtual override { 34 | require(ERC20.totalSupply() + amount <= cap(), "ERC20Capped: cap exceeded"); 35 | super._mint(account, amount); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../IERC20.sol"; 7 | 8 | /** 9 | * @dev Interface for the optional metadata functions from the ERC20 standard. 10 | * 11 | * _Available since v4.1._ 12 | */ 13 | interface IERC20Metadata is IERC20 { 14 | /** 15 | * @dev Returns the name of the token. 16 | */ 17 | function name() external view returns (string memory); 18 | 19 | /** 20 | * @dev Returns the symbol of the token. 21 | */ 22 | function symbol() external view returns (string memory); 23 | 24 | /** 25 | * @dev Returns the decimals places of the token. 26 | */ 27 | function decimals() external view returns (uint8); 28 | } 29 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/token/ERC20/presets/README.md: -------------------------------------------------------------------------------- 1 | Contract presets are now deprecated in favor of [Contracts Wizard](https://wizard.openzeppelin.com/) as a more powerful alternative. 2 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/token/ERC721/IERC721Receiver.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | /** 7 | * @title ERC721 token receiver interface 8 | * @dev Interface for any contract that wants to support safeTransfers 9 | * from ERC721 asset contracts. 10 | */ 11 | interface IERC721Receiver { 12 | /** 13 | * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} 14 | * by `operator` from `from`, this function is called. 15 | * 16 | * It must return its Solidity selector to confirm the token transfer. 17 | * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. 18 | * 19 | * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. 20 | */ 21 | function onERC721Received( 22 | address operator, 23 | address from, 24 | uint256 tokenId, 25 | bytes calldata data 26 | ) external returns (bytes4); 27 | } 28 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721Burnable.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Burnable.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../ERC721.sol"; 7 | import "../../../utils/Context.sol"; 8 | 9 | /** 10 | * @title ERC721 Burnable Token 11 | * @dev ERC721 Token that can be burned (destroyed). 12 | */ 13 | abstract contract ERC721Burnable is Context, ERC721 { 14 | /** 15 | * @dev Burns `tokenId`. See {ERC721-_burn}. 16 | * 17 | * Requirements: 18 | * 19 | * - The caller must own `tokenId` or be an approved operator. 20 | */ 21 | function burn(uint256 tokenId) public virtual { 22 | //solhint-disable-next-line max-line-length 23 | require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved"); 24 | _burn(tokenId); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/token/ERC721/extensions/IERC721Enumerable.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../IERC721.sol"; 7 | 8 | /** 9 | * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension 10 | * @dev See https://eips.ethereum.org/EIPS/eip-721 11 | */ 12 | interface IERC721Enumerable is IERC721 { 13 | /** 14 | * @dev Returns the total amount of tokens stored by the contract. 15 | */ 16 | function totalSupply() external view returns (uint256); 17 | 18 | /** 19 | * @dev Returns a token ID owned by `owner` at a given `index` of its token list. 20 | * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. 21 | */ 22 | function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); 23 | 24 | /** 25 | * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. 26 | * Use along with {totalSupply} to enumerate all tokens. 27 | */ 28 | function tokenByIndex(uint256 index) external view returns (uint256); 29 | } 30 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/token/ERC721/extensions/IERC721Metadata.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../IERC721.sol"; 7 | 8 | /** 9 | * @title ERC-721 Non-Fungible Token Standard, optional metadata extension 10 | * @dev See https://eips.ethereum.org/EIPS/eip-721 11 | */ 12 | interface IERC721Metadata is IERC721 { 13 | /** 14 | * @dev Returns the token collection name. 15 | */ 16 | function name() external view returns (string memory); 17 | 18 | /** 19 | * @dev Returns the token collection symbol. 20 | */ 21 | function symbol() external view returns (string memory); 22 | 23 | /** 24 | * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. 25 | */ 26 | function tokenURI(uint256 tokenId) external view returns (string memory); 27 | } 28 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/token/ERC721/extensions/draft-ERC721Votes.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/draft-ERC721Votes.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | // ERC721Votes was marked as draft due to the EIP-712 dependency. 7 | // EIP-712 is Final as of 2022-08-11. This file is deprecated. 8 | 9 | import "./ERC721Votes.sol"; 10 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/token/ERC721/presets/README.md: -------------------------------------------------------------------------------- 1 | Contract presets are now deprecated in favor of [Contracts Wizard](https://wizard.openzeppelin.com/) as a more powerful alternative. 2 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/token/ERC721/utils/ERC721Holder.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (token/ERC721/utils/ERC721Holder.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../IERC721Receiver.sol"; 7 | 8 | /** 9 | * @dev Implementation of the {IERC721Receiver} interface. 10 | * 11 | * Accepts all token transfers. 12 | * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}. 13 | */ 14 | contract ERC721Holder is IERC721Receiver { 15 | /** 16 | * @dev See {IERC721Receiver-onERC721Received}. 17 | * 18 | * Always returns `IERC721Receiver.onERC721Received.selector`. 19 | */ 20 | function onERC721Received( 21 | address, 22 | address, 23 | uint256, 24 | bytes memory 25 | ) public virtual override returns (bytes4) { 26 | return this.onERC721Received.selector; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/token/ERC777/README.adoc: -------------------------------------------------------------------------------- 1 | = ERC 777 2 | 3 | [.readme-notice] 4 | NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/token/erc777 5 | 6 | This set of interfaces and contracts are all related to the https://eips.ethereum.org/EIPS/eip-777[ERC777 token standard]. 7 | 8 | TIP: For an overview of ERC777 tokens and a walk through on how to create a token contract read our xref:ROOT:erc777.adoc[ERC777 guide]. 9 | 10 | The token behavior itself is implemented in the core contracts: {IERC777}, {ERC777}. 11 | 12 | Additionally there are interfaces used to develop contracts that react to token movements: {IERC777Sender}, {IERC777Recipient}. 13 | 14 | == Core 15 | 16 | {{IERC777}} 17 | 18 | {{ERC777}} 19 | 20 | == Hooks 21 | 22 | {{IERC777Sender}} 23 | 24 | {{IERC777Recipient}} 25 | 26 | == Presets 27 | 28 | These contracts are preconfigured combinations of features. They can be used through inheritance or as models to copy and paste their source code. 29 | 30 | {{ERC777PresetFixedSupply}} 31 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/token/ERC777/presets/ERC777PresetFixedSupply.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (token/ERC777/presets/ERC777PresetFixedSupply.sol) 3 | pragma solidity ^0.8.0; 4 | 5 | import "../ERC777.sol"; 6 | 7 | /** 8 | * @dev {ERC777} token, including: 9 | * 10 | * - Preminted initial supply 11 | * - No access control mechanism (for minting/pausing) and hence no governance 12 | * 13 | * _Available since v3.4._ 14 | */ 15 | contract ERC777PresetFixedSupply is ERC777 { 16 | /** 17 | * @dev Mints `initialSupply` amount of token and transfers them to `owner`. 18 | * 19 | * See {ERC777-constructor}. 20 | */ 21 | constructor( 22 | string memory name, 23 | string memory symbol, 24 | address[] memory defaultOperators, 25 | uint256 initialSupply, 26 | address owner 27 | ) ERC777(name, symbol, defaultOperators) { 28 | _mint(owner, initialSupply, "", ""); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/token/common/README.adoc: -------------------------------------------------------------------------------- 1 | = Common (Tokens) 2 | 3 | Functionality that is common to multiple token standards. 4 | 5 | * {ERC2981}: NFT Royalties compatible with both ERC721 and ERC1155. 6 | ** For ERC721 consider {ERC721Royalty} which clears the royalty information from storage on burn. 7 | 8 | == Contracts 9 | 10 | {{ERC2981}} 11 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/utils/Context.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | /** 7 | * @dev Provides information about the current execution context, including the 8 | * sender of the transaction and its data. While these are generally available 9 | * via msg.sender and msg.data, they should not be accessed in such a direct 10 | * manner, since when dealing with meta-transactions the account sending and 11 | * paying for execution may not be the actual sender (as far as an application 12 | * is concerned). 13 | * 14 | * This contract is only required for intermediate, library-like contracts. 15 | */ 16 | abstract contract Context { 17 | function _msgSender() internal view virtual returns (address) { 18 | return msg.sender; 19 | } 20 | 21 | function _msgData() internal view virtual returns (bytes calldata) { 22 | return msg.data; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/utils/Multicall.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.5.0) (utils/Multicall.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "./Address.sol"; 7 | 8 | /** 9 | * @dev Provides a function to batch together multiple calls in a single external call. 10 | * 11 | * _Available since v4.1._ 12 | */ 13 | abstract contract Multicall { 14 | /** 15 | * @dev Receives and executes a batch of function calls on this contract. 16 | */ 17 | function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results) { 18 | results = new bytes[](data.length); 19 | for (uint256 i = 0; i < data.length; i++) { 20 | results[i] = Address.functionDelegateCall(address(this), data[i]); 21 | } 22 | return results; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/utils/cryptography/draft-EIP712.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/draft-EIP712.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | // EIP-712 is Final as of 2022-08-11. This file is deprecated. 7 | 8 | import "./EIP712.sol"; 9 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/utils/escrow/ConditionalEscrow.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (utils/escrow/ConditionalEscrow.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "./Escrow.sol"; 7 | 8 | /** 9 | * @title ConditionalEscrow 10 | * @dev Base abstract escrow to only allow withdrawal if a condition is met. 11 | * @dev Intended usage: See {Escrow}. Same usage guidelines apply here. 12 | */ 13 | abstract contract ConditionalEscrow is Escrow { 14 | /** 15 | * @dev Returns whether an address is allowed to withdraw their funds. To be 16 | * implemented by derived contracts. 17 | * @param payee The destination address of the funds. 18 | */ 19 | function withdrawalAllowed(address payee) public view virtual returns (bool); 20 | 21 | function withdraw(address payable payee) public virtual override { 22 | require(withdrawalAllowed(payee), "ConditionalEscrow: payee is not allowed to withdraw"); 23 | super.withdraw(payee); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/utils/introspection/ERC165.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "./IERC165.sol"; 7 | 8 | /** 9 | * @dev Implementation of the {IERC165} interface. 10 | * 11 | * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check 12 | * for the additional interface id that will be supported. For example: 13 | * 14 | * ```solidity 15 | * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { 16 | * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); 17 | * } 18 | * ``` 19 | * 20 | * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. 21 | */ 22 | abstract contract ERC165 is IERC165 { 23 | /** 24 | * @dev See {IERC165-supportsInterface}. 25 | */ 26 | function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { 27 | return interfaceId == type(IERC165).interfaceId; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | /** 7 | * @dev Interface of the ERC165 standard, as defined in the 8 | * https://eips.ethereum.org/EIPS/eip-165[EIP]. 9 | * 10 | * Implementers can declare support of contract interfaces, which can then be 11 | * queried by others ({ERC165Checker}). 12 | * 13 | * For an implementation, see {ERC165}. 14 | */ 15 | interface IERC165 { 16 | /** 17 | * @dev Returns true if this contract implements the interface defined by 18 | * `interfaceId`. See the corresponding 19 | * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] 20 | * to learn more about how these ids are created. 21 | * 22 | * This function call must use less than 30 000 gas. 23 | */ 24 | function supportsInterface(bytes4 interfaceId) external view returns (bool); 25 | } 26 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/utils/introspection/IERC1820Implementer.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC1820Implementer.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | /** 7 | * @dev Interface for an ERC1820 implementer, as defined in the 8 | * https://eips.ethereum.org/EIPS/eip-1820#interface-implementation-erc1820implementerinterface[EIP]. 9 | * Used by contracts that will be registered as implementers in the 10 | * {IERC1820Registry}. 11 | */ 12 | interface IERC1820Implementer { 13 | /** 14 | * @dev Returns a special value (`ERC1820_ACCEPT_MAGIC`) if this contract 15 | * implements `interfaceHash` for `account`. 16 | * 17 | * See {IERC1820Registry-setInterfaceImplementer}. 18 | */ 19 | function canImplementInterfaceForAddress(bytes32 interfaceHash, address account) external view returns (bytes32); 20 | } 21 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/vendor/arbitrum/IDelayedMessageProvider.sol: -------------------------------------------------------------------------------- 1 | // Copyright 2021-2022, Offchain Labs, Inc. 2 | // For license information, see https://github.com/nitro/blob/master/LICENSE 3 | // SPDX-License-Identifier: BUSL-1.1 4 | // OpenZeppelin Contracts (last updated v4.8.0) (vendor/arbitrum/IDelayedMessageProvider.sol) 5 | 6 | // solhint-disable-next-line compiler-version 7 | pragma solidity >=0.6.9 <0.9.0; 8 | 9 | interface IDelayedMessageProvider { 10 | /// @dev event emitted when a inbox message is added to the Bridge's delayed accumulator 11 | event InboxMessageDelivered(uint256 indexed messageNum, bytes data); 12 | 13 | /// @dev event emitted when a inbox message is added to the Bridge's delayed accumulator 14 | /// same as InboxMessageDelivered but the batch data is available in tx.input 15 | event InboxMessageDeliveredFromOrigin(uint256 indexed messageNum); 16 | } 17 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/vendor/optimism/LICENSE: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright 2020-2021 Optimism 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/contracts/vendor/polygon/IFxMessageProcessor.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.6.0) (vendor/polygon/IFxMessageProcessor.sol) 3 | pragma solidity ^0.8.0; 4 | 5 | interface IFxMessageProcessor { 6 | function processMessageFromRoot( 7 | uint256 stateId, 8 | address rootMessageSender, 9 | bytes calldata data 10 | ) external; 11 | } 12 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/docs/antora.yml: -------------------------------------------------------------------------------- 1 | name: contracts 2 | title: Contracts 3 | version: 4.x 4 | nav: 5 | - modules/ROOT/nav.adoc 6 | - modules/api/nav.adoc 7 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/docs/config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const fs = require('fs'); 3 | 4 | /** @type import('solidity-docgen/dist/config').UserConfig */ 5 | module.exports = { 6 | outputDir: 'docs/modules/api/pages', 7 | templates: 'docs/templates', 8 | exclude: ['mocks'], 9 | pageExtension: '.adoc', 10 | pages: (_, file, config) => { 11 | // For each contract file, find the closest README.adoc and return its location as the output page path. 12 | const sourcesDir = path.resolve(config.root, config.sourcesDir); 13 | let dir = path.resolve(config.root, file.absolutePath); 14 | while (dir.startsWith(sourcesDir)) { 15 | dir = path.dirname(dir); 16 | if (fs.existsSync(path.join(dir, 'README.adoc'))) { 17 | return path.relative(sourcesDir, dir) + config.pageExtension; 18 | } 19 | } 20 | }, 21 | }; 22 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-exec.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngleProtocol/safe-multisig/967397ebb8da52d90e446ad8cf634548dc5d8814/lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-exec.png -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-vote.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngleProtocol/safe-multisig/967397ebb8da52d90e446ad8cf634548dc5d8814/lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-vote.png -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/docs/modules/ROOT/nav.adoc: -------------------------------------------------------------------------------- 1 | * xref:index.adoc[Overview] 2 | * xref:wizard.adoc[Wizard] 3 | * xref:extending-contracts.adoc[Extending Contracts] 4 | * xref:upgradeable.adoc[Using with Upgrades] 5 | 6 | * xref:releases-stability.adoc[Releases & Stability] 7 | 8 | * xref:access-control.adoc[Access Control] 9 | 10 | * xref:tokens.adoc[Tokens] 11 | ** xref:erc20.adoc[ERC20] 12 | *** xref:erc20-supply.adoc[Creating Supply] 13 | ** xref:erc721.adoc[ERC721] 14 | ** xref:erc777.adoc[ERC777] 15 | ** xref:erc1155.adoc[ERC1155] 16 | 17 | * xref:governance.adoc[Governance] 18 | 19 | * xref:crosschain.adoc[Crosschain] 20 | 21 | * xref:utilities.adoc[Utilities] 22 | 23 | * xref:subgraphs::index.adoc[Subgraphs] 24 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/docs/modules/ROOT/pages/crowdsales.adoc: -------------------------------------------------------------------------------- 1 | = Crowdsales 2 | 3 | All crowdsale-related contracts were removed from the OpenZeppelin Contracts library on the https://forum.openzeppelin.com/t/openzeppelin-contracts-v3-0-beta-release/2256[v3.0.0 release] due to both a decline in their usage and the complexity associated with migrating them to Solidity v0.6. 4 | 5 | They are however still available on the v2.5 release of OpenZeppelin Contracts, which you can install by running: 6 | 7 | ```console 8 | $ npm install @openzeppelin/contracts@v2.5 9 | ``` 10 | 11 | Refer to the https://docs.openzeppelin.com/contracts/2.x/crowdsales[v2.x documentation] when working with them. 12 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/docs/modules/ROOT/pages/drafts.adoc: -------------------------------------------------------------------------------- 1 | = Drafts 2 | 3 | All draft contracts were either moved into a different directory or removed from the OpenZeppelin Contracts library on the https://forum.openzeppelin.com/t/openzeppelin-contracts-v3-0-beta-release/2256[v3.0.0 release]. 4 | 5 | * `ERC20Migrator`: removed. 6 | * xref:api:token/ERC20.adoc#ERC20Snapshot[`ERC20Snapshot`]: moved to `token/ERC20`. 7 | * `ERC20Detailed` and `ERC1046`: removed. 8 | * `TokenVesting`: removed. Pending a replacement that is being discussed in https://github.com/OpenZeppelin/openzeppelin-contracts/issues/1214[`#1214`]. 9 | * xref:api:utils.adoc#Counters[`Counters`]: moved to xref:api:utils.adoc[`utils`]. 10 | * xref:api:utils.adoc#Strings[`Strings`]: moved to xref:api:utils.adoc[`utils`]. 11 | * xref:api:utils.adoc#SignedSafeMath[`SignedSafeMath`]: moved to xref:api:utils.adoc[`utils`]. 12 | 13 | Removed contracts are still available on the v2.5 release of OpenZeppelin Contracts, which you can install by running: 14 | 15 | ```console 16 | $ npm install @openzeppelin/contracts@v2.5 17 | ``` 18 | 19 | Refer to the xref:2.x@contracts:api:drafts.adoc[v2.x documentation] when working with them. 20 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/docs/modules/ROOT/pages/wizard.adoc: -------------------------------------------------------------------------------- 1 | = Contracts Wizard 2 | :page-notoc: 3 | 4 | Not sure where to start? Use the interactive generator below to bootstrap your 5 | contract and learn about the components offered in OpenZeppelin Contracts. 6 | 7 | TIP: Place the resulting contract in your `contracts` directory in order to compile it with a tool like Hardhat or Truffle. Consider reading our guide on xref:learn::developing-smart-contracts.adoc[Developing Smart Contracts] for more guidance! 8 | 9 | ++++ 10 | 11 | 12 | 13 | ++++ 14 | 15 | 16 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/docs/templates/page.hbs: -------------------------------------------------------------------------------- 1 | :github-icon: pass:[] 2 | {{#with-prelude}} 3 | {{readme (readme-path)}} 4 | {{/with-prelude}} 5 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/hardhat/env-contract.js: -------------------------------------------------------------------------------- 1 | extendEnvironment(env => { 2 | const { contract } = env; 3 | 4 | env.contract = function (name, body) { 5 | // remove the default account from the accounts list used in tests, in order 6 | // to protect tests against accidentally passing due to the contract 7 | // deployer being used subsequently as function caller 8 | contract(name, accounts => body(accounts.slice(1))); 9 | }; 10 | }); 11 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/hardhat/skip-foundry-tests.js: -------------------------------------------------------------------------------- 1 | const { subtask } = require('hardhat/config'); 2 | const { TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS } = require('hardhat/builtin-tasks/task-names'); 3 | 4 | subtask(TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS) 5 | .setAction(async (_, __, runSuper) => 6 | (await runSuper()).filter((path) => !path.endsWith('.t.sol')), 7 | ); 8 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/lib/forge-std/.gitignore: -------------------------------------------------------------------------------- 1 | cache/ 2 | out/ 3 | .vscode 4 | .idea 5 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/lib/forge-std/.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "lib/ds-test"] 2 | path = lib/ds-test 3 | url = https://github.com/dapphub/ds-test 4 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/lib/forge-std/foundry.toml: -------------------------------------------------------------------------------- 1 | [profile.default] 2 | fs_permissions = [{ access = "read-write", path = "./"}] 3 | 4 | [rpc_endpoints] 5 | # The RPC URLs are modified versions of the default for testing initialization. 6 | mainnet = "https://mainnet.infura.io/v3/16a8be88795540b9b3903d8de0f7baa5" # Different API key. 7 | optimism_goerli = "https://goerli.optimism.io/" # Adds a trailing slash. 8 | arbitrum_one_goerli = "https://goerli-rollup.arbitrum.io/rpc/" # Adds a trailing slash. 9 | needs_undefined_env_var = "${UNDEFINED_RPC_URL_PLACEHOLDER}" 10 | 11 | [fmt] 12 | # These are all the `forge fmt` defaults. 13 | line_length = 120 14 | tab_width = 4 15 | bracket_spacing = false 16 | int_types = 'long' 17 | multiline_func_header = 'attributes_first' 18 | quote_style = 'double' 19 | number_underscore = 'preserve' 20 | single_line_statement_blocks = 'preserve' 21 | ignore = ["src/console.sol", "src/console2.sol"] -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/.gitignore: -------------------------------------------------------------------------------- 1 | /.dapple 2 | /build 3 | /out 4 | /cache/ 5 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/Makefile: -------------------------------------------------------------------------------- 1 | all:; dapp build 2 | 3 | test: 4 | -dapp --use solc:0.4.23 build 5 | -dapp --use solc:0.4.26 build 6 | -dapp --use solc:0.5.17 build 7 | -dapp --use solc:0.6.12 build 8 | -dapp --use solc:0.7.5 build 9 | 10 | demo: 11 | DAPP_SRC=demo dapp --use solc:0.7.5 build 12 | -hevm dapp-test --verbose 3 13 | 14 | .PHONY: test demo 15 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/default.nix: -------------------------------------------------------------------------------- 1 | { solidityPackage, dappsys }: solidityPackage { 2 | name = "ds-test"; 3 | src = ./src; 4 | } 5 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ds-test", 3 | "version": "1.0.0", 4 | "description": "Assertions, equality checks and other test helpers ", 5 | "bugs": "https://github.com/dapphub/ds-test/issues", 6 | "license": "GPL-3.0", 7 | "author": "Contributors to ds-test", 8 | "files": [ 9 | "src/*" 10 | ], 11 | "repository": { 12 | "type": "git", 13 | "url": "https://github.com/dapphub/ds-test.git" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/lib/forge-std/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "forge-std", 3 | "version": "1.5.0", 4 | "description": "Forge Standard Library is a collection of helpful contracts and libraries for use with Forge and Foundry.", 5 | "homepage": "https://book.getfoundry.sh/forge/forge-std", 6 | "bugs": "https://github.com/foundry-rs/forge-std/issues", 7 | "license": "(Apache-2.0 OR MIT)", 8 | "author": "Contributors to Forge Standard Library", 9 | "files": [ 10 | "src/*" 11 | ], 12 | "repository": { 13 | "type": "git", 14 | "url": "https://github.com/foundry-rs/forge-std.git" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/lib/forge-std/src/Script.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.6.2 <0.9.0; 3 | 4 | // 💬 ABOUT 5 | // Standard Library's default Script. 6 | 7 | // 🧩 MODULES 8 | import {ScriptBase} from "./Base.sol"; 9 | import {console} from "./console.sol"; 10 | import {console2} from "./console2.sol"; 11 | import {StdChains} from "./StdChains.sol"; 12 | import {StdCheatsSafe} from "./StdCheats.sol"; 13 | import {stdJson} from "./StdJson.sol"; 14 | import {stdMath} from "./StdMath.sol"; 15 | import {StdStorage, stdStorageSafe} from "./StdStorage.sol"; 16 | import {StdUtils} from "./StdUtils.sol"; 17 | import {VmSafe} from "./Vm.sol"; 18 | 19 | // 📦 BOILERPLATE 20 | import {ScriptBase} from "./Base.sol"; 21 | 22 | // ⭐️ SCRIPT 23 | abstract contract Script is StdChains, StdCheatsSafe, StdUtils, ScriptBase { 24 | // Note: IS_SCRIPT() must return true. 25 | bool public IS_SCRIPT = true; 26 | } 27 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/lib/forge-std/src/StdError.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // Panics work for versions >=0.8.0, but we lowered the pragma to make this compatible with Test 3 | pragma solidity >=0.6.2 <0.9.0; 4 | 5 | library stdError { 6 | bytes public constant assertionError = abi.encodeWithSignature("Panic(uint256)", 0x01); 7 | bytes public constant arithmeticError = abi.encodeWithSignature("Panic(uint256)", 0x11); 8 | bytes public constant divisionError = abi.encodeWithSignature("Panic(uint256)", 0x12); 9 | bytes public constant enumConversionError = abi.encodeWithSignature("Panic(uint256)", 0x21); 10 | bytes public constant encodeStorageError = abi.encodeWithSignature("Panic(uint256)", 0x22); 11 | bytes public constant popError = abi.encodeWithSignature("Panic(uint256)", 0x31); 12 | bytes public constant indexOOBError = abi.encodeWithSignature("Panic(uint256)", 0x32); 13 | bytes public constant memOverflowError = abi.encodeWithSignature("Panic(uint256)", 0x41); 14 | bytes public constant zeroVarError = abi.encodeWithSignature("Panic(uint256)", 0x51); 15 | } 16 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/lib/forge-std/src/interfaces/IERC165.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.6.2; 3 | 4 | interface IERC165 { 5 | /// @notice Query if a contract implements an interface 6 | /// @param interfaceID The interface identifier, as specified in ERC-165 7 | /// @dev Interface identification is specified in ERC-165. This function 8 | /// uses less than 30,000 gas. 9 | /// @return `true` if the contract implements `interfaceID` and 10 | /// `interfaceID` is not 0xffffffff, `false` otherwise 11 | function supportsInterface(bytes4 interfaceID) external view returns (bool); 12 | } 13 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/lib/forge-std/test/compilation/CompilationScript.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.6.2 <0.9.0; 3 | 4 | pragma experimental ABIEncoderV2; 5 | 6 | import "../../src/Script.sol"; 7 | 8 | // The purpose of this contract is to benchmark compilation time to avoid accidentally introducing 9 | // a change that results in very long compilation times with via-ir. See https://github.com/foundry-rs/forge-std/issues/207 10 | contract CompilationScript is Script {} 11 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/lib/forge-std/test/compilation/CompilationScriptBase.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.6.2 <0.9.0; 3 | 4 | pragma experimental ABIEncoderV2; 5 | 6 | import "../../src/Script.sol"; 7 | 8 | // The purpose of this contract is to benchmark compilation time to avoid accidentally introducing 9 | // a change that results in very long compilation times with via-ir. See https://github.com/foundry-rs/forge-std/issues/207 10 | contract CompilationScriptBase is ScriptBase {} 11 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/lib/forge-std/test/compilation/CompilationTest.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.6.2 <0.9.0; 3 | 4 | pragma experimental ABIEncoderV2; 5 | 6 | import "../../src/Test.sol"; 7 | 8 | // The purpose of this contract is to benchmark compilation time to avoid accidentally introducing 9 | // a change that results in very long compilation times with via-ir. See https://github.com/foundry-rs/forge-std/issues/207 10 | contract CompilationTest is Test {} 11 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/lib/forge-std/test/compilation/CompilationTestBase.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity >=0.6.2 <0.9.0; 3 | 4 | pragma experimental ABIEncoderV2; 5 | 6 | import "../../src/Test.sol"; 7 | 8 | // The purpose of this contract is to benchmark compilation time to avoid accidentally introducing 9 | // a change that results in very long compilation times with via-ir. See https://github.com/foundry-rs/forge-std/issues/207 10 | contract CompilationTestBase is TestBase {} 11 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/netlify.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | command = "npm run docs" 3 | publish = "build/site" 4 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "github>OpenZeppelin/code-style" 4 | ], 5 | "packageRules": [ 6 | { 7 | "extends": ["packages:eslint"], 8 | "enabled": false 9 | } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/scripts/checks/generation.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | npm run generate 6 | git diff -R --exit-code 7 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/scripts/gen-nav.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const path = require('path'); 4 | const glob = require('glob'); 5 | const startCase = require('lodash.startcase'); 6 | 7 | const baseDir = process.argv[2]; 8 | 9 | const files = glob.sync(baseDir + '/**/*.adoc').map(f => path.relative(baseDir, f)); 10 | 11 | console.log('.API'); 12 | 13 | function getPageTitle (directory) { 14 | switch (directory) { 15 | case 'metatx': 16 | return 'Meta Transactions'; 17 | case 'common': 18 | return 'Common (Tokens)'; 19 | default: 20 | return startCase(directory); 21 | } 22 | } 23 | 24 | const links = files.map((file) => { 25 | const doc = file.replace(baseDir, ''); 26 | const title = path.parse(file).name; 27 | 28 | return { 29 | xref: `* xref:${doc}[${getPageTitle(title)}]`, 30 | title, 31 | }; 32 | }); 33 | 34 | // Case-insensitive sort based on titles (so 'token/ERC20' gets sorted as 'erc20') 35 | const sortedLinks = links.sort(function (a, b) { 36 | return a.title.toLowerCase().localeCompare(b.title.toLowerCase(), undefined, { numeric: true }); 37 | }); 38 | 39 | for (const link of sortedLinks) { 40 | console.log(link.xref); 41 | } 42 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/scripts/generate/format-lines.js: -------------------------------------------------------------------------------- 1 | function formatLines (...lines) { 2 | return [...indentEach(0, lines)].join('\n') + '\n'; 3 | } 4 | 5 | function *indentEach (indent, lines) { 6 | for (const line of lines) { 7 | if (Array.isArray(line)) { 8 | yield * indentEach(indent + 1, line); 9 | } else { 10 | const padding = ' '.repeat(indent); 11 | yield * line.split('\n').map(subline => subline === '' ? '' : padding + subline); 12 | } 13 | } 14 | } 15 | 16 | module.exports = formatLines; 17 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/scripts/generate/templates/conversion.js: -------------------------------------------------------------------------------- 1 | function toBytes32 (type, value) { 2 | switch (type) { 3 | case 'bytes32': 4 | return value; 5 | case 'uint256': 6 | return `bytes32(${value})`; 7 | case 'address': 8 | return `bytes32(uint256(uint160(${value})))`; 9 | default: 10 | throw new Error(`Conversion from ${type} to bytes32 not supported`); 11 | } 12 | } 13 | 14 | function fromBytes32 (type, value) { 15 | switch (type) { 16 | case 'bytes32': 17 | return value; 18 | case 'uint256': 19 | return `uint256(${value})`; 20 | case 'address': 21 | return `address(uint160(uint256(${value})))`; 22 | default: 23 | throw new Error(`Conversion from bytes32 to ${type} not supported`); 24 | } 25 | } 26 | 27 | module.exports = { 28 | toBytes32, 29 | fromBytes32, 30 | }; 31 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/scripts/git-user-config.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -euo pipefail -x 4 | 5 | git config user.name 'github-actions' 6 | git config user.email '41898282+github-actions[bot]@users.noreply.github.com' 7 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/scripts/helpers.js: -------------------------------------------------------------------------------- 1 | function chunk (array, size = 1) { 2 | return Array.range(Math.ceil(array.length / size)).map(i => array.slice(i * size, i * size + size)); 3 | } 4 | 5 | function range (start, stop = undefined, step = 1) { 6 | if (!stop) { stop = start; start = 0; } 7 | return start < stop ? Array(Math.ceil((stop - start) / step)).fill().map((_, i) => start + i * step) : []; 8 | } 9 | 10 | function unique (array, op = x => x) { 11 | return array.filter((obj, i) => array.findIndex(entry => op(obj) === op(entry)) === i); 12 | } 13 | 14 | function zip (...args) { 15 | return Array(Math.max(...args.map(arg => arg.length))).fill(null).map((_, i) => args.map(arg => arg[i])); 16 | } 17 | 18 | module.exports = { 19 | chunk, 20 | range, 21 | unique, 22 | zip, 23 | }; 24 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/scripts/prepack.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -euo pipefail 4 | shopt -s globstar 5 | 6 | # cross platform `mkdir -p` 7 | node -e 'fs.mkdirSync("build/contracts", { recursive: true })' 8 | 9 | cp artifacts/contracts/**/*.json build/contracts 10 | rm build/contracts/*.dbg.json 11 | 12 | node scripts/remove-ignored-artifacts.js 13 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/scripts/prepare-contracts-package.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # cd to the root of the repo 4 | cd "$(git rev-parse --show-toplevel)" 5 | 6 | # avoids re-compilation during publishing of both packages 7 | if [[ ! -v ALREADY_COMPILED ]]; then 8 | npm run clean 9 | npm run prepare 10 | npm run prepack 11 | fi 12 | 13 | cp README.md contracts/ 14 | mkdir contracts/build contracts/build/contracts 15 | cp -r build/contracts/*.json contracts/build/contracts 16 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/scripts/prepare-docs.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o errexit 4 | 5 | OUTDIR="$(node -p 'require("./docs/config.js").outputDir')" 6 | 7 | if [ ! -d node_modules ]; then 8 | npm ci 9 | fi 10 | 11 | rm -rf "$OUTDIR" 12 | 13 | hardhat docgen 14 | 15 | node scripts/gen-nav.js "$OUTDIR" > "$OUTDIR/../nav.adoc" 16 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/scripts/prepare.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | if [ "${SKIP_COMPILE:-}" == true ]; then 6 | exit 7 | fi 8 | 9 | npm run clean 10 | env COMPILE_MODE=production npm run compile 11 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/scripts/release/synchronize-versions.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | // Synchronizes the version in contracts/package.json with the one in package.json. 4 | // This is run automatically when npm version is run. 5 | 6 | const fs = require('fs'); 7 | const cp = require('child_process'); 8 | 9 | setVersion('contracts/package.json'); 10 | 11 | function setVersion (file) { 12 | const json = JSON.parse(fs.readFileSync(file)); 13 | json.version = process.env.npm_package_version; 14 | fs.writeFileSync(file, JSON.stringify(json, null, 2) + '\n'); 15 | cp.execFileSync('git', ['add', file]); 16 | } 17 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/scripts/release/version.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o errexit 4 | 5 | scripts/release/update-changelog-release-date.js 6 | scripts/release/synchronize-versions.js 7 | scripts/release/update-comment.js 8 | 9 | oz-docs update-version 10 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/slither.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "detectors_to_run": "reentrancy-eth,reentrancy-no-eth,reentrancy-unlimited-gas", 3 | "filter_paths": "contracts/mocks", 4 | "compile_force_framework": "hardhat" 5 | } -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/test/TESTING.md: -------------------------------------------------------------------------------- 1 | ## Testing 2 | 3 | Unit test are critical to OpenZeppelin Contracts. They help ensure code quality and mitigate against security vulnerabilities. The directory structure within the `/test` directory corresponds to the `/contracts` directory. 4 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/test/access/AccessControl.test.js: -------------------------------------------------------------------------------- 1 | const { 2 | shouldBehaveLikeAccessControl, 3 | } = require('./AccessControl.behavior.js'); 4 | 5 | const AccessControlMock = artifacts.require('AccessControlMock'); 6 | 7 | contract('AccessControl', function (accounts) { 8 | beforeEach(async function () { 9 | this.accessControl = await AccessControlMock.new({ from: accounts[0] }); 10 | }); 11 | 12 | shouldBehaveLikeAccessControl('AccessControl', ...accounts); 13 | }); 14 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/test/access/AccessControlEnumerable.test.js: -------------------------------------------------------------------------------- 1 | const { 2 | shouldBehaveLikeAccessControl, 3 | shouldBehaveLikeAccessControlEnumerable, 4 | } = require('./AccessControl.behavior.js'); 5 | 6 | const AccessControlMock = artifacts.require('AccessControlEnumerableMock'); 7 | 8 | contract('AccessControl', function (accounts) { 9 | beforeEach(async function () { 10 | this.accessControl = await AccessControlMock.new({ from: accounts[0] }); 11 | }); 12 | 13 | shouldBehaveLikeAccessControl('AccessControl', ...accounts); 14 | shouldBehaveLikeAccessControlEnumerable('AccessControl', ...accounts); 15 | }); 16 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/test/helpers/create2.js: -------------------------------------------------------------------------------- 1 | function computeCreate2Address (saltHex, bytecode, deployer) { 2 | return web3.utils.toChecksumAddress(`0x${web3.utils.sha3(`0x${[ 3 | 'ff', 4 | deployer, 5 | saltHex, 6 | web3.utils.soliditySha3(bytecode), 7 | ].map(x => x.replace(/0x/, '')).join('')}`).slice(-40)}`); 8 | } 9 | 10 | module.exports = { 11 | computeCreate2Address, 12 | }; 13 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/test/helpers/customError.js: -------------------------------------------------------------------------------- 1 | const { config } = require('hardhat'); 2 | 3 | const optimizationsEnabled = config.solidity.compilers.some(c => c.settings.optimizer.enabled); 4 | 5 | /** Revert handler that supports custom errors. */ 6 | async function expectRevertCustomError (promise, reason) { 7 | try { 8 | await promise; 9 | expect.fail('Expected promise to throw but it didn\'t'); 10 | } catch (revert) { 11 | if (reason) { 12 | if (optimizationsEnabled) { 13 | // Optimizations currently mess with Hardhat's decoding of custom errors 14 | expect(revert.message).to.include.oneOf([reason, 'unrecognized return data or custom error']); 15 | } else { 16 | expect(revert.message).to.include(reason); 17 | } 18 | } 19 | } 20 | }; 21 | 22 | module.exports = { 23 | expectRevertCustomError, 24 | }; 25 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/test/helpers/eip712.js: -------------------------------------------------------------------------------- 1 | const ethSigUtil = require('eth-sig-util'); 2 | 3 | const EIP712Domain = [ 4 | { name: 'name', type: 'string' }, 5 | { name: 'version', type: 'string' }, 6 | { name: 'chainId', type: 'uint256' }, 7 | { name: 'verifyingContract', type: 'address' }, 8 | ]; 9 | 10 | const Permit = [ 11 | { name: 'owner', type: 'address' }, 12 | { name: 'spender', type: 'address' }, 13 | { name: 'value', type: 'uint256' }, 14 | { name: 'nonce', type: 'uint256' }, 15 | { name: 'deadline', type: 'uint256' }, 16 | ]; 17 | 18 | async function domainSeparator (name, version, chainId, verifyingContract) { 19 | return '0x' + ethSigUtil.TypedDataUtils.hashStruct( 20 | 'EIP712Domain', 21 | { name, version, chainId, verifyingContract }, 22 | { EIP712Domain }, 23 | ).toString('hex'); 24 | } 25 | 26 | module.exports = { 27 | EIP712Domain, 28 | Permit, 29 | domainSeparator, 30 | }; 31 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/test/helpers/enums.js: -------------------------------------------------------------------------------- 1 | const { BN } = require('@openzeppelin/test-helpers'); 2 | 3 | function Enum (...options) { 4 | return Object.fromEntries(options.map((key, i) => [ key, new BN(i) ])); 5 | } 6 | 7 | module.exports = { 8 | Enum, 9 | ProposalState: Enum( 10 | 'Pending', 11 | 'Active', 12 | 'Canceled', 13 | 'Defeated', 14 | 'Succeeded', 15 | 'Queued', 16 | 'Expired', 17 | 'Executed', 18 | ), 19 | VoteType: Enum( 20 | 'Against', 21 | 'For', 22 | 'Abstain', 23 | ), 24 | Rounding: Enum( 25 | 'Down', 26 | 'Up', 27 | 'Zero', 28 | ), 29 | }; 30 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/test/helpers/erc1967.js: -------------------------------------------------------------------------------- 1 | const ImplementationLabel = 'eip1967.proxy.implementation'; 2 | const AdminLabel = 'eip1967.proxy.admin'; 3 | const BeaconLabel = 'eip1967.proxy.beacon'; 4 | 5 | function labelToSlot (label) { 6 | return '0x' + web3.utils.toBN(web3.utils.keccak256(label)).subn(1).toString(16); 7 | } 8 | 9 | function getSlot (address, slot) { 10 | return web3.eth.getStorageAt( 11 | web3.utils.isAddress(address) ? address : address.address, 12 | web3.utils.isHex(slot) ? slot : labelToSlot(slot), 13 | ); 14 | } 15 | 16 | module.exports = { 17 | ImplementationLabel, 18 | AdminLabel, 19 | BeaconLabel, 20 | ImplementationSlot: labelToSlot(ImplementationLabel), 21 | AdminSlot: labelToSlot(AdminLabel), 22 | BeaconSlot: labelToSlot(BeaconLabel), 23 | getSlot, 24 | }; 25 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/test/migrate-imports.test.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const { promises: fs, constants: { F_OK } } = require('fs'); 3 | const { expect } = require('chai'); 4 | 5 | const { pathUpdates, updateImportPaths, getUpgradeablePath } = require('../scripts/migrate-imports.js'); 6 | 7 | describe('migrate-imports.js', function () { 8 | it('every new path exists', async function () { 9 | for (const p of Object.values(pathUpdates)) { 10 | try { 11 | await fs.access(path.join('contracts', p), F_OK); 12 | } catch (e) { 13 | await fs.access(path.join('contracts', getUpgradeablePath(p)), F_OK); 14 | } 15 | } 16 | }); 17 | 18 | it('replaces import paths in a file', async function () { 19 | const source = ` 20 | import '@openzeppelin/contracts/math/Math.sol'; 21 | import '@openzeppelin/contracts-upgradeable/math/MathUpgradeable.sol'; 22 | `; 23 | const expected = ` 24 | import '@openzeppelin/contracts/utils/math/Math.sol'; 25 | import '@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol'; 26 | `; 27 | expect(updateImportPaths(source)).to.equal(expected); 28 | }); 29 | }); 30 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/test/proxy/ERC1967/ERC1967Proxy.test.js: -------------------------------------------------------------------------------- 1 | const shouldBehaveLikeProxy = require('../Proxy.behaviour'); 2 | 3 | const ERC1967Proxy = artifacts.require('ERC1967Proxy'); 4 | 5 | contract('ERC1967Proxy', function (accounts) { 6 | const [proxyAdminOwner] = accounts; 7 | 8 | const createProxy = async function (implementation, _admin, initData, opts) { 9 | return ERC1967Proxy.new(implementation, initData, opts); 10 | }; 11 | 12 | shouldBehaveLikeProxy(createProxy, undefined, proxyAdminOwner); 13 | }); 14 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/test/proxy/transparent/TransparentUpgradeableProxy.test.js: -------------------------------------------------------------------------------- 1 | const shouldBehaveLikeProxy = require('../Proxy.behaviour'); 2 | const shouldBehaveLikeTransparentUpgradeableProxy = require('./TransparentUpgradeableProxy.behaviour'); 3 | 4 | const TransparentUpgradeableProxy = artifacts.require('TransparentUpgradeableProxy'); 5 | const ITransparentUpgradeableProxy = artifacts.require('ITransparentUpgradeableProxy'); 6 | 7 | contract('TransparentUpgradeableProxy', function (accounts) { 8 | const [proxyAdminAddress, proxyAdminOwner] = accounts; 9 | 10 | const createProxy = async function (logic, admin, initData, opts) { 11 | const { address } = await TransparentUpgradeableProxy.new(logic, admin, initData, opts); 12 | return ITransparentUpgradeableProxy.at(address); 13 | }; 14 | 15 | shouldBehaveLikeProxy(createProxy, proxyAdminAddress, proxyAdminOwner); 16 | shouldBehaveLikeTransparentUpgradeableProxy(createProxy, accounts); 17 | }); 18 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/test/token/ERC20/extensions/ERC20Burnable.test.js: -------------------------------------------------------------------------------- 1 | const { BN } = require('@openzeppelin/test-helpers'); 2 | 3 | const { shouldBehaveLikeERC20Burnable } = require('./ERC20Burnable.behavior'); 4 | const ERC20BurnableMock = artifacts.require('ERC20BurnableMock'); 5 | 6 | contract('ERC20Burnable', function (accounts) { 7 | const [ owner, ...otherAccounts ] = accounts; 8 | 9 | const initialBalance = new BN(1000); 10 | 11 | const name = 'My Token'; 12 | const symbol = 'MTKN'; 13 | 14 | beforeEach(async function () { 15 | this.token = await ERC20BurnableMock.new(name, symbol, owner, initialBalance, { from: owner }); 16 | }); 17 | 18 | shouldBehaveLikeERC20Burnable(owner, initialBalance, otherAccounts); 19 | }); 20 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/test/token/ERC20/extensions/ERC20Capped.test.js: -------------------------------------------------------------------------------- 1 | const { BN, ether, expectRevert } = require('@openzeppelin/test-helpers'); 2 | const { shouldBehaveLikeERC20Capped } = require('./ERC20Capped.behavior'); 3 | 4 | const ERC20Capped = artifacts.require('ERC20CappedMock'); 5 | 6 | contract('ERC20Capped', function (accounts) { 7 | const [ minter, ...otherAccounts ] = accounts; 8 | 9 | const cap = ether('1000'); 10 | 11 | const name = 'My Token'; 12 | const symbol = 'MTKN'; 13 | 14 | it('requires a non-zero cap', async function () { 15 | await expectRevert( 16 | ERC20Capped.new(name, symbol, new BN(0), { from: minter }), 'ERC20Capped: cap is 0', 17 | ); 18 | }); 19 | 20 | context('once deployed', async function () { 21 | beforeEach(async function () { 22 | this.token = await ERC20Capped.new(name, symbol, cap, { from: minter }); 23 | }); 24 | 25 | shouldBehaveLikeERC20Capped(minter, otherAccounts, cap); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/test/token/ERC721/ERC721.test.js: -------------------------------------------------------------------------------- 1 | const { 2 | shouldBehaveLikeERC721, 3 | shouldBehaveLikeERC721Metadata, 4 | } = require('./ERC721.behavior'); 5 | 6 | const ERC721Mock = artifacts.require('ERC721Mock'); 7 | 8 | contract('ERC721', function (accounts) { 9 | const name = 'Non Fungible Token'; 10 | const symbol = 'NFT'; 11 | 12 | beforeEach(async function () { 13 | this.token = await ERC721Mock.new(name, symbol); 14 | }); 15 | 16 | shouldBehaveLikeERC721('ERC721', ...accounts); 17 | shouldBehaveLikeERC721Metadata('ERC721', name, symbol, ...accounts); 18 | }); 19 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/test/token/ERC721/ERC721Enumerable.test.js: -------------------------------------------------------------------------------- 1 | const { 2 | shouldBehaveLikeERC721, 3 | shouldBehaveLikeERC721Metadata, 4 | shouldBehaveLikeERC721Enumerable, 5 | } = require('./ERC721.behavior'); 6 | 7 | const ERC721Mock = artifacts.require('ERC721EnumerableMock'); 8 | 9 | contract('ERC721Enumerable', function (accounts) { 10 | const name = 'Non Fungible Token'; 11 | const symbol = 'NFT'; 12 | 13 | beforeEach(async function () { 14 | this.token = await ERC721Mock.new(name, symbol); 15 | }); 16 | 17 | shouldBehaveLikeERC721('ERC721', ...accounts); 18 | shouldBehaveLikeERC721Metadata('ERC721', name, symbol, ...accounts); 19 | shouldBehaveLikeERC721Enumerable('ERC721', ...accounts); 20 | }); 21 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/test/token/ERC721/utils/ERC721Holder.test.js: -------------------------------------------------------------------------------- 1 | const { BN } = require('@openzeppelin/test-helpers'); 2 | 3 | const { expect } = require('chai'); 4 | 5 | const ERC721Holder = artifacts.require('ERC721Holder'); 6 | const ERC721Mock = artifacts.require('ERC721Mock'); 7 | 8 | contract('ERC721Holder', function (accounts) { 9 | const [ owner ] = accounts; 10 | 11 | const name = 'Non Fungible Token'; 12 | const symbol = 'NFT'; 13 | 14 | it('receives an ERC721 token', async function () { 15 | const token = await ERC721Mock.new(name, symbol); 16 | const tokenId = new BN(1); 17 | await token.mint(owner, tokenId); 18 | 19 | const receiver = await ERC721Holder.new(); 20 | await token.safeTransferFrom(owner, receiver.address, tokenId, { from: owner }); 21 | 22 | expect(await token.ownerOf(tokenId)).to.be.equal(receiver.address); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/test/utils/Context.test.js: -------------------------------------------------------------------------------- 1 | require('@openzeppelin/test-helpers'); 2 | 3 | const ContextMock = artifacts.require('ContextMock'); 4 | const ContextMockCaller = artifacts.require('ContextMockCaller'); 5 | 6 | const { shouldBehaveLikeRegularContext } = require('./Context.behavior'); 7 | 8 | contract('Context', function (accounts) { 9 | const [ sender ] = accounts; 10 | 11 | beforeEach(async function () { 12 | this.context = await ContextMock.new(); 13 | this.caller = await ContextMockCaller.new(); 14 | }); 15 | 16 | shouldBehaveLikeRegularContext(sender); 17 | }); 18 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/test/utils/escrow/Escrow.test.js: -------------------------------------------------------------------------------- 1 | require('@openzeppelin/test-helpers'); 2 | const { shouldBehaveLikeEscrow } = require('./Escrow.behavior'); 3 | 4 | const Escrow = artifacts.require('Escrow'); 5 | 6 | contract('Escrow', function (accounts) { 7 | const [ owner, ...otherAccounts ] = accounts; 8 | 9 | beforeEach(async function () { 10 | this.escrow = await Escrow.new({ from: owner }); 11 | }); 12 | 13 | shouldBehaveLikeEscrow(owner, otherAccounts); 14 | }); 15 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/test/utils/introspection/ERC165.test.js: -------------------------------------------------------------------------------- 1 | const { shouldSupportInterfaces } = require('./SupportsInterface.behavior'); 2 | 3 | const ERC165Mock = artifacts.require('ERC165Mock'); 4 | 5 | contract('ERC165', function (accounts) { 6 | beforeEach(async function () { 7 | this.mock = await ERC165Mock.new(); 8 | }); 9 | 10 | shouldSupportInterfaces([ 11 | 'ERC165', 12 | ]); 13 | }); 14 | -------------------------------------------------------------------------------- /lib/openzeppelin-contracts/test/utils/introspection/ERC165Storage.test.js: -------------------------------------------------------------------------------- 1 | const { expectRevert } = require('@openzeppelin/test-helpers'); 2 | 3 | const { shouldSupportInterfaces } = require('./SupportsInterface.behavior'); 4 | 5 | const ERC165Mock = artifacts.require('ERC165StorageMock'); 6 | 7 | contract('ERC165Storage', function (accounts) { 8 | beforeEach(async function () { 9 | this.mock = await ERC165Mock.new(); 10 | }); 11 | 12 | it('register interface', async function () { 13 | expect(await this.mock.supportsInterface('0x00000001')).to.be.equal(false); 14 | await this.mock.registerInterface('0x00000001'); 15 | expect(await this.mock.supportsInterface('0x00000001')).to.be.equal(true); 16 | }); 17 | 18 | it('does not allow 0xffffffff', async function () { 19 | await expectRevert(this.mock.registerInterface('0xffffffff'), 'ERC165: invalid interface id'); 20 | }); 21 | 22 | shouldSupportInterfaces([ 23 | 'ERC165', 24 | ]); 25 | }); 26 | -------------------------------------------------------------------------------- /lib/safe-contracts/.env.sample: -------------------------------------------------------------------------------- 1 | MNEMONIC="" 2 | # Used for infura based network 3 | INFURA_KEY="" 4 | # Used for custom network 5 | NODE_URL="" 6 | ETHERSCAN_API_KEY="" 7 | # (Optional) Used to run ERC-4337 compatibility test. MNEMONIC is also required. 8 | ERC4337_TEST_BUNDLER_URL= 9 | ERC4337_TEST_NODE_URL= 10 | ERC4337_TEST_SINGLETON_ADDRESS= 11 | ERC4337_TEST_SAFE_FACTORY_ADDRESS= -------------------------------------------------------------------------------- /lib/safe-contracts/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | browser: true, 4 | es2021: true, 5 | node: true, 6 | }, 7 | extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"], 8 | overrides: [], 9 | parser: "@typescript-eslint/parser", 10 | parserOptions: { 11 | ecmaVersion: "latest", 12 | sourceType: "module", 13 | }, 14 | plugins: ["@typescript-eslint", "no-only-tests"], 15 | rules: { 16 | "@typescript-eslint/no-explicit-any": "warn", 17 | }, 18 | }; 19 | -------------------------------------------------------------------------------- /lib/safe-contracts/.gitattributes: -------------------------------------------------------------------------------- 1 | *.sol linguist-language=Solidity 2 | -------------------------------------------------------------------------------- /lib/safe-contracts/.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Bug report about the Safe smart contracts 4 | 5 | --- 6 | 7 | ## Prerequisites 8 | 9 | - First, many thanks for taking part in the community and helping us improve. We appreciate that a lot. 10 | - Support questions are better asked in our Discord: https://chat.safe.global 11 | - Please ensure the issue isn't already reported. 12 | 13 | *Please delete the above section and the instructions in the sections below before submitting* 14 | 15 | ## Description 16 | 17 | Please describe considely the bug you have found, and what you expect instead. 18 | 19 | ## Environment 20 | 21 | - Compiler version: 22 | - Compiler options (if applicable, e.g. optimizer enabled): 23 | - Framework/IDE (e.g. Truffle or Remix): 24 | - EVM execution environment / backend / blockchain client: 25 | - Operating system: 26 | 27 | ## Steps to reproduce 28 | 29 | If applicable, please provide a *minimal* source code example to trigger the bug you have found. 30 | Provide as much information as necessary to reproduce the bug. 31 | 32 | ## Additional context 33 | 34 | Add any other context about the problem here. 35 | -------------------------------------------------------------------------------- /lib/safe-contracts/.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea or feature request for the Safe smart contracts project 4 | 5 | --- 6 | 7 | ## Prerequisites 8 | 9 | - First, many thanks for taking part in the community and helping us improve. We appreciate that a lot. 10 | - Support questions are better asked in our Discord: https://chat.safe.global 11 | - Please ensure the issue isn't already reported. 12 | 13 | *Please delete the above section and the instructions in the sections below before submitting* 14 | 15 | ## Context / issue 16 | 17 | In case your feature request related to a problem, please add clear and concise description of what the issue is. 18 | 19 | ## Proposed solution 20 | 21 | Please add a clear and concise description of what you want to happen. 22 | 23 | ## Alternatives 24 | 25 | Please add a clear and concise description of any alternative solutions or features you've considered. 26 | 27 | ## Additional context 28 | 29 | Add any other context or screenshots about the feature request here. 30 | -------------------------------------------------------------------------------- /lib/safe-contracts/.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | node_modules/ 3 | .DS_Store 4 | .zos.session 5 | .openzeppelin/.session 6 | deployments/ 7 | env/ 8 | dist/ 9 | .env 10 | bin/ 11 | solc 12 | coverage/ 13 | coverage.json 14 | yarn-error.log 15 | typechain-types 16 | 17 | # Certora Formal Verification related files 18 | .certora_internal 19 | .certora_recent_jobs.json 20 | .zip-output-url.txt -------------------------------------------------------------------------------- /lib/safe-contracts/.husky/.gitignore: -------------------------------------------------------------------------------- 1 | _ 2 | -------------------------------------------------------------------------------- /lib/safe-contracts/.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | # Redirect output to stderr. 5 | exec 1>&2 6 | 7 | # prevent it.only or describe.only commited 8 | if [ "$allowonlytests" != "true" ] && 9 | test $(git diff --cached | grep -E "\b(it|describe).only\(" | wc -l) != 0 10 | then 11 | cat <<\EOF 12 | Error: Attempt to add it.only or describe.only - which may disable all other tests 13 | 14 | If you know what you are doing you can disable this check using: 15 | 16 | git config hooks.allowonlytests true 17 | EOF 18 | exit 1 19 | fi 20 | 21 | exit 0 22 | -------------------------------------------------------------------------------- /lib/safe-contracts/.nvmrc: -------------------------------------------------------------------------------- 1 | v18.17.1 2 | -------------------------------------------------------------------------------- /lib/safe-contracts/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "plugins": ["prettier-plugin-solidity"], 3 | "overrides": [ 4 | { 5 | "files": "*.sol", 6 | "options": { 7 | "parser": "solidity-parse", 8 | "printWidth": 140, 9 | "tabWidth": 4, 10 | "useTabs": false, 11 | "singleQuote": false, 12 | "bracketSpacing": false 13 | } 14 | } 15 | ], 16 | "tabWidth": 4, 17 | "printWidth": 140, 18 | "trailingComma": "all", 19 | "singleQuote": false, 20 | "semi": true 21 | } 22 | -------------------------------------------------------------------------------- /lib/safe-contracts/.solcover.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | skipFiles: ["test/Token.sol", "test/ERC20Token.sol", "test/TestHandler.sol", "test/ERC1155Token.sol"], 3 | mocha: { 4 | grep: "@skip-on-coverage", // Find everything with this tag 5 | invert: true, // Run the grep's inverse set. 6 | }, 7 | }; 8 | -------------------------------------------------------------------------------- /lib/safe-contracts/.solhint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "solhint:recommended", 3 | "plugins": [], 4 | "rules": { 5 | "compiler-version": "off", 6 | "func-visibility": [ 7 | "warn", 8 | { 9 | "ignoreConstructors": true 10 | } 11 | ], 12 | "not-rely-on-time": "off", 13 | "reason-string": "off", 14 | "no-empty-blocks": "off", 15 | "avoid-low-level-calls": "off", 16 | "custom-errors": "off" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /lib/safe-contracts/benchmark/Safe.Creation.spec.ts: -------------------------------------------------------------------------------- 1 | import { setupBenchmarkContracts } from "./utils/setup"; 2 | 3 | const contractSetup = setupBenchmarkContracts(undefined, true); 4 | describe("Safe", () => { 5 | it("creation", async () => { 6 | await contractSetup(); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /lib/safe-contracts/benchmark/Safe.Ether.spec.ts: -------------------------------------------------------------------------------- 1 | import { expect } from "chai"; 2 | import { ethers } from "hardhat"; 3 | import { BigNumberish } from "ethers"; 4 | import { buildSafeTransaction } from "../src/utils/execution"; 5 | import { benchmark } from "./utils/setup"; 6 | 7 | const testTarget = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"; 8 | 9 | benchmark("Ether", async () => { 10 | const [user1] = await ethers.getSigners(); 11 | return [ 12 | { 13 | name: "transfer", 14 | prepare: async (_, target: string, nonce: BigNumberish) => { 15 | // Create account, as we don't want to test this in the benchmark 16 | await user1.sendTransaction({ to: testTarget, value: 1 }); 17 | await user1.sendTransaction({ to: target, value: 1000 }); 18 | return buildSafeTransaction({ to: testTarget, value: 500, safeTxGas: 1000000, nonce }); 19 | }, 20 | after: async () => { 21 | expect(await ethers.provider.getBalance(testTarget)).to.eq(501n); 22 | }, 23 | }, 24 | ]; 25 | }); 26 | -------------------------------------------------------------------------------- /lib/safe-contracts/certora/.gitignore: -------------------------------------------------------------------------------- 1 | munged -------------------------------------------------------------------------------- /lib/safe-contracts/certora/Makefile: -------------------------------------------------------------------------------- 1 | default: help 2 | 3 | PATCH = applyHarness.patch 4 | CONTRACTS_DIR = ../contracts 5 | MUNGED_DIR = munged 6 | 7 | help: 8 | @echo "usage:" 9 | @echo " make clean: remove all generated files (those ignored by git)" 10 | @echo " make munged: create $(MUNGED_DIR) directory by applying the patch file to $(CONTRACTS_DIR)" 11 | @echo " make record: record a new patch file capturing the differences between $(CONTRACTS_DIR) and $(MUNGED_DIR)" 12 | 13 | munged: $(wildcard $(CONTRACTS_DIR)/*.sol) $(PATCH) 14 | rm -rf $@ 15 | cp -r $(CONTRACTS_DIR) $@ 16 | patch -p0 -d $@ < $(PATCH) 17 | 18 | record: 19 | diff -druN $(CONTRACTS_DIR) $(MUNGED_DIR) | sed 's+../contracts/++g' | sed 's+munged/++g' > $(PATCH) 20 | 21 | refresh: munged record 22 | 23 | clean: 24 | git clean -fdX 25 | touch $(PATCH) 26 | -------------------------------------------------------------------------------- /lib/safe-contracts/certora/scripts/verifyModules.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | params=("--send_only") 4 | 5 | if [[ -n "$CI" ]]; then 6 | params=() 7 | fi 8 | 9 | certoraRun certora/harnesses/SafeHarness.sol \ 10 | --verify SafeHarness:certora/specs/ModuleReach.spec \ 11 | --solc solc7.6 \ 12 | --optimistic_loop \ 13 | --prover_args '-smt_groundQuantifiers false' \ 14 | --loop_iter 3 \ 15 | --optimistic_hashing \ 16 | --hashing_length_bound 352 \ 17 | "${params[@]}" \ 18 | --msg "Safe $1 " -------------------------------------------------------------------------------- /lib/safe-contracts/certora/scripts/verifyOwners.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | params=("--send_only") 4 | 5 | if [[ -n "$CI" ]]; then 6 | params=() 7 | fi 8 | 9 | certoraRun certora/harnesses/SafeHarness.sol \ 10 | --verify SafeHarness:certora/specs/OwnerReach.spec \ 11 | --solc solc7.6 \ 12 | --optimistic_loop \ 13 | --prover_args '-smt_groundQuantifiers false -mediumTimeout 2000' \ 14 | --loop_iter 3 \ 15 | --optimistic_hashing \ 16 | --hashing_length_bound 352 \ 17 | "${params[@]}" \ 18 | --msg "Safe $1 " -------------------------------------------------------------------------------- /lib/safe-contracts/certora/scripts/verifySafe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | params=("--send_only") 4 | 5 | if [[ -n "$CI" ]]; then 6 | params=() 7 | fi 8 | 9 | certoraRun certora/harnesses/SafeHarness.sol \ 10 | --verify SafeHarness:certora/specs/Safe.spec \ 11 | --solc solc7.6 \ 12 | --optimistic_loop \ 13 | --prover_args '-optimisticFallback true -s z3' \ 14 | --loop_iter 3 \ 15 | --optimistic_hashing \ 16 | --hashing_length_bound 352 \ 17 | --rule_sanity \ 18 | "${params[@]}" \ 19 | --msg "Safe $1 " -------------------------------------------------------------------------------- /lib/safe-contracts/contracts/common/Enum.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: LGPL-3.0-only 2 | pragma solidity >=0.7.0 <0.9.0; 3 | 4 | /** 5 | * @title Enum - Collection of enums used in Safe contracts. 6 | * @author Richard Meissner - @rmeissner 7 | */ 8 | abstract contract Enum { 9 | enum Operation { 10 | Call, 11 | DelegateCall 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /lib/safe-contracts/contracts/common/NativeCurrencyPaymentFallback.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: LGPL-3.0-only 2 | pragma solidity >=0.7.0 <0.9.0; 3 | 4 | /** 5 | * @title NativeCurrencyPaymentFallback - A contract that has a fallback to accept native currency payments. 6 | * @author Richard Meissner - @rmeissner 7 | */ 8 | abstract contract NativeCurrencyPaymentFallback { 9 | event SafeReceived(address indexed sender, uint256 value); 10 | 11 | /** 12 | * @notice Receive function accepts native currency transactions. 13 | * @dev Emits an event with sender and received value. 14 | */ 15 | receive() external payable { 16 | emit SafeReceived(msg.sender, msg.value); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /lib/safe-contracts/contracts/common/SelfAuthorized.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: LGPL-3.0-only 2 | pragma solidity >=0.7.0 <0.9.0; 3 | 4 | /** 5 | * @title SelfAuthorized - Authorizes current contract to perform actions to itself. 6 | * @author Richard Meissner - @rmeissner 7 | */ 8 | abstract contract SelfAuthorized { 9 | function requireSelfCall() private view { 10 | require(msg.sender == address(this), "GS031"); 11 | } 12 | 13 | modifier authorized() { 14 | // Modifiers are copied around during compilation. This is a function call as it minimized the bytecode size 15 | requireSelfCall(); 16 | _; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /lib/safe-contracts/contracts/common/Singleton.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: LGPL-3.0-only 2 | pragma solidity >=0.7.0 <0.9.0; 3 | 4 | /** 5 | * @title Singleton - Base for singleton contracts (should always be the first super contract) 6 | * This contract is tightly coupled to our proxy contract (see `proxies/SafeProxy.sol`) 7 | * @author Richard Meissner - @rmeissner 8 | */ 9 | abstract contract Singleton { 10 | // singleton always has to be the first declared variable to ensure the same location as in the Proxy contract. 11 | // It should also always be ensured the address is stored alone (uses a full word) 12 | address private singleton; 13 | } 14 | -------------------------------------------------------------------------------- /lib/safe-contracts/contracts/interfaces/IERC165.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: LGPL-3.0-only 2 | pragma solidity >=0.7.0 <0.9.0; 3 | 4 | /// @notice More details at https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/introspection/IERC165.sol 5 | interface IERC165 { 6 | /** 7 | * @dev Returns true if this contract implements the interface defined by `interfaceId`. 8 | * See the corresponding EIP section 9 | * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified 10 | * to learn more about how these ids are created. 11 | * 12 | * This function call must use less than 30 000 gas. 13 | */ 14 | function supportsInterface(bytes4 interfaceId) external view returns (bool); 15 | } 16 | -------------------------------------------------------------------------------- /lib/safe-contracts/contracts/interfaces/ISignatureValidator.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: LGPL-3.0-only 2 | /* solhint-disable one-contract-per-file */ 3 | pragma solidity >=0.7.0 <0.9.0; 4 | 5 | contract ISignatureValidatorConstants { 6 | // bytes4(keccak256("isValidSignature(bytes32,bytes)") 7 | bytes4 internal constant EIP1271_MAGIC_VALUE = 0x1626ba7e; 8 | } 9 | 10 | abstract contract ISignatureValidator is ISignatureValidatorConstants { 11 | /** 12 | * @notice EIP1271 method to validate a signature. 13 | * @param _hash Hash of the data signed on the behalf of address(this). 14 | * @param _signature Signature byte array associated with _data. 15 | * 16 | * MUST return the bytes4 magic value 0x1626ba7e when function passes. 17 | * MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5) 18 | * MUST allow external calls 19 | */ 20 | function isValidSignature(bytes32 _hash, bytes memory _signature) external view virtual returns (bytes4); 21 | } 22 | -------------------------------------------------------------------------------- /lib/safe-contracts/contracts/interfaces/ViewStorageAccessible.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.5.0 <0.9.0; 2 | 3 | /// @title ViewStorageAccessible - Interface on top of StorageAccessible base class to allow simulations from view functions. 4 | /// @notice Adjusted version of https://github.com/gnosis/util-contracts/blob/3db1e531cb243a48ea91c60a800d537c1000612a/contracts/StorageAccessible.sol 5 | interface ViewStorageAccessible { 6 | /** 7 | * @dev Same as `simulate` on StorageAccessible. Marked as view so that it can be called from external contracts 8 | * that want to run simulations from within view functions. Will revert if the invoked simulation attempts to change state. 9 | */ 10 | function simulate(address targetContract, bytes calldata calldataPayload) external view returns (bytes memory); 11 | } 12 | -------------------------------------------------------------------------------- /lib/safe-contracts/contracts/libraries/SafeStorage.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: LGPL-3.0-only 2 | pragma solidity >=0.7.0 <0.9.0; 3 | 4 | /** 5 | * @title SafeStorage - Storage layout of the Safe contracts to be used in libraries. 6 | * @dev Should be always the first base contract of a library that is used with a Safe. 7 | * @author Richard Meissner - @rmeissner 8 | */ 9 | contract SafeStorage { 10 | // From /common/Singleton.sol 11 | address internal singleton; 12 | // From /common/ModuleManager.sol 13 | mapping(address => address) internal modules; 14 | // From /common/OwnerManager.sol 15 | mapping(address => address) internal owners; 16 | uint256 internal ownerCount; 17 | uint256 internal threshold; 18 | 19 | // From /Safe.sol 20 | uint256 internal nonce; 21 | bytes32 internal _deprecatedDomainSeparator; 22 | mapping(bytes32 => uint256) internal signedMessages; 23 | mapping(address => mapping(bytes32 => uint256)) internal approvedHashes; 24 | } 25 | -------------------------------------------------------------------------------- /lib/safe-contracts/contracts/proxies/IProxyCreationCallback.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: LGPL-3.0-only 2 | pragma solidity >=0.7.0 <0.9.0; 3 | import {SafeProxy} from "./SafeProxy.sol"; 4 | 5 | /** 6 | * @title IProxyCreationCallback 7 | * @dev An interface for a contract that implements a callback function to be executed after the creation of a proxy instance. 8 | */ 9 | interface IProxyCreationCallback { 10 | /** 11 | * @dev Function to be called after the creation of a SafeProxy instance. 12 | * @param proxy The newly created SafeProxy instance. 13 | * @param _singleton The address of the singleton contract used to create the proxy. 14 | * @param initializer The initializer function call data. 15 | * @param saltNonce The nonce used to generate the salt for the proxy deployment. 16 | */ 17 | function proxyCreated(SafeProxy proxy, address _singleton, bytes calldata initializer, uint256 saltNonce) external; 18 | } 19 | -------------------------------------------------------------------------------- /lib/safe-contracts/contracts/test/DelegateCaller.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: LGPL-3.0-only 2 | pragma solidity >=0.7.0 <0.9.0; 3 | 4 | /** 5 | * @title DelegateCaller - A test contract that executes delegatecalls 6 | */ 7 | contract DelegateCaller { 8 | /** 9 | * @notice makes a delegatecall 10 | * @param _called The address to be delegate called 11 | * @param _calldata the calldata of the call 12 | */ 13 | function makeDelegatecall(address _called, bytes memory _calldata) external returns (bool success, bytes memory returnData) { 14 | (success, returnData) = _called.delegatecall(_calldata); 15 | if (!success) { 16 | // solhint-disable-next-line no-inline-assembly 17 | assembly { 18 | let length := returndatasize() 19 | returndatacopy(0, 0, length) 20 | revert(0, length) 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /lib/safe-contracts/contracts/test/ERC20Token.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: LGPL-3.0-only 2 | pragma solidity >=0.6.0 <0.8.0; 3 | 4 | import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; 5 | 6 | /** 7 | * @title ERC20Token 8 | * @dev This contract is an ERC20 token contract that extends the OpenZeppelin ERC20 contract. 9 | */ 10 | contract ERC20Token is ERC20 { 11 | /** 12 | * @dev Constructor that sets the name and symbol of the token and mints an initial supply to the contract deployer. 13 | */ 14 | constructor() public ERC20("TestToken", "TT") { 15 | _mint(msg.sender, 1000000000000000); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /lib/safe-contracts/contracts/test/TestHandler.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: LGPL-3.0-only 2 | pragma solidity >=0.7.0 <0.9.0; 3 | 4 | import {HandlerContext} from "../handler/HandlerContext.sol"; 5 | 6 | /** 7 | * @title TestHandler - A test FallbackHandler contract 8 | */ 9 | contract TestHandler is HandlerContext { 10 | /** 11 | * @notice Returns the sender and manager address provided by the HandlerContext 12 | * @return sender The sender address 13 | * @return manager The manager address 14 | */ 15 | function dudududu() external view returns (address sender, address manager) { 16 | return (_msgSender(), _manager()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /lib/safe-contracts/contracts/test/TestImports.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: LGPL-3.0-only 2 | 3 | pragma solidity >=0.7.0 <0.9.0; 4 | 5 | // Import the contract so hardhat compiles it, and we have the ABI available 6 | // solhint-disable-next-line no-unused-import 7 | import {MockContract} from "@safe-global/mock-contract/contracts/MockContract.sol"; 8 | -------------------------------------------------------------------------------- /lib/safe-contracts/contracts/test/TestNativeTokenReceiver.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: LGPL-3.0-only 2 | pragma solidity >=0.7.0 <0.9.0; 3 | 4 | /// @title TestNativeTokenReceiver 5 | /// @dev This contract emits an event with sender, value, and remaining gas details whenever it receives Ether. 6 | contract TestNativeTokenReceiver { 7 | /// @dev Emitted when the contract receives Ether. 8 | /// @param from The address of the sender. 9 | /// @param amount The amount of Ether received, in wei. 10 | /// @param forwardedGas The remaining gas at the time of transaction. 11 | event BreadReceived(address indexed from, uint256 amount, uint256 forwardedGas); 12 | 13 | /// @dev Fallback function that is called when the contract receives Ether. 14 | /// Emits the BreadReceived event with the sender's address, the amount of Ether sent, and the remaining gas. 15 | fallback() external payable { 16 | emit BreadReceived(msg.sender, msg.value, gasleft()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /lib/safe-contracts/contracts/test/Token.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: LGPL-3.0-only 2 | pragma solidity >=0.6.0 <0.7.0; 3 | 4 | interface Token { 5 | function transfer(address _to, uint256 value) external returns (bool); 6 | } 7 | -------------------------------------------------------------------------------- /lib/safe-contracts/docs/Gnosis_Safe_Audit_Report.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngleProtocol/safe-multisig/967397ebb8da52d90e446ad8cf634548dc5d8814/lib/safe-contracts/docs/Gnosis_Safe_Audit_Report.pdf -------------------------------------------------------------------------------- /lib/safe-contracts/docs/Gnosis_Safe_Audit_Report_1_1_0.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngleProtocol/safe-multisig/967397ebb8da52d90e446ad8cf634548dc5d8814/lib/safe-contracts/docs/Gnosis_Safe_Audit_Report_1_1_0.pdf -------------------------------------------------------------------------------- /lib/safe-contracts/docs/Gnosis_Safe_Audit_Report_1_1_1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngleProtocol/safe-multisig/967397ebb8da52d90e446ad8cf634548dc5d8814/lib/safe-contracts/docs/Gnosis_Safe_Audit_Report_1_1_1.pdf -------------------------------------------------------------------------------- /lib/safe-contracts/docs/Gnosis_Safe_Audit_Report_1_2_0.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngleProtocol/safe-multisig/967397ebb8da52d90e446ad8cf634548dc5d8814/lib/safe-contracts/docs/Gnosis_Safe_Audit_Report_1_2_0.pdf -------------------------------------------------------------------------------- /lib/safe-contracts/docs/Gnosis_Safe_Audit_Report_1_3_0_Final.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngleProtocol/safe-multisig/967397ebb8da52d90e446ad8cf634548dc5d8814/lib/safe-contracts/docs/Gnosis_Safe_Audit_Report_1_3_0_Final.pdf -------------------------------------------------------------------------------- /lib/safe-contracts/docs/Gnosis_Safe_Audit_Report_1_3_0_Initial.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngleProtocol/safe-multisig/967397ebb8da52d90e446ad8cf634548dc5d8814/lib/safe-contracts/docs/Gnosis_Safe_Audit_Report_1_3_0_Initial.pdf -------------------------------------------------------------------------------- /lib/safe-contracts/docs/Gnosis_Safe_Formal_Verification_Report_1_0_0.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngleProtocol/safe-multisig/967397ebb8da52d90e446ad8cf634548dc5d8814/lib/safe-contracts/docs/Gnosis_Safe_Formal_Verification_Report_1_0_0.pdf -------------------------------------------------------------------------------- /lib/safe-contracts/docs/Gnosis_Safe_Symbolic_Execution.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngleProtocol/safe-multisig/967397ebb8da52d90e446ad8cf634548dc5d8814/lib/safe-contracts/docs/Gnosis_Safe_Symbolic_Execution.pdf -------------------------------------------------------------------------------- /lib/safe-contracts/docs/Safe_Audit_Report_1_4_0.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AngleProtocol/safe-multisig/967397ebb8da52d90e446ad8cf634548dc5d8814/lib/safe-contracts/docs/Safe_Audit_Report_1_4_0.pdf -------------------------------------------------------------------------------- /lib/safe-contracts/docs/alexey_audit.md: -------------------------------------------------------------------------------- 1 | ### Audit Results 2 | 3 | ##### Auditor 4 | * Alexey Akhunov () 5 | 6 | ##### Notes 7 | The audit report was based on commit [942968d66a4fa200fe9757d02b377dbfc3c88636](https://github.com/safe-global/safe-contracts/commit/942968d66a4fa200fe9757d02b377dbfc3c88636) 8 | 9 | Changes made until commit [898cc8969736bc190db1b7c446e050f49177f898](https://github.com/safe-global/safe-contracts/commit/898cc8969736bc190db1b7c446e050f49177f898) have been checked with symbolic execution and can be found in the attached pdf (see table `SecuredTokenTransfer::transferToken`). 10 | 11 | ##### Files 12 | * [Audit Report](Gnosis_Safe_Audit_Report.pdf) 13 | * [Symbolic execution](Gnosis_Safe_Symbolic_Execution.pdf) 14 | -------------------------------------------------------------------------------- /lib/safe-contracts/docs/audit_1_1_1.md: -------------------------------------------------------------------------------- 1 | ### Audit Results 2 | 3 | ##### Auditor 4 | * G0 Group (https://github.com/g0-group) 5 | * Adam Kolář (@adamkolar) 6 | * Nick Munoz-McDonald (@NickErrant) 7 | 8 | ##### Notes 9 | All changes for 1.1.1 until commit [2df0b2e0ad5d0f7ab5423e7f5baa72b2456d32ae](https://github.com/safe-global/safe-contracts/commit/2df0b2e0ad5d0f7ab5423e7f5baa72b2456d32ae) have been audited and the result were added to an ammended report. 10 | 11 | All changes for 1.1.0 until commit [78494bcdbc61b3db52308a25f0556c42cf656ab1](https://github.com/safe-global/safe-contracts/commit/78494bcdbc61b3db52308a25f0556c42cf656ab1) have been audited and are considered in the audit report. 12 | 13 | The audit was initially performed on commit [1a9e5ce768e134c556770ea50e114fd83666b8a8](https://github.com/safe-global/safe-contracts/commit/1a9e5ce768e134c556770ea50e114fd83666b8a8) 14 | 15 | ##### Links 16 | * [Audit Report 1.1.1](https://github.com/g0-group/Audits/blob/master/G0Group-GnosisSafe-Ammended.pdf) 17 | 18 | ##### Files 19 | * [Audit Report 1.1.1](Gnosis_Safe_Audit_Report_1_1_1.pdf) 20 | * [Audit Report 1.1.0](Gnosis_Safe_Audit_Report_1_1_0.pdf) 21 | -------------------------------------------------------------------------------- /lib/safe-contracts/docs/audit_1_2_0.md: -------------------------------------------------------------------------------- 1 | ### Audit Results 2 | 3 | ##### Auditor 4 | * G0 Group (https://github.com/g0-group) 5 | * Adam Kolář (@adamkolar) 6 | * Nick Munoz-McDonald (@NickErrant) 7 | 8 | ##### Notes 9 | The audit was performed on commit [62d4bd39925db65083b035115d6987772b2d2dca](https://github.com/safe-global/safe-contracts/commit/62d4bd39925db65083b035115d6987772b2d2dca) 10 | 11 | ##### Files 12 | * [Audit Report 1.2.0](Gnosis_Safe_Audit_Report_1_2_0.pdf) 13 | -------------------------------------------------------------------------------- /lib/safe-contracts/docs/audit_1_4_0.md: -------------------------------------------------------------------------------- 1 | ### Audit Results 2 | 3 | ##### Auditor 4 | 5 | - Ackee Blockchain (https://ackeeblockchain.com/) 6 | 7 | ##### Notes 8 | 9 | The final audit was performed on commit [eb93dbb0f62e2dc1b308ac4c110038062df0a8c9](https://github.com/safe-global/safe-contracts/tree/eb93dbb0f62e2dc1b308ac4c110038062df0a8c9). 10 | 11 | There has been one minor bugfix after the audit related to ERC-4337 opcode compatibility: 12 | 13 | - [Pull request](https://github.com/safe-global/safe-contracts/pull/572) 14 | - [Commit](https://github.com/safe-global/safe-contracts/commit/f8bd2159b64392d5b594f4e056be258ade2fefab) 15 | 16 | A change of similar scope has been successfully audited in the 1.4.0 release. Therefore, after notifying the auditors, we concluded no re-audit was necessary. 17 | 18 | ##### Files 19 | 20 | - [Final Audit Report 1.4.0](Safe_Audit_Report_1_4_0.pdf) 21 | 22 | ##### External links for Audit Reports 23 | 24 | - Ackee Blockchain is working on a hosted repository for the audit reports. We will provide the link here as soon as it is available. 25 | -------------------------------------------------------------------------------- /lib/safe-contracts/docs/guidelines.md: -------------------------------------------------------------------------------- 1 | ## Coding Guidelines 2 | 3 | ### Declaration of variables 4 | 5 | New variables will use a hash based storage approach to avoid conflicts in the storage layout of the proxy contract when updating the master copy. 6 | 7 | For this a variable identifier should be defined (e.g. `fallback_manager.handler.address` for the handler address in the fallback manager contract) and hash this identifier to generate the storage location from where the data should be loaded. 8 | 9 | The data can be stored to this location with 10 | 11 | ``` 12 | bytes32 slot = VARIABLE_SLOT; 13 | // solhint-disable-next-line no-inline-assembly 14 | assembly { 15 | sstore(slot, value) 16 | } 17 | ``` 18 | 19 | and read with 20 | 21 | ``` 22 | bytes32 slot = VARIABLE_SLOT; 23 | // solhint-disable-next-line no-inline-assembly 24 | assembly { 25 | value := sload(slot) 26 | } 27 | ``` 28 | 29 | Note: Make sure to use a unique identifier else unexpected behaviour will occur 30 | 31 | ### Code comments 32 | 33 | Use `/** */` for multiline comments and `//` for single-line comments. 34 | 35 | The comment should start with a capital letter and end with a dot. 36 | -------------------------------------------------------------------------------- /lib/safe-contracts/docs/rv_1_0_0.md: -------------------------------------------------------------------------------- 1 | ### Formal Verification Results 2 | 3 | ##### Auditor 4 | * Runtime Verification (https://github.com/runtimeverification) 5 | 6 | ##### Notes 7 | The formal verification was based on commit [427d6f7e779431333c54bcb4d4cde31e4d57ce96](https://github.com/safe-global/safe-contracts/commit/427d6f7e779431333c54bcb4d4cde31e4d57ce96) 8 | 9 | Critical findings have been fixed with https://github.com/safe-global/safe-contracts/pull/90 10 | 11 | ##### Files 12 | * [Formal Verification Report](Gnosis_Safe_Formal_Verification_Report_1_0_0.pdf) 13 | -------------------------------------------------------------------------------- /lib/safe-contracts/src/deploy/deploy_accessors.ts: -------------------------------------------------------------------------------- 1 | import { DeployFunction } from "hardhat-deploy/types"; 2 | import { HardhatRuntimeEnvironment } from "hardhat/types"; 3 | 4 | const deploy: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { 5 | const { deployments, getNamedAccounts } = hre; 6 | const { deployer } = await getNamedAccounts(); 7 | const { deploy } = deployments; 8 | 9 | await deploy("SimulateTxAccessor", { 10 | from: deployer, 11 | args: [], 12 | log: true, 13 | deterministicDeployment: true, 14 | }); 15 | }; 16 | 17 | deploy.tags = ["accessors", "l2-suite", "main-suite"]; 18 | export default deploy; 19 | -------------------------------------------------------------------------------- /lib/safe-contracts/src/deploy/deploy_factories.ts: -------------------------------------------------------------------------------- 1 | import { DeployFunction } from "hardhat-deploy/types"; 2 | import { HardhatRuntimeEnvironment } from "hardhat/types"; 3 | 4 | const deploy: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { 5 | const { deployments, getNamedAccounts } = hre; 6 | const { deployer } = await getNamedAccounts(); 7 | const { deploy } = deployments; 8 | 9 | await deploy("SafeProxyFactory", { 10 | from: deployer, 11 | args: [], 12 | log: true, 13 | deterministicDeployment: true, 14 | }); 15 | }; 16 | 17 | deploy.tags = ["factory", "l2-suite", "main-suite"]; 18 | export default deploy; 19 | -------------------------------------------------------------------------------- /lib/safe-contracts/src/deploy/deploy_handlers.ts: -------------------------------------------------------------------------------- 1 | import { DeployFunction } from "hardhat-deploy/types"; 2 | import { HardhatRuntimeEnvironment } from "hardhat/types"; 3 | 4 | const deploy: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { 5 | const { deployments, getNamedAccounts } = hre; 6 | const { deployer } = await getNamedAccounts(); 7 | const { deploy } = deployments; 8 | 9 | await deploy("TokenCallbackHandler", { 10 | from: deployer, 11 | args: [], 12 | log: true, 13 | deterministicDeployment: true, 14 | }); 15 | 16 | await deploy("CompatibilityFallbackHandler", { 17 | from: deployer, 18 | args: [], 19 | log: true, 20 | deterministicDeployment: true, 21 | }); 22 | }; 23 | 24 | deploy.tags = ["handlers", "l2-suite", "main-suite"]; 25 | export default deploy; 26 | -------------------------------------------------------------------------------- /lib/safe-contracts/src/deploy/deploy_libraries.ts: -------------------------------------------------------------------------------- 1 | import { DeployFunction } from "hardhat-deploy/types"; 2 | import { HardhatRuntimeEnvironment } from "hardhat/types"; 3 | 4 | const deploy: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { 5 | const { deployments, getNamedAccounts } = hre; 6 | const { deployer } = await getNamedAccounts(); 7 | const { deploy } = deployments; 8 | 9 | await deploy("CreateCall", { 10 | from: deployer, 11 | args: [], 12 | log: true, 13 | deterministicDeployment: true, 14 | }); 15 | 16 | await deploy("MultiSend", { 17 | from: deployer, 18 | args: [], 19 | log: true, 20 | deterministicDeployment: true, 21 | }); 22 | 23 | await deploy("MultiSendCallOnly", { 24 | from: deployer, 25 | args: [], 26 | log: true, 27 | deterministicDeployment: true, 28 | }); 29 | 30 | await deploy("SignMessageLib", { 31 | from: deployer, 32 | args: [], 33 | log: true, 34 | deterministicDeployment: true, 35 | }); 36 | }; 37 | 38 | deploy.tags = ["libraries", "l2-suite", "main-suite"]; 39 | export default deploy; 40 | -------------------------------------------------------------------------------- /lib/safe-contracts/src/deploy/deploy_safe_l2.ts: -------------------------------------------------------------------------------- 1 | import { DeployFunction } from "hardhat-deploy/types"; 2 | import { HardhatRuntimeEnvironment } from "hardhat/types"; 3 | 4 | const deploy: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { 5 | const { deployments, getNamedAccounts } = hre; 6 | const { deployer } = await getNamedAccounts(); 7 | const { deploy } = deployments; 8 | 9 | await deploy("SafeL2", { 10 | from: deployer, 11 | args: [], 12 | log: true, 13 | deterministicDeployment: true, 14 | }); 15 | }; 16 | 17 | deploy.tags = ["l2", "l2-suite"]; 18 | export default deploy; 19 | -------------------------------------------------------------------------------- /lib/safe-contracts/src/deploy/deploy_safe_singleton.ts: -------------------------------------------------------------------------------- 1 | import { DeployFunction } from "hardhat-deploy/types"; 2 | import { HardhatRuntimeEnvironment } from "hardhat/types"; 3 | 4 | const deploy: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { 5 | const { deployments, getNamedAccounts } = hre; 6 | const { deployer } = await getNamedAccounts(); 7 | const { deploy } = deployments; 8 | 9 | await deploy("Safe", { 10 | from: deployer, 11 | args: [], 12 | log: true, 13 | deterministicDeployment: true, 14 | }); 15 | }; 16 | 17 | deploy.tags = ["singleton", "main-suite"]; 18 | export default deploy; 19 | -------------------------------------------------------------------------------- /lib/safe-contracts/src/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./utils/proxies"; 2 | export * from "./utils/constants"; 3 | export * from "./utils/execution"; 4 | export * from "./utils/multisend"; 5 | -------------------------------------------------------------------------------- /lib/safe-contracts/src/tasks/deploy_contracts.ts: -------------------------------------------------------------------------------- 1 | import { task } from "hardhat/config"; 2 | 3 | task("deploy-contracts", "Deploys and verifies Safe contracts").setAction(async (_, hre) => { 4 | await hre.run("deploy"); 5 | await hre.run("local-verify"); 6 | await hre.run("sourcify"); 7 | await hre.run("etherscan-verify", { forceLicense: true, license: "LGPL-3.0" }); 8 | }); 9 | 10 | export {}; 11 | -------------------------------------------------------------------------------- /lib/safe-contracts/src/utils/constants.ts: -------------------------------------------------------------------------------- 1 | export const AddressOne = "0x0000000000000000000000000000000000000001"; 2 | -------------------------------------------------------------------------------- /lib/safe-contracts/src/utils/multisend.ts: -------------------------------------------------------------------------------- 1 | import { ethers, BigNumberish } from "ethers"; 2 | import { buildContractCall, MetaTransaction, SafeTransaction } from "./execution"; 3 | import { MultiSend } from "../../typechain-types"; 4 | 5 | const encodeMetaTransaction = (tx: MetaTransaction): string => { 6 | const data = ethers.getBytes(tx.data); 7 | const encoded = ethers.solidityPacked( 8 | ["uint8", "address", "uint256", "uint256", "bytes"], 9 | [tx.operation, tx.to, tx.value, data.length, data], 10 | ); 11 | return encoded.slice(2); 12 | }; 13 | 14 | export const encodeMultiSend = (txs: MetaTransaction[]): string => { 15 | return "0x" + txs.map((tx) => encodeMetaTransaction(tx)).join(""); 16 | }; 17 | 18 | export const buildMultiSendSafeTx = async ( 19 | multiSend: MultiSend, 20 | txs: MetaTransaction[], 21 | nonce: BigNumberish, 22 | overrides?: Partial, 23 | ): Promise => { 24 | return buildContractCall(multiSend, "multiSend", [encodeMultiSend(txs)], nonce, true, overrides); 25 | }; 26 | -------------------------------------------------------------------------------- /lib/safe-contracts/src/utils/solc.ts: -------------------------------------------------------------------------------- 1 | import solc from "solc"; 2 | 3 | const solcCache: Record = {}; 4 | 5 | export const loadSolc = async (version: string): Promise => { 6 | return await new Promise((resolve, reject) => { 7 | if (solcCache[version] !== undefined) resolve(solcCache[version]); 8 | else 9 | solc.loadRemoteVersion(`v${version}`, (error: any, soljson: any) => { 10 | solcCache[version] = soljson; 11 | return error ? reject(error) : resolve(soljson); 12 | }); 13 | }); 14 | }; 15 | -------------------------------------------------------------------------------- /lib/safe-contracts/test/core/Safe.Storage.spec.ts: -------------------------------------------------------------------------------- 1 | import { expect } from "chai"; 2 | import hre from "hardhat"; 3 | import { getContractStorageLayout } from "../utils/storage"; 4 | 5 | describe("Safe", () => { 6 | it("follows storage layout defined by SafeStorage library", async () => { 7 | const safeStorageLayout = await getContractStorageLayout(hre, "SafeStorage"); 8 | const safeSingletonStorageLayout = await getContractStorageLayout(hre, "Safe"); 9 | 10 | // Chai doesn't have built-in matcher for deep object equality 11 | // For the sake of simplicity I decided just to convert the object to a string and compare the strings 12 | expect(JSON.stringify(safeSingletonStorageLayout).startsWith(JSON.stringify(safeStorageLayout))).to.be.true; 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /lib/safe-contracts/test/factory/Proxy.spec.ts: -------------------------------------------------------------------------------- 1 | import { expect } from "chai"; 2 | import hre from "hardhat"; 3 | import { AddressZero } from "@ethersproject/constants"; 4 | 5 | describe("Proxy", () => { 6 | describe("constructor", () => { 7 | it("should revert with invalid singleton address", async () => { 8 | const Proxy = await hre.ethers.getContractFactory("SafeProxy"); 9 | await expect(Proxy.deploy(AddressZero)).to.be.revertedWith("Invalid singleton address provided"); 10 | }); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /lib/safe-contracts/test/utils/config.ts: -------------------------------------------------------------------------------- 1 | export const safeContractUnderTest = (): "Safe" | "SafeL2" => { 2 | switch (process.env.SAFE_CONTRACT_UNDER_TEST) { 3 | case "SafeL2": 4 | return "SafeL2"; 5 | default: 6 | return "Safe"; 7 | } 8 | }; 9 | -------------------------------------------------------------------------------- /lib/safe-contracts/test/utils/encoding.ts: -------------------------------------------------------------------------------- 1 | import hre from "hardhat"; 2 | 3 | export const Erc20 = [ 4 | "function transfer(address _receiver, uint256 _value) public returns (bool success)", 5 | "function approve(address _spender, uint256 _value) public returns (bool success)", 6 | "function allowance(address _owner, address _spender) public view returns (uint256 remaining)", 7 | "function balanceOf(address _owner) public view returns (uint256 balance)", 8 | "event Approval(address indexed _owner, address indexed _spender, uint256 _value)", 9 | ]; 10 | 11 | export const Erc20Interface = new hre.ethers.Interface(Erc20); 12 | 13 | export const encodeTransfer = (target: string, amount: string | number): string => { 14 | return Erc20Interface.encodeFunctionData("transfer", [target, amount]); 15 | }; 16 | 17 | export const chainId = async () => { 18 | return (await hre.ethers.provider.getNetwork()).chainId; 19 | }; 20 | -------------------------------------------------------------------------------- /lib/safe-contracts/test/utils/numbers.ts: -------------------------------------------------------------------------------- 1 | const getRandomInt = (min = 0, max: number = Number.MAX_SAFE_INTEGER): number => { 2 | return Math.floor(Math.random() * (max - min + 1)) + min; 3 | }; 4 | 5 | const getRandomIntAsString = (min = 0, max: number = Number.MAX_SAFE_INTEGER): string => { 6 | return getRandomInt(min, max).toString(); 7 | }; 8 | 9 | export { getRandomInt, getRandomIntAsString }; 10 | -------------------------------------------------------------------------------- /lib/safe-contracts/tsconfig.prod.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig", 3 | "exclude": ["./test/**/*"] 4 | } 5 | -------------------------------------------------------------------------------- /lib/safe-contracts/types/solc.d.ts: -------------------------------------------------------------------------------- 1 | declare module "solc"; 2 | -------------------------------------------------------------------------------- /lib/solidity-stringutils/.gitattributes: -------------------------------------------------------------------------------- 1 | *.sol linguist-language=Solidity 2 | -------------------------------------------------------------------------------- /lib/solidity-stringutils/.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: "CI" 2 | on: "push" 3 | jobs: 4 | tests: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - uses: actions/checkout@v2.3.4 8 | - uses: cachix/install-nix-action@v13 9 | - name: Install dapp 10 | run: nix-env -iA dapp -f $(curl -sS https://api.github.com/repos/dapphub/dapptools/releases/latest | jq -r .tarball_url) 11 | - name: Fetch submodules 12 | run: git submodule update --init 13 | - name: Run tests 14 | run: make test 15 | -------------------------------------------------------------------------------- /lib/solidity-stringutils/.gitignore: -------------------------------------------------------------------------------- 1 | **/chain_db//out 2 | build 3 | out 4 | 5 | -------------------------------------------------------------------------------- /lib/solidity-stringutils/.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "lib/ds-test"] 2 | path = lib/ds-test 3 | url = https://github.com/dapphub/ds-test 4 | -------------------------------------------------------------------------------- /lib/solidity-stringutils/Makefile: -------------------------------------------------------------------------------- 1 | all :; dapp build 2 | clean :; dapp clean 3 | test :; dapp test 4 | deploy :; dapp create SolidityStringutils 5 | -------------------------------------------------------------------------------- /lib/solidity-stringutils/README: -------------------------------------------------------------------------------- 1 | Basic string utilities for Solidity, optimized for low gas usage. 2 | -------------------------------------------------------------------------------- /lib/solidity-stringutils/dappfile: -------------------------------------------------------------------------------- 1 | version: 2.0.0 2 | tags: [] 3 | layout: 4 | sol_sources: . 5 | build_dir: build 6 | dependencies: {} 7 | ignore: [] 8 | name: ethereum-stringutils 9 | -------------------------------------------------------------------------------- /lib/solidity-stringutils/lib/ds-test/.gitignore: -------------------------------------------------------------------------------- 1 | /.dapple 2 | /build 3 | /out 4 | -------------------------------------------------------------------------------- /lib/solidity-stringutils/lib/ds-test/Makefile: -------------------------------------------------------------------------------- 1 | all:; dapp build 2 | 3 | test: 4 | -dapp --use solc:0.4.23 build 5 | -dapp --use solc:0.4.26 build 6 | -dapp --use solc:0.5.17 build 7 | -dapp --use solc:0.6.12 build 8 | -dapp --use solc:0.7.5 build 9 | 10 | demo: 11 | DAPP_SRC=demo dapp --use solc:0.7.5 build 12 | -hevm dapp-test --verbose 3 13 | 14 | .PHONY: test demo 15 | -------------------------------------------------------------------------------- /lib/solidity-stringutils/lib/ds-test/default.nix: -------------------------------------------------------------------------------- 1 | { solidityPackage, dappsys }: solidityPackage { 2 | name = "ds-test"; 3 | src = ./src; 4 | } 5 | -------------------------------------------------------------------------------- /lib/solidity-stringutils/strings.sol: -------------------------------------------------------------------------------- 1 | ./src/strings.sol -------------------------------------------------------------------------------- /remappings.txt: -------------------------------------------------------------------------------- 1 | ds-test/=lib/forge-std/lib/ds-test/src/ 2 | forge-std/=lib/forge-std/src/ 3 | oz/=lib/openzeppelin-contracts/contracts 4 | safe/=lib/safe-contracts/contracts/ 5 | test/=test/ -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | requests 2 | dotenv 3 | eth_account 4 | web3 5 | hexbytes 6 | click -------------------------------------------------------------------------------- /scripts/submitFoundryTx.ts: -------------------------------------------------------------------------------- 1 | import { submit } from './utils/submitTx'; 2 | import transactionJson from '../scripts/foundry/transaction.json'; 3 | 4 | async function main() { 5 | const chainId = transactionJson['chainId']; 6 | console.log(transactionJson); 7 | const safeAddress = transactionJson['safe']; 8 | await submit(transactionJson, 0, chainId, safeAddress); 9 | } 10 | 11 | main().catch(error => { 12 | console.error(error); 13 | process.exit(1); 14 | }); 15 | -------------------------------------------------------------------------------- /scripts/utils/constants.ts: -------------------------------------------------------------------------------- 1 | import { ChainId } from '@angleprotocol/sdk'; 2 | 3 | export function getSafeAPI(chainId: number) { 4 | const chainName = ChainId[chainId].toLowerCase(); 5 | const safeAPI = `https://safe-transaction-${chainName}.safe.global/api/v1`; 6 | return safeAPI; 7 | } 8 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2018", 4 | "module": "commonjs", 5 | "outDir": "./build", 6 | "strict": false, 7 | "esModuleInterop": true, 8 | "skipLibCheck": true, 9 | "forceConsistentCasingInFileNames": true, 10 | "resolveJsonModule": true 11 | }, 12 | "include": ["./scripts"], 13 | "files": ["./hardhat.config.ts"] 14 | } 15 | --------------------------------------------------------------------------------