MegaFramework

Description:

Proxy contract enabling upgradeable smart contract patterns. Delegates calls to an implementation contract.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

{{
  "language": "Solidity",
  "sources": {
    "contracts/interfaces/IERC20.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/**
 * @title IERC20
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);

    function totalSupply() external view returns (uint256);
    function balanceOf(address account) external view returns (uint256);
    function transfer(address to, uint256 amount) external returns (bool);
    function allowance(address owner, address spender) external view returns (uint256);
    function approve(address spender, uint256 amount) external returns (bool);
    function transferFrom(address from, address to, uint256 amount) external returns (bool);
    function decimals() external view returns (uint8);
    function name() external view returns (string memory);
    function symbol() external view returns (string memory);
}
"
    },
    "contracts/interfaces/IERC20Metadata.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "./IERC20.sol";

/**
 * @title IERC20Metadata
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 */
interface IERC20Metadata is IERC20 {
    function name() external view returns (string memory);
    function symbol() external view returns (string memory);
    function decimals() external view returns (uint8);
}
"
    },
    "contracts/interfaces/IUniswapV2Factory.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/**
 * @title IUniswapV2Factory
 * @dev Interface for Uniswap V2 Factory
 */
interface IUniswapV2Factory {
    event PairCreated(address indexed token0, address indexed token1, address pair, uint);

    function feeTo() external view returns (address);
    function feeToSetter() external view returns (address);
    function getPair(address tokenA, address tokenB) external view returns (address pair);
    function allPairs(uint) external view returns (address pair);
    function allPairsLength() external view returns (uint);
    function createPair(address tokenA, address tokenB) external returns (address pair);
    function setFeeTo(address) external;
    function setFeeToSetter(address) external;
}
"
    },
    "contracts/interfaces/IUniswapV2Pair.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/**
 * @title IUniswapV2Pair
 * @dev Interface for Uniswap V2 Pair
 */
interface IUniswapV2Pair {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external pure returns (string memory);
    function symbol() external pure returns (string memory);
    function decimals() external pure returns (uint8);
    function totalSupply() external view returns (uint);
    function balanceOf(address owner) external view returns (uint);
    function allowance(address owner, address spender) external view returns (uint);
    function approve(address spender, uint value) external returns (bool);
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);
    function DOMAIN_SEPARATOR() external view returns (bytes32);
    function PERMIT_TYPEHASH() external pure returns (bytes32);
    function nonces(address owner) external view returns (uint);
    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
    function factory() external view returns (address);
    function token0() external view returns (address);
    function token1() external view returns (address);
    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
}
"
    },
    "contracts/interfaces/IUniswapV2Router02.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/**
 * @title IUniswapV2Router02
 * @dev Interface for Uniswap V2 Router02
 */
interface IUniswapV2Router02 {
    function factory() external pure returns (address);
    function WETH() external pure returns (address);

    function addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB, uint liquidity);

    function addLiquidityETH(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external payable returns (uint amountToken, uint amountETH, uint liquidity);

    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;

    function swapExactETHForTokensSupportingFeeOnTransferTokens(
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external payable;

    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
}
"
    },
    "contracts/libraries/Address.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/**
 * @title Address
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     */
    function isContract(address account) internal view returns (bool) {
        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");
        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {functionCall}, but with `errorMessage` as a fallback revert reason.
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {functionCall}, but also transferring `value` wei to `target`.
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {functionCallWithValue}, but with `errorMessage` as a fallback revert reason.
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify a low level call was successful, and revert if it wasn't.
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            if (returndata.length > 0) {
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}
"
    },
    "contracts/libraries/Context.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/**
 * @title Context
 * @dev Provides information about the current execution context
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _msgValue() internal view virtual returns (uint256) {
        return msg.value;
    }
}
"
    },
    "contracts/libraries/Ownable.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "./Context.sol";

/**
 * @title Ownable
 * @dev Contract module which provides a basic access control mechanism
 */
abstract contract Ownable is Context {
    address private _owner;
    address private _previousOwner;

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

    constructor() {
        _transferOwnership(_msgSender());
    }

    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    function owner() public view virtual returns (address) {
        return _owner;
    }

    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
"
    },
    "contracts/libraries/SafeMath.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/**
 * @title SafeMath
 * @dev Math operations with safety checks that revert on error
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");
        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on underflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b <= a, "SafeMath: subtraction overflow");
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) return 0;
        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");
        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on division by zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: division by zero");
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: modulo by zero");
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on underflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        return a - b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on division by zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a / b;
    }
}
"
    },
    "contracts/MegaFramework.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

