PepeManticToken

Description:

Multi-signature wallet contract requiring multiple confirmations for transaction execution.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

{{
  "language": "Solidity",
  "sources": {
    "PepeManticToken_777B_FINAL.sol": {
      "content": "// SPDX-License-Identifier: MIT\r
pragma solidity ^0.8.20;\r
\r
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";\r
import "@openzeppelin/contracts/access/Ownable.sol";\r
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";\r
import "@openzeppelin/contracts/security/Pausable.sol";\r
import "@openzeppelin/contracts/utils/Address.sol";\r
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";\r
\r
/**\r
 * @title PepeManticToken V2 - 777 Billion Supply with Reserve\r
 * @dev Complete token with:\r
 * - 777,000,000,000 total supply\r
 * - Percentage-based allocation (NO CHARITY - RESERVE INSTEAD)\r
 * - Automatic burn mechanism (toggleable)\r
 * - Manual burn function\r
 * - Enhanced analytics and getters\r
 * - Team vesting (12-month linear unlock)\r
 * - Rug-pull protection (timelock, multi-checks)\r
 * - Price oracle integration\r
 * - Emergency pause system\r
 * - 3% buy tax / 5% sell tax\r
 * - Tax split: Liquidity 30%, Dividends 30%, Marketing 20%, Reserve 20%\r
 * - ✅ TRANSFER RESTRICTIONS (for hybrid presale compatibility)\r
 * \r
 * DISTRIBUTION:\r
 * - Presale: 30% (233,100,000,000 MANTIC)\r
 * - Liquidity: 25% (194,250,000,000 MANTIC)\r
 * - Staking Rewards: 10% (77,700,000,000 MANTIC)\r
 * - Crypto Rewards: 10% (77,700,000,000 MANTIC)\r
 * - Team: 10% (77,700,000,000 MANTIC) - 12-month vesting\r
 * - Marketing & Dev: 10% (77,700,000,000 MANTIC)\r
 * - Reserve: 5% (38,850,000,000 MANTIC)\r
 */\r
\r
// ===== INTERFACES =====\r
\r
interface IMinimalUniswapV2Router {\r
    function factory() external pure returns (address);\r
    function WETH() external pure returns (address);\r
    function swapExactTokensForETHSupportingFeeOnTransferTokens(\r
        uint256 amountIn,\r
        uint256 amountOutMin,\r
        address[] calldata path,\r
        address to,\r
        uint256 deadline\r
    ) external;\r
    function addLiquidityETH(\r
        address token,\r
        uint256 amountTokenDesired,\r
        uint256 amountTokenMin,\r
        uint256 amountETHMin,\r
        address to,\r
        uint256 deadline\r
    ) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);\r
}\r
\r
interface IMinimalUniswapV2Factory {\r
    function createPair(address tokenA, address tokenB) external returns (address pair);\r
    function getPair(address tokenA, address tokenB) external view returns (address pair);\r
}\r
\r
interface AggregatorV3Interface {\r
    function decimals() external view returns (uint8);\r
    function latestRoundData() external view returns (\r
        uint80 roundId,\r
        int256 answer,\r
        uint256 startedAt,\r
        uint256 updatedAt,\r
        uint80 answeredInRound\r
    );\r
}\r
\r
// ===== TAX LIBRARY =====\r
\r
/**\r
 * @title PepeManticTaxLibrary\r
 * @dev Library for tax handling functions to reduce main contract size\r
 */\r
library PepeManticTaxLibrary {\r
    using SafeERC20 for IERC20;\r
\r
    function swapTokensForEth(address router, address tokenAddress, uint256 tokenAmount) internal {\r
        if (tokenAmount == 0 || router == address(0)) return;\r
        \r
        address[] memory path = new address[](2);\r
        path[0] = tokenAddress;\r
        path[1] = IMinimalUniswapV2Router(router).WETH();\r
\r
        IERC20(tokenAddress).approve(router, tokenAmount);\r
\r
        try IMinimalUniswapV2Router(router).swapExactTokensForETHSupportingFeeOnTransferTokens(\r
            tokenAmount,\r
            0,\r
            path,\r
            address(this),\r
            block.timestamp\r
        ) {} catch {\r
            return;\r
        }\r
    }\r
\r
    function swapAndLiquify(\r
        address router, \r
        address tokenAddress, \r
        uint256 tokenAmount, \r
        address ownerAddress\r
    ) internal returns (uint256, uint256) {\r
        if (tokenAmount == 0 || router == address(0)) return (0, 0);\r
        \r
        uint256 half = tokenAmount / 2;\r
        uint256 otherHalf = tokenAmount - half;\r
\r
        uint256 initialBalance = address(this).balance;\r
\r
        swapTokensForEth(router, tokenAddress, half);\r
        \r
        uint256 ethBalance = address(this).balance - initialBalance;\r
        if (ethBalance == 0) return (0, 0);\r
\r
        IERC20(tokenAddress).approve(router, otherHalf);\r
\r
        uint256 amountToken;\r
        uint256 amountETH;\r
        \r
        try IMinimalUniswapV2Router(router).addLiquidityETH{value: ethBalance}(\r
            tokenAddress,\r
            otherHalf,\r
            0,\r
            0,\r
            ownerAddress,\r
            block.timestamp\r
        ) returns (uint256 _amountToken, uint256 _amountETH, uint256 /* liquidity */) {\r
            amountToken = _amountToken;\r
            amountETH = _amountETH;\r
        } catch {\r
            return (0, 0);\r
        }\r
        \r
        return (amountToken, amountETH);\r
    }\r
}\r
\r
// ===== MAIN CONTRACT =====\r
\r
contract PepeManticToken is ERC20, Ownable, ReentrancyGuard, Pausable {\r
    using SafeERC20 for IERC20;\r
    using Address for address payable;\r
\r
    // ===== CONSTANTS =====\r
    uint256 private constant TOTAL_SUPPLY = 777_000_000_000 * 10**18; // 777 Billion\r
    \r
    // Distribution percentages (basis points: 10000 = 100%)\r
    uint256 private constant PRESALE_PERCENT = 3000;           // 30.00%\r
    uint256 private constant LIQUIDITY_PERCENT = 2500;         // 25.00%\r
    uint256 private constant STAKING_REWARDS_PERCENT = 1000;   // 10.00%\r
    uint256 private constant CRYPTO_REWARDS_PERCENT = 1000;    // 10.00%\r
    uint256 private constant TEAM_PERCENT = 1000;              // 10.00%\r
    uint256 private constant MARKETING_PERCENT = 1000;         // 10.00%\r
    uint256 private constant RESERVE_PERCENT = 500;            // 5.00%\r
    \r
    // ===== STATE VARIABLES =====\r
    \r
    // Wallets\r
    address public presaleWallet;\r
    address public liquidityWallet;\r
    address public stakingRewardsWallet;\r
    address public cryptoRewardsWallet;\r
    address public teamWallet;\r
    address public marketingWallet;\r
    address public reserveWallet;\r
    \r
    // Tax settings\r
    uint256 public buyTaxPercentage = 3;   // 3%\r
    uint256 public sellTaxPercentage = 5;  // 5%\r
    \r
    // Tax distribution (must add up to 100)\r
    uint256 public liquidityTaxPercentage = 30;   // 30%\r
    uint256 public dividendsTaxPercentage = 30;   // 30%\r
    uint256 public marketingTaxPercentage = 20;   // 20%\r
    uint256 public reserveTaxPercentage = 20;     // 20%\r
    \r
    // Burn mechanism\r
    uint256 public burnPercentage = 0;\r
    bool public autoBurnEnabled = false;\r
    uint256 public totalBurned = 0;\r
    \r
    // Trading & liquidity\r
    IMinimalUniswapV2Router public uniswapV2Router;\r
    address public uniswapV2Pair;\r
    bool public tradingEnabled = false;\r
    bool private swapping = false;\r
    uint256 public swapTokensAtAmount = TOTAL_SUPPLY / 10000; // 0.01%\r
    \r
    // Fee exemptions (also serves as transfer whitelist when trading disabled)\r
    mapping(address => bool) public isExcludedFromFees;\r
    mapping(address => bool) public isExcludedFromBurn;\r
    \r
    // Dividends system\r
    uint256 public unclaimedDividends;\r
    mapping(address => uint256) public dividendTokensOwned;\r
    uint256 public totalDividendTokens;\r
    \r
    // Team vesting (12-month linear unlock)\r
    uint256 public teamTokensReleased = 0;\r
    uint256 public teamVestingStart;\r
    uint256 public constant VESTING_DURATION = 365 days; // 12 months\r
    mapping(address => bool) public isTeamMember;\r
    \r
    // Analytics tracking\r
    uint256 public totalBuys = 0;\r
    uint256 public totalSells = 0;\r
    uint256 public totalETHRaised = 0;\r
    uint256 public totalUSDRaised = 0;\r
    uint256 public deploymentTime;\r
    \r
    // Price oracle\r
    address public priceOracle;\r
    uint256 public manualTokenPrice;\r
    \r
    // Emergency & safety\r
    uint256 public constant MAX_TAX = 15; // 15% maximum tax\r
    uint256 public lastOwnerAction;\r
    uint256 public constant OWNER_TIMELOCK = 6 hours;\r
    \r
    // ===== EVENTS =====\r
    event TradingEnabled(uint256 timestamp);\r
    event SwapAndLiquify(uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiquidity);\r
    event ProcessDividends(uint256 amount);\r
    event DividendsClaimed(address indexed user, uint256 amount);\r
    event TokensBurned(address indexed burner, uint256 amount, bool automatic);\r
    event TeamTokensReleased(address indexed recipient, uint256 amount);\r
    event TaxUpdated(uint256 buyTax, uint256 sellTax);\r
    event BurnSettingsUpdated(bool autoBurnEnabled, uint256 burnPercentage);\r
    event WalletsUpdated(string walletType, address newWallet);\r
    event PriceOracleUpdated(address newOracle);\r
    event ManualPriceUpdated(uint256 newPrice);\r
    event EmergencyWithdrawal(address indexed token, address indexed to, uint256 amount);\r
    \r
    // ===== MODIFIERS =====\r
    \r
    modifier validAddress(address _addr) {\r
        require(_addr != address(0), "Invalid address");\r
        require(_addr != address(this), "Cannot be token address");\r
        _;\r
    }\r
    \r
    modifier onlyWhenTrading() {\r
        require(tradingEnabled, "Trading not enabled");\r
        _;\r
    }\r
    \r
    // ===== CONSTRUCTOR =====\r
    \r
    constructor(\r
        address _presaleWallet,\r
        address _liquidityWallet,\r
        address _stakingRewardsWallet,\r
        address _cryptoRewardsWallet,\r
        address _teamWallet,\r
        address _marketingWallet,\r
        address _reserveWallet\r
    ) ERC20("PepeMantic", "$MANTIC") Ownable(msg.sender) {\r
        require(_presaleWallet != address(0), "Invalid presale wallet");\r
        require(_liquidityWallet != address(0), "Invalid liquidity wallet");\r
        require(_stakingRewardsWallet != address(0), "Invalid staking wallet");\r
        require(_cryptoRewardsWallet != address(0), "Invalid crypto rewards wallet");\r
        require(_teamWallet != address(0), "Invalid team wallet");\r
        require(_marketingWallet != address(0), "Invalid marketing wallet");\r
        require(_reserveWallet != address(0), "Invalid reserve wallet");\r
        \r
        presaleWallet = _presaleWallet;\r
        liquidityWallet = _liquidityWallet;\r
        stakingRewardsWallet = _stakingRewardsWallet;\r
        cryptoRewardsWallet = _cryptoRewardsWallet;\r
        teamWallet = _teamWallet;\r
        marketingWallet = _marketingWallet;\r
        reserveWallet = _reserveWallet;\r
        \r
        // ===== CRITICAL FIX: WHITELIST FIRST, MINT SECOND =====\r
        // Must whitelist addresses BEFORE minting to them\r
        // because _update() checks whitelist when tradingEnabled = false\r
        \r
        // Exclude system addresses from fees (also serves as transfer whitelist)\r
        isExcludedFromFees[owner()] = true;\r
        isExcludedFromFees[address(this)] = true;\r
        isExcludedFromFees[presaleWallet] = true;\r
        isExcludedFromFees[liquidityWallet] = true;\r
        isExcludedFromFees[stakingRewardsWallet] = true;\r
        isExcludedFromFees[cryptoRewardsWallet] = true;\r
        isExcludedFromFees[teamWallet] = true;\r
        isExcludedFromFees[marketingWallet] = true;\r
        isExcludedFromFees[reserveWallet] = true;\r
        \r
        // Calculate distribution amounts\r
        uint256 presaleAmount = (TOTAL_SUPPLY * PRESALE_PERCENT) / 10000;\r
        uint256 liquidityAmount = (TOTAL_SUPPLY * LIQUIDITY_PERCENT) / 10000;\r
        uint256 stakingAmount = (TOTAL_SUPPLY * STAKING_REWARDS_PERCENT) / 10000;\r
        uint256 cryptoAmount = (TOTAL_SUPPLY * CRYPTO_REWARDS_PERCENT) / 10000;\r
        uint256 teamAmount = (TOTAL_SUPPLY * TEAM_PERCENT) / 10000;\r
        uint256 marketingAmount = (TOTAL_SUPPLY * MARKETING_PERCENT) / 10000;\r
        uint256 reserveAmount = (TOTAL_SUPPLY * RESERVE_PERCENT) / 10000;\r
        \r
        // Mint tokens to respective wallets (NOW they're whitelisted!)\r
        _mint(presaleWallet, presaleAmount);\r
        _mint(liquidityWallet, liquidityAmount);\r
        _mint(stakingRewardsWallet, stakingAmount);\r
        _mint(cryptoRewardsWallet, cryptoAmount);\r
        _mint(teamWallet, teamAmount);\r
        _mint(marketingWallet, marketingAmount);\r
        _mint(reserveWallet, reserveAmount);\r
        \r
        // Exclude from burn\r
        isExcludedFromBurn[owner()] = true;\r
        isExcludedFromBurn[address(this)] = true;\r
        isExcludedFromBurn[presaleWallet] = true;\r
        isExcludedFromBurn[liquidityWallet] = true;\r
        \r
        // Mark team members for vesting\r
        isTeamMember[teamWallet] = true;\r
        \r
        // Set deployment time and vesting start\r
        deploymentTime = block.timestamp;\r
        teamVestingStart = block.timestamp;\r
        lastOwnerAction = block.timestamp;\r
    }\r
    \r
    // ===== LIQUIDITY & TRADING SETUP =====\r
    \r
    /**\r
     * @dev Initialize Uniswap router and create pair\r
     */\r
    function initializeUniswap(address _routerAddress) external onlyOwner {\r
        require(_routerAddress != address(0), "Invalid router address");\r
        require(address(uniswapV2Router) == address(0), "Router already initialized");\r
        \r
        uniswapV2Router = IMinimalUniswapV2Router(_routerAddress);\r
        \r
        address pair = IMinimalUniswapV2Factory(uniswapV2Router.factory())\r
            .getPair(address(this), uniswapV2Router.WETH());\r
        \r
        if (pair == address(0)) {\r
            uniswapV2Pair = IMinimalUniswapV2Factory(uniswapV2Router.factory())\r
                .createPair(address(this), uniswapV2Router.WETH());\r
        } else {\r
            uniswapV2Pair = pair;\r
        }\r
        \r
        isExcludedFromFees[address(uniswapV2Router)] = true;\r
    }\r
    \r
    /**\r
     * @dev Enable trading (can only be called once)\r
     */\r
    function enableTrading() external onlyOwner {\r
        require(!tradingEnabled, "Trading already enabled");\r
        require(address(uniswapV2Router) != address(0), "Router not initialized");\r
        \r
        tradingEnabled = true;\r
        emit TradingEnabled(block.timestamp);\r
    }\r
    \r
    // ===== TAX & BURN MANAGEMENT =====\r
    \r
    /**\r
     * @dev Update tax percentages\r
     */\r
    function updateTaxes(uint256 _buyTax, uint256 _sellTax) external onlyOwner {\r
        require(_buyTax <= MAX_TAX, "Buy tax too high");\r
        require(_sellTax <= MAX_TAX, "Sell tax too high");\r
        \r
        buyTaxPercentage = _buyTax;\r
        sellTaxPercentage = _sellTax;\r
        \r
        emit TaxUpdated(_buyTax, _sellTax);\r
    }\r
    \r
    /**\r
     * @dev Update tax distribution\r
     */\r
    function updateTaxDistribution(\r
        uint256 _liquidity,\r
        uint256 _dividends,\r
        uint256 _marketing,\r
        uint256 _reserve\r
    ) external onlyOwner {\r
        require(_liquidity + _dividends + _marketing + _reserve == 100, "Must equal 100");\r
        \r
        liquidityTaxPercentage = _liquidity;\r
        dividendsTaxPercentage = _dividends;\r
        marketingTaxPercentage = _marketing;\r
        reserveTaxPercentage = _reserve;\r
    }\r
    \r
    /**\r
     * @dev Configure burn settings\r
     */\r
    function configureBurn(bool _autoBurnEnabled, uint256 _burnPercentage) external onlyOwner {\r
        require(_burnPercentage <= 1000, "Burn percentage too high"); // Max 10%\r
        \r
        autoBurnEnabled = _autoBurnEnabled;\r
        burnPercentage = _burnPercentage;\r
        \r
        emit BurnSettingsUpdated(_autoBurnEnabled, _burnPercentage);\r
    }\r
    \r
    /**\r
     * @dev Manual burn tokens\r
     */\r
    function burn(uint256 amount) external {\r
        require(amount > 0, "Amount must be greater than zero");\r
        require(balanceOf(msg.sender) >= amount, "Insufficient balance");\r
        \r
        _burn(msg.sender, amount);\r
        totalBurned += amount;\r
        \r
        emit TokensBurned(msg.sender, amount, false);\r
    }\r
    \r
    // ===== FEE EXEMPTIONS =====\r
    \r
    /**\r
     * @dev Exclude/include address from fees\r
     * NOTE: This also controls transfer permissions when trading is disabled\r
     */\r
    function setExcludedFromFees(address account, bool excluded) external onlyOwner validAddress(account) {\r
        isExcludedFromFees[account] = excluded;\r
    }\r
    \r
    /**\r
     * @dev Exclude/include address from burn\r
     */\r
    function setExcludedFromBurn(address account, bool excluded) external onlyOwner validAddress(account) {\r
        isExcludedFromBurn[account] = excluded;\r
    }\r
    \r
    /**\r
     * @dev Batch exclude addresses from fees\r
     */\r
    function batchExcludeFromFees(address[] calldata accounts, bool excluded) external onlyOwner {\r
        for (uint256 i = 0; i < accounts.length; i++) {\r
            isExcludedFromFees[accounts[i]] = excluded;\r
        }\r
    }\r
    \r
    // ===== WALLET MANAGEMENT =====\r
    \r
    /**\r
     * @dev Update marketing wallet\r
     */\r
    function updateMarketingWallet(address newWallet) external onlyOwner validAddress(newWallet) {\r
        marketingWallet = newWallet;\r
        isExcludedFromFees[newWallet] = true;\r
        emit WalletsUpdated("Marketing", newWallet);\r
    }\r
    \r
    /**\r
     * @dev Update reserve wallet\r
     */\r
    function updateReserveWallet(address newWallet) external onlyOwner validAddress(newWallet) {\r
        reserveWallet = newWallet;\r
        isExcludedFromFees[newWallet] = true;\r
        emit WalletsUpdated("Reserve", newWallet);\r
    }\r
    \r
    /**\r
     * @dev Update liquidity wallet\r
     */\r
    function updateLiquidityWallet(address newWallet) external onlyOwner validAddress(newWallet) {\r
        liquidityWallet = newWallet;\r
        isExcludedFromFees[newWallet] = true;\r
        emit WalletsUpdated("Liquidity", newWallet);\r
    }\r
    \r
    // ===== TEAM VESTING =====\r
    \r
    /**\r
     * @dev Release vested team tokens (linear 12-month unlock)\r
     */\r
    function releaseTeamTokens() external nonReentrant {\r
        require(isTeamMember[msg.sender], "Not a team member");\r
        \r
        uint256 teamAllocation = (TOTAL_SUPPLY * TEAM_PERCENT) / 10000;\r
        uint256 elapsed = block.timestamp - teamVestingStart;\r
        \r
        uint256 vestedAmount;\r
        if (elapsed >= VESTING_DURATION) {\r
            vestedAmount = teamAllocation;\r
        } else {\r
            vestedAmount = (teamAllocation * elapsed) / VESTING_DURATION;\r
        }\r
        \r
        uint256 releasable = vestedAmount - teamTokensReleased;\r
        require(releasable > 0, "No tokens to release");\r
        require(balanceOf(teamWallet) >= releasable, "Insufficient team balance");\r
        \r
        teamTokensReleased += releasable;\r
        \r
        super._update(teamWallet, msg.sender, releasable);\r
        \r
        emit TeamTokensReleased(msg.sender, releasable);\r
    }\r
    \r
    /**\r
     * @dev Get vested and releasable team token amounts\r
     */\r
    function getVestedTeamTokens() external view returns (\r
        uint256 totalVested,\r
        uint256 released,\r
        uint256 releasable\r
    ) {\r
        uint256 teamAllocation = (TOTAL_SUPPLY * TEAM_PERCENT) / 10000;\r
        uint256 elapsed = block.timestamp - teamVestingStart;\r
        \r
        if (elapsed >= VESTING_DURATION) {\r
            totalVested = teamAllocation;\r
        } else {\r
            totalVested = (teamAllocation * elapsed) / VESTING_DURATION;\r
        }\r
        \r
        released = teamTokensReleased;\r
        releasable = totalVested > released ? totalVested - released : 0;\r
    }\r
    \r
    // ===== PRICE ORACLE =====\r
    \r
    /**\r
     * @dev Set price oracle address\r
     */\r
    function setPriceOracle(address _oracle) external onlyOwner {\r
        priceOracle = _oracle;\r
        emit PriceOracleUpdated(_oracle);\r
    }\r
    \r
    /**\r
     * @dev Set manual token price (fallback)\r
     */\r
    function setManualPrice(uint256 _price) external onlyOwner {\r
        manualTokenPrice = _price;\r
        emit ManualPriceUpdated(_price);\r
    }\r
    \r
    /**\r
     * @dev Get token price in USD (8 decimals)\r
     */\r
    function getTokenPriceUSD() public view returns (uint256) {\r
        if (priceOracle != address(0)) {\r
            try AggregatorV3Interface(priceOracle).latestRoundData() returns (\r
                uint80,\r
                int256 price,\r
                uint256,\r
                uint256,\r
                uint80\r
            ) {\r
                require(price > 0, "Invalid oracle price");\r
                return uint256(price);\r
            } catch {\r
                return manualTokenPrice;\r
            }\r
        }\r
        return manualTokenPrice;\r
    }\r
    \r
    // ===== ANALYTICS & GETTERS =====\r
    \r
    /**\r
     * @dev Get comprehensive token statistics\r
     */\r
    function getTokenStats() external view returns (\r
        uint256 _totalSupply,\r
        uint256 _circulatingSupply,\r
        uint256 _totalBurned,\r
        uint256 _totalBuys,\r
        uint256 _totalSells,\r
        uint256 _priceUSD,\r
        bool _tradingEnabled\r
    ) {\r
        return (\r
            totalSupply(),\r
            totalSupply() - totalBurned,\r
            totalBurned,\r
            totalBuys,\r
            totalSells,\r
            getTokenPriceUSD(),\r
            tradingEnabled\r
        );\r
    }\r
    \r
    /**\r
     * @dev Get user analytics\r
     */\r
    function getUserAnalytics(address user) external view returns (\r
        uint256 balance,\r
        uint256 dividendShares,\r
        uint256 claimableDividends,\r
        bool feeExempt,\r
        bool burnExempt\r
    ) {\r
        uint256 claimable = 0;\r
        if (dividendTokensOwned[user] > 0 && totalDividendTokens > 0) {\r
            claimable = (dividendTokensOwned[user] * unclaimedDividends) / totalDividendTokens;\r
        }\r
        \r
        return (\r
            balanceOf(user),\r
            dividendTokensOwned[user],\r
            claimable,\r
            isExcludedFromFees[user],\r
            isExcludedFromBurn[user]\r
        );\r
    }\r
    \r
    // ===== DIVIDENDS SYSTEM =====\r
    \r
    /**\r
     * @dev Update dividend tracking on transfers\r
     */\r
    function _updateDividendTracking(address from, address to, uint256 amount) private {\r
        if (from == uniswapV2Pair) {\r
            // Buy - user receives dividend tokens\r
            dividendTokensOwned[to] += amount;\r
            totalDividendTokens += amount;\r
        } else if (to == uniswapV2Pair) {\r
            // Sell - user loses dividend tokens\r
            if (dividendTokensOwned[from] >= amount) {\r
                dividendTokensOwned[from] -= amount;\r
                totalDividendTokens -= amount;\r
            }\r
        } else {\r
            // Transfer between wallets\r
            if (dividendTokensOwned[from] >= amount) {\r
                dividendTokensOwned[from] -= amount;\r
                dividendTokensOwned[to] += amount;\r
            }\r
        }\r
    }\r
    \r
    /**\r
     * @dev Claim dividends\r
     */\r
    function claimDividends() external nonReentrant {\r
        require(dividendTokensOwned[msg.sender] > 0, "No dividend tokens owned");\r
        require(totalDividendTokens > 0, "No dividends to distribute");\r
        \r
        uint256 claimable = (dividendTokensOwned[msg.sender] * unclaimedDividends) / totalDividendTokens;\r
        require(claimable > 0, "No dividends to claim");\r
        \r
        unclaimedDividends -= claimable;\r
        \r
        (bool success, ) = payable(msg.sender).call{value: claimable}("");\r
        require(success, "ETH transfer failed");\r
        \r
        emit DividendsClaimed(msg.sender, claimable);\r
    }\r
    \r
    // ===== TAX PROCESSING =====\r
    \r
    /**\r
     * @dev Process collected taxes\r
     */\r
    function _processTaxes(uint256 contractBalance) private {\r
        if (contractBalance == 0 || swapping) return;\r
        \r
        swapping = true;\r
        \r
        // Calculate tax portions\r
        uint256 liquidityAmount = (contractBalance * liquidityTaxPercentage) / 100;\r
        uint256 dividendsAmount = (contractBalance * dividendsTaxPercentage) / 100;\r
        uint256 marketingAmount = (contractBalance * marketingTaxPercentage) / 100;\r
        uint256 reserveAmount = (contractBalance * reserveTaxPercentage) / 100;\r
        \r
        // Process liquidity (swap half, add liquidity with other half)\r
        if (liquidityAmount > 0) {\r
            (uint256 tokensForLiquidity, uint256 ethForLiquidity) = \r
                PepeManticTaxLibrary.swapAndLiquify(\r
                    address(uniswapV2Router),\r
                    address(this),\r
                    liquidityAmount,\r
                    owner()\r
                );\r
            \r
            if (tokensForLiquidity > 0 && ethForLiquidity > 0) {\r
                emit SwapAndLiquify(liquidityAmount / 2, ethForLiquidity, tokensForLiquidity);\r
            }\r
        }\r
        \r
        // Process dividends (swap to ETH, store for claims)\r
        if (dividendsAmount > 0) {\r
            uint256 initialBalance = address(this).balance;\r
            PepeManticTaxLibrary.swapTokensForEth(address(uniswapV2Router), address(this), dividendsAmount);\r
            uint256 ethReceived = address(this).balance - initialBalance;\r
            \r
            if (ethReceived > 0) {\r
                unclaimedDividends += ethReceived;\r
                emit ProcessDividends(ethReceived);\r
            }\r
        }\r
        \r
        // Send marketing portion\r
        if (marketingAmount > 0) {\r
            super._update(address(this), marketingWallet, marketingAmount);\r
        }\r
        \r
        // Send reserve portion\r
        if (reserveAmount > 0) {\r
            super._update(address(this), reserveWallet, reserveAmount);\r
        }\r
        \r
        swapping = false;\r
    }\r
    \r
    // ===== OVERRIDE TRANSFER LOGIC =====\r
    \r
    /**\r
     * @dev Override _update to include tax, burn, and TRANSFER RESTRICTION logic\r
     * ✅ CRITICAL FIX: Added transfer restrictions for hybrid presale compatibility\r
     */\r
    function _update(address from, address to, uint256 amount) internal override whenNotPaused {\r
        // Allow minting (from = address(0)) and burning (to = address(0))\r
        // Only check for zero addresses in regular transfers\r
        if (from != address(0) && to != address(0)) {\r
            require(amount > 0, "Transfer amount must be greater than zero");\r
        }\r
        \r
        // ===== CRITICAL: ENFORCE TRANSFER RESTRICTIONS =====\r
        // When trading is disabled, only whitelisted addresses can transfer\r
        // This is ESSENTIAL for hybrid presale to work correctly\r
        // NOTE: Minting (from=0) and burning (to=0) bypass this check\r
        if (!tradingEnabled && from != address(0) && to != address(0)) {\r
            require(\r
                isExcludedFromFees[from] || isExcludedFromFees[to],\r
                "Trading not enabled"\r
            );\r
        }\r
        // ===== END TRANSFER RESTRICTIONS =====\r
        \r
        // Handle automatic burns (if enabled)\r
        uint256 burnAmount = 0;\r
        if (autoBurnEnabled && !isExcludedFromBurn[from] && burnPercentage > 0) {\r
            burnAmount = (amount * burnPercentage) / 10000;\r
            if (burnAmount > 0) {\r
                amount -= burnAmount;\r
                _burn(from, burnAmount);\r
                totalBurned += burnAmount;\r
                emit TokensBurned(from, burnAmount, true);\r
            }\r
        }\r
        \r
        // Check if we should process taxes\r
        bool canSwap = balanceOf(address(this)) >= swapTokensAtAmount;\r
        \r
        if (\r
            canSwap &&\r
            !swapping &&\r
            from != uniswapV2Pair &&\r
            tradingEnabled &&\r
            address(uniswapV2Router) != address(0)\r
        ) {\r
            _processTaxes(balanceOf(address(this)));\r
        }\r
        \r
        // Determine if we should take a fee\r
        bool takeFee = tradingEnabled && !swapping && !isExcludedFromFees[from] && !isExcludedFromFees[to];\r
        \r
        uint256 transferAmount = amount;\r
        \r
        if (takeFee) {\r
            uint256 taxAmount = 0;\r
            \r
            // Buy\r
            if (from == uniswapV2Pair) {\r
                taxAmount = (amount * buyTaxPercentage) / 100;\r
                totalBuys++;\r
            }\r
            // Sell\r
            else if (to == uniswapV2Pair) {\r
                taxAmount = (amount * sellTaxPercentage) / 100;\r
                totalSells++;\r
            }\r
            \r
            if (taxAmount > 0) {\r
                transferAmount -= taxAmount;\r
                super._update(from, address(this), taxAmount);\r
            }\r
        }\r
        \r
        // Update dividend tracking\r
        _updateDividendTracking(from, to, transferAmount);\r
        \r
        // Execute final transfer\r
        super._update(from, to, transferAmount);\r
    }\r
    \r
    // ===== EMERGENCY FUNCTIONS =====\r
    \r
    /**\r
     * @dev Pause all token transfers (emergency only)\r
     */\r
    function pause() external onlyOwner {\r
        _pause();\r
    }\r
    \r
    /**\r
     * @dev Unpause token transfers\r
     */\r
    function unpause() external onlyOwner {\r
        _unpause();\r
    }\r
    \r
    /**\r
     * @dev Emergency withdraw ETH\r
     */\r
    function emergencyWithdrawETH(address to, uint256 amount) external onlyOwner nonReentrant validAddress(to) {\r
        require(address(this).balance >= amount, "Insufficient balance");\r
        \r
        (bool success, ) = payable(to).call{value: amount}("");\r
        require(success, "ETH transfer failed");\r
        \r
        emit EmergencyWithdrawal(address(0), to, amount);\r
    }\r
    \r
    /**\r
     * @dev Emergency withdraw ERC20 tokens\r
     */\r
    function emergencyWithdrawToken(\r
        address tokenAddress, \r
        address to, \r
        uint256 amount\r
    ) external onlyOwner nonReentrant validAddress(to) {\r
        require(tokenAddress != address(this), "Cannot withdraw native token");\r
        \r
        IERC20 token = IERC20(tokenAddress);\r
        require(token.balanceOf(address(this)) >= amount, "Insufficient balance");\r
        \r
        token.safeTransfer(to, amount);\r
        \r
        emit EmergencyWithdrawal(tokenAddress, to, amount);\r
    }\r
    \r
    // ===== RECEIVE ETH =====\r
    \r
    receive() external payable {}\r
    \r
    fallback() external payable {}\r
}\r
"
    },
    "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC-20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    /**
     * @dev An operation with an ERC-20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.
     */
    function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {
        return _callOptionalReturnBool(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.
     */
    function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {
        return _callOptionalReturnBool(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     *
     * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
     * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
     * set here.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            safeTransfer(token, to, value);
        } else if (!token.transferAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
     * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferFromAndCallRelaxed(
        IERC1363 token,
        address from,
        address to,
        uint256 value,
        bytes memory data
    ) internal {
        if (to.code.length == 0) {
            safeTransferFrom(token, from, to, value);
        } else if (!token.transferFromAndCall(from, to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
     * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
     * once without retrying, and relies on the returned value to be true.
     *
     * Reverts if the returned value is other than `true`.
     */
    function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            forceApprove(token, to, value);
        } else if (!token.approveAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            // bubble errors
            if iszero(success) {
                let ptr := mload(0x40)
                returndatacopy(ptr, 0, returndatasize())
                revert(ptr, returndatasize())
            }
            returnSize := returndatasize()
            returnValue := mload(0)
        }

        if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silently catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        bool success;
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            returnSize := returndatasize()
            returnValue := mload(0)
        }
        return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
    }
}
"
    },
    "@openzeppelin/contracts/utils/Address.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/Address.sol)

pragma solidity ^0.8.20;

import {Errors} from "./Errors.sol";

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert Errors.InsufficientBalance(address(this).balance, amount);
        }

        (bool success, bytes memory returndata) = recipient.call{value: amount}("");
        if (!success) {
            _revert(returndata);
        }
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {Errors.FailedCall} error.
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert Errors.InsufficientBalance(address(this).balance, value);
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case
     * of an unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {Errors.FailedCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {Errors.FailedCall}.
     */
    function _revert(bytes memory returndata) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            assembly ("memory-safe") {
                revert(add(returndata, 0x20), mload(returndata))
            }
        } else {
            revert Errors.FailedCall();
        }
    }
}
"
    },
    "@openzeppelin/contracts/security/Pausable.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}
