// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract PolkadotCTF { address public winner; event FlagCaptured(address indexed player); // Encoded parts of the flag as byte arrays bytes private part1 = hex"50437b497354686973"; bytes private part2 = hex"546865466c61674f72"; bytes private part3 = hex"644e6f747d"; // Function to decode the parts and get the full flag function decodeFlag() public view returns (string memory) { return string(abi.encodePacked(part1, part2, part3)); } // Function to capture the flag function captureFlag(string memory _solution) public { string memory decodedFlag = decodeFlag(); require(keccak256(abi.encodePacked(_solution)) == keccak256(abi.encodePacked(decodedFlag)), "Incorrect solution"); winner = msg.sender; emit FlagCaptured(msg.sender); } // Function to get the flag function getFlag() public view returns (string memory) { require(msg.sender == winner, "You are not the winner"); return decodeFlag(); } }