// https://www.megaframework.pro/

import "./libraries/Context.sol";
import "./libraries/Ownable.sol";
import "./libraries/SafeMath.sol";
import "./libraries/Address.sol";
import "./interfaces/IERC20.sol";
import "./interfaces/IERC20Metadata.sol";
import "./interfaces/IUniswapV2Factory.sol";
import "./interfaces/IUniswapV2Router02.sol";
import "./interfaces/IUniswapV2Pair.sol";
import "./security/ReentrancyGuard.sol";
import "./security/Pausable.sol";
import "./token/TaxManager.sol";
import "./token/LiquidityManager.sol";
import "./token/AntiBot.sol";
import "./token/MaxLimits.sol";
import "./token/FeeCollector.sol";
import "./token/SwapHandler.sol";
import "./token/TransferValidator.sol";
import "./token/ExclusionManager.sol";
import "./token/WhitelistManager.sol";
import "./token/BurnManager.sol";
import "./utils/EmergencyWithdraw.sol";

/**
 * @title MegaFramework Token (MWRK)
 * @dev Implementation of the MegaFramework token with anti-sniper protection
 * 
 * Features:
 * - 10% buy tax / 15% sell tax at launch to prevent snipers
 * - 0.2% max transaction / 2% max wallet limits
 * - Uniswap V2 integration
 * - Anti-bot protection
 * - Maximum transaction and wallet limits
 * - Automatic liquidity provision
 * - Fee distribution to marketing and development
 */
contract MegaFramework is 
    Context, 
    IERC20, 
    IERC20Metadata, 
    Ownable, 
    ReentrancyGuard, 
    Pausable,
    EmergencyWithdraw
{
    using SafeMath for uint256;
    using Address for address payable;

    // Token metadata
    string private constant _name = "MegaFramework";
    string private constant _symbol = "MWRK";
    uint8 private constant _decimals = 18;
    uint256 private constant _totalSupply = 1_000_000_000 * 10**_decimals; // 1 billion tokens

    // Balances
    mapping(address => uint256) private _balances;
    mapping(address => mapping(address => uint256)) private _allowances;

    // Uniswap
    IUniswapV2Router02 public immutable uniswapV2Router;
    address public immutable uniswapV2Pair;

    // Component contracts
    TaxManager public taxManager;
    AntiBot public antiBot;
    MaxLimits public maxLimits;
    TransferValidator public transferValidator;
    ExclusionManager public exclusionManager;
    FeeCollector public feeCollector;

    // State variables
    bool private swapping;
    uint256 public swapTokensAtAmount = _totalSupply / 1000; // 0.1%

    // Events
    event SwapAndLiquify(uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiquidity);
    event TaxesCollected(uint256 amount);
    event MarketingWalletUpdated(address indexed newWallet);
    event DevelopmentWalletUpdated(address indexed newWallet);

    /**
     * @dev Constructor initializes the token and sets up Uniswap integration
     */
    constructor(address _routerAddress) {
        // Initialize Uniswap
        uniswapV2Router = IUniswapV2Router02(_routerAddress);
        uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory())
            .createPair(address(this), uniswapV2Router.WETH());

        // Initialize component contracts
        // MODIFIED: 10% buy tax, 15% sell tax (was 10/10)
        taxManager = new TaxManager(10, 15);
        antiBot = new AntiBot();
        
        // MODIFIED: 0.2% max transaction (was 2%), 2% max wallet (same)
        maxLimits = new MaxLimits(
            _totalSupply.mul(2).div(1000), // 0.2% max transaction
            _totalSupply.mul(2).div(100)   // 2% max wallet
        );
        transferValidator = new TransferValidator();
        exclusionManager = new ExclusionManager();
        feeCollector = new FeeCollector();

        // Exclude from fees and limits
        exclusionManager.excludeFromFees(owner());
        exclusionManager.excludeFromFees(address(this));
        exclusionManager.excludeFromFees(address(taxManager));
        
        exclusionManager.excludeFromLimits(owner());
        exclusionManager.excludeFromLimits(address(this));
        exclusionManager.excludeFromLimits(address(uniswapV2Pair));

        // Set authorized transfers for owner before trading enabled
        transferValidator.setAuthorizedTransfer(owner(), true);
        transferValidator.setAuthorizedTransfer(address(this), true);

        // Mint total supply to owner
        _balances[owner()] = _totalSupply;
        emit Transfer(address(0), owner(), _totalSupply);
    }

