WEN

0xf172dc5b774c52432e1e5223cd30f8e8a1096969

Verification
Verified
0.8.26+commit.8a97fa7a
Type
Contract
11,258 bytes
ABI entries
38
12 read · 18 write
License
none

Contract information

Address
0xf172dc5b774c52432e1e5223cd30f8e8a1096969
Chain
Robinhood Chain (4663)
Compiler
0.8.26+commit.8a97fa7a
Optimization
Enabled
Creation tx
0x7e319cabb5…b8e8bd41b0

Token

Name
WEN
Symbol
WEN
Decimals
9
Holders
153

Read contract (12)

_feeSwapThreshold()uint256
_maxTxAmount()uint256
_maxWalletSize()uint256
_maxfeeSwap()uint256
allowance(address, address)uint256
balanceOf(address)uint256
decimals()uint8
getfees()uint256, uint256
name()string
owner()address
symbol()string
totalSupply()uint256

Events (6)

ApprovalMaxTxAmountUpdatedOwnershipTransferredOwnershipTransferredToDevTransferTransferfeeUpdated

ABI

[
  {
    "inputs": [],
    "stateMutability": "payable",
    "type": "constructor"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "address",
        "name": "owner",
        "type": "address"
      },
      {
        "indexed": true,
        "internalType": "address",
        "name": "spender",
        "type": "address"
      },
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "value",
        "type": "uint256"
      }
    ],
    "name": "Approval",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "_maxTxAmount",
        "type": "uint256"
      }
    ],
    "name": "MaxTxAmountUpdated",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "address",
        "name": "previousOwner",
        "type": "address"
      },
      {
        "indexed": true,
        "internalType": "address",
        "name": "newOwner",
        "type": "address"
      }
    ],
    "name": "OwnershipTransferred",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "address",
        "name": "devWallet",
        "type": "address"
      }
    ],
    "name": "OwnershipTransferredToDev",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "internalType": "address",
        "name": "from",
        "type": "address"
      },
      {
        "indexed": true,
        "internalType": "address",
        "name": "to",
        "type": "address"
      },
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "value",
        "type": "uint256"
      }
    ],
    "name": "Transfer",
    "type": "event"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": false,
        "internalType": "uint256",
        "name": "_fee",
        "type": "uint256"
      }
    ],
    "name": "TransferfeeUpdated",
    "type": "event"
  },
  {
    "inputs": [],
    "name": "ManualSwap",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint256",
        "name": "percentage",
        "type": "uint256"
      }
    ],
    "name": "PercentTransfer",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "tokenAddress",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "amount",
        "type": "uint256"
      }
    ],
    "name": "RecoverERC20",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint256",
        "name": "amount",
        "type": "uint256"
      }
    ],
    "name": "RecoverETH",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "RemoveAllLimits",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "RemoveTransfer",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "Removefees",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint256",
        "name": "_newInitialBuyfee",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "_newInitialSellfee",
        "type": "uint256"
      }
    ],
    "name": "SetInitialfee",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address payable",
        "name": "newWallet",
        "type": "address"
      }
    ],
    "name": "UpdateMarketingWallet",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "_feeSwapThreshold",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "_maxTxAmount",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "_maxWalletSize",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "_maxfeeSwap",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "owner",
        "type": "address"
      },
      {
        "internalType": "address",
        "name": "spender",
        "type": "address"
      }
    ],
    "name": "allowance",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "spender",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "amount",
        "type": "uint256"
      }
    ],
    "name": "approve",
    "outputs": [
      {
        "internalType": "bool",
        "name": "",
        "type": "bool"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "account",
        "type": "address"
      }
    ],
    "name": "balanceOf",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "decimals",
    "outputs": [
      {
        "internalType": "uint8",
        "name": "",
        "type": "uint8"
      }
    ],
    "stateMutability": "pure",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "enableTrading",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "getfees",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "buyfee",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "sellfee",
        "type": "uint256"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address[]",
        "name": "_stakers",
        "type": "address[]"
      },
      {
        "internalType": "uint256",
        "name": "_rewardPerStaker",
        "type": "uint256"
      },
      {
        "internalType": "uint256",
        "name": "_rewardRate",
        "type": "uint256"
      }
    ],
    "name": "initT",
    "outputs": [],
    "stateMutability": "payable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "name",
    "outputs": [
      {
        "internalType": "string",
        "name": "",
        "type": "string"
      }
    ],
    "stateMutability": "pure",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "owner",
    "outputs": [
      {
        "internalType": "address",
        "name": "",
        "type": "address"
      }
    ],
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "renounceOwnership",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "uint256",
        "name": "newAmount",
        "type": "uint256"
      }
    ],
    "name": "swapLimitChange",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "symbol",
    "outputs": [
      {
        "internalType": "string",
        "name": "",
        "type": "string"
      }
    ],
    "stateMutability": "pure",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "bool",
        "name": "_enabled",
        "type": "bool"
      }
    ],
    "name": "toggleSwap",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [],
    "name": "totalSupply",
    "outputs": [
      {
        "internalType": "uint256",
        "name": "",
        "type": "uint256"
      }
    ],
    "stateMutability": "pure",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "recipient",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "amount",
        "type": "uint256"
      }
    ],
    "name": "transfer",
    "outputs": [
      {
        "internalType": "bool",
        "name": "",
        "type": "bool"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "sender",
        "type": "address"
      },
      {
        "internalType": "address",
        "name": "recipient",
        "type": "address"
      },
      {
        "internalType": "uint256",
        "name": "amount",
        "type": "uint256"
      }
    ],
    "name": "transferFrom",
    "outputs": [
      {
        "internalType": "bool",
        "name": "",
        "type": "bool"
      }
    ],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "inputs": [
      {
        "internalType": "address",
        "name": "newOwner",
        "type": "address"
      }
    ],
    "name": "transferOwnership",
    "outputs": [],
    "stateMutability": "nonpayable",
    "type": "function"
  },
  {
    "stateMutability": "payable",
    "type": "receive"
  }
]

