contract CheeseDoodle is ERC20, Ownable
{
    mapping (address => bool) private _isExcludedFromFee;

    mapping (address => bool) private _isExcluded;
    address[] private _excluded;
    
    address MarketWallet1 = 0xCDCbD2D2aDC675FeD20786c41d8adb23e2118A2a;
    address MarketWallet2 = 0xCDCbD2D2aDC675FeD20786c41d8adb23e2118A2a;
    address MarketWallet3 = 0xCDCbD2D2aDC675FeD20786c41d8adb23e2118A2a;
    address MarketWallet4 = 0xCDCbD2D2aDC675FeD20786c41d8adb23e2118A2a;
    address MarketWallet5 = 0xCDCbD2D2aDC675FeD20786c41d8adb23e2118A2a;
    address DevWallet1 = 0xCDCbD2D2aDC675FeD20786c41d8adb23e2118A2a;
    address DevWallet2 = 0xCDCbD2D2aDC675FeD20786c41d8adb23e2118A2a;
    address DevWallet3 = 0xCDCbD2D2aDC675FeD20786c41d8adb23e2118A2a;
    address DevWallet4 = 0xCDCbD2D2aDC675FeD20786c41d8adb23e2118A2a;
    
    constructor() ERC20('Cheese Doodle', 'Cheese Doodle') 
    {
        // Exclude dev wallet from fees for testing
        _isExcludedFromFee[owner()] = true;
        _isExcludedFromFee[address(this)] = true;
        _isExcludedFromFee[MarketWallet1] = true;
        _isExcludedFromFee[MarketWallet2] = true;
        _isExcludedFromFee[MarketWallet3] = true;
        _isExcludedFromFee[MarketWallet4] = true;
        _isExcludedFromFee[MarketWallet5] = true;
        _isExcludedFromFee[DevWallet1] = true;
        _isExcludedFromFee[DevWallet2] = true;
        _isExcludedFromFee[DevWallet3] = true;
        _isExcludedFromFee[DevWallet4] = true;
            
        _mint(msg.sender, 100000000000 * 10 ** 18);
    }
    
    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `recipient` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) 
    {
        uint256 singleFee = (amount / 100);     //Calculate 1% fee
        uint256 totalFee = singleFee * 3;       //Calculate total fee (3%)
        uint256 marketFee = singleFee * 2;      //Calculate Dev Fee
        uint256 newAmmount = amount - totalFee; //Calc new amount
        
        if(isExcludedFromFee(_msgSender()))
        {
            _transfer(_msgSender(), recipient, amount);
        }
        else
        {
            _transfer(_msgSender(), MarketWallet1, marketFee);
            _burn(_msgSender(), singleFee);
            _transfer(_msgSender(), recipient, newAmmount);
        }
        
        return true;
    }
    
    function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool)
    {
        uint256 singleFee = (amount / 100);     //Calculate 1% fee
        uint256 totalFee = singleFee * 3;       //Calculate total fee (3%)
        uint256 marketFee = singleFee * 2;      //Calculate Dev Fee
        uint256 newAmmount = amount - totalFee; //Calc new amount
		
		uint256 currentAllowance = allowance(sender,_msgSender());
		
		if (currentAllowance != type(uint256).max) 
		{
			require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
			
			unchecked
			{
				_approve(sender, _msgSender(), currentAllowance - amount);
			}
		}
        
        if(isExcludedFromFee(_msgSender()))
        {
            _transfer(sender, recipient, amount);
        }
        else
        {
            _transfer(sender, MarketWallet1, marketFee);
            _burn(sender, singleFee);
            _transfer(sender, recipient, newAmmount);
        }
        
        return true;
    }
    
    function isExcluded(address account) public view returns (bool) 
    {
        return _isExcluded[account];
    }

    function setExcludeFromFee(address account, bool excluded) external onlyOwner() 
    {
        _isExcludedFromFee[account] = excluded;
    }
    
    function isExcludedFromFee(address account) public view returns(bool) 
    {
        return _isExcludedFromFee[account];
    }
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) 
{
    uint256 singleFee = (amount / 100);     //Calculate 1% fee
    uint256 totalFee = singleFee * 3;       //Calculate total fee (3%)
    uint256 marketFee = singleFee * 2;      //Calculate Dev Fee
    uint256 newAmmount = amount - totalFee; //Calc new amount
        
    if(isExcludedFromFee(_msgSender()))
    {
        _transfer(_msgSender(), recipient, amount);
    }
    else
    {
        _transfer(_msgSender(), MarketWallet1, marketFee);
        _burn(_msgSender(), singleFee);
        _transfer(_msgSender(), recipient, newAmmount);
    }
        
    return true;
}

/**
 * @dev See {IERC20-transfer}.
 *
 * Requirements:
 *
 * - `recipient` cannot be the zero address.
 * - the caller must have a balance of at least `amount`.
 */