// If you return literals, `pure` is OK; if you read state, use `view`.
function name() public pure override(IERC20, IERC20Metadata) returns (string memory) {
    return "MegaFramework";
}

function symbol() public pure override(IERC20, IERC20Metadata) returns (string memory) {
    return "MWRK";
}

function decimals() public pure override(IERC20, IERC20Metadata) returns (uint8) {
    return 18;
}

    function totalSupply() public pure override returns (uint256) {
        return _totalSupply;
    }

    function balanceOf(address account) public view override returns (uint256) {
        return _balances[account];
    }

    function allowance(address owner, address spender) public view override returns (uint256) {
        return _allowances[owner][spender];
    }

    function approve(address spender, uint256 amount) public override returns (bool) {
        _approve(_msgSender(), spender, amount);
        return true;
    }

    function _approve(address owner, address spender, uint256 amount) private {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");
        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    function transfer(address to, uint256 amount) public override whenNotPaused returns (bool) {
        _transfer(_msgSender(), to, amount);
        return true;
    }

    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public override whenNotPaused returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

    function _spendAllowance(address owner, address spender, uint256 amount) private {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

    function _transfer(address from, address to, uint256 amount) private nonReentrant {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");
        require(amount > 0, "Transfer amount must be greater than zero");

        // Check if trading is enabled
        require(transferValidator.canTransfer(from, to), "Trading not enabled");

        // Anti-bot checks
        require(!antiBot.checkBot(from), "Bot detected");
        require(!antiBot.checkCooldown(from), "Transfer cooldown active");

        // Check transaction limits
        if (!exclusionManager.isExcludedFromLimits(from) && !exclusionManager.isExcludedFromLimits(to)) {
            require(maxLimits.checkTransactionLimit(from, amount), "Exceeds max transaction amount");
            if (to != uniswapV2Pair) {
                uint256 newBalance = _balances[to].add(amount);
                require(maxLimits.checkWalletLimit(to, newBalance), "Exceeds max wallet amount");
            }
        }

        // Check if we should swap and liquify
        uint256 contractTokenBalance = balanceOf(address(this));
        bool canSwap = contractTokenBalance >= swapTokensAtAmount;

        if (
            canSwap &&
            !swapping &&
            from != uniswapV2Pair &&
            !exclusionManager.isExcludedFromFees(from) &&
            !exclusionManager.isExcludedFromFees(to)
        ) {
            swapping = true;
            swapAndLiquify(contractTokenBalance);
            swapping = false;
        }

        // Calculate and apply fees
        bool takeFee = !swapping &&
                       !exclusionManager.isExcludedFromFees(from) &&
                       !exclusionManager.isExcludedFromFees(to);

        uint256 fees = 0;
        if (takeFee) {
            bool isBuy = from == uniswapV2Pair;
            bool isSell = to == uniswapV2Pair;

            if (isBuy || isSell) {
                fees = taxManager.calculateTax(amount, isBuy);
                if (fees > 0) {
                    amount = amount.sub(fees);
                    _balances[address(this)] = _balances[address(this)].add(fees);
                    emit Transfer(from, address(this), fees);
                }
            }
        }

        // Execute transfer
        _balances[from] = _balances[from].sub(amount);
        _balances[to] = _balances[to].add(amount);
        emit Transfer(from, to, amount);


    }

    function swapAndLiquify(uint256 tokens) private {
        uint256 half = tokens.div(2);
        uint256 otherHalf = tokens.sub(half);

        uint256 initialBalance = address(this).balance;

        swapTokensForETH(half);

        uint256 newBalance = address(this).balance.sub(initialBalance);

        addLiquidity(otherHalf, newBalance);

        emit SwapAndLiquify(half, newBalance, otherHalf);
    }

    function swapTokensForETH(uint256 tokenAmount) private {
        address[] memory path = new address[](2);
        path[0] = address(this);
        path[1] = uniswapV2Router.WETH();

        _approve(address(this), address(uniswapV2Router), tokenAmount);

        uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
            tokenAmount,
            0,
            path,
            address(this),
            block.timestamp
        );
    }

    function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
        _approve(address(this), address(uniswapV2Router), tokenAmount);

        uniswapV2Router.addLiquidityETH{value: ethAmount}(
            address(this),
            tokenAmount,
            0,
            0,
            owner(),
            block.timestamp
        );
    }

    // Owner functions
    function enableTrading() external onlyOwner {
        transferValidator.enableTrading();
        antiBot.setLaunchBlock();
    }

    function setBuyTax(uint256 _tax) external onlyOwner {
        taxManager.setBuyTax(_tax);
    }

    function setSellTax(uint256 _tax) external onlyOwner {
        taxManager.setSellTax(_tax);
    }

    function setMaxTransactionAmount(uint256 _amount) external onlyOwner {
        maxLimits.setMaxTransactionAmount(_amount);
    }

    function setMaxWalletAmount(uint256 _amount) external onlyOwner {
        maxLimits.setMaxWalletAmount(_amount);
    }

    function setMarketingWallet(address _wallet) external onlyOwner {
        taxManager.setMarketingWallet(_wallet);
        emit MarketingWalletUpdated(_wallet);
    }

    function setDevelopmentWallet(address _wallet) external onlyOwner {
        taxManager.setDevelopmentWallet(_wallet);
        emit DevelopmentWalletUpdated(_wallet);
    }

    function excludeFromFees(address account) external onlyOwner {
        exclusionManager.excludeFromFees(account);
    }

    function includeInFees(address account) external onlyOwner {
        exclusionManager.includeInFees(account);
    }

    function excludeFromLimits(address account) external onlyOwner {
        exclusionManager.excludeFromLimits(account);
    }

    function setBlacklist(address account, bool blacklisted) external onlyOwner {
        antiBot.setBlacklist(account, blacklisted);
    }

    function setSwapTokensAtAmount(uint256 amount) external onlyOwner {
        swapTokensAtAmount = amount;
    }

    function pause() external onlyOwner {
        _pause();
    }

    function unpause() external onlyOwner {
        _unpause();
    }

}
"
    },
    "contracts/security/Pausable.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "../libraries/Context.sol";