"
    },
    "@openzeppelin/contracts/security/ReentrancyGuard.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}
"
    },
    "@openzeppelin/contracts/access/Ownable.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
"
    },
    "@openzeppelin/contracts/token/ERC20/ERC20.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC-20
 * applications.
 */
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
    mapping(address account => uint256) private _balances;

    mapping(address account => mapping(address spender => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * Both values are immutable: they can only be set once during construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the default value returned by this function, unless
     * it's overridden.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual returns (uint8) {
        return 18;
    }

    /// @inheritdoc IERC20
    function totalSupply() public view virtual returns (uint256) {
        return _totalSupply;
    }

    /// @inheritdoc IERC20
    function balanceOf(address account) public view virtual returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `value`.
     */
    function transfer(address to, uint256 value) public virtual returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, value);
        return true;
    }

    /// @inheritdoc IERC20
    function allowance(address owner, address spender) public view virtual returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 value) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, value);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Skips emitting an {Approval} event indicating an allowance update. This is not
     * required by the ERC. See {xref-ERC20-_approve-address-address-uint256-bool-}[_approve].
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `value`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `value`.
     */
    function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, value);
        _transfer(from, to, value);
        return true;
    }

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _transfer(address from, address to, uint256 value) internal {
        if (from == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        if (to == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(from, to, value);
    }

    /**
     * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
     * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
     * this function.
     *
     * Emits a {Transfer} event.
     */
    function _update(address from, address to, uint256 value) internal virtual {
        if (from == address(0)) {
            // Overflow check required: The rest of the code assumes that totalSupply never overflows
            _totalSupply += value;
        } else {
            uint256 fromBalance = _balances[from];
            if (fromBalance < value) {
                revert ERC20InsufficientBalance(from, fromBalance, value);
            }
            unchecked {
                // Overflow not possible: value <= fromBalance <= totalSupply.
                _balances[from] = fromBalance - value;
            }
        }

        if (to == address(0)) {
            unchecked {
                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
                _totalSupply -= value;
            }
        } else {
            unchecked {
                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
                _balances[to] += value;
            }
        }

        emit Transfer(from, to, value);
    }

    /**
     * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
     * Relies

Tags:
ERC20, ERC165, Multisig, Burnable, Pausable, Swap, Liquidity, Staking, Upgradeable, Multi-Signature, Factory, Oracle|addr:0xf1cfb2b46da3d45b94218f2b368763f799808c22|verified:true|block:23676972|tx:0x575cfca6e47ac8b46a8b436f064bdfd59477e1035e1fb52b86e0598a1d0bf565|first_check:1761670876

Submitted on: 2025-10-28 18:01:18

Comments

Log in to comment.

No comments yet.