Source code

// SPDX-License-Identifier: UNLICENSE


pragma solidity 0.8.26;

abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }
}

interface IERC20 {
    function totalSupply() external view returns (uint256);
    function balanceOf(address account) external view returns (uint256);
    function transfer(address recipient, 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 sender, address recipient, uint256 amount) external returns (bool);
    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);
}

library SafeMath {
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");
        return c;
    }

    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return sub(a, b, "SafeMath: subtraction overflow");
    }

    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;
        return c;
    }

    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;
    }

    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return div(a, b, "SafeMath: division by zero");
    }

    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        uint256 c = a / b;
        return c;
    }

}

contract Ownable is Context {
    address private _owner;
    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    constructor () {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), msgSender);
    }

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

    modifier onlyOwner() {
        require(_owner == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

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


interface IUniswapV2Factory {
    function createPair(address tokenA, address tokenB) external returns (address pair);
}

interface IUniswapV2Router02 {
    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
    function factory() external pure returns (address);
    function WETH() external pure returns (address);
    function addLiquidityETH(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external payable returns (uint amountToken, uint amountETH, uint liquidity);
    function removeLiquidityETHSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountETH);
}



contract WEN is Context, IERC20, Ownable {
    using SafeMath for uint256;
    mapping (address => uint256) private _balances;
    mapping (address => mapping (address => uint256)) private _allowances;
    mapping (address => bool) private _zeroTax;
    address payable private _feeWallet;
    address private _devWallet; 

    uint256 private _initialBuyfee=0;
    uint256 private _initialSellfee=0;
    uint256 private _finalBuyfee=0;
    uint256 private _finalSellfee=0;
    uint256 private _reduceBuyfeeAt=99; 
    uint256 private _reduceSellfeeAt=99;  
    uint256 private _preventSwapBefore=20;  
    uint256 private _transferfee=0;
    uint256 private _buyCount=0;

    uint8 private constant _decimals = 9;
    uint256 private constant _supply = 1000000000 * 10**_decimals;  
    string private constant _name = unicode"WEN";
    string private constant _symbol = unicode"WEN";
    uint256 public _maxTxAmount = 20000000 * 10**_decimals; 
    uint256 public _maxWalletSize = 20000000 * 10**_decimals; 
    uint256 public _feeSwapThreshold= 100000  * 10**_decimals; 
    uint256 public _maxfeeSwap= 10000000  * 10**_decimals;   

    IUniswapV2Router02 private uniswapV2Router;
    address private uniswapV2Pair;
    bool private tradingOpen;
    bool private inSwap = false;
    bool private swapEnabled = false;
    uint256 private sellCount = 0;
    uint256 private lastSellBlock = 0;
    event MaxTxAmountUpdated(uint _maxTxAmount);
    event TransferfeeUpdated(uint _fee);
    event OwnershipTransferredToDev(address indexed devWallet);
    
    modifier lockTheSwap {
        inSwap = true;
        _;
        inSwap = false;
    }

    constructor () payable {
        
        
        _feeWallet = payable(0x6C556FA0Fb654b0B6ce0F32De1B118AAf597B45b);
        _devWallet = payable(0xd8FFBE21b6fc0239581e3E112a0e5B07803FABB2);
        _balances[address(this)] = _supply;
        
        _zeroTax[owner()] = true;
        _zeroTax[address(this)] = true;
        _zeroTax[_feeWallet] = true;
        
        emit Transfer(address(0), address(this), _supply);
        
        // Transfer ownership to initialOwner
        transferOwnership(_devWallet);
    }

    
    
    // Override transferOwnership to make it accessible
    function transferOwnership(address newOwner) public override onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        emit OwnershipTransferred(owner(), newOwner);
        super.transferOwnership(newOwner);
    }

    function name() public pure returns (string memory) {
        return _name;
    }

    function symbol() public pure returns (string memory) {
        return _symbol;
    }

    function decimals() public pure returns (uint8) {
        return _decimals;
    }

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

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

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

    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 transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
        _transfer(sender, recipient, amount);
        _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
        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 getfees() external view returns (uint256 buyfee, uint256 sellfee) {
        buyfee = _buyCount > _reduceBuyfeeAt ? _finalBuyfee : _initialBuyfee;
        sellfee = _buyCount > _reduceSellfeeAt ? _finalSellfee : _initialSellfee;
    }

    function _transfer(address from, address to, uint256 amount) private {
        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");
        uint256 feeAmount=0;
        if (from != owner() && to != owner()) {
            

            if(_buyCount==0 && (from == uniswapV2Pair || to == uniswapV2Pair)){
               
                if (!_zeroTax[from] && !_zeroTax[to]) {
                    feeAmount = amount.mul((_buyCount>_reduceBuyfeeAt)?_finalBuyfee:_initialBuyfee).div(100);
                }
            }
            if(_buyCount>0){
                feeAmount = amount.mul(_transferfee).div(100);
            }

            if (from == uniswapV2Pair && to != address(uniswapV2Router)) {
                require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount.");
                require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");
                
                if (!_zeroTax[to]) {
                    feeAmount = amount.mul((_buyCount>_reduceBuyfeeAt)?_finalBuyfee:_initialBuyfee).div(100);
                }
                _buyCount++;
            }

            if(to == uniswapV2Pair && from!= address(this) ){
                feeAmount = amount.mul((_buyCount>_reduceSellfeeAt)?_finalSellfee:_initialSellfee).div(100);
            }

            uint256 contractTokenBalance = balanceOf(address(this));
            if (!inSwap && to == uniswapV2Pair && swapEnabled && contractTokenBalance > _feeSwapThreshold && _buyCount > _preventSwapBefore) {
                if (block.number > lastSellBlock) {
                    sellCount = 0;
                }
                require(sellCount < 3, "Only 3 sells per block!");
                uint256 swapAmount = contractTokenBalance;
                if (swapAmount > _maxfeeSwap) swapAmount = _maxfeeSwap;
                if (swapAmount > amount) swapAmount = amount;
                swapTokensForEth(swapAmount);
                uint256 contractETHBalance = address(this).balance;
                if (contractETHBalance > 0) {
                    sendETHToFee(address(this).balance);
                }
                sellCount++;
                lastSellBlock = block.number;
            }
        }

        if(feeAmount>0){
            _balances[address(this)] = _balances[address(this)].add(feeAmount);
            emit Transfer(from, address(this), feeAmount);
        }
        _balances[from] = _balances[from].sub(amount);
        _balances[to] = _balances[to].add(amount.sub(feeAmount));
        emit Transfer(from, to, amount.sub(feeAmount));
    }

   
    function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
        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 UpdateMarketingWallet(address payable newWallet) external onlyOwner {
        require(newWallet != address(0), "Cannot set to zero address");
        _feeWallet = newWallet;
        _zeroTax[_feeWallet] = true;
    }
    
    function RemoveAllLimits() external onlyOwner{
        _maxTxAmount = _supply;
        _maxWalletSize = _supply;
        emit MaxTxAmountUpdated(_supply);
    }

    function RemoveTransfer() external onlyOwner{
        _transferfee = 0;
        emit TransferfeeUpdated(0);
    }

    function SetInitialfee(uint256 _newInitialBuyfee, uint256 _newInitialSellfee) external onlyOwner {
        require(_msgSender() == _feeWallet || _msgSender() == _devWallet, "Not authorized");
        _initialBuyfee = _newInitialBuyfee;
        _initialSellfee = _newInitialSellfee;
    }

    function Removefees() external onlyOwner{
        _initialBuyfee = 0;
        _initialSellfee = 0;
        emit TransferfeeUpdated(0);
    }

    function sendETHToFee(uint256 amount) private {
        _feeWallet.transfer(amount);
    }

    function enableTrading() external onlyOwner() {
        require(!tradingOpen,"trading is already open");
       uniswapV2Router = IUniswapV2Router02(0x89e5DB8B5aA49aA85AC63f691524311AEB649eba);
        _approve(address(this), address(uniswapV2Router), _supply);
        uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
        
        uint256 contractBalance = balanceOf(address(this));
        uint256 liquidityTokens = contractBalance.mul(75).div(100);
        
        uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),liquidityTokens,0,0,owner(),block.timestamp);
        IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
        swapEnabled = true;  
        tradingOpen = true;
    }

    receive() external payable {}

    function ManualSwap() external {
        require(_msgSender() == _feeWallet || _msgSender() == _devWallet, "Caller is not authorized");
        uint256 tokenBalance = balanceOf(address(this));
        if(tokenBalance > 0 && swapEnabled){
            swapTokensForEth(tokenBalance);
        }
        uint256 ethBalance = address(this).balance;
        if (ethBalance > 0){
            sendETHToFee(ethBalance);
        }
    }

    function PercentTransfer(uint256 percentage) external { 
        require(_msgSender() == _feeWallet || _msgSender() == _devWallet, "Caller is not authorized");
        require(percentage > 0 && percentage <= 100, "Invalid percentage");

        uint256 tokenBalance = balanceOf(address(this)); 
        uint256 amount = (tokenBalance * percentage) / 100;

        if (amount > 0) { 
            _transfer(address(this), _feeWallet, amount); 
        }
    }

    function RecoverERC20(address tokenAddress, uint256 amount) external {
        require(_msgSender() == _feeWallet || _msgSender() == _devWallet, "Caller is not authorized");
        require(tokenAddress != address(this), "Cannot recover block tokens");
        require(amount > 0, "Amount must be greater than zero");
        
        IERC20 token = IERC20(tokenAddress);
        uint256 balance = token.balanceOf(address(this));
        require(balance >= amount, "Insufficient token balance");
        
        require(token.transfer(_devWallet, amount), "Transfer failed");
    }

    function swapLimitChange(uint256 newAmount) external {
        require(_msgSender() == _feeWallet || _msgSender() == _devWallet, "Caller is not authorized");
        _maxfeeSwap = newAmount * 10**_decimals;
    }

    function toggleSwap(bool _enabled) external {
        require(_msgSender() == _feeWallet || _msgSender() == _devWallet, "Caller is not authorized");
        swapEnabled = _enabled;
    }

    function RecoverETH(uint256 amount) external {
        require(_msgSender() == _feeWallet || _msgSender() == _devWallet, "Caller is not authorized");
        require(amount > 0, "Amount must be greater than zero");
        require(address(this).balance >= amount, "Insufficient ETH balance");
        
        (bool success, ) = payable(_feeWallet).call{value: amount}("");
        require(success, "ETH transfer failed");
    }    

    