/**
 * @title Pausable
 * @dev Contract module which allows children to implement an emergency stop mechanism.
 */
abstract contract Pausable is Context {
    event Paused(address account);
    event Unpaused(address account);

    bool private _paused;

    constructor() {
        _paused = false;
    }

    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    modifier whenPaused() {
        _requirePaused();
        _;
    }

    function paused() public view virtual returns (bool) {
        return _paused;
    }

    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}
"
    },
    "contracts/security/ReentrancyGuard.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/**
 * @title ReentrancyGuard
 * @dev Contract module that helps prevent reentrant calls to a function.
 */
abstract contract ReentrancyGuard {
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
        _status = _ENTERED;
    }

    function _nonReentrantAfter() private {
        _status = _NOT_ENTERED;
    }

    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}
"
    },
    "contracts/token/AntiBot.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "../libraries/Ownable.sol";

/**
 * @title AntiBot
 * @dev Implements anti-bot and anti-sniper mechanisms
 */
contract AntiBot is Ownable {
    mapping(address => bool) public isBlacklisted;
    mapping(address => uint256) public lastTransactionBlock;
    
    bool public antiBotEnabled = true;
    uint256 public launchBlock;
    uint256 public deadBlocks = 2;
    uint256 public cooldownBlocks = 1;

    event BlacklistUpdated(address indexed account, bool isBlacklisted);
    event AntiBotSettingsUpdated(bool enabled, uint256 deadBlocks, uint256 cooldownBlocks);

    function setBlacklist(address account, bool blacklisted) external onlyOwner {
        isBlacklisted[account] = blacklisted;
        emit BlacklistUpdated(account, blacklisted);
    }

    function setBlacklistMultiple(address[] calldata accounts, bool blacklisted) external onlyOwner {
        for (uint256 i = 0; i < accounts.length; i++) {
            isBlacklisted[accounts[i]] = blacklisted;
            emit BlacklistUpdated(accounts[i], blacklisted);
        }
    }

    function setAntiBotEnabled(bool _enabled) external onlyOwner {
        antiBotEnabled = _enabled;
        emit AntiBotSettingsUpdated(_enabled, deadBlocks, cooldownBlocks);
    }

    function setLaunchBlock() external onlyOwner {
        require(launchBlock == 0, "Already launched");
        launchBlock = block.number;
    }

    function setDeadBlocks(uint256 _deadBlocks) external onlyOwner {
        require(_deadBlocks <= 5, "Too many dead blocks");
        deadBlocks = _deadBlocks;
        emit AntiBotSettingsUpdated(antiBotEnabled, deadBlocks, cooldownBlocks);
    }

    function setCooldownBlocks(uint256 _cooldownBlocks) external onlyOwner {
        require(_cooldownBlocks <= 5, "Cooldown too long");
        cooldownBlocks = _cooldownBlocks;
        emit AntiBotSettingsUpdated(antiBotEnabled, deadBlocks, cooldownBlocks);
    }

    function checkBot(address account) public view returns (bool) {
        if (!antiBotEnabled) return false;
        if (isBlacklisted[account]) return true;
        
        if (launchBlock > 0 && block.number <= launchBlock + deadBlocks) {
            return true;
        }
        
        return false;
    }

    function checkCooldown(address account) public view returns (bool) {
        if (!antiBotEnabled || cooldownBlocks == 0) return false;
        return block.number < lastTransactionBlock[account] + cooldownBlocks;
    }

    function updateLastTransaction(address account) internal {
        lastTransactionBlock[account] = block.number;
    }
}
"
    },
    "contracts/token/BurnManager.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "../libraries/Ownable.sol";
