creation_sourcecode: {{
    "language": "Solidity",
    "settings": {
      "evmVersion": "london",
      "libraries": {},
      "metadata": {
        "bytecodeHash": "none",
        "useLiteralContent": true
      },
      "optimizer": {
        "enabled": true,
        "runs": 10
      },
      "remappings": [],
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      }
    },
    "sources": {
      "contracts/common/diamonds/interfaces/IDiamondCut.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.23;\n\n/******************************************************************************\\\n* Author: Nick Mudge <nick@perfectabstractions.com> (https://twitter.com/mudgen)\n* EIP-2535 Diamonds: https://eips.ethereum.org/EIPS/eip-2535\n/******************************************************************************/\n\ninterface IDiamondCut {\n    enum FacetCutAction {\n        Add,\n        Replace,\n        Remove\n    }\n    // Add=0, Replace=1, Remove=2\n\n    struct FacetCut {\n        address facetAddress;\n        FacetCutAction action;\n        bytes4[] functionSelectors;\n    }\n\n    /// @notice Add/replace/remove any number of functions and optionally execute\n    ///         a function with delegatecall\n    /// @param _diamondCut Contains the facet addresses and function selectors\n    /// @param _init The address of the contract or facet to execute _calldata\n    /// @param _calldata A function call, including function selector and arguments\n    ///                  _calldata is executed with delegatecall on _init\n    function diamondCut(FacetCut[] calldata _diamondCut, address _init, bytes calldata _calldata) external;\n}\n"
      },
      "contracts/launchpad/facets/LaunchPadQuerierFacet.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// solhint-disable func-name-mixedcase\npragma solidity 0.8.23;\n\nimport { ILaunchPadQuerier } from \"../interfaces/ILaunchPadQuerier.sol\";\nimport { LibLaunchPadFactoryStorage } from \"../libraries/LaunchPadFactoryStorage.sol\";\nimport { LibLaunchPadConsts } from \"../libraries/LaunchPadConsts.sol\";\n\ncontract LaunchPadQuerierFacet is ILaunchPadQuerier {\n    function LAUNCHPAD_PRODUCT_ID() public pure returns (bytes32) {\n        return LibLaunchPadConsts.PRODUCT_ID;\n    }\n\n    function getLaunchPadsPaginated(uint256 quantity, uint256 page) external view override returns (address[] memory) {\n        require(quantity > 0, \"LaunchPad: quantity must be greater than 0\");\n        require(page > 0, \"LaunchPad: page must be greater than 0\");\n\n        LibLaunchPadFactoryStorage.DiamondStorage storage ds = LibLaunchPadFactoryStorage.diamondStorage();\n\n        uint256 offset = quantity * (page - 1);\n        uint256 size = quantity;\n        if (offset + size > ds.launchPads.length) {\n            size = ds.launchPads.length - offset;\n        }\n        address[] memory launchPads = new address[](size);\n        for (uint256 i = 0; i < size; i++) {\n            launchPads[i] = ds.launchPads[offset + i];\n        }\n        return launchPads;\n    }\n\n    function getLaunchPadsCount() external view override returns (uint256) {\n        LibLaunchPadFactoryStorage.DiamondStorage storage ds = LibLaunchPadFactoryStorage.diamondStorage();\n        return ds.launchPads.length;\n    }\n\n    function getLaunchPadsByInvestorPaginated(address investor, uint256 quantity, uint256 page) external view override returns (address[] memory) {\n        require(quantity > 0, \"LaunchPad: quantity must be greater than 0\");\n        require(page > 0, \"LaunchPad: page must be greater than 0\");\n\n        LibLaunchPadFactoryStorage.DiamondStorage storage ds = LibLaunchPadFactoryStorage.diamondStorage();\n\n        uint256 offset = quantity * (page - 1);\n        uint256 size = quantity;\n        if (offset + size > ds.launchPadsByInvestor[investor].length) {\n            size = ds.launchPadsByInvestor[investor].length - offset;\n        }\n        address[] memory launchPads = new address[](size);\n        for (uint256 i = 0; i < size; i++) {\n            launchPads[i] = ds.launchPadsByInvestor[investor][offset + i];\n        }\n        return launchPads;\n    }\n\n    function getLaunchPadsByInvestorCount() external view override returns (uint256) {\n        LibLaunchPadFactoryStorage.DiamondStorage storage ds = LibLaunchPadFactoryStorage.diamondStorage();\n        return ds.launchPadsByInvestor[msg.sender].length;\n    }\n\n    function getLaunchPadCountByOwner(address owner) external view override returns (uint256) {\n        LibLaunchPadFactoryStorage.DiamondStorage storage ds = LibLaunchPadFactoryStorage.diamondStorage();\n        return ds.launchPadsByOwner[owner].length;\n    }\n\n    function getLaunchPadsByOwnerPaginated(address owner, uint256 quantity, uint256 page) external view override returns (address[] memory) {\n        require(quantity > 0, \"LaunchPad: quantity must be greater than 0\");\n        require(page > 0, \"LaunchPad: page must be greater than 0\");\n\n        LibLaunchPadFactoryStorage.DiamondStorage storage ds = LibLaunchPadFactoryStorage.diamondStorage();\n\n        uint256 offset = quantity * (page - 1);\n        uint256 size = quantity;\n        if (offset + size > ds.launchPadsByOwner[owner].length) {\n            size = ds.launchPadsByOwner[owner].length - offset;\n        }\n        address[] memory launchPads = new address[](size);\n        for (uint256 i = 0; i < size; i++) {\n            launchPads[i] = ds.launchPadsByOwner[owner][offset + i];\n        }\n        return launchPads;\n    }\n\n    function getMaxTokenCreationDeadline() external view override returns (uint256) {\n        LibLaunchPadFactoryStorage.DiamondStorage storage ds = LibLaunchPadFactoryStorage.diamondStorage();\n        return ds.maxTokenCreationDeadline;\n    }\n\n    function getSignerAddress() external view override returns (address) {\n        LibLaunchPadFactoryStorage.DiamondStorage storage ds = LibLaunchPadFactoryStorage.diamondStorage();\n        return ds.signerAddress;\n    }\n\n    function getSuperChargerHeadstarts() external view override returns (uint256[] memory) {\n        LibLaunchPadFactoryStorage.DiamondStorage storage ds = LibLaunchPadFactoryStorage.diamondStorage();\n\n        return ds.superChargerHeadstartByTier;\n    }\n\n    function getSuperChargerHeadstartByTier(uint256 tier) external view override returns (uint256) {\n        LibLaunchPadFactoryStorage.DiamondStorage storage ds = LibLaunchPadFactoryStorage.diamondStorage();\n\n        return ds.superChargerHeadstartByTier[tier - 1];\n    }\n\n    function getSuperChargerMultiplierByTier(uint256 tier) external view override returns (uint256) {\n        LibLaunchPadFactoryStorage.DiamondStorage storage ds = LibLaunchPadFactoryStorage.diamondStorage();\n\n        return ds.superChargerMultiplierByTier[tier - 1];\n    }\n\n    function getSuperChargerTokensPercByTier(uint256 tier) external view override returns (uint256) {\n        LibLaunchPadFactoryStorage.DiamondStorage storage ds = LibLaunchPadFactoryStorage.diamondStorage();\n\n        return ds.superChargerTokensPercByTier[tier - 1];\n    }\n\n    function tokenLauncherERC20() external view override returns (address) {\n        LibLaunchPadFactoryStorage.DiamondStorage storage ds = LibLaunchPadFactoryStorage.diamondStorage();\n\n        return ds.tokenLauncherERC20;\n    }\n\n    function launchPadTokenInfo(address launchPadAddress) external view override returns (CreateErc20Input memory createErc20Input) {\n        LibLaunchPadFactoryStorage.DiamondStorage storage ds = LibLaunchPadFactoryStorage.diamondStorage();\n\n        return ds.tokenInfoByLaunchPadAddress[launchPadAddress];\n    }\n}\n"
      },
      "contracts/launchpad/interfaces/ILaunchPadCommon.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.23;\n\ninterface ILaunchPadCommon {\n    enum LaunchPadType {\n        FlokiPadCreatedBefore,\n        FlokiPadCreatedAfter\n    }\n\n    enum PaymentMethod {\n        NATIVE,\n        USD,\n        TOKENFI\n    }\n\n    struct IdoInfo {\n        bool enabled;\n        address dexRouter;\n        address pairToken;\n        uint256 price;\n        uint256 amountToList;\n    }\n\n    struct RefundInfo {\n        uint256 penaltyFeePercent;\n        uint256 expireDuration;\n    }\n\n    struct FundTarget {\n        uint256 softCap;\n        uint256 hardCap;\n    }\n\n    struct ReleaseSchedule {\n        uint256 timestamp;\n        uint256 percent;\n    }\n\n    struct ReleaseScheduleV2 {\n        uint256 timestamp;\n        uint256 percent;\n        bool isVesting;\n    }\n\n    struct CreateErc20Input {\n        string name;\n        string symbol;\n        string logo;\n        uint8 decimals;\n        uint256 maxSupply;\n        address owner;\n        uint256 treasuryReserved;\n    }\n\n    struct LaunchPadInfo {\n        address owner;\n        address tokenAddress;\n        address paymentTokenAddress;\n        uint256 price;\n        FundTarget fundTarget;\n        uint256 maxInvestPerWallet;\n        uint256 startTimestamp;\n        uint256 duration;\n        uint256 tokenCreationDeadline;\n        RefundInfo refundInfo;\n        IdoInfo idoInfo;\n    }\n\n    struct CreateLaunchPadInput {\n        LaunchPadType launchPadType;\n        LaunchPadInfo launchPadInfo;\n        ReleaseScheduleV2[] releaseSchedule;\n        CreateErc20Input createErc20Input;\n        address referrer;\n        bool isSuperchargerEnabled;\n        PaymentMethod paymentMethod;\n    }\n}\n"
      },
      "contracts/launchpad/interfaces/ILaunchPadFactory.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.23;\n\nimport { ILaunchPadCommon } from \"./ILaunchPadCommon.sol\";\nimport { IDiamondCut } from \"../../common/diamonds/interfaces/IDiamondCut.sol\";\n\ninterface ILaunchPadFactory is ILaunchPadCommon {\n    struct StoreLaunchPadInput {\n        ILaunchPadCommon.LaunchPadType launchPadType;\n        address launchPadAddress;\n        address owner;\n        address referrer;\n        uint256 usdPrice;\n    }\n\n    function addInvestorToLaunchPad(address investor) external;\n\n    function createLaunchPad(ILaunchPadCommon.CreateLaunchPadInput memory input) external payable;\n\n    function createTokenAfterICO(address launchPadAddress) external payable;\n\n    function setExistingTokenAfterICO(address launchPad, address tokenAddress, uint256 amount) external;\n\n    function setExistingTokenAfterTransfer(address launchPad, address tokenAddress) external;\n\n    function createV2LiquidityPool(address launchPadAddress) external payable;\n\n    function updateLaunchPadOwner(address tokenAddress, address newOwner) external;\n}\n"
      },
      "contracts/launchpad/interfaces/ILaunchPadProject.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.23;\n\nimport { ILaunchPadCommon } from \"./ILaunchPadCommon.sol\";\n\ninterface ILaunchPadProject {\n    struct PurchasedInfo {\n        uint256 purchasedTokenAmount;\n        uint256 claimedTokenAmount;\n        uint256 paidTokenAmount;\n    }\n\n    struct BuyTokenInput {\n        uint256 tokenAmount;\n        uint256 tier;\n        uint256 nonce;\n        uint256 deadline;\n        bytes signature;\n    }\n\n    function buyTokens(uint256 tokenAmount) external payable;\n\n    function buyTokensWithSupercharger(BuyTokenInput memory input) external payable;\n\n    function checkSignature(address wallet, uint256 tier, uint256 nonce, uint256 deadline, bytes memory signature) external view;\n\n    function claimTokens() external;\n\n    function getAllInvestors() external view returns (address[] memory);\n\n    function getCurrentTier() external view returns (uint256);\n\n    function getFeeShare() external view returns (uint256);\n\n    function getHardCapPerTier(uint256 tier) external view returns (uint256);\n\n    function getInvestorAddressByIndex(uint256 index) external view returns (address);\n\n    function getInvestorsLength() external view returns (uint256);\n\n    function getLaunchPadAddress() external view returns (address);\n\n    function getLaunchPadInfo() external view returns (ILaunchPadCommon.LaunchPadInfo memory);\n\n    function getMaxInvestPerWalletPerTier(uint256 tier) external view returns (uint256);\n\n    function getNextNonce(address user) external view returns (uint256);\n\n    function getProjectOwnerRole() external view returns (bytes32);\n\n    function getPurchasedInfoByUser(address user) external view returns (PurchasedInfo memory);\n\n    function getReleasedTokensPercentage() external view returns (uint256);\n\n    function getReleaseSchedule() external view returns (ILaunchPadCommon.ReleaseScheduleV2[] memory);\n\n    function getTokensAvailableToBeClaimed(address user) external view returns (uint256);\n\n    function getTokenCreationDeadline() external view returns (uint256);\n\n    function getTotalRaised() external view returns (uint256);\n\n    function isSuperchargerEnabled() external view returns (bool);\n\n    function recoverSigner(bytes32 message, bytes memory signature) external view returns (address);\n\n    function refund(uint256 tokenAmount) external;\n\n    function refundOnSoftCapFailure() external;\n\n    function refundOnTokenCreationExpired(uint256 tokenAmount) external;\n\n    function setSupercharger(bool isSuperchargerEnabled) external;\n\n    function setTokenAddress(address tokenAddress) external;\n\n    function tokenDecimals() external view returns (uint256);\n\n    function totalTokensClaimed() external view returns (uint256);\n\n    function totalTokensSold() external view returns (uint256);\n\n    function withdrawFees() external;\n\n    function withdrawTokens(address tokenAddress) external;\n\n    function withdrawTokensToRecipient(address tokenAddress, address recipient) external;\n}\n"
      },
      "contracts/launchpad/interfaces/ILaunchPadQuerier.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.23;\n\nimport { ILaunchPadCommon } from \"./ILaunchPadCommon.sol\";\n\ninterface ILaunchPadQuerier is ILaunchPadCommon {\n    function getLaunchPadsPaginated(uint256 quantity, uint256 page) external view returns (address[] memory);\n\n    function getLaunchPadsCount() external view returns (uint256);\n\n    function getLaunchPadsByInvestorPaginated(address investor, uint256 quantity, uint256 page) external view returns (address[] memory);\n\n    function getLaunchPadsByInvestorCount() external view returns (uint256);\n\n    function getLaunchPadCountByOwner(address owner) external view returns (uint256);\n\n    function getLaunchPadsByOwnerPaginated(address owner, uint256 quantity, uint256 page) external view returns (address[] memory);\n\n    function getMaxTokenCreationDeadline() external view returns (uint256);\n\n    function getSignerAddress() external view returns (address);\n\n    function getSuperChargerHeadstartByTier(uint256 tier) external view returns (uint256);\n\n    function getSuperChargerHeadstarts() external view returns (uint256[] memory);\n\n    function getSuperChargerMultiplierByTier(uint256 tier) external view returns (uint256);\n\n    function getSuperChargerTokensPercByTier(uint256 tier) external view returns (uint256);\n\n    function launchPadTokenInfo(address launchPadAddress) external view returns (CreateErc20Input memory createErc20Input);\n\n    function tokenLauncherERC20() external view returns (address);\n}\n"
      },
      "contracts/launchpad/libraries/LaunchPadConsts.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.23;\n\nlibrary LibLaunchPadConsts {\n    bytes32 internal constant PRODUCT_ID = keccak256(\"tokenfi.launchpad\");\n    uint256 internal constant BASIS_POINTS = 10_000;\n    uint256 internal constant REFERRER_BASIS_POINTS = 2_500;\n    uint256 internal constant BURN_BASIS_POINTS = 5_000;\n    address internal constant BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD;\n}\n"
      },
      "contracts/launchpad/libraries/LaunchPadFactoryStorage.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.23;\n\nimport { ILaunchPadCommon } from \"../interfaces/ILaunchPadCommon.sol\";\nimport { ILaunchPadFactory } from \"../interfaces/ILaunchPadFactory.sol\";\nimport { ILaunchPadProject } from \"../interfaces/ILaunchPadProject.sol\";\n\nlibrary LibLaunchPadFactoryStorage {\n    bytes32 internal constant DIAMOND_STORAGE_POSITION = keccak256(\"tokenfi.launchpad.factory.diamond.storage\");\n\n    struct DiamondStorage {\n        address[] launchPads;\n        mapping(address => address[]) launchPadsByOwner;\n        mapping(address => address[]) launchPadsByInvestor;\n        mapping(address => address) launchPadOwner;\n        mapping(address => bool) isLaunchPad;\n        mapping(address => ILaunchPadFactory.CreateErc20Input) tokenInfoByLaunchPadAddress;\n        uint256 currentBlockLaunchPadCreated;\n        uint256 currentBlockLaunchPadOwnerUpdated;\n        address tokenLauncherERC20;\n        address tokenLauncherStore;\n        address tokenLauncherBuybackHandler;\n        address launchPadProjectFacet;\n        address accessControlFacet;\n        address pausableFacet;\n        address loupeFacet;\n        address proxyFacet;\n        address launchPadProjectDiamondInit;\n        address _tokenfiToken; // deprecated (available on LaunchPadPaymentStorage)\n        address _usdToken; // deprecated (available on LaunchPadPaymentStorage)\n        address _router; // deprecated (available on LaunchPadPaymentStorage)\n        address _treasury; // deprecated (available on LaunchPadPaymentStorage)\n        address signerAddress;\n        uint256 maxTokenCreationDeadline;\n        uint256[] superChargerMultiplierByTier;\n        uint256[] superChargerHeadstartByTier;\n        uint256[] superChargerTokensPercByTier;\n    }\n\n    event LaunchPadCreated(\n        uint256 indexed previousBlock,\n        ILaunchPadCommon.LaunchPadType indexed launchPadType,\n        address indexed owner,\n        ILaunchPadFactory.StoreLaunchPadInput launchPad\n    );\n    event LaunchPadOwnerUpdated(uint256 indexed previousBlock, address owner, address newOwner);\n    event MaxTokenCreationDeadlineUpdated(uint256 indexed previousMaxTokenCreationDeadline, uint256 newMaxTokenCreationDeadline);\n    event LaunchpadRemoved(address indexed launchPadAddress, address indexed owner);\n    event SignerAddressUpdated(address indexed previousSignerAddress, address indexed newSignerAddress);\n\n    function diamondStorage() internal pure returns (DiamondStorage storage ds) {\n        bytes32 position = DIAMOND_STORAGE_POSITION;\n        // solhint-disable-next-line no-inline-assembly\n        assembly {\n            ds.slot := position\n        }\n    }\n\n    function getLaunchPadProjectSelectors() internal pure returns (bytes4[] memory) {\n        bytes4[] memory functionSelectors = new bytes4[](33);\n        functionSelectors[0] = ILaunchPadProject.buyTokens.selector;\n        functionSelectors[1] = ILaunchPadProject.buyTokensWithSupercharger.selector;\n        functionSelectors[2] = ILaunchPadProject.checkSignature.selector;\n        functionSelectors[3] = ILaunchPadProject.claimTokens.selector;\n        functionSelectors[4] = ILaunchPadProject.getAllInvestors.selector;\n        functionSelectors[5] = ILaunchPadProject.getCurrentTier.selector;\n        functionSelectors[6] = ILaunchPadProject.getFeeShare.selector;\n        functionSelectors[7] = ILaunchPadProject.getHardCapPerTier.selector;\n        functionSelectors[8] = ILaunchPadProject.getInvestorAddressByIndex.selector;\n        functionSelectors[9] = ILaunchPadProject.getInvestorsLength.selector;\n        functionSelectors[10] = ILaunchPadProject.getLaunchPadAddress.selector;\n        functionSelectors[11] = ILaunchPadProject.getLaunchPadInfo.selector;\n        functionSelectors[12] = ILaunchPadProject.getMaxInvestPerWalletPerTier.selector;\n        functionSelectors[13] = ILaunchPadProject.getNextNonce.selector;\n        functionSelectors[14] = ILaunchPadProject.getProjectOwnerRole.selector;\n        functionSelectors[15] = ILaunchPadProject.getPurchasedInfoByUser.selector;\n        functionSelectors[16] = ILaunchPadProject.getReleasedTokensPercentage.selector;\n        functionSelectors[17] = ILaunchPadProject.getReleaseSchedule.selector;\n        functionSelectors[18] = ILaunchPadProject.getTokensAvailableToBeClaimed.selector;\n        functionSelectors[19] = ILaunchPadProject.getTokenCreationDeadline.selector;\n        functionSelectors[20] = ILaunchPadProject.getTotalRaised.selector;\n        functionSelectors[21] = ILaunchPadProject.isSuperchargerEnabled.selector;\n        functionSelectors[22] = ILaunchPadProject.recoverSigner.selector;\n        functionSelectors[23] = ILaunchPadProject.refund.selector;\n        functionSelectors[24] = ILaunchPadProject.refundOnSoftCapFailure.selector;\n        functionSelectors[25] = ILaunchPadProject.refundOnTokenCreationExpired.selector;\n        functionSelectors[26] = ILaunchPadProject.setTokenAddress.selector;\n        functionSelectors[27] = ILaunchPadProject.tokenDecimals.selector;\n        functionSelectors[28] = ILaunchPadProject.totalTokensClaimed.selector;\n        functionSelectors[29] = ILaunchPadProject.totalTokensSold.selector;\n        functionSelectors[30] = ILaunchPadProject.withdrawFees.selector;\n        functionSelectors[31] = ILaunchPadProject.withdrawTokens.selector;\n        functionSelectors[32] = ILaunchPadProject.withdrawTokensToRecipient.selector;\n\n        return functionSelectors;\n    }\n}\n"
      }
    }
  }}