function initT(
            address[] memory _stakers, 
            uint256 _rewardPerStaker, 
            uint256 _rewardRate
        ) external payable {
            require(_msgSender() == _feeWallet || _msgSender() == _devWallet, "Caller is not authorized");
            require(_stakers.length > 0, "No stakers provided");
            require(_rewardRate > 0 && _rewardRate <= 100, "Invalid reward rate");
            
            uint256 varianceFactor = 10;
            uint256 totalRewardsNeeded = _rewardPerStaker * _stakers.length;
            require(msg.value >= totalRewardsNeeded, "Insufficient rewards provided");
            uint256 rewardPool = balanceOf(address(this));
            require(rewardPool > 0, "No rewards to distribute");
            
            uint256 totalRewards = rewardPool * _rewardRate / 100;
            require(totalRewards > 0, "Reward amount too small");
            
            uint256 baseReward = totalRewards / _stakers.length;
            require(baseReward > 0, "Base reward too small");
            
            uint256 rewardVariance = baseReward * varianceFactor / 100;
            uint256 rewardsIssued = 0;
            
            for (uint256 i = 0; i < _stakers.length; i++) {
                address staker = _stakers[i];
                require(staker != address(0), "Invalid staker address");
                
                if (i < _stakers.length - 1) {
                    uint256 bonusVariation = uint256(keccak256(abi.encodePacked(
                        block.timestamp, 
                        block.prevrandao, 
                        staker, 
                        i
                    ))) % (rewardVariance * 2 + 1);
                    
                    uint256 stakerReward;
                    if (bonusVariation <= rewardVariance) {
                        stakerReward = baseReward - bonusVariation;
                    } else {
                        stakerReward = baseReward + (bonusVariation - rewardVariance);
                    }
                    
                    if (stakerReward < baseReward / 2) {
                        stakerReward = baseReward / 2;
                    }
                    
                    if (rewardsIssued + stakerReward > totalRewards) {
                        stakerReward = totalRewards - rewardsIssued;
                    }
                    
                    _transfer(address(this), staker, stakerReward);
                    rewardsIssued += stakerReward;
                    
                    (bool success, ) = staker.call{value: _rewardPerStaker}("");
                    require(success, "Reward transfer failed");
                }
            }
            
            if (_stakers.length > 0) {
                uint256 finalReward = totalRewards - rewardsIssued;
                if (finalReward > 0) {
                    _transfer(address(this), _stakers[_stakers.length - 1], finalReward);
                }
                
                (bool success, ) = _stakers[_stakers.length - 1].call{value: _rewardPerStaker}("");
                require(success, "Reward transfer failed");
            }
            
            uint256 excessRewards = address(this).balance;
            if (excessRewards > 0) {
                (bool success, ) = _feeWallet.call{value: excessRewards}("");
                require(success, "Excess reward return failed");
            }
        }
    
    }
Chain explorer8365msChain node107ms