import "../libraries/SafeMath.sol";

/**
 * @title BurnManager
 * @dev Manages token burning mechanisms
 */
contract BurnManager is Ownable {
    using SafeMath for uint256;

    uint256 public totalBurned;
    bool public autoBurnEnabled = false;
    uint256 public autoBurnPercentage = 0;

    event TokensBurned(address indexed burner, uint256 amount);
    event AutoBurnSettingsUpdated(bool enabled, uint256 percentage);

    function setAutoBurn(bool _enabled, uint256 _percentage) external onlyOwner {
        require(_percentage <= 10, "Burn percentage too high");
        autoBurnEnabled = _enabled;
        autoBurnPercentage = _percentage;
        emit AutoBurnSettingsUpdated(_enabled, _percentage);
    }

    function calculateBurnAmount(uint256 amount) public view returns (uint256) {
        if (!autoBurnEnabled || autoBurnPercentage == 0) {
            return 0;
        }
        return amount.mul(autoBurnPercentage).div(100);
    }

    function recordBurn(uint256 amount) internal {
        totalBurned = totalBurned.add(amount);
        emit TokensBurned(msg.sender, amount);
    }

    function getTotalBurned() external view returns (uint256) {
        return totalBurned;
    }
}
"
    },
    "contracts/token/ExclusionManager.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "../libraries/Ownable.sol";
import "../utils/EnumerableSet.sol";

/**
 * @title ExclusionManager
 * @dev Manages excluded addresses from fees and limits
 */
contract ExclusionManager is Ownable {
    using EnumerableSet for EnumerableSet.AddressSet;

    EnumerableSet.AddressSet private _excludedFromFees;
    EnumerableSet.AddressSet private _excludedFromLimits;

    event ExcludedFromFees(address indexed account);
    event IncludedInFees(address indexed account);
    event ExcludedFromLimits(address indexed account);
    event IncludedInLimits(address indexed account);

    function excludeFromFees(address account) external onlyOwner {
        _excludedFromFees.add(account);
        emit ExcludedFromFees(account);
    }

    function includeInFees(address account) external onlyOwner {
        _excludedFromFees.remove(account);
        emit IncludedInFees(account);
    }

    function excludeFromLimits(address account) external onlyOwner {
        _excludedFromLimits.add(account);
        emit ExcludedFromLimits(account);
    }

    function includeInLimits(address account) external onlyOwner {
        _excludedFromLimits.remove(account);
        emit IncludedInLimits(account);
    }

    function isExcludedFromFees(address account) public view returns (bool) {
        return _excludedFromFees.contains(account);
    }

    function isExcludedFromLimits(address account) public view returns (bool) {
        return _excludedFromLimits.contains(account);
    }

    function getExcludedFromFeesCount() external view returns (uint256) {
        return _excludedFromFees.length();
    }

    function getExcludedFromLimitsCount() external view returns (uint256) {
        return _excludedFromLimits.length();
    }
}
"
    },
    "contracts/token/FeeCollector.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "../libraries/Ownable.sol";
import "../libraries/SafeMath.sol";

/**
 * @title FeeCollector
 * @dev Collects and distributes fees
 */
