|
|
|
|
|
|
|
|
|
|
|
|
|
pragma solidity 0.8.15;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface IERC20Metadata is IERC20 {
|
|
function name() external view returns (string memory);
|
|
function symbol() external view returns (string memory);
|
|
function decimals() external view returns (uint8);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
abstract contract Context {
|
|
function _msgSender() internal view virtual returns (address) {
|
|
return msg.sender;
|
|
}
|
|
|
|
function _msgData() internal view virtual returns (bytes calldata) {
|
|
return msg.data;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
contract Ownable is Context {
|
|
address private _owner;
|
|
address private _previousOwner;
|
|
|
|
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
|
|
|
|
|
|
|
|
|
|
constructor () {
|
|
address msgSender = _msgSender();
|
|
_owner = msgSender;
|
|
emit OwnershipTransferred(address(0), msgSender);
|
|
}
|
|
|
|
|
|
|
|
|
|
function owner() public view returns (address) {
|
|
return _owner;
|
|
}
|
|
|
|
|
|
|
|
|
|
modifier onlyOwner() {
|
|
require(_owner == _msgSender(), "Ownable: caller is not the owner");
|
|
_;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
contract ERC20 is Context, IERC20, IERC20Metadata {
|
|
mapping(address => uint256) private _balances;
|
|
|
|
mapping(address => mapping(address => uint256)) private _allowances;
|
|
|
|
uint256 private _totalSupply;
|
|
|
|
string private _name;
|
|
string private _symbol;
|
|
|
|
|
|
|
|
|
|
constructor(string memory name_, string memory symbol_) {
|
|
_name = name_;
|
|
_symbol = symbol_;
|
|
}
|
|
|
|
|
|
|
|
|
|
function name() public view virtual override returns (string memory) {
|
|
return _name;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function symbol() public view virtual override returns (string memory) {
|
|
return _symbol;
|
|
}
|
|
|
|
|
|
|
|
|
|
function decimals() public view virtual override returns (uint8) {
|
|
return 18;
|
|
}
|
|
|
|
|
|
|
|
|
|
function totalSupply() public view virtual override returns (uint256) {
|
|
return _totalSupply;
|
|
}
|
|
|
|
|
|
|
|
|
|
function balanceOf(address account) public view virtual override returns (uint256) {
|
|
return _balances[account];
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
|
|
_transfer(_msgSender(), recipient, amount);
|
|
return true;
|
|
}
|
|
|
|
|
|
|
|
|
|
function allowance(address owner, address spender) public view virtual override returns (uint256) {
|
|
return _allowances[owner][spender];
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function approve(address spender, uint256 amount) public virtual override returns (bool) {
|
|
_approve(_msgSender(), spender, amount);
|
|
return true;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function transferFrom(
|
|
address sender,
|
|
address recipient,
|
|
uint256 amount
|
|
) public virtual override returns (bool) {
|
|
_transfer(sender, recipient, amount);
|
|
|
|
uint256 currentAllowance = _allowances[sender][_msgSender()];
|
|
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
|
|
unchecked {
|
|
_approve(sender, _msgSender(), currentAllowance - amount);
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function _transfer(
|
|
address sender,
|
|
address recipient,
|
|
uint256 amount
|
|
) internal virtual {
|
|
require(sender != address(0), "ERC20: transfer from the zero address");
|
|
require(recipient != address(0), "ERC20: transfer to the zero address");
|
|
|
|
_beforeTokenTransfer(sender, recipient, amount);
|
|
|
|
uint256 senderBalance = _balances[sender];
|
|
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
|
|
unchecked {
|
|
_balances[sender] = senderBalance - amount;
|
|
}
|
|
_balances[recipient] += amount;
|
|
|
|
emit Transfer(sender, recipient, amount);
|
|
|
|
_afterTokenTransfer(sender, recipient, amount);
|
|
}
|
|
|
|
|
|
|
|
|
|
function _createInitialTotalSupply(address account, uint256 amount) internal virtual {
|
|
require(account != address(0));
|
|
|
|
_beforeTokenTransfer(address(0), account, amount);
|
|
|
|
_totalSupply += amount;
|
|
_balances[account] += amount;
|
|
emit Transfer(address(0), account, amount);
|
|
|
|
_afterTokenTransfer(address(0), account, amount);
|
|
}
|
|
|
|
|
|
|
|
|
|
function _approve(
|
|
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 _beforeTokenTransfer(
|
|
address from,
|
|
address to,
|
|
uint256 amount
|
|
) internal virtual {}
|
|
|
|
|
|
|
|
|
|
function _afterTokenTransfer(
|
|
address from,
|
|
address to,
|
|
uint256 amount
|
|
) internal virtual {}
|
|
}
|
|
|
|
|
|
interface IUniswapV2Router01 {
|
|
function factory() external pure returns (address);
|
|
function WETH() external pure returns (address);
|
|
|
|
function addLiquidity(
|
|
address tokenA,
|
|
address tokenB,
|
|
uint amountADesired,
|
|
uint amountBDesired,
|
|
uint amountAMin,
|
|
uint amountBMin,
|
|
address to,
|
|
uint deadline
|
|
) external returns (uint amountA, uint amountB, uint liquidity);
|
|
function addLiquidityETH(
|
|
address token,
|
|
uint amountTokenDesired,
|
|
uint amountTokenMin,
|
|
uint amountETHMin,
|
|
address to,
|
|
uint deadline
|
|
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
|
|
function removeLiquidity(
|
|
address tokenA,
|
|
address tokenB,
|
|
uint liquidity,
|
|
uint amountAMin,
|
|
uint amountBMin,
|
|
address to,
|
|
uint deadline
|
|
) external returns (uint amountA, uint amountB);
|
|
function removeLiquidityETH(
|
|
address token,
|
|
uint liquidity,
|
|
uint amountTokenMin,
|
|
uint amountETHMin,
|
|
address to,
|
|
uint deadline
|
|
) external returns (uint amountToken, uint amountETH);
|
|
function removeLiquidityWithPermit(
|
|
address tokenA,
|
|
address tokenB,
|
|
uint liquidity,
|
|
uint amountAMin,
|
|
uint amountBMin,
|
|
address to,
|
|
uint deadline,
|
|
bool approveMax, uint8 v, bytes32 r, bytes32 s
|
|
) external returns (uint amountA, uint amountB);
|
|
function removeLiquidityETHWithPermit(
|
|
address token,
|
|
uint liquidity,
|
|
uint amountTokenMin,
|
|
uint amountETHMin,
|
|
address to,
|
|
uint deadline,
|
|
bool approveMax, uint8 v, bytes32 r, bytes32 s
|
|
) external returns (uint amountToken, uint amountETH);
|
|
function swapExactTokensForTokens(
|
|
uint amountIn,
|
|
uint amountOutMin,
|
|
address[] calldata path,
|
|
address to,
|
|
uint deadline
|
|
) external returns (uint[] memory amounts);
|
|
function swapTokensForExactTokens(
|
|
uint amountOut,
|
|
uint amountInMax,
|
|
address[] calldata path,
|
|
address to,
|
|
uint deadline
|
|
) external returns (uint[] memory amounts);
|
|
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
|
|
external
|
|
payable
|
|
returns (uint[] memory amounts);
|
|
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
|
|
external
|
|
returns (uint[] memory amounts);
|
|
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
|
|
external
|
|
returns (uint[] memory amounts);
|
|
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
|
|
external
|
|
payable
|
|
returns (uint[] memory amounts);
|
|
|
|
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
|
|
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
|
|
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
|
|
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
|
|
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
|
|
}
|
|
|
|
interface IUniswapV2Router02 is IUniswapV2Router01 {
|
|
function removeLiquidityETHSupportingFeeOnTransferTokens(
|
|
address token,
|
|
uint liquidity,
|
|
uint amountTokenMin,
|
|
uint amountETHMin,
|
|
address to,
|
|
uint deadline
|
|
) external returns (uint amountETH);
|
|
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
|
|
address token,
|
|
uint liquidity,
|
|
uint amountTokenMin,
|
|
uint amountETHMin,
|
|
address to,
|
|
uint deadline,
|
|
bool approveMax, uint8 v, bytes32 r, bytes32 s
|
|
) external returns (uint amountETH);
|
|
|
|
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
|
|
uint amountIn,
|
|
uint amountOutMin,
|
|
address[] calldata path,
|
|
address to,
|
|
uint deadline
|
|
) external;
|
|
function swapExactETHForTokensSupportingFeeOnTransferTokens(
|
|
uint amountOutMin,
|
|
address[] calldata path,
|
|
address to,
|
|
uint deadline
|
|
) external payable;
|
|
function swapExactTokensForETHSupportingFeeOnTransferTokens(
|
|
uint amountIn,
|
|
uint amountOutMin,
|
|
address[] calldata path,
|
|
address to,
|
|
uint deadline
|
|
) external;
|
|
}
|
|
|
|
interface IUniswapV2Factory {
|
|
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
|
|
|
|
function feeTo() external view returns (address);
|
|
function feeToSetter() external view returns (address);
|
|
|
|
function getPair(address tokenA, address tokenB) external view returns (address pair);
|
|
function allPairs(uint) external view returns (address pair);
|
|
function allPairsLength() external view returns (uint);
|
|
|
|
function createPair(address tokenA, address tokenB) external returns (address pair);
|
|
|
|
function setFeeTo(address) external;
|
|
function setFeeToSetter(address) external;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
library SignedSafeMath {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function mul(int256 a, int256 b) internal pure returns (int256) {
|
|
return a * b;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function div(int256 a, int256 b) internal pure returns (int256) {
|
|
return a / b;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function sub(int256 a, int256 b) internal pure returns (int256) {
|
|
return a - b;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function add(int256 a, int256 b) internal pure returns (int256) {
|
|
return a + b;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
library SafeMath {
|
|
|
|
|
|
|
|
|
|
|
|
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
|
|
unchecked {
|
|
uint256 c = a + b;
|
|
if (c < a) return (false, 0);
|
|
return (true, c);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
|
|
unchecked {
|
|
if (b > a) return (false, 0);
|
|
return (true, a - b);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
|
|
unchecked {
|
|
|
|
|
|
|
|
if (a == 0) return (true, 0);
|
|
uint256 c = a * b;
|
|
if (c / a != b) return (false, 0);
|
|
return (true, c);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
|
|
unchecked {
|
|
if (b == 0) return (false, 0);
|
|
return (true, a / b);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
|
|
unchecked {
|
|
if (b == 0) return (false, 0);
|
|
return (true, a % b);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function add(uint256 a, uint256 b) internal pure returns (uint256) {
|
|
return a + b;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
|
|
return a - b;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
|
|
return a * b;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function div(uint256 a, uint256 b) internal pure returns (uint256) {
|
|
return a / b;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
|
|
return a % b;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function sub(
|
|
uint256 a,
|
|
uint256 b,
|
|
string memory errorMessage
|
|
) internal pure returns (uint256) {
|
|
unchecked {
|
|
require(b <= a, errorMessage);
|
|
return a - b;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function div(
|
|
uint256 a,
|
|
uint256 b,
|
|
string memory errorMessage
|
|
) internal pure returns (uint256) {
|
|
unchecked {
|
|
require(b > 0, errorMessage);
|
|
return a / b;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function mod(
|
|
uint256 a,
|
|
uint256 b,
|
|
string memory errorMessage
|
|
) internal pure returns (uint256) {
|
|
unchecked {
|
|
require(b > 0, errorMessage);
|
|
return a % b;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
library SafeCast {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function toUint224(uint256 value) internal pure returns (uint224) {
|
|
require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits");
|
|
return uint224(value);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function toUint128(uint256 value) internal pure returns (uint128) {
|
|
require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits");
|
|
return uint128(value);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function toUint96(uint256 value) internal pure returns (uint96) {
|
|
require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits");
|
|
return uint96(value);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function toUint64(uint256 value) internal pure returns (uint64) {
|
|
require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits");
|
|
return uint64(value);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function toUint32(uint256 value) internal pure returns (uint32) {
|
|
require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits");
|
|
return uint32(value);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function toUint16(uint256 value) internal pure returns (uint16) {
|
|
require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits");
|
|
return uint16(value);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function toUint8(uint256 value) internal pure returns (uint8) {
|
|
require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits");
|
|
return uint8(value);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function toUint256(int256 value) internal pure returns (uint256) {
|
|
require(value >= 0, "SafeCast: value must be positive");
|
|
return uint256(value);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function toInt128(int256 value) internal pure returns (int128) {
|
|
require(value >= type(int128).min && value <= type(int128).max, "SafeCast: value doesn't fit in 128 bits");
|
|
return int128(value);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function toInt64(int256 value) internal pure returns (int64) {
|
|
require(value >= type(int64).min && value <= type(int64).max, "SafeCast: value doesn't fit in 64 bits");
|
|
return int64(value);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function toInt32(int256 value) internal pure returns (int32) {
|
|
require(value >= type(int32).min && value <= type(int32).max, "SafeCast: value doesn't fit in 32 bits");
|
|
return int32(value);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function toInt16(int256 value) internal pure returns (int16) {
|
|
require(value >= type(int16).min && value <= type(int16).max, "SafeCast: value doesn't fit in 16 bits");
|
|
return int16(value);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function toInt8(int256 value) internal pure returns (int8) {
|
|
require(value >= type(int8).min && value <= type(int8).max, "SafeCast: value doesn't fit in 8 bits");
|
|
return int8(value);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function toInt256(uint256 value) internal pure returns (int256) {
|
|
|
|
require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256");
|
|
return int256(value);
|
|
}
|
|
}
|
|
|
|
contract ProofOfRug is ERC20, Ownable {
|
|
using SafeMath for uint256;
|
|
|
|
bool private inSwapAndLiquify;
|
|
bool public swapAndLiquifyEnabled = true;
|
|
bool private isOpen = false;
|
|
|
|
uint256 public liquidityFee = 1;
|
|
uint256 public marketingFee = 3;
|
|
uint256 public devFee = 1;
|
|
uint256 public sellLiquidityFee = 1;
|
|
uint256 public sellMarketingFee = 3;
|
|
uint256 public sellDevFee = 1;
|
|
uint256 public maxTransactionAmount = 20000000 * (10**18);
|
|
uint256 public maxWalletToken = 30000000 * (10**18);
|
|
uint256 public swapTokensAtAmount = 500000 * (10**18);
|
|
|
|
IUniswapV2Router02 public uniswapV2Router;
|
|
address public immutable uniswapV2Pair;
|
|
|
|
address payable public marketingWallet = payable(0x6087376a24F6cb6394cA7D9A0Fc4FB07Ab4CDBA5);
|
|
address payable public devWallet = payable(0xf97bBC95e7A640BA845285C1004DE0a1aA1c1ec2);
|
|
|
|
|
|
mapping (address => bool) private _isExcludedFromFees;
|
|
|
|
modifier lockTheSwap {
|
|
inSwapAndLiquify = true;
|
|
_;
|
|
inSwapAndLiquify = false;
|
|
}
|
|
|
|
event SwapAndLiquify(uint256 tokensIntoLiqudity, uint256 ethReceived);
|
|
event SwapAndLiquifyEnabledUpdated(bool enabled);
|
|
event SwapETHForTokens(uint256 amountIn, address[] path);
|
|
event ExcludeFromFees(address indexed account, bool isExcluded);
|
|
|
|
|
|
constructor() ERC20("Proof Of Rug", "SAFU") {
|
|
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
|
|
|
|
address _uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
|
|
.createPair(address(this), _uniswapV2Router.WETH());
|
|
|
|
uniswapV2Router = _uniswapV2Router;
|
|
uniswapV2Pair = _uniswapV2Pair;
|
|
|
|
|
|
excludeFromFees(owner(), true);
|
|
excludeFromFees(marketingWallet, true);
|
|
excludeFromFees(devWallet, true);
|
|
excludeFromFees(address(this), true);
|
|
|
|
|
|
|
|
|
|
|
|
_createInitialTotalSupply(owner(), 1000000000 * (10**18));
|
|
}
|
|
|
|
function _transfer(
|
|
address from,
|
|
address to,
|
|
uint256 amount
|
|
) internal override {
|
|
require(from != address(0), "ERC20: transfer from the zero address");
|
|
require(to != address(0), "ERC20: transfer to the zero address");
|
|
bool excludedAccount = _isExcludedFromFees[from] || _isExcludedFromFees[to];
|
|
require(isOpen || excludedAccount, "trading is yet Open");
|
|
|
|
if(amount == 0) {
|
|
super._transfer(from, to, 0);
|
|
return;
|
|
}
|
|
|
|
if(from==uniswapV2Pair && !_isExcludedFromFees[from] && !_isExcludedFromFees[to]){
|
|
uint256 contractBalanceRecepient = balanceOf(to);
|
|
require(contractBalanceRecepient + amount <= maxWalletToken, "Exceeds maximum wallet token amount.");
|
|
}
|
|
|
|
if(to==uniswapV2Pair && !excludedAccount) {
|
|
require(amount <= maxTransactionAmount, "amount exceeds the maxTransactionAmount.");
|
|
}
|
|
|
|
uint256 contractTokenBalance = balanceOf(address(this));
|
|
|
|
bool overMinTokenBalance = contractTokenBalance >= swapTokensAtAmount;
|
|
|
|
if(overMinTokenBalance && !inSwapAndLiquify && to==uniswapV2Pair && swapAndLiquifyEnabled) {
|
|
contractTokenBalance = swapTokensAtAmount;
|
|
swapAndLiquify(contractTokenBalance);
|
|
|
|
}
|
|
|
|
|
|
if(!excludedAccount) {
|
|
uint256 fees;
|
|
if(from==uniswapV2Pair) {
|
|
fees = amount.mul(liquidityFee.add(marketingFee).add(devFee)).div(100);
|
|
}
|
|
|
|
if(to==uniswapV2Pair) {
|
|
fees = amount.mul(sellLiquidityFee.add(sellMarketingFee).add(sellDevFee)).div(100);
|
|
}
|
|
|
|
amount = amount.sub(fees);
|
|
if(fees > 0) {
|
|
super._transfer(from, address(this), fees);
|
|
}
|
|
}
|
|
|
|
super._transfer(from, to, amount);
|
|
|
|
}
|
|
|
|
function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap {
|
|
uint256 tokensForLiquidity = contractTokenBalance.mul(sellLiquidityFee).div(sellMarketingFee.add(sellLiquidityFee).add(sellDevFee));
|
|
|
|
uint256 half = tokensForLiquidity.div(2);
|
|
uint256 otherHalf = tokensForLiquidity.sub(half);
|
|
|
|
|
|
|
|
|
|
|
|
uint256 initialBalance = address(this).balance;
|
|
|
|
|
|
swapTokensForEth(half);
|
|
|
|
|
|
uint256 newBalance = address(this).balance.sub(initialBalance);
|
|
|
|
|
|
addLiquidity(otherHalf, newBalance);
|
|
|
|
|
|
swapTokensForEth(contractTokenBalance.sub(tokensForLiquidity));
|
|
devWallet.transfer(address(this).balance.mul(sellDevFee).div(sellMarketingFee.add(sellDevFee)));
|
|
marketingWallet.transfer(address(this).balance);
|
|
|
|
emit SwapAndLiquify(half, newBalance);
|
|
}
|
|
|
|
function swapTokensForEth(uint256 tokenAmount) private {
|
|
|
|
address[] memory path = new address[](2);
|
|
path[0] = address(this);
|
|
path[1] = uniswapV2Router.WETH();
|
|
|
|
if(allowance(address(this), address(uniswapV2Router)) < tokenAmount) {
|
|
_approve(address(this), address(uniswapV2Router), ~uint256(0));
|
|
}
|
|
|
|
|
|
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
|
|
tokenAmount,
|
|
0, // accept any amount of ETH
|
|
path,
|
|
address(this),
|
|
block.timestamp
|
|
);
|
|
|
|
}
|
|
|
|
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
|
|
|
|
uniswapV2Router.addLiquidityETH{value: ethAmount}(
|
|
address(this),
|
|
tokenAmount,
|
|
0,
|
|
0,
|
|
owner(),
|
|
block.timestamp
|
|
);
|
|
|
|
}
|
|
|
|
function excludeFromFees(address account, bool excluded) public onlyOwner {
|
|
require(_isExcludedFromFees[account] != excluded, "Account is already the value of 'excluded'");
|
|
_isExcludedFromFees[account] = excluded;
|
|
emit ExcludeFromFees(account, excluded);
|
|
}
|
|
|
|
function isExcludedFromFees(address account) public view returns(bool) {
|
|
return _isExcludedFromFees[account];
|
|
}
|
|
|
|
function openTrade() external onlyOwner {
|
|
isOpen = true;
|
|
}
|
|
|
|
function setMaxWalletLimit(uint256 _newLimit) public onlyOwner {
|
|
maxWalletToken = _newLimit;
|
|
require(maxWalletToken >= totalSupply().div(200), "value too low");
|
|
}
|
|
|
|
function setMaxTxAmount(uint256 _maxTx) public onlyOwner {
|
|
maxTransactionAmount = _maxTx;
|
|
require(maxTransactionAmount >= totalSupply().div(1000000000), "value too low");
|
|
}
|
|
|
|
function updateBuyFees(uint256 _liquidityFee, uint256 _marketingFee, uint256 _devFee) public onlyOwner {
|
|
require(_liquidityFee.add(_marketingFee).add(_devFee) <= 6, "tax too high");
|
|
liquidityFee = _liquidityFee;
|
|
marketingFee = _marketingFee;
|
|
devFee = _devFee;
|
|
}
|
|
|
|
function updateSellFees(uint256 _liquidityFee, uint256 _marketingFee, uint256 _devFee) public onlyOwner {
|
|
require(_liquidityFee.add(_marketingFee).add(_devFee) <= 6, "tax too high");
|
|
sellLiquidityFee = _liquidityFee;
|
|
sellMarketingFee = _marketingFee;
|
|
sellDevFee = _devFee;
|
|
}
|
|
|
|
function updateWallets(address payable _marketingWallet, address payable _devWallet) public onlyOwner {
|
|
marketingWallet = _marketingWallet;
|
|
devWallet = _devWallet;
|
|
}
|
|
|
|
function setSwapTokensAtAmouunt(uint256 _newAmount) public onlyOwner {
|
|
swapTokensAtAmount = _newAmount;
|
|
}
|
|
|
|
function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner {
|
|
swapAndLiquifyEnabled = _enabled;
|
|
emit SwapAndLiquifyEnabledUpdated(_enabled);
|
|
}
|
|
|
|
receive() external payable {
|
|
|
|
}
|
|
|
|
} |