├── .github
└── pull_request_template.md
├── Articles
├── How I landed up getting 10+ job offers in 3 months of my web3 internship
│ └── Article.md
├── How to get free Test Ethers for Rinkeby Test Network
│ └── Article.md
├── How to interact with a Smart Contract, when it is not verified: Smart Hack Coding #1
│ └── Article.md
├── IPFS | Article Series
│ └── What in the world is IPFS? | Getting Started | Part 1.md
└── sampleArticle.md
├── ContractInteraction
└── Hogwarts.sol
├── DutchAuction
├── DutchAuction.sol
└── NFT.sol
├── Flash_swap
├── .gitignore
├── contracts
│ ├── flashswap.sol
│ └── interfaces
│ │ └── Uniswap.sol
├── hardhat.config.js
├── package-lock.json
├── package.json
└── tests
│ └── flashswaptest.js
├── Foundry_Testing_ERC20
├── .gas-snapshot
├── .gitignore
├── .gitmodules
├── README.md
├── foundry.toml
├── lib
│ ├── forge-std
│ │ ├── .github
│ │ │ └── workflows
│ │ │ │ └── tests.yml
│ │ ├── .gitignore
│ │ ├── .gitmodules
│ │ ├── LICENSE-APACHE
│ │ ├── LICENSE-MIT
│ │ ├── README.md
│ │ ├── lib
│ │ │ └── ds-test
│ │ │ │ ├── .gitignore
│ │ │ │ ├── LICENSE
│ │ │ │ ├── Makefile
│ │ │ │ ├── default.nix
│ │ │ │ ├── demo
│ │ │ │ └── demo.sol
│ │ │ │ └── src
│ │ │ │ └── test.sol
│ │ └── src
│ │ │ ├── Script.sol
│ │ │ ├── Test.sol
│ │ │ ├── Vm.sol
│ │ │ ├── console.sol
│ │ │ ├── console2.sol
│ │ │ └── test
│ │ │ ├── StdAssertions.t.sol
│ │ │ ├── StdCheats.t.sol
│ │ │ ├── StdError.t.sol
│ │ │ ├── StdMath.t.sol
│ │ │ └── StdStorage.t.sol
│ └── openzeppelin-contracts
│ │ ├── .codecov.yml
│ │ ├── .editorconfig
│ │ ├── .eslintrc
│ │ ├── .gitattributes
│ │ ├── .github
│ │ ├── ISSUE_TEMPLATE
│ │ │ ├── bug_report.md
│ │ │ ├── config.yml
│ │ │ └── feature_request.md
│ │ ├── PULL_REQUEST_TEMPLATE.md
│ │ ├── actions
│ │ │ └── setup
│ │ │ │ └── action.yml
│ │ └── workflows
│ │ │ ├── checks.yml
│ │ │ ├── docs.yml
│ │ │ └── upgradeable.yml
│ │ ├── .gitignore
│ │ ├── .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
│ │ │ └── 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
│ │ │ ├── IERC20.sol
│ │ │ ├── IERC20Metadata.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
│ │ │ ├── ArraysImpl.sol
│ │ │ ├── BadBeacon.sol
│ │ │ ├── Base64Mock.sol
│ │ │ ├── BitmapMock.sol
│ │ │ ├── CallReceiverMock.sol
│ │ │ ├── CheckpointsImpl.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
│ │ │ │ ├── ERC165MissingData.sol
│ │ │ │ └── ERC165NotSupported.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
│ │ │ ├── ERC20TokenizedVaultMock.sol
│ │ │ ├── ERC20VotesCompMock.sol
│ │ │ ├── ERC20VotesMock.sol
│ │ │ ├── ERC20WrapperMock.sol
│ │ │ ├── ERC2771ContextMock.sol
│ │ │ ├── ERC3156FlashBorrowerMock.sol
│ │ │ ├── ERC721BurnableMock.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
│ │ │ ├── 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
│ │ │ │ │ ├── ERC20TokenizedVault.sol
│ │ │ │ │ ├── ERC20Votes.sol
│ │ │ │ │ ├── ERC20VotesComp.sol
│ │ │ │ │ ├── ERC20Wrapper.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
│ │ │ │ │ ├── ERC721Enumerable.sol
│ │ │ │ │ ├── ERC721Pausable.sol
│ │ │ │ │ ├── ERC721Royalty.sol
│ │ │ │ │ ├── ERC721URIStorage.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
│ │ │ │ ├── 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
│ │ │ ├── IInbox.sol
│ │ │ ├── IMessageProvider.sol
│ │ │ └── IOutbox.sol
│ │ │ ├── compound
│ │ │ ├── ICompoundTimelock.sol
│ │ │ └── LICENSE
│ │ │ ├── optimism
│ │ │ ├── ICrossDomainMessenger.sol
│ │ │ └── LICENSE
│ │ │ └── polygon
│ │ │ └── IFxMessageProcessor.sol
│ │ ├── docs
│ │ ├── antora.yml
│ │ ├── contract.hbs
│ │ ├── helpers.js
│ │ ├── modules
│ │ │ └── ROOT
│ │ │ │ ├── images
│ │ │ │ ├── tally-admin.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
│ │ └── prelude.hbs
│ │ ├── hardhat.config.js
│ │ ├── hardhat
│ │ └── env-contract.js
│ │ ├── logo.svg
│ │ ├── migrations
│ │ └── .gitkeep
│ │ ├── netlify.toml
│ │ ├── package-lock.json
│ │ ├── package.json
│ │ ├── renovate.json
│ │ ├── scripts
│ │ ├── checks
│ │ │ ├── generation.sh
│ │ │ └── inheritance-ordering.js
│ │ ├── gen-nav.js
│ │ ├── generate
│ │ │ ├── format-lines.js
│ │ │ ├── run.js
│ │ │ └── templates
│ │ │ │ ├── SafeCast.js
│ │ │ │ └── SafeCastMock.js
│ │ ├── git-user-config.sh
│ │ ├── helpers.js
│ │ ├── migrate-imports.js
│ │ ├── prepack.sh
│ │ ├── prepare-contracts-package.sh
│ │ ├── prepare-docs-solc.js
│ │ ├── 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
│ │ ├── 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
│ │ │ ├── GovernorWeightQuorumFraction.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
│ │ │ │ ├── ERC20TokenizedVault.test.js
│ │ │ │ ├── ERC20Votes.test.js
│ │ │ │ ├── ERC20VotesComp.test.js
│ │ │ │ ├── ERC20Wrapper.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
│ │ │ │ ├── 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
│ │ ├── MerkleProof.test.js
│ │ ├── SignatureChecker.test.js
│ │ └── draft-EIP712.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.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
├── public
│ └── gas-report.png
├── remappings.txt
├── src
│ └── MyToken.sol
└── test
│ └── MyToken.t.sol
├── GameofThronesNFT
├── GameofThrones.sol
├── jsonMetadata
│ ├── 1.json
│ ├── 2.json
│ ├── 3.json
│ ├── 4.json
│ ├── 5.json
│ └── 6.json
└── package.json
├── Mainnet-Forking
├── .gitignore
├── README.md
├── hardhat.config.js
├── package-lock.json
├── package.json
├── scripts
│ └── transfer.js
└── yarn.lock
├── NFT-verse
├── .gitignore
├── NFTMetadata.json
├── artifacts
│ ├── @openzeppelin
│ │ └── contracts
│ │ │ ├── token
│ │ │ └── ERC721
│ │ │ │ ├── ERC721.sol
│ │ │ │ ├── ERC721.dbg.json
│ │ │ │ └── ERC721.json
│ │ │ │ ├── IERC721.sol
│ │ │ │ ├── IERC721.dbg.json
│ │ │ │ └── IERC721.json
│ │ │ │ ├── IERC721Receiver.sol
│ │ │ │ ├── IERC721Receiver.dbg.json
│ │ │ │ └── IERC721Receiver.json
│ │ │ │ └── extensions
│ │ │ │ ├── ERC721URIStorage.sol
│ │ │ │ ├── ERC721URIStorage.dbg.json
│ │ │ │ └── ERC721URIStorage.json
│ │ │ │ └── IERC721Metadata.sol
│ │ │ │ ├── IERC721Metadata.dbg.json
│ │ │ │ └── IERC721Metadata.json
│ │ │ └── utils
│ │ │ ├── Address.sol
│ │ │ ├── Address.dbg.json
│ │ │ └── Address.json
│ │ │ ├── Context.sol
│ │ │ ├── Context.dbg.json
│ │ │ └── Context.json
│ │ │ ├── Counters.sol
│ │ │ ├── Counters.dbg.json
│ │ │ └── Counters.json
│ │ │ ├── Strings.sol
│ │ │ ├── Strings.dbg.json
│ │ │ └── Strings.json
│ │ │ └── introspection
│ │ │ ├── ERC165.sol
│ │ │ ├── ERC165.dbg.json
│ │ │ └── ERC165.json
│ │ │ └── IERC165.sol
│ │ │ ├── IERC165.dbg.json
│ │ │ └── IERC165.json
│ ├── build-info
│ │ └── 033cd62698f0725a2ff122cf7d11bc97.json
│ └── contracts
│ │ └── NFT.sol
│ │ ├── NFT.dbg.json
│ │ └── NFT.json
├── cache
│ └── solidity-files-cache.json
├── contracts
│ └── NFT.sol
├── hardhat.config.js
├── package-lock.json
├── package.json
├── scripts
│ ├── deploy.js
│ └── mint.js
└── yarn.lock
├── NFT-verse_v2
├── .gitignore
├── NFTMetadata.json
├── cache
│ └── solidity-files-cache.json
├── contracts
│ └── NFT.sol
├── deploy
│ └── 00_deploy_NFT.js
├── deployments
│ ├── localhost
│ │ ├── .chainId
│ │ ├── NFT.json
│ │ └── solcInputs
│ │ │ └── 4b51beea37a5e2175f6af2ae78a5a673.json
│ └── mumbai-matic
│ │ ├── .chainId
│ │ ├── NFT.json
│ │ └── solcInputs
│ │ └── 4b51beea37a5e2175f6af2ae78a5a673.json
├── hardhat.config.js
├── package.json
├── scripts
│ ├── deploy.js
│ └── mint.js
└── yarn.lock
├── README.md
└── uni_swap
├── .gitignore
├── README.md
├── contracts
├── interfaces
│ ├── IERC20.sol
│ └── Uniswap.sol
└── testSwap.sol
├── hardhat.config.js
├── package-lock.json
├── package.json
├── result.txt
├── scripts
└── deploy.js
└── test
└── sample-test.js
/.github/pull_request_template.md:
--------------------------------------------------------------------------------
1 | # PR Submission Checklist
2 |
3 | Thank you for your PR. Please select from the following:
4 |
5 | - [ ] This PR submits only an Article
6 | - [ ] This PR submits a Tutorial with an Article
7 | - [ ] This PR requests modification to an existing Tutorial / Article
8 |
9 | If this PR is a Tutorial with an Article, please select from the following as well:
10 |
11 | - [ ] What level does the Tutorial serve:
12 | - [ ] Beginner (from nil experience in the subject to 1 year)
13 | - [ ] Intermediate (from nil experience in the subject to 1 year)
14 | - [ ] Advanced
15 |
16 | In respect of the Article, please submit the following, if applicable:
17 |
18 | - [ ] Please confirm that you have mentioned yourself as the author of the Article
19 | - [ ] You are more than welcome to also give links to your social media handles too, for reference
20 |
--------------------------------------------------------------------------------
/Articles/sampleArticle.md:
--------------------------------------------------------------------------------
1 | # Topic of the article (should be the same name as the file name)
2 |
3 | [//]: <> (Insert Cover Image)
4 |
5 | ## TL;DR (If applicable)
6 | [//]: <> (If applicable)
7 |
8 | ## Sub-heading
9 |
10 | Text
11 |
12 | Bullet point format:
13 | - Text
14 |
15 | > *Quote Format*
16 |
17 |
18 | Authors (open to feedback): 👇
19 |
20 | [YourName](https://relevantSocialMediaLinks.com)
21 |
22 | [//]: <> (All other formatting standards of markdown continues to be applicable)
--------------------------------------------------------------------------------
/ContractInteraction/Hogwarts.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-3.0
2 |
3 | pragma solidity >=0.7.0 <0.9.0;
4 |
5 |
6 | contract firstContract {
7 |
8 | uint256 gryffinder = 0;
9 | uint256 hufflepuff = 0;
10 | uint256 ravenclaw = 0;
11 | uint256 slytherin = 0;
12 |
13 |
14 | function Gryffinder() public view returns(uint){
15 | return gryffinder;
16 | }
17 |
18 | function Hufflepuff() public view returns(uint){
19 | return hufflepuff;
20 | }
21 | function Ravenclaw() public view returns(uint){
22 | return ravenclaw;
23 | }
24 |
25 | function Slytherin() public view returns(uint){
26 | return slytherin;
27 | }
28 |
29 | function addPointsToGryffinder() public {
30 |
31 | gryffinder += 10;
32 | }
33 |
34 | function addPointsToHufflepuff( ) public payable{
35 |
36 | hufflepuff += 10;
37 | }
38 | function addPointsToRavenclaw( ) public payable {
39 |
40 | ravenclaw += 10;
41 |
42 | }
43 |
44 | function addPointsToSlytherin( ) public payable {
45 |
46 | slytherin += 10;
47 | }
48 |
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/DutchAuction/NFT.sol:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UV-Labs/Tutorials/b853ba9166e115a8e5962304a8fd84f322c5392a/DutchAuction/NFT.sol
--------------------------------------------------------------------------------
/Flash_swap/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .env
3 | coverage
4 | coverage.json
5 | typechain
6 |
7 | #Hardhat files
8 | cache
9 | artifacts
10 |
--------------------------------------------------------------------------------
/Flash_swap/hardhat.config.js:
--------------------------------------------------------------------------------
1 | require("@nomiclabs/hardhat-waffle");
2 | require("@nomiclabs/hardhat-ethers");
3 | require('dotenv').config();
4 |
5 |
6 | /**
7 | * @type import('hardhat/config').HardhatUserConfig
8 | */
9 | module.exports = {
10 | solidity: "0.8.4",
11 | networks: {
12 | hardhat: {
13 | forking: {
14 | url: `https://eth-mainnet.alchemyapi.io/v2/${process.env.ALCHEMY_KEY}`,
15 | blockNumber: 14638929,
16 | },
17 | },
18 | },
19 | };
--------------------------------------------------------------------------------
/Flash_swap/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "flash_swap",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "@nomiclabs/hardhat-waffle": "^2.0.3",
14 | "@openzeppelin/contracts": "^4.6.0",
15 | "@uniswap/v2-core": "^1.0.1",
16 | "bn.js": "^5.2.0",
17 | "chai": "^4.3.6"
18 | },
19 | "devDependencies": {
20 | "dotenv": "^16.0.0",
21 | "hardhat": "^2.9.3"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/.gas-snapshot:
--------------------------------------------------------------------------------
1 | ContractTest:testApprove() (gas: 33692)
2 | ContractTest:testBurn() (gas: 61113)
3 | ContractTest:testDescreaseAllowance() (gas: 38966)
4 | ContractTest:testFailApproveFromZeroAddress() (gas: 10721)
5 | ContractTest:testFailApproveToZeroAddress() (gas: 5818)
6 | ContractTest:testFailBurnFromZero() (gas: 5857)
7 | ContractTest:testFailBurnInsufficientBalance() (gas: 60684)
8 | ContractTest:testFailMintToZero() (gas: 5829)
9 | ContractTest:testFailTransferFromInsufficientApprove() (gas: 88155)
10 | ContractTest:testFailTransferFromInsufficientBalance() (gas: 88403)
11 | ContractTest:testFailTransferFromZeroAddress() (gas: 65141)
12 | ContractTest:testFailTransferInsufficientBalance() (gas: 62575)
13 | ContractTest:testFailTransferToZeroAddress() (gas: 60204)
14 | ContractTest:testIncreaseAllowance() (gas: 35589)
15 | ContractTest:testMint() (gas: 56216)
16 | ContractTest:testName() (gas: 9798)
17 | ContractTest:testSymbol() (gas: 9821)
18 | ContractTest:testTransfer() (gas: 89883)
19 | ContractTest:testTransferFrom() (gas: 119247)
20 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/.gitignore:
--------------------------------------------------------------------------------
1 | out/
2 | cache/
3 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "lib/forge-std"]
2 | path = lib/forge-std
3 | url = https://github.com/foundry-rs/forge-std
4 |
5 | [submodule "lib/openzeppelin-contracts"]
6 | path = lib/openzeppelin-contracts
7 | url = https://github.com/OpenZeppelin/openzeppelin-contracts/
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/README.md:
--------------------------------------------------------------------------------
1 | OpenSource Code Contributed by: [Akshay Tarpara](https://github.com/Atarpara)
2 |
3 |
4 | # Setup
5 |
6 | ```
7 | forge install
8 | ```
9 |
10 | # Run the test
11 |
12 | Run the all testcase
13 |
14 | ```
15 | forge test
16 | ```
17 |
18 | Run the particular testcase
19 |
20 | ```
21 | forge test -m testMint
22 | ```
23 |
24 | # Gas Report
25 |
26 | ```
27 | forge test --gas-report
28 | ```
29 |
30 |
31 |
32 | # Gas SnapShot
33 |
34 | create the snapshot file of the gas
35 |
36 | ```
37 | forge snapshot
38 | ```
39 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/foundry.toml:
--------------------------------------------------------------------------------
1 | [default]
2 | src = 'src'
3 | out = 'out'
4 | libs = ['lib']
5 | solc_version = "0.8.13"
6 | gas_reports = ["*"]
7 |
8 | fuzz_runs = 1000
9 |
10 | # See more config options https://github.com/foundry-rs/foundry/tree/master/config
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/forge-std/.github/workflows/tests.yml:
--------------------------------------------------------------------------------
1 | name: Tests
2 | on: [push, pull_request]
3 |
4 | jobs:
5 | check:
6 | name: Foundry project
7 | runs-on: ubuntu-latest
8 | steps:
9 | - uses: actions/checkout@v2
10 | with:
11 | submodules: recursive
12 |
13 | - name: Install Foundry
14 | uses: onbjerg/foundry-toolchain@v1
15 | with:
16 | version: nightly
17 |
18 | - name: Install dependencies
19 | run: forge install
20 | - name: Run tests
21 | run: forge test -vvv
22 | - name: Build Test with older solc versions
23 | run: |
24 | forge build --contracts src/Test.sol --use solc:0.8.0
25 | forge build --contracts src/Test.sol --use solc:0.7.0
26 | forge build --contracts src/Test.sol --use solc:0.6.0
27 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/forge-std/.gitignore:
--------------------------------------------------------------------------------
1 | cache/
2 | out/
3 | .vscode
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/forge-std/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "lib/ds-test"]
2 | path = lib/ds-test
3 | url = https://github.com/dapphub/ds-test
4 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/forge-std/LICENSE-MIT:
--------------------------------------------------------------------------------
1 | Copyright (c) 2021 Brock Elmore
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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/forge-std/lib/ds-test/.gitignore:
--------------------------------------------------------------------------------
1 | /.dapple
2 | /build
3 | /out
4 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/forge-std/lib/ds-test/default.nix:
--------------------------------------------------------------------------------
1 | { solidityPackage, dappsys }: solidityPackage {
2 | name = "ds-test";
3 | src = ./src;
4 | }
5 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/forge-std/src/Script.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Unlicense
2 | pragma solidity >=0.6.0 <0.9.0;
3 |
4 | import "./Vm.sol";
5 | import "./console.sol";
6 | import "./console2.sol";
7 |
8 | abstract contract Script {
9 | address constant private VM_ADDRESS =
10 | address(bytes20(uint160(uint256(keccak256('hevm cheat code')))));
11 |
12 | Vm public constant vm = Vm(VM_ADDRESS);
13 | }
14 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 | project:
10 | default:
11 | threshold: 1%
12 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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]
21 | max_line_length = 0
22 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/.gitattributes:
--------------------------------------------------------------------------------
1 | *.sol linguist-language=Solidity
2 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/.github/workflows/docs.yml:
--------------------------------------------------------------------------------
1 | name: Build Docs
2 |
3 | on:
4 | push:
5 | branches: [release-v*]
6 |
7 | jobs:
8 | build:
9 | runs-on: ubuntu-latest
10 | steps:
11 | - uses: actions/checkout@v3
12 | - name: Set up environment
13 | uses: ./.github/actions/setup
14 | - run: bash scripts/git-user-config.sh
15 | - run: node scripts/update-docs-branch.js
16 | - run: git push --all origin
17 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/.mocharc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | require: 'hardhat/register',
3 | timeout: 4000,
4 | };
5 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/RELEASING.md:
--------------------------------------------------------------------------------
1 | # Releasing
2 |
3 | > Visit the documentation for [details about release schedule].
4 |
5 | Start on an up-to-date `master` branch.
6 |
7 | Create the release branch with `npm run release start minor`.
8 |
9 | Publish a release candidate with `npm run release rc`.
10 |
11 | Publish the final release with `npm run release final`.
12 |
13 | Follow the general [OpenZeppelin Contracts release checklist].
14 |
15 | [details about release schedule]: https://docs.openzeppelin.com/contracts/releases-stability
16 | [OpenZeppelin Contracts release checklist]: https://github.com/OpenZeppelin/code-style/blob/master/RELEASE_CHECKLIST.md
17 |
18 |
19 | ## Merging the release branch
20 |
21 | After the final release, the release branch should be merged back into `master`. This merge must not be squashed because it would lose the tagged release commit. Since the GitHub repo is set up to only allow squashed merges, the merge should be done locally and pushed.
22 |
23 | Make sure to have the latest changes from `upstream` in your local release branch.
24 |
25 | ```
26 | git checkout release-vX.Y.Z
27 | git pull upstream
28 | ```
29 |
30 | ```
31 | git checkout master
32 | git merge --no-ff release-vX.Y.Z
33 | git push upstream master
34 | ```
35 |
36 | The release branch can then be deleted on GitHub.
37 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/audit/2018-10.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UV-Labs/Tutorials/b853ba9166e115a8e5962304a8fd84f322c5392a/Foundry_Testing_ERC20/lib/openzeppelin-contracts/audit/2018-10.pdf
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/certora/munged/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 | }
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 | {{IAccessControl}}
16 |
17 | {{AccessControl}}
18 |
19 | {{AccessControlCrossChain}}
20 |
21 | {{IAccessControlEnumerable}}
22 |
23 | {{AccessControlEnumerable}}
24 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/contracts/crosschain/README.adoc:
--------------------------------------------------------------------------------
1 | = Cross Chain Awareness
2 |
3 | [.readme-notice]
4 | NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/crosschain
5 |
6 | This directory provides building blocks to improve cross-chain awareness of smart contracts.
7 |
8 | - {CrossChainEnabled} is an abstraction that contains accessors and modifiers to control the execution flow when receiving cross-chain messages.
9 |
10 | == CrossChainEnabled specializations
11 |
12 | The following specializations of {CrossChainEnabled} provide implementations of the {CrossChainEnabled} abstraction for specific bridges. This can be used to complex cross-chain aware components such as {AccessControlCrossChain}.
13 |
14 | {{CrossChainEnabledAMB}}
15 |
16 | {{CrossChainEnabledArbitrumL1}}
17 |
18 | {{CrossChainEnabledArbitrumL2}}
19 |
20 | {{CrossChainEnabledOptimism}}
21 |
22 | {{CrossChainEnabledPolygonChild}}
23 |
24 | == Libraries for cross-chain
25 |
26 | In addition to the {CrossChainEnabled} abstraction, cross-chain awareness is also available through libraries. These libraries can be used to build complex designs such as contracts with the ability to interact with multiple bridges.
27 |
28 | {{LibAMB}}
29 |
30 | {{LibArbitrumL1}}
31 |
32 | {{LibArbitrumL2}}
33 |
34 | {{LibOptimism}}
35 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/contracts/interfaces/IERC1363Spender.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1363Spender.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | interface IERC1363Spender {
7 | /*
8 | * Note: the ERC-165 identifier for this interface is 0x7b04a2d0.
9 | * 0x7b04a2d0 === bytes4(keccak256("onApprovalReceived(address,uint256,bytes)"))
10 | */
11 |
12 | /**
13 | * @notice Handle the approval of ERC1363 tokens
14 | * @dev Any ERC1363 smart contract calls this function on the recipient
15 | * after an `approve`. This function MAY throw to revert and reject the
16 | * approval. Return of other than the magic value MUST result in the
17 | * transaction being reverted.
18 | * Note: the token contract address is always the message sender.
19 | * @param owner address The address which called `approveAndCall` function
20 | * @param value uint256 The amount of tokens to be spent
21 | * @param data bytes Additional data with no specified format
22 | * @return `bytes4(keccak256("onApprovalReceived(address,uint256,bytes)"))`
23 | * unless throwing
24 | */
25 | function onApprovalReceived(
26 | address owner,
27 | uint256 value,
28 | bytes memory data
29 | ) external returns (bytes4);
30 | }
31 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/contracts/interfaces/IERC3156FlashBorrower.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/contracts/interfaces/README.adoc:
--------------------------------------------------------------------------------
1 | = Interfaces
2 |
3 | [.readme-notice]
4 | NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/interfaces
5 |
6 | == List of standardized interfaces
7 | These interfaces are available as `.sol` files, and also as compiler `.json` ABI files (through the npm package). These
8 | are useful to interact with third party contracts that implement them.
9 |
10 | - {IERC20}
11 | - {IERC20Metadata}
12 | - {IERC165}
13 | - {IERC721}
14 | - {IERC721Receiver}
15 | - {IERC721Enumerable}
16 | - {IERC721Metadata}
17 | - {IERC777}
18 | - {IERC777Recipient}
19 | - {IERC777Sender}
20 | - {IERC1155}
21 | - {IERC1155Receiver}
22 | - {IERC1155MetadataURI}
23 | - {IERC1271}
24 | - {IERC1363}
25 | - {IERC1820Implementer}
26 | - {IERC1820Registry}
27 | - {IERC2612}
28 | - {IERC2981}
29 | - {IERC3156FlashLender}
30 | - {IERC3156FlashBorrower}
31 |
32 | == Detailed ABI
33 |
34 | {{IERC1271}}
35 |
36 | {{IERC1363}}
37 |
38 | {{IERC1363Receiver}}
39 |
40 | {{IERC1820Implementer}}
41 |
42 | {{IERC1820Registry}}
43 |
44 | {{IERC2612}}
45 |
46 | {{IERC2981}}
47 |
48 | {{IERC3156FlashLender}}
49 |
50 | {{IERC3156FlashBorrower}}
51 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 virtual returns (bytes32) {
20 | return _crossChainRoleAlias(role);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/contracts/mocks/ArraysImpl.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 |
3 | pragma solidity ^0.8.0;
4 |
5 | import "../utils/Arrays.sol";
6 |
7 | contract ArraysImpl {
8 | using Arrays for uint256[];
9 |
10 | uint256[] private _array;
11 |
12 | constructor(uint256[] memory array) {
13 | _array = array;
14 | }
15 |
16 | function findUpperBound(uint256 element) external view returns (uint256) {
17 | return _array.findUpperBound(element);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/contracts/mocks/CheckpointsImpl.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 |
3 | pragma solidity ^0.8.0;
4 |
5 | import "../utils/Checkpoints.sol";
6 |
7 | contract CheckpointsImpl {
8 | using Checkpoints for Checkpoints.History;
9 |
10 | Checkpoints.History private _totalCheckpoints;
11 |
12 | function latest() public view returns (uint256) {
13 | return _totalCheckpoints.latest();
14 | }
15 |
16 | function getAtBlock(uint256 blockNumber) public view returns (uint256) {
17 | return _totalCheckpoints.getAtBlock(blockNumber);
18 | }
19 |
20 | function push(uint256 value) public returns (uint256, uint256) {
21 | return _totalCheckpoints.push(value);
22 | }
23 |
24 | function length() public view returns (uint256) {
25 | return _totalCheckpoints._checkpoints.length;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 an admin() function made to clash with
7 | * @dev TransparentUpgradeableProxy's to test correct functioning of the
8 | * @dev Transparent Proxy feature.
9 | */
10 | contract ClashingImplementation {
11 | function admin() external pure returns (address) {
12 | return 0x0000000000000000000000000000000011111142;
13 | }
14 |
15 | function delegatedFunction() external pure returns (bool) {
16 | return true;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/contracts/mocks/ClonesMock.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 |
3 | pragma solidity ^0.8.0;
4 |
5 | import "../proxy/Clones.sol";
6 | import "../utils/Address.sol";
7 |
8 | contract ClonesMock {
9 | using Address for address;
10 | using Clones for address;
11 |
12 | event NewInstance(address instance);
13 |
14 | function clone(address implementation, bytes calldata initdata) public payable {
15 | _initAndEmit(implementation.clone(), initdata);
16 | }
17 |
18 | function cloneDeterministic(
19 | address implementation,
20 | bytes32 salt,
21 | bytes calldata initdata
22 | ) public payable {
23 | _initAndEmit(implementation.cloneDeterministic(salt), initdata);
24 | }
25 |
26 | function predictDeterministicAddress(address implementation, bytes32 salt) public view returns (address predicted) {
27 | return implementation.predictDeterministicAddress(salt);
28 | }
29 |
30 | function _initAndEmit(address instance, bytes memory initdata) private {
31 | if (initdata.length > 0) {
32 | instance.functionCallWithValue(initdata, msg.value);
33 | }
34 | emit NewInstance(instance);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/contracts/mocks/ECDSAMock.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 |
3 | pragma solidity ^0.8.0;
4 |
5 | import "../utils/cryptography/ECDSA.sol";
6 |
7 | contract ECDSAMock {
8 | using ECDSA for bytes32;
9 | using ECDSA for bytes;
10 |
11 | function recover(bytes32 hash, bytes memory signature) public pure returns (address) {
12 | return hash.recover(signature);
13 | }
14 |
15 | // solhint-disable-next-line func-name-mixedcase
16 | function recover_v_r_s(
17 | bytes32 hash,
18 | uint8 v,
19 | bytes32 r,
20 | bytes32 s
21 | ) public pure returns (address) {
22 | return hash.recover(v, r, s);
23 | }
24 |
25 | // solhint-disable-next-line func-name-mixedcase
26 | function recover_r_vs(
27 | bytes32 hash,
28 | bytes32 r,
29 | bytes32 vs
30 | ) public pure returns (address) {
31 | return hash.recover(r, vs);
32 | }
33 |
34 | function toEthSignedMessageHash(bytes32 hash) public pure returns (bytes32) {
35 | return hash.toEthSignedMessageHash();
36 | }
37 |
38 | function toEthSignedMessageHash(bytes memory s) public pure returns (bytes32) {
39 | return s.toEthSignedMessageHash();
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/contracts/mocks/EIP712External.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 |
3 | pragma solidity ^0.8.0;
4 |
5 | import "../utils/cryptography/draft-EIP712.sol";
6 | import "../utils/cryptography/ECDSA.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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/contracts/mocks/ERC1155Mock.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 |
3 | pragma solidity ^0.8.0;
4 |
5 | import "../token/ERC1155/ERC1155.sol";
6 |
7 | /**
8 | * @title ERC1155Mock
9 | * This mock just publicizes internal functions for testing purposes
10 | */
11 | contract ERC1155Mock is ERC1155 {
12 | constructor(string memory uri) ERC1155(uri) {}
13 |
14 | function setURI(string memory newuri) public {
15 | _setURI(newuri);
16 | }
17 |
18 | function mint(
19 | address to,
20 | uint256 id,
21 | uint256 value,
22 | bytes memory data
23 | ) public {
24 | _mint(to, id, value, data);
25 | }
26 |
27 | function mintBatch(
28 | address to,
29 | uint256[] memory ids,
30 | uint256[] memory values,
31 | bytes memory data
32 | ) public {
33 | _mintBatch(to, ids, values, data);
34 | }
35 |
36 | function burn(
37 | address owner,
38 | uint256 id,
39 | uint256 value
40 | ) public {
41 | _burn(owner, id, value);
42 | }
43 |
44 | function burnBatch(
45 | address owner,
46 | uint256[] memory ids,
47 | uint256[] memory values
48 | ) public {
49 | _burnBatch(owner, ids, values);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 virtual override(ERC1155, ERC1155Pausable) {
27 | super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 virtual override(ERC1155, ERC1155Supply) {
19 | super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 virtual 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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 virtual 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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/contracts/mocks/ERC20TokenizedVaultMock.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 |
3 | pragma solidity ^0.8.0;
4 |
5 | import "../token/ERC20/extensions/ERC20TokenizedVault.sol";
6 |
7 | // mock class using ERC20
8 | contract ERC20TokenizedVaultMock is ERC20TokenizedVault {
9 | constructor(
10 | IERC20Metadata asset,
11 | string memory name,
12 | string memory symbol
13 | ) ERC20(name, symbol) ERC20TokenizedVault(asset) {}
14 |
15 | function mockMint(address account, uint256 amount) public {
16 | _mint(account, amount);
17 | }
18 |
19 | function mockBurn(address account, uint256 amount) public {
20 | _burn(account, amount);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 virtual override(Context, ERC2771Context) returns (address) {
16 | return ERC2771Context._msgSender();
17 | }
18 |
19 | function _msgData() internal view virtual override(Context, ERC2771Context) returns (bytes calldata) {
20 | return ERC2771Context._msgData();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/contracts/mocks/ERC721PausableMock.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 |
3 | pragma solidity ^0.8.0;
4 |
5 | import "../token/ERC721/extensions/ERC721Pausable.sol";
6 |
7 | /**
8 | * @title ERC721PausableMock
9 | * This mock just provides a public mint, burn and exists functions for testing purposes
10 | */
11 | contract ERC721PausableMock is ERC721Pausable {
12 | constructor(string memory name, string memory symbol) ERC721(name, symbol) {}
13 |
14 | function pause() external {
15 | _pause();
16 | }
17 |
18 | function unpause() external {
19 | _unpause();
20 | }
21 |
22 | function exists(uint256 tokenId) public view returns (bool) {
23 | return _exists(tokenId);
24 | }
25 |
26 | function mint(address to, uint256 tokenId) public {
27 | _mint(to, tokenId);
28 | }
29 |
30 | function safeMint(address to, uint256 tokenId) public {
31 | _safeMint(to, tokenId);
32 | }
33 |
34 | function safeMint(
35 | address to,
36 | uint256 tokenId,
37 | bytes memory _data
38 | ) public {
39 | _safeMint(to, tokenId, _data);
40 | }
41 |
42 | function burn(uint256 tokenId) public {
43 | _burn(tokenId);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/contracts/mocks/ERC721ReceiverMock.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 |
3 | pragma solidity ^0.8.0;
4 |
5 | import "../token/ERC721/IERC721Receiver.sol";
6 |
7 | contract ERC721ReceiverMock is IERC721Receiver {
8 | enum Error {
9 | None,
10 | RevertWithMessage,
11 | RevertWithoutMessage,
12 | Panic
13 | }
14 |
15 | bytes4 private immutable _retval;
16 | Error private immutable _error;
17 |
18 | event Received(address operator, address from, uint256 tokenId, bytes data, uint256 gas);
19 |
20 | constructor(bytes4 retval, Error error) {
21 | _retval = retval;
22 | _error = error;
23 | }
24 |
25 | function onERC721Received(
26 | address operator,
27 | address from,
28 | uint256 tokenId,
29 | bytes memory data
30 | ) public override returns (bytes4) {
31 | if (_error == Error.RevertWithMessage) {
32 | revert("ERC721ReceiverMock: reverting");
33 | } else if (_error == Error.RevertWithoutMessage) {
34 | revert();
35 | } else if (_error == Error.Panic) {
36 | uint256 a = uint256(0) / uint256(0);
37 | a;
38 | }
39 | emit Received(operator, from, tokenId, data, gasleft());
40 | return _retval;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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/draft-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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/contracts/mocks/MathMock.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 |
3 | pragma solidity ^0.8.0;
4 |
5 | import "../utils/math/Math.sol";
6 |
7 | contract MathMock {
8 | function max(uint256 a, uint256 b) public pure returns (uint256) {
9 | return Math.max(a, b);
10 | }
11 |
12 | function min(uint256 a, uint256 b) public pure returns (uint256) {
13 | return Math.min(a, b);
14 | }
15 |
16 | function average(uint256 a, uint256 b) public pure returns (uint256) {
17 | return Math.average(a, b);
18 | }
19 |
20 | function ceilDiv(uint256 a, uint256 b) public pure returns (uint256) {
21 | return Math.ceilDiv(a, b);
22 | }
23 |
24 | function mulDiv(
25 | uint256 a,
26 | uint256 b,
27 | uint256 denominator,
28 | Math.Rounding direction
29 | ) public pure returns (uint256) {
30 | return Math.mulDiv(a, b, denominator, direction);
31 | }
32 |
33 | function sqrt(uint256 a, Math.Rounding direction) public pure returns (uint256) {
34 | return Math.sqrt(a, direction);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 testReturnValues(
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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/contracts/mocks/ReentrancyMock.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 |
3 | pragma solidity ^0.8.0;
4 |
5 | import "../security/ReentrancyGuard.sol";
6 | import "./ReentrancyAttack.sol";
7 |
8 | contract ReentrancyMock is ReentrancyGuard {
9 | uint256 public counter;
10 |
11 | constructor() {
12 | counter = 0;
13 | }
14 |
15 | function callback() external nonReentrant {
16 | _count();
17 | }
18 |
19 | function countLocalRecursive(uint256 n) public nonReentrant {
20 | if (n > 0) {
21 | _count();
22 | countLocalRecursive(n - 1);
23 | }
24 | }
25 |
26 | function countThisRecursive(uint256 n) public nonReentrant {
27 | if (n > 0) {
28 | _count();
29 | (bool success, ) = address(this).call(abi.encodeWithSignature("countThisRecursive(uint256)", n - 1));
30 | require(success, "ReentrancyMock: failed call");
31 | }
32 | }
33 |
34 | function countAndCall(ReentrancyAttack attacker) public nonReentrant {
35 | _count();
36 | bytes4 func = bytes4(keccak256("callback()"));
37 | attacker.callSender(func);
38 | }
39 |
40 | function _count() private {
41 | counter += 1;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/contracts/mocks/StorageSlotMock.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 |
3 | pragma solidity ^0.8.0;
4 |
5 | import "../utils/StorageSlot.sol";
6 |
7 | contract StorageSlotMock {
8 | using StorageSlot for bytes32;
9 |
10 | function setBoolean(bytes32 slot, bool value) public {
11 | slot.getBooleanSlot().value = value;
12 | }
13 |
14 | function setAddress(bytes32 slot, address value) public {
15 | slot.getAddressSlot().value = value;
16 | }
17 |
18 | function setBytes32(bytes32 slot, bytes32 value) public {
19 | slot.getBytes32Slot().value = value;
20 | }
21 |
22 | function setUint256(bytes32 slot, uint256 value) public {
23 | slot.getUint256Slot().value = value;
24 | }
25 |
26 | function getBoolean(bytes32 slot) public view returns (bool) {
27 | return slot.getBooleanSlot().value;
28 | }
29 |
30 | function getAddress(bytes32 slot) public view returns (address) {
31 | return slot.getAddressSlot().value;
32 | }
33 |
34 | function getBytes32(bytes32 slot) public view returns (bytes32) {
35 | return slot.getBytes32Slot().value;
36 | }
37 |
38 | function getUint256(bytes32 slot) public view returns (uint256) {
39 | return slot.getUint256Slot().value;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 fromUint256(uint256 value) public pure returns (string memory) {
9 | return Strings.toString(value);
10 | }
11 |
12 | function fromUint256Hex(uint256 value) public pure returns (string memory) {
13 | return Strings.toHexString(value);
14 | }
15 |
16 | function fromUint256HexFixed(uint256 value, uint256 length) public pure returns (string memory) {
17 | return Strings.toHexString(value, length);
18 | }
19 |
20 | function fromAddressHexFixed(address addr) public pure returns (string memory) {
21 | return Strings.toHexString(addr);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 virtual override {}
11 | }
12 |
13 | contract UUPSUpgradeableUnsafeMock is UUPSUpgradeableMock {
14 | function upgradeTo(address newImplementation) external virtual override {
15 | ERC1967Upgrade._upgradeToAndCall(newImplementation, bytes(""), false);
16 | }
17 |
18 | function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual override {
19 | ERC1967Upgrade._upgradeToAndCall(newImplementation, data, false);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/contracts/mocks/VotesMock.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 |
3 | pragma solidity ^0.8.0;
4 |
5 | import "../governance/utils/Votes.sol";
6 |
7 | contract VotesMock is Votes {
8 | mapping(address => uint256) private _balances;
9 | mapping(uint256 => address) private _owners;
10 |
11 | constructor(string memory name) EIP712(name, "1") {}
12 |
13 | function getTotalSupply() public view returns (uint256) {
14 | return _getTotalSupply();
15 | }
16 |
17 | function delegate(address account, address newDelegation) public {
18 | return _delegate(account, newDelegation);
19 | }
20 |
21 | function _getVotingUnits(address account) internal view virtual override returns (uint256) {
22 | return _balances[account];
23 | }
24 |
25 | function mint(address account, uint256 voteId) external {
26 | _balances[account] += 1;
27 | _owners[voteId] = account;
28 | _transferVotingUnits(address(0), account, 1);
29 | }
30 |
31 | function burn(uint256 voteId) external {
32 | address owner = _owners[voteId];
33 | _balances[owner] -= 1;
34 | _transferVotingUnits(owner, address(0), 1);
35 | }
36 |
37 | function getChainId() external view returns (uint256) {
38 | return block.chainid;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/contracts/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@openzeppelin/contracts",
3 | "description": "Secure Smart Contract library for Solidity",
4 | "version": "4.6.0",
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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/contracts/token/ERC1155/extensions/ERC1155Burnable.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/ERC1155Burnable.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../ERC1155.sol";
7 |
8 | /**
9 | * @dev Extension of {ERC1155} that allows token holders to destroy both their
10 | * own tokens and those that they have been approved to use.
11 | *
12 | * _Available since v3.1._
13 | */
14 | abstract contract ERC1155Burnable is ERC1155 {
15 | function burn(
16 | address account,
17 | uint256 id,
18 | uint256 value
19 | ) public virtual {
20 | require(
21 | account == _msgSender() || isApprovedForAll(account, _msgSender()),
22 | "ERC1155: caller is not token owner nor approved"
23 | );
24 |
25 | _burn(account, id, value);
26 | }
27 |
28 | function burnBatch(
29 | address account,
30 | uint256[] memory ids,
31 | uint256[] memory values
32 | ) public virtual {
33 | require(
34 | account == _msgSender() || isApprovedForAll(account, _msgSender()),
35 | "ERC1155: caller is not token owner nor approved"
36 | );
37 |
38 | _burnBatch(account, ids, values);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/contracts/token/ERC1155/extensions/ERC1155Pausable.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/ERC1155Pausable.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../ERC1155.sol";
7 | import "../../../security/Pausable.sol";
8 |
9 | /**
10 | * @dev ERC1155 token with pausable token transfers, minting and burning.
11 | *
12 | * Useful for scenarios such as preventing trades until the end of an evaluation
13 | * period, or having an emergency switch for freezing all token transfers in the
14 | * event of a large bug.
15 | *
16 | * _Available since v3.1._
17 | */
18 | abstract contract ERC1155Pausable is ERC1155, Pausable {
19 | /**
20 | * @dev See {ERC1155-_beforeTokenTransfer}.
21 | *
22 | * Requirements:
23 | *
24 | * - the contract must not be paused.
25 | */
26 | function _beforeTokenTransfer(
27 | address operator,
28 | address from,
29 | address to,
30 | uint256[] memory ids,
31 | uint256[] memory amounts,
32 | bytes memory data
33 | ) internal virtual override {
34 | super._beforeTokenTransfer(operator, from, to, ids, amounts, data);
35 |
36 | require(!paused(), "ERC1155Pausable: token transfer while paused");
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/contracts/token/ERC20/extensions/ERC20Pausable.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Pausable.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../ERC20.sol";
7 | import "../../../security/Pausable.sol";
8 |
9 | /**
10 | * @dev ERC20 token with pausable token transfers, minting and burning.
11 | *
12 | * Useful for scenarios such as preventing trades until the end of an evaluation
13 | * period, or having an emergency switch for freezing all token transfers in the
14 | * event of a large bug.
15 | */
16 | abstract contract ERC20Pausable is ERC20, Pausable {
17 | /**
18 | * @dev See {ERC20-_beforeTokenTransfer}.
19 | *
20 | * Requirements:
21 | *
22 | * - the contract must not be paused.
23 | */
24 | function _beforeTokenTransfer(
25 | address from,
26 | address to,
27 | uint256 amount
28 | ) internal virtual override {
29 | super._beforeTokenTransfer(from, to, amount);
30 |
31 | require(!paused(), "ERC20Pausable: token transfer while paused");
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/contracts/token/ERC20/presets/ERC20PresetFixedSupply.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/presets/ERC20PresetFixedSupply.sol)
3 | pragma solidity ^0.8.0;
4 |
5 | import "../extensions/ERC20Burnable.sol";
6 |
7 | /**
8 | * @dev {ERC20} token, including:
9 | *
10 | * - Preminted initial supply
11 | * - Ability for holders to burn (destroy) their tokens
12 | * - No access control mechanism (for minting/pausing) and hence no governance
13 | *
14 | * This contract uses {ERC20Burnable} to include burn capabilities - head to
15 | * its documentation for details.
16 | *
17 | * _Available since v3.4._
18 | *
19 | * _Deprecated in favor of https://wizard.openzeppelin.com/[Contracts Wizard]._
20 | */
21 | contract ERC20PresetFixedSupply is ERC20Burnable {
22 | /**
23 | * @dev Mints `initialSupply` amount of token and transfers them to `owner`.
24 | *
25 | * See {ERC20-constructor}.
26 | */
27 | constructor(
28 | string memory name,
29 | string memory symbol,
30 | uint256 initialSupply,
31 | address owner
32 | ) ERC20(name, symbol) {
33 | _mint(owner, initialSupply);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721Burnable.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (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 nor approved");
24 | _burn(tokenId);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721Pausable.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Pausable.sol)
3 |
4 | pragma solidity ^0.8.0;
5 |
6 | import "../ERC721.sol";
7 | import "../../../security/Pausable.sol";
8 |
9 | /**
10 | * @dev ERC721 token with pausable token transfers, minting and burning.
11 | *
12 | * Useful for scenarios such as preventing trades until the end of an evaluation
13 | * period, or having an emergency switch for freezing all token transfers in the
14 | * event of a large bug.
15 | */
16 | abstract contract ERC721Pausable is ERC721, Pausable {
17 | /**
18 | * @dev See {ERC721-_beforeTokenTransfer}.
19 | *
20 | * Requirements:
21 | *
22 | * - the contract must not be paused.
23 | */
24 | function _beforeTokenTransfer(
25 | address from,
26 | address to,
27 | uint256 tokenId
28 | ) internal virtual override {
29 | super._beforeTokenTransfer(from, to, tokenId);
30 |
31 | require(!paused(), "ERC721Pausable: token transfer while paused");
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/contracts/vendor/arbitrum/IMessageProvider.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: Apache-2.0
2 | // OpenZeppelin Contracts (last updated v4.6.0) (vendor/arbitrum/IMessageProvider.sol)
3 |
4 | /*
5 | * Copyright 2021, Offchain Labs, Inc.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | */
19 |
20 | pragma solidity ^0.8.0;
21 |
22 | interface IMessageProvider {
23 | event InboxMessageDelivered(uint256 indexed messageNum, bytes data);
24 |
25 | event InboxMessageDeliveredFromOrigin(uint256 indexed messageNum);
26 | }
27 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/contracts/vendor/optimism/ICrossDomainMessenger.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: MIT
2 | // OpenZeppelin Contracts (last updated v4.6.0) (vendor/optimism/ICrossDomainMessenger.sol)
3 | pragma solidity >0.5.0 <0.9.0;
4 |
5 | /**
6 | * @title ICrossDomainMessenger
7 | */
8 | interface ICrossDomainMessenger {
9 | /**********
10 | * Events *
11 | **********/
12 |
13 | event SentMessage(address indexed target, address sender, bytes message, uint256 messageNonce, uint256 gasLimit);
14 | event RelayedMessage(bytes32 indexed msgHash);
15 | event FailedRelayedMessage(bytes32 indexed msgHash);
16 |
17 | /*************
18 | * Variables *
19 | *************/
20 |
21 | function xDomainMessageSender() external view returns (address);
22 |
23 | /********************
24 | * Public Functions *
25 | ********************/
26 |
27 | /**
28 | * Sends a cross domain message to the target messenger.
29 | * @param _target Target contract address.
30 | * @param _message Message to send to the target.
31 | * @param _gasLimit Gas limit for the provided message.
32 | */
33 | function sendMessage(
34 | address _target,
35 | bytes calldata _message,
36 | uint32 _gasLimit
37 | ) external;
38 | }
39 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/docs/helpers.js:
--------------------------------------------------------------------------------
1 | const { version } = require('../package.json');
2 |
3 | module.exports = {
4 | 'github-link': (contractPath) => {
5 | if (typeof contractPath !== 'string') {
6 | throw new Error('Missing argument');
7 | }
8 | return `https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v${version}/contracts/${contractPath}`;
9 | },
10 | };
11 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-admin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UV-Labs/Tutorials/b853ba9166e115a8e5962304a8fd84f322c5392a/Foundry_Testing_ERC20/lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-admin.png
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-vote.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UV-Labs/Tutorials/b853ba9166e115a8e5962304a8fd84f322c5392a/Foundry_Testing_ERC20/lib/openzeppelin-contracts/docs/modules/ROOT/images/tally-vote.png
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/docs/prelude.hbs:
--------------------------------------------------------------------------------
1 | :github-icon: pass:[]
2 |
3 | {{#links}}
4 | :{{slug target.fullName}}: pass:normal[xref:{{path}}#{{target.anchor}}[`{{target.fullName}}`]]
5 | :xref-{{slug target.anchor}}: xref:{{path}}#{{target.anchor}}
6 | {{/links}}
7 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/migrations/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UV-Labs/Tutorials/b853ba9166e115a8e5962304a8fd84f322c5392a/Foundry_Testing_ERC20/lib/openzeppelin-contracts/migrations/.gitkeep
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/netlify.toml:
--------------------------------------------------------------------------------
1 | [build]
2 | command = "npm run docs"
3 | publish = "build/site"
4 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 --quiet --exit-code
7 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/scripts/gen-nav.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | const path = require('path');
4 | const proc = require('child_process');
5 | const startCase = require('lodash.startcase');
6 |
7 | const baseDir = process.argv[2];
8 |
9 | const files = proc.execFileSync(
10 | 'find', [baseDir, '-type', 'f'], { encoding: 'utf8' },
11 | ).split('\n').filter(s => s !== '');
12 |
13 | console.log('.API');
14 |
15 | function getPageTitle (directory) {
16 | switch (directory) {
17 | case 'metatx':
18 | return 'Meta Transactions';
19 | case 'common':
20 | return 'Common (Tokens)';
21 | default:
22 | return startCase(directory);
23 | }
24 | }
25 |
26 | const links = files.map((file) => {
27 | const doc = file.replace(baseDir, '');
28 | const title = path.parse(file).name;
29 |
30 | return {
31 | xref: `* xref:${doc}[${getPageTitle(title)}]`,
32 | title,
33 | };
34 | });
35 |
36 | // Case-insensitive sort based on titles (so 'token/ERC20' gets sorted as 'erc20')
37 | const sortedLinks = links.sort(function (a, b) {
38 | return a.title.toLowerCase().localeCompare(b.title.toLowerCase(), undefined, { numeric: true });
39 | });
40 |
41 | for (const link of sortedLinks) {
42 | console.log(link.xref);
43 | }
44 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/scripts/generate/run.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | const fs = require('fs');
4 | const format = require('./format-lines');
5 |
6 | function getVersion (path) {
7 | try {
8 | return fs
9 | .readFileSync(path, 'utf8')
10 | .match(/\/\/ OpenZeppelin Contracts \(last updated v\d+\.\d+\.\d+\)/)[0];
11 | } catch (err) {
12 | return null;
13 | }
14 | }
15 |
16 | for (const [ file, template ] of Object.entries({
17 | 'utils/math/SafeCast.sol': './templates/SafeCast',
18 | 'mocks/SafeCastMock.sol': './templates/SafeCastMock',
19 | })) {
20 | const path = `./contracts/${file}`;
21 | const version = getVersion(path);
22 | const content = format(
23 | '// SPDX-License-Identifier: MIT',
24 | (version ? version + ` (${file})\n` : ''),
25 | require(template).trimEnd(),
26 | );
27 |
28 | fs.writeFileSync(path, content);
29 | }
30 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/scripts/prepare-docs-solc.js:
--------------------------------------------------------------------------------
1 | const hre = require('hardhat');
2 |
3 | const { getCompilersDir } = require('hardhat/internal/util/global-dir');
4 | const { CompilerDownloader } = require('hardhat/internal/solidity/compiler/downloader');
5 | const { Compiler } = require('hardhat/internal/solidity/compiler');
6 |
7 | const [{ version }] = hre.config.solidity.compilers;
8 |
9 | async function getSolc () {
10 | const downloader = new CompilerDownloader(await getCompilersDir(), { forceSolcJs: true });
11 | const { compilerPath } = await downloader.getDownloadedCompilerPath(version);
12 | const compiler = new Compiler(compilerPath);
13 | return compiler.getSolc();
14 | }
15 |
16 | module.exports = Object.assign(getSolc(), { __esModule: true });
17 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/scripts/prepare-docs.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -o errexit
4 |
5 | OUTDIR=docs/modules/api/pages/
6 |
7 | if [ ! -d node_modules ]; then
8 | npm ci
9 | fi
10 |
11 | rm -rf "$OUTDIR"
12 |
13 | solidity-docgen \
14 | -t docs \
15 | -o "$OUTDIR" \
16 | -e contracts/mocks,contracts/examples \
17 | --output-structure readmes \
18 | --helpers ./docs/helpers.js \
19 | --solc-module ./scripts/prepare-docs-solc.js
20 |
21 | rm -f "$OUTDIR"/token/*/presets.md
22 |
23 | node scripts/gen-nav.js "$OUTDIR" > "$OUTDIR/../nav.adoc"
24 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/scripts/release/update-changelog-release-date.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | // Sets the release date of the current release in the changelog.
4 | // This is run automatically when npm version is run.
5 |
6 | const fs = require('fs');
7 | const cp = require('child_process');
8 |
9 | const suffix = process.env.PRERELEASE_SUFFIX || 'rc';
10 |
11 | const changelog = fs.readFileSync('CHANGELOG.md', 'utf8');
12 |
13 | // The changelog entry to be updated looks like this:
14 | // ## Unreleased
15 | // We need to add the version and release date in a YYYY-MM-DD format, so that it looks like this:
16 | // ## 2.5.3 (2019-04-25)
17 |
18 | const pkg = require('../../package.json');
19 | const version = pkg.version.replace(new RegExp('-' + suffix + '\\..*'), '');
20 |
21 | const header = new RegExp(`^## (Unreleased|${version})$`, 'm');
22 |
23 | if (!header.test(changelog)) {
24 | console.error('Missing changelog entry');
25 | process.exit(1);
26 | }
27 |
28 | const newHeader = pkg.version.indexOf(suffix) === -1
29 | ? `## ${version} (${new Date().toISOString().split('T')[0]})`
30 | : `## ${version}`;
31 |
32 | fs.writeFileSync('CHANGELOG.md', changelog.replace(header, newHeader));
33 |
34 | cp.execSync('git add CHANGELOG.md', { stdio: 'inherit' });
35 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 | }
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/test/helpers/txpool.js:
--------------------------------------------------------------------------------
1 | const { network } = require('hardhat');
2 | const { promisify } = require('util');
3 |
4 | const queue = promisify(setImmediate);
5 |
6 | async function countPendingTransactions () {
7 | return parseInt(
8 | await network.provider.send('eth_getBlockTransactionCountByNumber', ['pending']),
9 | );
10 | }
11 |
12 | async function batchInBlock (txs) {
13 | try {
14 | // disable auto-mining
15 | await network.provider.send('evm_setAutomine', [false]);
16 | // send all transactions
17 | const promises = txs.map(fn => fn());
18 | // wait for node to have all pending transactions
19 | while (txs.length > await countPendingTransactions()) {
20 | await queue();
21 | }
22 | // mine one block
23 | await network.provider.send('evm_mine');
24 | // fetch receipts
25 | const receipts = await Promise.all(promises);
26 | // Sanity check, all tx should be in the same block
27 | const minedBlocks = new Set(receipts.map(({ receipt }) => receipt.blockNumber));
28 | expect(minedBlocks.size).to.equal(1);
29 |
30 | return receipts;
31 | } finally {
32 | // enable auto-mining
33 | await network.provider.send('evm_setAutomine', [true]);
34 | }
35 | }
36 |
37 | module.exports = {
38 | countPendingTransactions,
39 | batchInBlock,
40 | };
41 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
6 | contract('TransparentUpgradeableProxy', function (accounts) {
7 | const [proxyAdminAddress, proxyAdminOwner] = accounts;
8 |
9 | const createProxy = async function (logic, admin, initData, opts) {
10 | return TransparentUpgradeableProxy.new(logic, admin, initData, opts);
11 | };
12 |
13 | shouldBehaveLikeProxy(createProxy, proxyAdminAddress, proxyAdminOwner);
14 | shouldBehaveLikeTransparentUpgradeableProxy(createProxy, accounts);
15 | });
16 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/test/token/ERC20/extensions/ERC20Capped.behavior.js:
--------------------------------------------------------------------------------
1 | const { expectRevert } = require('@openzeppelin/test-helpers');
2 |
3 | const { expect } = require('chai');
4 |
5 | function shouldBehaveLikeERC20Capped (minter, [other], cap) {
6 | describe('capped token', function () {
7 | const from = minter;
8 |
9 | it('starts with the correct cap', async function () {
10 | expect(await this.token.cap()).to.be.bignumber.equal(cap);
11 | });
12 |
13 | it('mints when amount is less than cap', async function () {
14 | await this.token.mint(other, cap.subn(1), { from });
15 | expect(await this.token.totalSupply()).to.be.bignumber.equal(cap.subn(1));
16 | });
17 |
18 | it('fails to mint if the amount exceeds the cap', async function () {
19 | await this.token.mint(other, cap.subn(1), { from });
20 | await expectRevert(this.token.mint(other, 2, { from }), 'ERC20Capped: cap exceeded');
21 | });
22 |
23 | it('fails to mint after cap is reached', async function () {
24 | await this.token.mint(other, cap, { from });
25 | await expectRevert(this.token.mint(other, 1, { from }), 'ERC20Capped: cap exceeded');
26 | });
27 | });
28 | }
29 |
30 | module.exports = {
31 | shouldBehaveLikeERC20Capped,
32 | };
33 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/test/utils/Base64.test.js:
--------------------------------------------------------------------------------
1 | const { expect } = require('chai');
2 |
3 | const Base64Mock = artifacts.require('Base64Mock');
4 |
5 | contract('Strings', function () {
6 | beforeEach(async function () {
7 | this.base64 = await Base64Mock.new();
8 | });
9 |
10 | describe('from bytes - base64', function () {
11 | it('converts to base64 encoded string with double padding', async function () {
12 | const TEST_MESSAGE = 'test';
13 | const input = web3.utils.asciiToHex(TEST_MESSAGE);
14 | expect(await this.base64.encode(input)).to.equal('dGVzdA==');
15 | });
16 |
17 | it('converts to base64 encoded string with single padding', async function () {
18 | const TEST_MESSAGE = 'test1';
19 | const input = web3.utils.asciiToHex(TEST_MESSAGE);
20 | expect(await this.base64.encode(input)).to.equal('dGVzdDE=');
21 | });
22 |
23 | it('converts to base64 encoded string without padding', async function () {
24 | const TEST_MESSAGE = 'test12';
25 | const input = web3.utils.asciiToHex(TEST_MESSAGE);
26 | expect(await this.base64.encode(input)).to.equal('dGVzdDEy');
27 | });
28 |
29 | it('empty bytes', async function () {
30 | expect(await this.base64.encode([])).to.equal('');
31 | });
32 | });
33 | });
34 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/lib/openzeppelin-contracts/test/utils/escrow/ConditionalEscrow.test.js:
--------------------------------------------------------------------------------
1 | const { ether, expectRevert } = require('@openzeppelin/test-helpers');
2 | const { shouldBehaveLikeEscrow } = require('./Escrow.behavior');
3 |
4 | const ConditionalEscrowMock = artifacts.require('ConditionalEscrowMock');
5 |
6 | contract('ConditionalEscrow', function (accounts) {
7 | const [ owner, payee, ...otherAccounts ] = accounts;
8 |
9 | beforeEach(async function () {
10 | this.escrow = await ConditionalEscrowMock.new({ from: owner });
11 | });
12 |
13 | context('when withdrawal is allowed', function () {
14 | beforeEach(async function () {
15 | await Promise.all(otherAccounts.map(payee => this.escrow.setAllowed(payee, true)));
16 | });
17 |
18 | shouldBehaveLikeEscrow(owner, otherAccounts);
19 | });
20 |
21 | context('when withdrawal is disallowed', function () {
22 | const amount = ether('23');
23 |
24 | beforeEach(async function () {
25 | await this.escrow.setAllowed(payee, false);
26 | });
27 |
28 | it('reverts on withdrawals', async function () {
29 | await this.escrow.deposit(payee, { from: owner, value: amount });
30 |
31 | await expectRevert(this.escrow.withdraw(payee, { from: owner }),
32 | 'ConditionalEscrow: payee is not allowed to withdraw',
33 | );
34 | });
35 | });
36 | });
37 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/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 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/public/gas-report.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/UV-Labs/Tutorials/b853ba9166e115a8e5962304a8fd84f322c5392a/Foundry_Testing_ERC20/public/gas-report.png
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/remappings.txt:
--------------------------------------------------------------------------------
1 | ds-test/=lib/forge-std/lib/ds-test/src/
2 | forge-std/=lib/forge-std/src/
3 | openzeppelin/=lib/openzeppelin-contracts/
4 |
--------------------------------------------------------------------------------
/Foundry_Testing_ERC20/src/MyToken.sol:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: UNLICENSED
2 | pragma solidity ^0.8.13;
3 |
4 | import "openzeppelin/contracts/token/ERC20/ERC20.sol";
5 |
6 | contract MyToken is ERC20{
7 |
8 | constructor (string memory _name, string memory _symbol) ERC20 (_name,_symbol){
9 | }
10 |
11 | function mint(address to, uint256 amount) public virtual {
12 | _mint(to,amount);
13 | }
14 |
15 | function burn(address form, uint amount) public virtual {
16 | _burn(form, amount);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/GameofThronesNFT/jsonMetadata/1.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Jon Snow",
3 | "description": "I know Nothing!",
4 | "image": "https://gateway.pinata.cloud/ipfs/QmZbEETnL21Mq9ry5MmQ5mrzzCQALjhxwHZxN8Y5SZWyLM",
5 | "attributes": [
6 | {
7 | "trait_type": "Eye color",
8 | "value": "Black"
9 | },
10 | {
11 | "trait_type": "Hair color",
12 | "value": "Black"
13 | }, {
14 | "trait_type": "House Name",
15 | "value": "Starks / Targaryens"
16 | }
17 | ]
18 | }
--------------------------------------------------------------------------------
/GameofThronesNFT/jsonMetadata/2.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Cersei Lannister",
3 | "description": "Power is Power!!",
4 | "image": "https://gateway.pinata.cloud/ipfs/QmXHfXgSFsACQRwkt5fs4AvMzzBKKwSTLxgegbXYjJeFaK",
5 | "attributes": [
6 | {
7 | "trait_type": "Eye color",
8 | "value": "Brown"
9 | },
10 | {
11 | "trait_type": "Hair color",
12 | "value": "Blonde"
13 | }, {
14 | "trait_type": "House Name",
15 | "value": "Lannisters"
16 | }
17 | ]
18 | }
--------------------------------------------------------------------------------
/GameofThronesNFT/jsonMetadata/3.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Daenerys Targaryen",
3 | "description": "Mother of Dragons!",
4 | "image": "https://gateway.pinata.cloud/ipfs/QmcMBqNKNeXmcXfY3QTc7Nh6qBBfjUNjdahNetZBJzFScH",
5 | "attributes": [
6 | {
7 | "trait_type": "Eye color",
8 | "value": "Light Brown"
9 | },
10 | {
11 | "trait_type": "Hair color",
12 | "value": "Golden"
13 | }, {
14 | "trait_type": "House Name",
15 | "value": "Targaryens"
16 | }
17 | ]
18 | }
--------------------------------------------------------------------------------
/GameofThronesNFT/jsonMetadata/4.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Night King",
3 | "description": "I'm going to destroy you.",
4 | "image": "https://gateway.pinata.cloud/ipfs/QmUeeYTYgwmzrUfmeZY8jc58nmNrq64TCBxDj9zvJYHFoC",
5 | "attributes": [
6 | {
7 | "trait_type": "Eye color",
8 | "value": "Blue"
9 | },
10 | {
11 | "trait_type": "Hair color",
12 | "value": "No Hair"
13 | }, {
14 | "trait_type": "House Name",
15 | "value": "White Walker"
16 | }
17 | ]
18 | }
--------------------------------------------------------------------------------
/GameofThronesNFT/jsonMetadata/5.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Tyrion Lannister",
3 | "description": "I have to disagree. Death is so final, yet life is full of possibilities.",
4 | "image": "https://gateway.pinata.cloud/ipfs/QmVWFHGYs7ihtTVeprvy1XxwJ2TzxFK9tbWagnYjTc5Tfm",
5 | "attributes": [
6 | {
7 | "trait_type": "Eye color",
8 | "value": "Brown"
9 | },
10 | {
11 | "trait_type": "Hair color",
12 | "value": "Blonde"
13 | }, {
14 | "trait_type": "House Name",
15 | "value": "Lannisters"
16 | }
17 | ]
18 | }
--------------------------------------------------------------------------------
/GameofThronesNFT/jsonMetadata/6.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Arya Stark",
3 | "description": "Not Today!!!",
4 | "image": "https://gateway.pinata.cloud/ipfs/QmdzZWdTegjsMXhr2bZao2sxhDm2ATqhzDzEcpuS3uzwqa",
5 | "attributes": [
6 | {
7 | "trait_type": "Eye color",
8 | "value": "Brown"
9 | },
10 | {
11 | "trait_type": "Hair color",
12 | "value": "Dark Brown"
13 | }, {
14 | "trait_type": "House Name",
15 | "value": "Starks"
16 | }
17 | ]
18 | }
--------------------------------------------------------------------------------
/GameofThronesNFT/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "gameofthronesnft",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC"
12 | }
13 |
--------------------------------------------------------------------------------
/Mainnet-Forking/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | /.env
--------------------------------------------------------------------------------
/Mainnet-Forking/README.md:
--------------------------------------------------------------------------------
1 | ## Commands to run the script
2 |
3 | Running mainnet fork: `npx hardhat node`
4 |
5 | Transferring UNI token: `npx hardhat run scripts/transfer.js`
--------------------------------------------------------------------------------
/Mainnet-Forking/hardhat.config.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type import('hardhat/config').HardhatUserConfig
3 | */
4 |
5 | require('@nomiclabs/hardhat-ethers')
6 | require('dotenv').config();
7 |
8 | const { ALCHEMY_KEY } = process.env
9 |
10 | module.exports = {
11 | solidity: "0.7.3",
12 | networks: {
13 | hardhat: {
14 | forking: {
15 | url: `https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_KEY}`,
16 | blockNumber: 14608000,
17 | },
18 | },
19 | },
20 | };
21 |
--------------------------------------------------------------------------------
/Mainnet-Forking/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "mainnet-forking",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "devDependencies": {
13 | "@nomiclabs/hardhat-ethers": "^2.0.2",
14 | "@nomiclabs/hardhat-waffle": "^2.0.1",
15 | "chai": "^4.3.4",
16 | "ethereum-waffle": "^3.3.0",
17 | "ethers": "^5.6.4",
18 | "hardhat": "^2.9.3"
19 | },
20 | "dependencies": {
21 | "dotenv": "^16.0.0"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/NFT-verse/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | /.env
3 | /artifacts
--------------------------------------------------------------------------------
/NFT-verse/NFTMetadata.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "UVLabs",
3 | "image": "https://gateway.pinata.cloud/ipfs/QmTfjtxzekdGkZvm9qcFaFMWAsgkjUtiU7knSyQ3d2ze62",
4 | "name": "UVLabs"
5 | }
--------------------------------------------------------------------------------
/NFT-verse/artifacts/@openzeppelin/contracts/token/ERC721/ERC721.sol/ERC721.dbg.json:
--------------------------------------------------------------------------------
1 | {
2 | "_format": "hh-sol-dbg-1",
3 | "buildInfo": "../../../../../build-info/033cd62698f0725a2ff122cf7d11bc97.json"
4 | }
5 |
--------------------------------------------------------------------------------
/NFT-verse/artifacts/@openzeppelin/contracts/token/ERC721/IERC721.sol/IERC721.dbg.json:
--------------------------------------------------------------------------------
1 | {
2 | "_format": "hh-sol-dbg-1",
3 | "buildInfo": "../../../../../build-info/033cd62698f0725a2ff122cf7d11bc97.json"
4 | }
5 |
--------------------------------------------------------------------------------
/NFT-verse/artifacts/@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol/IERC721Receiver.dbg.json:
--------------------------------------------------------------------------------
1 | {
2 | "_format": "hh-sol-dbg-1",
3 | "buildInfo": "../../../../../build-info/033cd62698f0725a2ff122cf7d11bc97.json"
4 | }
5 |
--------------------------------------------------------------------------------
/NFT-verse/artifacts/@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol/IERC721Receiver.json:
--------------------------------------------------------------------------------
1 | {
2 | "_format": "hh-sol-artifact-1",
3 | "contractName": "IERC721Receiver",
4 | "sourceName": "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol",
5 | "abi": [
6 | {
7 | "inputs": [
8 | {
9 | "internalType": "address",
10 | "name": "operator",
11 | "type": "address"
12 | },
13 | {
14 | "internalType": "address",
15 | "name": "from",
16 | "type": "address"
17 | },
18 | {
19 | "internalType": "uint256",
20 | "name": "tokenId",
21 | "type": "uint256"
22 | },
23 | {
24 | "internalType": "bytes",
25 | "name": "data",
26 | "type": "bytes"
27 | }
28 | ],
29 | "name": "onERC721Received",
30 | "outputs": [
31 | {
32 | "internalType": "bytes4",
33 | "name": "",
34 | "type": "bytes4"
35 | }
36 | ],
37 | "stateMutability": "nonpayable",
38 | "type": "function"
39 | }
40 | ],
41 | "bytecode": "0x",
42 | "deployedBytecode": "0x",
43 | "linkReferences": {},
44 | "deployedLinkReferences": {}
45 | }
46 |
--------------------------------------------------------------------------------
/NFT-verse/artifacts/@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol/ERC721URIStorage.dbg.json:
--------------------------------------------------------------------------------
1 | {
2 | "_format": "hh-sol-dbg-1",
3 | "buildInfo": "../../../../../../build-info/033cd62698f0725a2ff122cf7d11bc97.json"
4 | }
5 |
--------------------------------------------------------------------------------
/NFT-verse/artifacts/@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol/IERC721Metadata.dbg.json:
--------------------------------------------------------------------------------
1 | {
2 | "_format": "hh-sol-dbg-1",
3 | "buildInfo": "../../../../../../build-info/033cd62698f0725a2ff122cf7d11bc97.json"
4 | }
5 |
--------------------------------------------------------------------------------
/NFT-verse/artifacts/@openzeppelin/contracts/utils/Address.sol/Address.dbg.json:
--------------------------------------------------------------------------------
1 | {
2 | "_format": "hh-sol-dbg-1",
3 | "buildInfo": "../../../../build-info/033cd62698f0725a2ff122cf7d11bc97.json"
4 | }
5 |
--------------------------------------------------------------------------------
/NFT-verse/artifacts/@openzeppelin/contracts/utils/Address.sol/Address.json:
--------------------------------------------------------------------------------
1 | {
2 | "_format": "hh-sol-artifact-1",
3 | "contractName": "Address",
4 | "sourceName": "@openzeppelin/contracts/utils/Address.sol",
5 | "abi": [],
6 | "bytecode": "0x60566050600b82828239805160001a6073146043577f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220982cb7716f9c9dd51c9954398a6fcbeb93aa72fefaa3c4cc058ae53726e3ec5564736f6c63430008010033",
7 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220982cb7716f9c9dd51c9954398a6fcbeb93aa72fefaa3c4cc058ae53726e3ec5564736f6c63430008010033",
8 | "linkReferences": {},
9 | "deployedLinkReferences": {}
10 | }
11 |
--------------------------------------------------------------------------------
/NFT-verse/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json:
--------------------------------------------------------------------------------
1 | {
2 | "_format": "hh-sol-dbg-1",
3 | "buildInfo": "../../../../build-info/033cd62698f0725a2ff122cf7d11bc97.json"
4 | }
5 |
--------------------------------------------------------------------------------
/NFT-verse/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.json:
--------------------------------------------------------------------------------
1 | {
2 | "_format": "hh-sol-artifact-1",
3 | "contractName": "Context",
4 | "sourceName": "@openzeppelin/contracts/utils/Context.sol",
5 | "abi": [],
6 | "bytecode": "0x",
7 | "deployedBytecode": "0x",
8 | "linkReferences": {},
9 | "deployedLinkReferences": {}
10 | }
11 |
--------------------------------------------------------------------------------
/NFT-verse/artifacts/@openzeppelin/contracts/utils/Counters.sol/Counters.dbg.json:
--------------------------------------------------------------------------------
1 | {
2 | "_format": "hh-sol-dbg-1",
3 | "buildInfo": "../../../../build-info/033cd62698f0725a2ff122cf7d11bc97.json"
4 | }
5 |
--------------------------------------------------------------------------------
/NFT-verse/artifacts/@openzeppelin/contracts/utils/Counters.sol/Counters.json:
--------------------------------------------------------------------------------
1 | {
2 | "_format": "hh-sol-artifact-1",
3 | "contractName": "Counters",
4 | "sourceName": "@openzeppelin/contracts/utils/Counters.sol",
5 | "abi": [],
6 | "bytecode": "0x60566050600b82828239805160001a6073146043577f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220f7ab9631425d9ad99cae1f5e6434a30d6ffcac09b211e47ed4128660ae7abc6f64736f6c63430008010033",
7 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220f7ab9631425d9ad99cae1f5e6434a30d6ffcac09b211e47ed4128660ae7abc6f64736f6c63430008010033",
8 | "linkReferences": {},
9 | "deployedLinkReferences": {}
10 | }
11 |
--------------------------------------------------------------------------------
/NFT-verse/artifacts/@openzeppelin/contracts/utils/Strings.sol/Strings.dbg.json:
--------------------------------------------------------------------------------
1 | {
2 | "_format": "hh-sol-dbg-1",
3 | "buildInfo": "../../../../build-info/033cd62698f0725a2ff122cf7d11bc97.json"
4 | }
5 |
--------------------------------------------------------------------------------
/NFT-verse/artifacts/@openzeppelin/contracts/utils/Strings.sol/Strings.json:
--------------------------------------------------------------------------------
1 | {
2 | "_format": "hh-sol-artifact-1",
3 | "contractName": "Strings",
4 | "sourceName": "@openzeppelin/contracts/utils/Strings.sol",
5 | "abi": [],
6 | "bytecode": "0x60566050600b82828239805160001a6073146043577f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220b24ea44a0ec1e8b21b9dc1c19754dc24b2fbbbabf1140e79f107f54bfb5da16d64736f6c63430008010033",
7 | "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220b24ea44a0ec1e8b21b9dc1c19754dc24b2fbbbabf1140e79f107f54bfb5da16d64736f6c63430008010033",
8 | "linkReferences": {},
9 | "deployedLinkReferences": {}
10 | }
11 |
--------------------------------------------------------------------------------
/NFT-verse/artifacts/@openzeppelin/contracts/utils/introspection/ERC165.sol/ERC165.dbg.json:
--------------------------------------------------------------------------------
1 | {
2 | "_format": "hh-sol-dbg-1",
3 | "buildInfo": "../../../../../build-info/033cd62698f0725a2ff122cf7d11bc97.json"
4 | }
5 |
--------------------------------------------------------------------------------
/NFT-verse/artifacts/@openzeppelin/contracts/utils/introspection/ERC165.sol/ERC165.json:
--------------------------------------------------------------------------------
1 | {
2 | "_format": "hh-sol-artifact-1",
3 | "contractName": "ERC165",
4 | "sourceName": "@openzeppelin/contracts/utils/introspection/ERC165.sol",
5 | "abi": [
6 | {
7 | "inputs": [
8 | {
9 | "internalType": "bytes4",
10 | "name": "interfaceId",
11 | "type": "bytes4"
12 | }
13 | ],
14 | "name": "supportsInterface",
15 | "outputs": [
16 | {
17 | "internalType": "bool",
18 | "name": "",
19 | "type": "bool"
20 | }
21 | ],
22 | "stateMutability": "view",
23 | "type": "function"
24 | }
25 | ],
26 | "bytecode": "0x",
27 | "deployedBytecode": "0x",
28 | "linkReferences": {},
29 | "deployedLinkReferences": {}
30 | }
31 |
--------------------------------------------------------------------------------
/NFT-verse/artifacts/@openzeppelin/contracts/utils/introspection/IERC165.sol/IERC165.dbg.json:
--------------------------------------------------------------------------------
1 | {
2 | "_format": "hh-sol-dbg-1",
3 | "buildInfo": "../../../../../build-info/033cd62698f0725a2ff122cf7d11bc97.json"
4 | }
5 |
--------------------------------------------------------------------------------
/NFT-verse/artifacts/@openzeppelin/contracts/utils/introspection/IERC165.sol/IERC165.json:
--------------------------------------------------------------------------------
1 | {
2 | "_format": "hh-sol-artifact-1",
3 | "contractName": "IERC165",
4 | "sourceName": "@openzeppelin/contracts/utils/introspection/IERC165.sol",
5 | "abi": [
6 | {
7 | "inputs": [
8 | {
9 | "internalType": "bytes4",
10 | "name": "interfaceId",
11 | "type": "bytes4"
12 | }
13 | ],
14 | "name": "supportsInterface",
15 | "outputs": [
16 | {
17 | "internalType": "bool",
18 | "name": "",
19 | "type": "bool"
20 | }
21 | ],
22 | "stateMutability": "view",
23 | "type": "function"
24 | }
25 | ],
26 | "bytecode": "0x",
27 | "deployedBytecode": "0x",
28 | "linkReferences": {},
29 | "deployedLinkReferences": {}
30 | }
31 |
--------------------------------------------------------------------------------
/NFT-verse/artifacts/contracts/NFT.sol/NFT.dbg.json:
--------------------------------------------------------------------------------
1 | {
2 | "_format": "hh-sol-dbg-1",
3 | "buildInfo": "../../build-info/b59e41de16b04d782f58364aa78f1194.json"
4 | }
5 |
--------------------------------------------------------------------------------
/NFT-verse/hardhat.config.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type import('hardhat/config').HardhatUserConfig
3 | */
4 |
5 | require('dotenv').config();
6 | require('@nomiclabs/hardhat-ethers')
7 |
8 | const {API_URL, PRIVATE_KEY} = process.env;
9 |
10 | module.exports = {
11 | solidity: "0.8.1",
12 | defaultNetworks: "hardhat",
13 | networks: {
14 | hardhat: {},
15 | "mumbai-matic": {
16 | url: API_URL,
17 | accounts: [`0x${PRIVATE_KEY}`],
18 | },
19 | }
20 | }
--------------------------------------------------------------------------------
/NFT-verse/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nft-verse",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "devDependencies": {
13 | "@nomiclabs/hardhat-ethers": "^2.0.5",
14 | "ethers": "^5.0.0",
15 | "hardhat": "^2.9.2"
16 | },
17 | "dependencies": {
18 | "@openzeppelin/contracts": "^4.5.0",
19 | "dotenv": "^16.0.0"
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/NFT-verse/scripts/deploy.js:
--------------------------------------------------------------------------------
1 | const { ethers } = require("hardhat");
2 |
3 | async function main() {
4 | const NFT = await ethers.getContractFactory("NFT");
5 | const deployedNFT = await NFT.deploy();
6 | console.log(`Contract deployed to address: ${deployedNFT.address}`)
7 | }
8 |
9 | main()
10 | .then(() => process.exit(0))
11 | .catch((error) => {
12 | console.error(error);
13 | process.exit(1);
14 | });
--------------------------------------------------------------------------------
/NFT-verse/scripts/mint.js:
--------------------------------------------------------------------------------
1 | const hre = require('hardhat');
2 |
3 | async function main() {
4 | const tokenURI = "https://gateway.pinata.cloud/ipfs/Qmc4ywZjPsHAb67PVNPjRpjKgcqEAhxwy1FzkdPHoo5e4h";
5 | // this is URL that you will get from Pinata
6 |
7 | const nftContractFactory = await ethers.getContractFactory("NFT");
8 | const nftContractInstance = new ethers.Contract(
9 | "0x4D89D079aCfef45b7cDA107533A89d5c44DCFb94", //insert contract address that gets deployed
10 | nftContractFactory.interface,
11 | )
12 | const signer = await ethers.provider.getSigner();
13 | const signerAddress = await signer.getAddress()
14 | const txn = await nftContractInstance.connect(signer).mint(signerAddress, tokenURI)
15 | txn.wait();
16 | console.log(`Your transaction has been successfully broadcasted! The transaction hash is ${txn.hash}`);
17 | if (hre.network.config.url != 'http://127.0.0.1:8545') {
18 | console.log(`\nPlease follow this link https://testnets.opensea.io/${signerAddress}`);
19 | };
20 | };
21 |
22 | main()
23 | .then(() => process.exit(0))
24 | .catch((error) => {
25 | console.error(error);
26 | process.exit(1);
27 | });
--------------------------------------------------------------------------------
/NFT-verse_v2/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | /.env
3 | /artifacts
--------------------------------------------------------------------------------
/NFT-verse_v2/NFTMetadata.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "UVLabs",
3 | "image": "https://gateway.pinata.cloud/ipfs/QmTfjtxzekdGkZvm9qcFaFMWAsgkjUtiU7knSyQ3d2ze62",
4 | "name": "UVLabs"
5 | }
--------------------------------------------------------------------------------
/NFT-verse_v2/deploy/00_deploy_NFT.js:
--------------------------------------------------------------------------------
1 | const func = async function (hre) {
2 | const { getNamedAccounts, deployments } = hre;
3 | const { deployer } = await getNamedAccounts();
4 | const { deploy } = deployments;
5 | await deploy("NFT", {
6 | from: deployer,
7 | log: true,
8 | });
9 |
10 | }
11 | func.tags = ["NFT"];
12 |
13 | module.exports = func;
14 |
--------------------------------------------------------------------------------
/NFT-verse_v2/deployments/localhost/.chainId:
--------------------------------------------------------------------------------
1 | 31337
--------------------------------------------------------------------------------
/NFT-verse_v2/deployments/mumbai-matic/.chainId:
--------------------------------------------------------------------------------
1 | 80001
--------------------------------------------------------------------------------
/NFT-verse_v2/hardhat.config.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @type import('hardhat/config').HardhatUserConfig
3 | */
4 |
5 | require('dotenv').config();
6 | require('@nomiclabs/hardhat-ethers');
7 | require('hardhat-deploy');
8 |
9 | const {API_URL, PRIVATE_KEY} = process.env;
10 |
11 | module.exports = {
12 | solidity: "0.8.1",
13 | defaultNetworks: "hardhat",
14 | networks: {
15 | hardhat: {},
16 | "mumbai-matic": {
17 | url: API_URL,
18 | accounts: [`0x${PRIVATE_KEY}`],
19 | },
20 | },
21 | namedAccounts: {
22 | deployer: 0
23 | }
24 | }
--------------------------------------------------------------------------------
/NFT-verse_v2/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nft-verse-v2",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "devDependencies": {
13 | "@nomiclabs/hardhat-ethers": "^2.0.5",
14 | "ethers": "^5.0.0",
15 | "hardhat": "^2.9.2"
16 | },
17 | "dependencies": {
18 | "@openzeppelin/contracts": "^4.5.0",
19 | "dotenv": "^16.0.0",
20 | "hardhat-deploy": "^0.11.4"
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/NFT-verse_v2/scripts/deploy.js:
--------------------------------------------------------------------------------
1 | const { ethers } = require("hardhat");
2 | require('dotenv').config();
3 |
4 | async function main() {
5 | const NFT = await ethers.getContractFactory("NFT");
6 | const deployedNFT = await NFT.deploy();
7 | console.log(`Contract deployed to address: ${deployedNFT.address}`)
8 | }
9 |
10 | main()
11 | .then(() => process.exit(0))
12 | .catch((error) => {
13 | console.error(error);
14 | process.exit(1);
15 | });
--------------------------------------------------------------------------------
/NFT-verse_v2/scripts/mint.js:
--------------------------------------------------------------------------------
1 | const hre = require('hardhat');
2 |
3 | async function main() {
4 | const tokenURI = "https://gateway.pinata.cloud/ipfs/Qmc4ywZjPsHAb67PVNPjRpjKgcqEAhxwy1FzkdPHoo5e4h";
5 | // this is URL that you will get from Pinata
6 |
7 | const nftContractFactory = await ethers.getContractFactory("NFT");
8 | const nftContractInstance = new ethers.Contract(
9 | "0x4D89D079aCfef45b7cDA107533A89d5c44DCFb94", //insert contract address that gets deployed
10 | nftContractFactory.interface,
11 | )
12 | const signer = await ethers.provider.getSigner();
13 | const signerAddress = await signer.getAddress()
14 | const txn = await nftContractInstance.connect(signer).mint(signerAddress, tokenURI)
15 | txn.wait();
16 | console.log(`Your transaction has been successfully broadcasted! The transaction hash is ${txn.hash}`);
17 | if (hre.network.config.url != 'http://127.0.0.1:8545') {
18 | console.log(`\nPlease follow this link https://testnets.opensea.io/${signerAddress}`);
19 | };
20 | };
21 |
22 | main()
23 | .then(() => process.exit(0))
24 | .catch((error) => {
25 | console.error(error);
26 | process.exit(1);
27 | });
--------------------------------------------------------------------------------
/uni_swap/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .env
3 | coverage
4 | coverage.json
5 | typechain
6 |
7 | #Hardhat files
8 | cache
9 | artifacts
10 |
--------------------------------------------------------------------------------
/uni_swap/README.md:
--------------------------------------------------------------------------------
1 | # Basic Sample Hardhat Project
2 |
3 | This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, a sample script that deploys that contract, and an example of a task implementation, which simply lists the available accounts.
4 |
5 | Try running some of the following tasks:
6 |
7 | ```shell
8 | npx hardhat accounts
9 | npx hardhat compile
10 | npx hardhat clean
11 | npx hardhat test
12 | npx hardhat node
13 | node scripts/sample-script.js
14 | npx hardhat help
15 | ```
16 |
--------------------------------------------------------------------------------
/uni_swap/contracts/interfaces/IERC20.sol:
--------------------------------------------------------------------------------
1 | pragma solidity ^0.8;
2 |
3 | interface IERC20 {
4 | function totalSupply() external view returns (uint);
5 | function balanceOf(address account) external view returns (uint);
6 | function transfer(address recipient, uint amount) external returns (bool);
7 | function allowance(address owner, address spender) external view returns (uint);
8 | function approve(address spender, uint amount) external returns (bool);
9 | function transferFrom(
10 | address sender,
11 | address recipient,
12 | uint amount
13 | ) external returns (bool);
14 | event Transfer(address indexed from, address indexed to, uint value);
15 | event Approval(address indexed owner, address indexed spender, uint value);
16 | }
--------------------------------------------------------------------------------
/uni_swap/contracts/interfaces/Uniswap.sol:
--------------------------------------------------------------------------------
1 | pragma solidity ^0.8;
2 |
3 |
4 | interface IUniswapV2Router {
5 | function swapExactTokensForTokens(
6 | uint amounswapExactTokensForTokenstIn,
7 | uint amountOutMin,
8 | address[] calldata path,
9 | address to,
10 | uint deadline
11 | ) external returns (uint[] memory amounts);
12 | function WETH() external pure returns (address);
13 | function getAmountsOut(uint amountIn, address[] memory path) external view returns (uint[] memory amounts);
14 |
15 | }
--------------------------------------------------------------------------------
/uni_swap/hardhat.config.js:
--------------------------------------------------------------------------------
1 | require("@nomiclabs/hardhat-waffle");
2 | require("@nomiclabs/hardhat-ethers");
3 | require('dotenv').config();
4 |
5 |
6 | /**
7 | * @type import('hardhat/config').HardhatUserConfig
8 | */
9 | module.exports = {
10 | solidity: "0.8.4",
11 | networks: {
12 | hardhat: {
13 | forking: {
14 | url: `https://eth-mainnet.alchemyapi.io/v2/${process.env.ALCHEMY_KEY}`,
15 | blockNumber: 14638929,
16 | },
17 | },
18 | },
19 | };
20 |
--------------------------------------------------------------------------------
/uni_swap/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "hardhat-project",
3 | "devDependencies": {
4 | "@nomiclabs/hardhat-ethers": "^2.0.5",
5 | "@nomiclabs/hardhat-waffle": "^2.0.3",
6 | "chai": "^4.3.6",
7 | "ethereum-waffle": "^3.4.4",
8 | "ethers": "^5.6.4",
9 | "hardhat": "^2.9.3",
10 | "dotenv": "^16.0.0",
11 | "@uniswap/v2-core": "1.0.1",
12 | "@uniswap/v3-core": "1.0.0",
13 | "@uniswap/v3-periphery": "1.3.0"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/uni_swap/result.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 | Test Swap
4 | 1) should swap
5 |
6 |
7 | 0 passing (3s)
8 | 1 failing
9 |
10 | 1) Test Swap
11 | should swap:
12 | Error: could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.6.4)
13 | at Logger.makeError (node_modules/@ethersproject/logger/src.ts/index.ts:261:28)
14 | at Logger.throwError (node_modules/@ethersproject/logger/src.ts/index.ts:273:20)
15 | at JsonRpcProvider. (node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:431:23)
16 | at step (node_modules/@ethersproject/providers/lib/json-rpc-provider.js:48:23)
17 | at Object.next (node_modules/@ethersproject/providers/lib/json-rpc-provider.js:29:53)
18 | at fulfilled (node_modules/@ethersproject/providers/lib/json-rpc-provider.js:20:58)
19 | at runNextTicks (internal/process/task_queues.js:62:5)
20 | at listOnTimeout (internal/timers.js:523:9)
21 | at processTimers (internal/timers.js:497:7)
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/uni_swap/scripts/deploy.js:
--------------------------------------------------------------------------------
1 | const { ethers } = require("hardhat");
2 | async function main() {
3 | const factory = await ethers.getContractFactory("testSwap");
4 | // If we had constructor arguments, they would be passed into deploy()
5 | const contract = await factory.deploy();
6 | await contract.deployed();
7 | // The address the Contract WILL have once mined
8 | console.log("Contract deployed to: ", contract.address);
9 | }
10 |
11 | main()
12 | .then(() => process.exit(0))
13 | .catch(error => {
14 | console.error(error);
15 | process.exit(1);
16 | });
--------------------------------------------------------------------------------