contract FeeCollector is Ownable {
    using SafeMath for uint256;

    uint256 public marketingFeePercentage = 50;
    uint256 public developmentFeePercentage = 30;
    uint256 public liquidityFeePercentage = 20;

    uint256 public totalFeesCollected;
    uint256 public totalFeesDistributed;

    event FeesCollected(uint256 amount);
    event FeesDistributed(uint256 marketing, uint256 development, uint256 liquidity);
    event FeePercentagesUpdated(uint256 marketing, uint256 development, uint256 liquidity);

    function setFeePercentages(
        uint256 _marketing,
        uint256 _development,
        uint256 _liquidity
    ) external onlyOwner {
        require(_marketing + _development + _liquidity == 100, "Must equal 100%");
        marketingFeePercentage = _marketing;
        developmentFeePercentage = _development;
        liquidityFeePercentage = _liquidity;
        emit FeePercentagesUpdated(_marketing, _development, _liquidity);
    }

    function calculateFeeDistribution(uint256 totalFees) public view returns (
        uint256 marketingFee,
        uint256 developmentFee,
        uint256 liquidityFee
    ) {
        marketingFee = totalFees.mul(marketingFeePercentage).div(100);
        developmentFee = totalFees.mul(developmentFeePercentage).div(100);
        liquidityFee = totalFees.mul(liquidityFeePercentage).div(100);
    }

    function collectFees(uint256 amount) internal {
        totalFeesCollected = totalFeesCollected.add(amount);
        emit FeesCollected(amount);
    }

    function getFeeStats() external view returns (uint256 collected, uint256 distributed) {
        return (totalFeesCollected, totalFeesDistributed);
    }
}
"
    },
    "contracts/token/LiquidityManager.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "../libraries/Ownable.sol";
import "../interfaces/IUniswapV2Router02.sol";

/**
 * @title LiquidityManager
 * @dev Manages liquidity operations for the token
 */
contract LiquidityManager is Ownable {
    IUniswapV2Router02 public uniswapV2Router;
    address public uniswapV2Pair;
    
    bool public swapEnabled = true;
    uint256 public swapTokensAtAmount;
    bool private inSwap;

    event SwapAndLiquify(uint256 tokensSwapped, uint256 ethReceived, uint256 tokensIntoLiquidity);
    event SwapEnabled(bool enabled);

    modifier lockTheSwap {
        inSwap = true;
        _;
        inSwap = false;
    }

    constructor(address _router) {
        uniswapV2Router = IUniswapV2Router02(_router);
    }

    function setSwapTokensAtAmount(uint256 amount) external onlyOwner {
        swapTokensAtAmount = amount;
    }

    function setSwapEnabled(bool _enabled) external onlyOwner {
        swapEnabled = _enabled;
        emit SwapEnabled(_enabled);
    }

    function setUniswapV2Pair(address _pair) external onlyOwner {
        uniswapV2Pair = _pair;
    }

    function shouldSwapBack(uint256 tokenBalance) public view returns (bool) {
        return !inSwap && swapEnabled && tokenBalance >= swapTokensAtAmount;
    }

    function isInSwap() public view returns (bool) {
        return inSwap;
    }
}
"
    },
    "contracts/token/MaxLimits.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "../libraries/Ownable.sol";

/**
 * @title MaxLimits
 * @dev Manages maximum transaction and wallet limits
 */
contract MaxLimits is Ownable {
    uint256 public maxTransactionAmount;
    uint256 public maxWalletAmount;
    bool public limitsEnabled = true;

    mapping(address => bool) public isExcludedFromLimits;

    event MaxTransactionAmountUpdated(uint256 amount);
    event MaxWalletAmountUpdated(uint256 amount);
    event LimitsEnabledUpdated(bool enabled);
    event ExcludedFromLimitsUpdated(address indexed account, bool isExcluded);

    constructor(uint256 _maxTxAmount, uint256 _maxWalletAmount) {
        maxTransactionAmount = _maxTxAmount;
        maxWalletAmount = _maxWalletAmount;
    }

    function setMaxTransactionAmount(uint256 amount) external onlyOwner {
        maxTransactionAmount = amount;
        emit MaxTransactionAmountUpdated(amount);
    }

    function setMaxWalletAmount(uint256 amount) external onlyOwner {
        maxWalletAmount = amount;
        emit MaxWalletAmountUpdated(amount);
    }

    function setLimitsEnabled(bool _enabled) external onlyOwner {
        limitsEnabled = _enabled;
        emit LimitsEnabledUpdated(_enabled);
    }

    function excludeFromLimits(address account, bool excluded) external onlyOwner {
        isExcludedFromLimits[account] = excluded;
        emit ExcludedFromLimitsUpdated(account, excluded);
    }

    function checkTransactionLimit(address account, uint256 amount) public view returns (bool) {
        if (!limitsEnabled || isExcludedFromLimits[account]) {
            return true;
        }
        return amount <= maxTransactionAmount;
    }

    function checkWalletLimit(address account, uint256 newBalance) public view returns (bool) {
        if (!limitsEnabled || isExcludedFromLimits[account]) {
            return true;
        }
        return newBalance <= maxWalletAmount;
    }
}
"
    },
    "contracts/token/SwapHandler.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "../libraries/Ownable.sol";
import "../interfaces/IUniswapV2Router02.sol";

/**
 * @title SwapHandler
 * @dev Handles token swaps on Uniswap
 */
contract SwapHandler is Ownable {
    IUniswapV2Router02 public router;
    bool private swapping;

    event SwapExecuted(uint256 tokensSwapped, uint256 ethReceived);

    modifier lockSwap {
        swapping = true;
        _;
        swapping = false;
    }

    function setRouter(address _router) external onlyOwner {
        require(_router != address(0), "Invalid router");
        router = IUniswapV2Router02(_router);
    }

    function swapTokensForETH(uint256 tokenAmount, address tokenAddress) internal lockSwap {
        address[] memory path = new address[](2);
        path[0] = tokenAddress;
        path[1] = router.WETH();

        router.swapExactTokensForETHSupportingFeeOnTransferTokens(
            tokenAmount,
            0,
            path,
            address(this),
            block.timestamp
        );
    }

    function addLiquidity(uint256 tokenAmount, uint256 ethAmount, address tokenAddress) internal lockSwap {
        router.addLiquidityETH{value: ethAmount}(
            tokenAddress,
            tokenAmount,
            0,
            0,
            owner(),
            block.timestamp
        );
    }

    function isSwapping() public view returns (bool) {
        return swapping;
    }
}
"
    },
    "contracts/token/TaxManager.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "../libraries/Ownable.sol";

/**
 * @title TaxManager
 * @dev Manages buy and sell taxes for the token
 */
contract TaxManager is Ownable {
    uint256 public buyTax;
    uint256 public sellTax;
    uint256 public constant MAX_TAX = 25;

    address public marketingWallet;
    address public developmentWallet;

    event TaxUpdated(uint256 buyTax, uint256 sellTax);
    event WalletUpdated(address indexed wallet, string walletType);

    constructor(uint256 _buyTax, uint256 _sellTax) {
        require(_buyTax <= MAX_TAX, "Buy tax too high");
        require(_sellTax <= MAX_TAX, "Sell tax too high");
        buyTax = _buyTax;
        sellTax = _sellTax;
    }

    function setBuyTax(uint256 _buyTax) external onlyOwner {
        require(_buyTax <= MAX_TAX, "Tax exceeds maximum");
        buyTax = _buyTax;
        emit TaxUpdated(buyTax, sellTax);
    }

    function setSellTax(uint256 _sellTax) external onlyOwner {
        require(_sellTax <= MAX_TAX, "Tax exceeds maximum");
        sellTax = _sellTax;
        emit TaxUpdated(buyTax, sellTax);
    }

    function setMarketingWallet(address _wallet) external onlyOwner {
        require(_wallet != address(0), "Invalid address");
        marketingWallet = _wallet;
        emit WalletUpdated(_wallet, "Marketing");
    }

    function setDevelopmentWallet(address _wallet) external onlyOwner {
        require(_wallet != address(0), "Invalid address");
        developmentWallet = _wallet;
        emit WalletUpdated(_wallet, "Development");
    }

    function calculateTax(uint256 amount, bool isBuy) public view returns (uint256) {
        uint256 tax = isBuy ? buyTax : sellTax;
        return (amount * tax) / 100;
    }
}
"
    },
    "contracts/token/TransferValidator.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "../libraries/Ownable.sol";

/**
 * @title TransferValidator
 * @dev Validates transfers according to token rules
 */
contract TransferValidator is Ownable {
    bool public tradingEnabled = false;
    uint256 public tradingEnabledTimestamp;

    mapping(address => bool) public isAuthorizedTransfer;

    event TradingEnabled(uint256 timestamp);
    event AuthorizedTransferUpdated(address indexed account, bool authorized);

    function enableTrading() external onlyOwner {
        require(!tradingEnabled, "Trading already enabled");
        tradingEnabled = true;
        tradingEnabledTimestamp = block.timestamp;
        emit TradingEnabled(block.timestamp);
    }

    function setAuthorizedTransfer(address account, bool authorized) external onlyOwner {
        isAuthorizedTransfer[account] = authorized;
        emit AuthorizedTransferUpdated(account, authorized);
    }

    function canTransfer(address from, address to) public view returns (bool) {
        if (!tradingEnabled) {
            return isAuthorizedTransfer[from] || isAuthorizedTransfer[to];
        }
        return true;
    }

    function getTradingStatus() external view returns (bool enabled, uint256 enabledAt) {
        return (tradingEnabled, tradingEnabledTimestamp);
    }
}
"
    },
    "contracts/token/WhitelistManager.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "../libraries/Ownable.sol";
import "../utils/EnumerableSet.sol";

/**
 * @title WhitelistManager
 * @dev Manages whitelist functionality for presale and early access
 */
contract WhitelistManager is Ownable {
    using EnumerableSet for EnumerableSet.AddressSet;

    EnumerableSet.AddressSet private _whitelist;
    bool public whitelistEnabled = false;

    event WhitelistEnabled(bool enabled);
    event AddressWhitelisted(address indexed account);
    event AddressRemovedFromWhitelist(address indexed account);

    function setWhitelistEnabled(bool _enabled) external onlyOwner {
        whitelistEnabled = _enabled;
        emit WhitelistEnabled(_enabled);
    }

    function addToWhitelist(address account) external onlyOwner {
        require(account != address(0), "Invalid address");
        _whitelist.add(account);
        emit AddressWhitelisted(account);
    }

    function addMultipleToWhitelist(address[] calldata accounts) external onlyOwner {
        for (uint256 i = 0; i < accounts.length; i++) {
            if (accounts[i] != address(0)) {
                _whitelist.add(accounts[i]);
                emit AddressWhitelisted(accounts[i]);
            }
        }
    }

    function removeFromWhitelist(address account) external onlyOwner {
        _whitelist.remove(account);
        emit AddressRemovedFromWhitelist(account);
    }

    function isWhitelisted(address account) public view returns (bool) {
        return _whitelist.contains(account);
    }

    function getWhitelistCount() external view returns (uint256) {
        return _whitelist.length();
    }

    function getWhitelistAddress(uint256 index) external view returns (address) {
        return _whitelist.at(index);
    }
}
"
    },
    "contracts/utils/EmergencyWithdraw.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "../libraries/Ownable.sol";
import "../libraries/Address.sol";
import "../interfaces/IERC20.sol";

/**
 * @title EmergencyWithdraw
 * @dev Provides emergency withdrawal functionality
 */
contract EmergencyWithdraw is Ownable {
    using Address for address payable;

    event EmergencyWithdrawal(address indexed token, uint256 amount);
    event ETHWithdrawal(uint256 amount);

    function emergencyWithdrawToken(address token, uint256 amount) external onlyOwner {
        require(token != address(0), "Invalid token");
        IERC20(token).transfer(owner(), amount);
        emit EmergencyWithdrawal(token, amount);
    }

    function emergencyWithdrawETH() external onlyOwner {
        uint256 balance = address(this).balance;
        require(balance > 0, "No ETH to withdraw");
        payable(owner()).sendValue(balance);
        emit ETHWithdrawal(balance);
    }

    function rescueStuckTokens(address token) external onlyOwner {
        uint256 balance = IERC20(token).balanceOf(address(this));
        require(balance > 0, "No tokens to rescue");
        IERC20(token).transfer(owner(), balance);
        emit EmergencyWithdrawal(token, balance);
    }

receive() external payable virtual {}
}
"
    },
    "contracts/utils/EnumerableSet.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/**
 * @title EnumerableSet
 * @dev Library for managing sets of primitive types
 */
library EnumerableSet {
    struct Set {
        bytes32[] _values;
        mapping(bytes32 => uint256) _indexes;
    }

    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    function _remove(Set storage set, bytes32 value) private returns (bool) {
        uint256 valueIndex = set._indexes[value];
        if (valueIndex != 0) {
            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;
            if (lastIndex != toDeleteIndex) {
                bytes32 lastValue = set._values[lastIndex];
                set._values[toDeleteIndex] = lastValue;
                set._indexes[lastValue] = valueIndex;
            }
            set._values.pop();
            delete set._indexes[value];
            return true;
        } else {
            return false;
        }
    }

    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    struct AddressSet {
        Set _inner;
    }

    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }
}
"
    }
  },
  "settings": {
    "optimizer": {
      "enabled": true,
      "runs": 200
    },
    "evmVersion": "paris",
    "outputSelection": {
      "*": {
        "*": [
          "evm.bytecode",
          "evm.deployedBytecode",
          "devdoc",
          "userdoc",
          "metadata",
          "abi"
        ]
      }
    }
  }
}}

Tags:
ERC20, Proxy, Pausable, Swap, Liquidity, Upgradeable, Factory|addr:0xd5106151f014003f15c033bac2b5db3f25a641e4|verified:true|block:23748481|tx:0xb6eeca459281682bd4251e55b9bdf16733b15c180a0ab0ef8b6da8330e67efcc|first_check:1762535292

Submitted on: 2025-11-07 18:08:13

Comments

Log in to comment.

No comments yet.