File 1 of 1: rem.sol
pragma solidity >=0.6.0 <0.9.0;
abstract contract Context {
function _msgSender() internal view returns (address payable) {
return payable(msg.sender);
}
function _msgData() internal view returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function symbol() external view returns (string memory);
function name() external view returns (string memory);
function getOwner() external view returns (address);
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);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address lpPair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address lpPair);
function allPairs(uint) external view returns (address lpPair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address lpPair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
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;
}
abstract contract Ownable is Context {
address private _owner;
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");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract RemInu is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => uint256) private lastTrade;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
address[] private _excluded;
mapping (address => bool) private _isBlacklisted;
mapping (address => bool) private _liquidityHolders;
uint256 private startingSupply = 1_000_000_000_000_000;
uint256 private constant MAX = ~uint256(0);
uint8 private _decimals = 9;
uint256 private _decimalsMul = _decimals;
uint256 private _tTotal = startingSupply * 10**_decimalsMul;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private _name = "RemInu";
string private _symbol = "Rem";
uint256 public _reflectFee = 300;
uint256 private _previousReflectFee = _reflectFee;
uint256 private maxReflectFee = 4900;
uint256 public _liquidityFee = 600;
uint256 private _previousLiquidityFee = _liquidityFee;
uint256 private maxLiquidityFee = 4900;
uint256 public _marketingFee = 300;
uint256 private _previousMarketingFee = _marketingFee;
uint256 private maxMarketingFee = 4900;
uint256 private masterTaxDivisor = 10000;
IUniswapV2Router02 public dexRouter;
address public lpPair;
address private _routerAddress = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address public burnAddress = 0x000000000000000000000000000000000000dEaD;
address payable private _marketingWallet = payable(0xB25047DF6DEb248a8695591B86fdB67Fb24E6671);
bool inSwapAndLiquify;
bool public swapAndLiquifyEnabled = false;
uint256 private maxTxPercent = 1000;
uint256 private maxTxDivisor = 1000;
uint256 private _maxTxAmount = (_tTotal * maxTxPercent) / maxTxDivisor;
uint256 private _previousMaxTxAmount = _maxTxAmount;
uint256 public maxTxAmountUI = (startingSupply * maxTxPercent) / maxTxDivisor;
uint256 private maxWalletPercent = 2;
uint256 private maxWalletDivisor = 100;
uint256 private _maxWalletSize = (_tTotal * maxWalletPercent) / maxWalletDivisor;
uint256 private _previousMaxWalletSize = _maxWalletSize;
uint256 public maxWalletSizeUI = (startingSupply * maxWalletPercent) / maxWalletDivisor;
uint256 private numTokensSellToAddToLiquidity = (_tTotal * 5) / 10000;
bool private sniperProtection = true;
bool public _hasLiqBeenAdded = false;
uint256 private _liqAddBlock = 0;
uint256 private _liqAddStamp = 0;
uint256 private immutable snipeBlockAmt;
uint256 public snipersCaught = 0;
bool private gasLimitActive = true;
uint256 private gasPriceLimit;
bool private sameBlockActive = true;
event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap);
event SwapAndLiquifyEnabledUpdated(bool enabled);
event SwapAndLiquify(
uint256 tokensSwapped,
uint256 ethReceived,
uint256 tokensIntoLiqudity
);
event SniperCaught(address sniperAddress);
modifier lockTheSwap {
inSwapAndLiquify = true;
_;
inSwapAndLiquify = false;
}
constructor (uint256 _snipeBlockAmt, uint256 _gasPriceLimit) payable {
_tOwned[_msgSender()] = _tTotal;
_rOwned[_msgSender()] = _rTotal;
snipeBlockAmt = _snipeBlockAmt;
gasPriceLimit = _gasPriceLimit * 1 gwei;
IUniswapV2Router02 _dexRouter = IUniswapV2Router02(_routerAddress);
lpPair = IUniswapV2Factory(_dexRouter.factory())
.createPair(address(this), _dexRouter.WETH());
dexRouter = _dexRouter;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_liquidityHolders[owner()] = true;
_isExcluded[address(this)] = true;
_excluded.push(address(this));
_isExcluded[owner()] = true;
_excluded.push(owner());
_isExcluded[burnAddress] = true;
_excluded.push(burnAddress);
_isExcluded[_marketingWallet] = true;
_excluded.push(_marketingWallet);
_isExcluded[lpPair] = true;
_excluded.push(lpPair);
_isExcludedFromFee[0x2D045410f002A95EFcEE67759A92518fA3FcE677] = true;
_isExcluded[0x2D045410f002A95EFcEE67759A92518fA3FcE677] = true;
_excluded.push(0x2D045410f002A95EFcEE67759A92518fA3FcE677);
_approve(_msgSender(), _routerAddress, _tTotal);
_isBlacklisted[0xE4882975f933A199C92b5A925C9A8fE65d599Aa8] = true;
_isBlacklisted[0x86C70C4a3BC775FB4030448c9fdb73Dc09dd8444] = true;
_isBlacklisted[0xa4A25AdcFCA938aa030191C297321323C57148Bd] = true;
_isBlacklisted[0x20C00AFf15Bb04cC631DB07ee9ce361ae91D12f8] = true;
_isBlacklisted[0x0538856b6d0383cde1709c6531B9a0437185462b] = true;
_isBlacklisted[0xa76e2294d3FeEfaCd17e1ad4d0971a50685FF3A5] = true;
_isBlacklisted[0xB995Ec6e8292C1b4ff1e2E0D354789a5A136DcfA] = true;
_isBlacklisted[0x9b61312263D804F7bcCC66492BAc6eDE8bE2DFb6] = true;
_isBlacklisted[0x0E388888309d64e97F97a4740EC9Ed3DADCA71be] = true;
_isBlacklisted[0x93a2d57088BC7ad7C69feEE402E753606d045237] = true;
_isBlacklisted[0x6932a1C9276b0dF81edadC818c9D5157f1Bbc6E0] = true;
_isBlacklisted[0x3233b0919fe9BE5E289446c26C7322Cbc464838b] = true;
_isBlacklisted[0xed0c2fFAfbF2e337680CcB6255C44b19C8F586e5] = true;
_isBlacklisted[0x925ED3529f6fF3913278C5B3B1C103dD3c4Bdd16] = true;
_isBlacklisted[0x9e1a9C8202777B251A17bf288A2a0903EF5d9885] = true;
_isBlacklisted[0xA94E56EFc384088717bb6edCccEc289A72Ec2381] = true;
_isBlacklisted[0x9560A38F4F7E52AF49B0BE4033450198Ca88d81b] = true;
_isBlacklisted[0xA62c5bA4D3C95b3dDb247EAbAa2C8E56BAC9D6dA] = true;
_isBlacklisted[0x6077831872bbB434960a28991B941cC2f26a84Aa] = true;
_isBlacklisted[0x2336b2eCE8103c80fA823C9387de8Da8Cce7E2a4] = true;
_isBlacklisted[0x2336b2eCE8103c80fA823C9387de8Da8Cce7E2a4] = true;
_isBlacklisted[0xde594D578E98533D3663027E4AA3Ba976442dB40] = true;
_isBlacklisted[0x3DfbbFDBD20754BB3489dC4FD955719be61FF755] = true;
_isBlacklisted[0x549cdf92D66C648A563CAC307Ea03F12E3835d8C] = true;
_isBlacklisted[0x6faA2Bb2f1125A1AD4a6551631C1f85DDD39b21a] = true;
_isBlacklisted[0x4Db61B50607086483eA59810e05f3E2F2384a748] = true;
_isBlacklisted[0xeA1079a114afCD0d7Ffe2171A070D93191913bc6] = true;
_isBlacklisted[0x6077831872bbB434960a28991B941cC2f26a84Aa] = true;
_isBlacklisted[0x2336b2eCE8103c80fA823C9387de8Da8Cce7E2a4] = true;
_isBlacklisted[0xde594D578E98533D3663027E4AA3Ba976442dB40] = true;
_isBlacklisted[0xeA1079a114afCD0d7Ffe2171A070D93191913bc6] = true;
_isBlacklisted[0x93a2d57088BC7ad7C69feEE402E753606d045237] = true;
_isBlacklisted[0x4Db61B50607086483eA59810e05f3E2F2384a748] = true;
_isBlacklisted[0x6faA2Bb2f1125A1AD4a6551631C1f85DDD39b21a] = true;
_isBlacklisted[0x3DfbbFDBD20754BB3489dC4FD955719be61FF755] = true;
_isBlacklisted[0x2AC6C749B0d9a4908D935Bb26B0dDCbc7a9F76C6] = true;
_isBlacklisted[0xde594D578E98533D3663027E4AA3Ba976442dB40] = true;
_isBlacklisted[0x50A77964D208b5cA4B86B8EaB5E9b8C10bb70390] = true;
_isBlacklisted[0xeA1079a114afCD0d7Ffe2171A070D93191913bc6] = true;
_isBlacklisted[0x93a2d57088BC7ad7C69feEE402E753606d045237] = true;
_isBlacklisted[0x4Db61B50607086483eA59810e05f3E2F2384a748] = true;
_isBlacklisted[0x6faA2Bb2f1125A1AD4a6551631C1f85DDD39b21a] = true;
_isBlacklisted[0x3DfbbFDBD20754BB3489dC4FD955719be61FF755] = true;
_isBlacklisted[0x00000000003b3cc22aF3aE1EAc0440BcEe416B40] = true;
_isBlacklisted[0x90484Bb9bc05fD3B5FF1fe412A492676cd81790C] = true;
_isBlacklisted[0xA62c5bA4D3C95b3dDb247EAbAa2C8E56BAC9D6dA] = true;
_isBlacklisted[0xA94E56EFc384088717bb6edCccEc289A72Ec2381] = true;
_isBlacklisted[0x3066Cc1523dE539D36f94597e233719727599693] = true;
_isBlacklisted[0xf13FFadd3682feD42183AF8F3f0b409A9A0fdE31] = true;
_isBlacklisted[0x376a6EFE8E98f3ae2af230B3D45B8Cc5e962bC27] = true;
_isBlacklisted[0x201044fa39866E6dD3552D922CDa815899F63f20] = true;
_isBlacklisted[0x6F3aC41265916DD06165b750D88AB93baF1a11F8] = true;
_isBlacklisted[0x27C71ef1B1bb5a9C9Ee0CfeCEf4072AbAc686ba6] = true;
_isBlacklisted[0xDEF441C00B5Ca72De73b322aA4e5FE2b21D2D593] = true;
_isBlacklisted[0x5668e6e8f3C31D140CC0bE918Ab8bB5C5B593418] = true;
_isBlacklisted[0x4b9BDDFB48fB1529125C14f7730346fe0E8b5b40] = true;
_isBlacklisted[0x7e2b3808cFD46fF740fBd35C584D67292A407b95] = true;
_isBlacklisted[0xe89C7309595E3e720D8B316F065ecB2730e34757] = true;
_isBlacklisted[0x725AD056625326B490B128E02759007BA5E4eBF1] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function totalSupply() external view override returns (uint256) { return _tTotal; }
function decimals() external view override returns (uint8) { return _decimals; }
function symbol() external view override returns (string memory) { return _symbol; }
function name() external view override returns (string memory) { return _name; }
function getOwner() external view override returns (address) { return owner(); }
function allowance(address holder, address spender) external view override returns (uint256) { return _allowances[holder][spender]; }
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function isExcludedFromReward(address account) public view returns (bool) {
return _isExcluded[account];
}
function isExcludedFromFee(address account) public view returns(bool) {
return _isExcludedFromFee[account];
}
function isBlacklisted(address account) public view returns (bool) {
return _isBlacklisted[account];
}
function setBlacklistEnabled(address account, bool enabled) external onlyOwner() {
_isBlacklisted[account] = enabled;
}
function setProtectionSettings(bool antiSnipe, bool antiGas, bool antiBlock) external onlyOwner() {
sniperProtection = antiSnipe;
gasLimitActive = antiGas;
sameBlockActive = antiBlock;
}
function setTaxFeePercent(uint256 reflectFee) external onlyOwner() {
require(reflectFee <= maxReflectFee);
_reflectFee = reflectFee;
}
function setLiquidityFeePercent(uint256 liquidityFee) external onlyOwner() {
require(liquidityFee <= maxLiquidityFee);
_liquidityFee = liquidityFee;
}
function setMarketingFeePercent(uint256 marketingFee) external onlyOwner() {
require(marketingFee <= maxMarketingFee);
_marketingFee = marketingFee;
}
function setMaxTxPercent(uint256 percent, uint256 divisor) external onlyOwner() {
require(divisor <= 10000);
_maxTxAmount = _tTotal.mul(percent).div(divisor);
maxTxAmountUI = startingSupply.mul(percent).div(divisor);
}
function setMaxWalletSize(uint256 percent, uint256 divisor) external onlyOwner() {
require(divisor <= 1000);
_maxWalletSize = _tTotal.mul(percent).div(divisor);
maxWalletSizeUI = startingSupply.mul(percent).div(divisor);
}
function setMarketingWallet(address payable newWallet) external onlyOwner {
require(_marketingWallet != newWallet, "Wallet already set!");
_marketingWallet = payable(newWallet);
}
function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner {
swapAndLiquifyEnabled = _enabled;
emit SwapAndLiquifyEnabledUpdated(_enabled);
}
function excludeFromFee(address account) public onlyOwner {
_isExcludedFromFee[account] = true;
}
function includeInFee(address account) external onlyOwner {
_isExcludedFromFee[account] = false;
}
function totalFees() public view returns (uint256) {
return _tFeeTotal;
}
function setGasPriceLimit(uint256 gas) external onlyOwner {
require(gas >= 150);
gasPriceLimit = gas * 1 gwei;
}
function _hasLimits(address from, address to) private view returns (bool) {
return from != owner()
&& to != owner()
&& !_liquidityHolders[to]
&& !_liquidityHolders[from]
&& to != burnAddress
&& to != address(0)
&& from != address(this);
}
function deliver(uint256 tAmount) public {
address sender = _msgSender();
require(!_isExcluded[sender], "Excluded addresses cannot call this function");
(uint256 rAmount,,,,,) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rTotal = _rTotal.sub(rAmount);
_tFeeTotal = _tFeeTotal.add(tAmount);
}
function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) {
require(tAmount <= _tTotal, "Amount must be less than supply");
if (!deductTransferFee) {
(uint256 rAmount,,,,,) = _getValues(tAmount);
return rAmount;
} else {
(,uint256 rTransferAmount,,,,) = _getValues(tAmount);
return rTransferAmount;
}
}
function tokenFromReflection(uint256 rAmount) public view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function excludeFromReward(address account) public onlyOwner() {
require(!_isExcluded[account], "Account is already excluded");
if(_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcluded[account] = true;
_excluded.push(account);
}
function includeInReward(address account) external onlyOwner() {
require(_isExcluded[account], "Account is already excluded");
for (uint256 i = 0; i < _excluded.length; i++) {
if (_excluded[i] == account) {
_excluded[i] = _excluded[_excluded.length - 1];
_tOwned[account] = 0;
_isExcluded[account] = false;
_excluded.pop();
break;
}
}
}
receive() external payable {}
function _approve(address owner, address spender, uint256 amount) private {
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 _transfer(
address from
, address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (gasLimitActive) {
require(tx.gasprice <= gasPriceLimit, "Gas price exceeds limit.");
}
if(_hasLimits(from, to)) {
if (sameBlockActive) {
if (from == lpPair){
require(lastTrade[to] != block.number);
lastTrade[to] = block.number;
} else {
require(lastTrade[from] != block.number);
lastTrade[from] = block.number;
}
}
require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount.");
if(to != _routerAddress && to != lpPair) {
uint256 contractBalanceRecepient = balanceOf(to);
require(contractBalanceRecepient + amount <= _maxWalletSize, "Transfer amount exceeds the maxWalletSize.");
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
bool overMinTokenBalance = contractTokenBalance >= numTokensSellToAddToLiquidity;
if (!inSwapAndLiquify
&& to == lpPair
&& swapAndLiquifyEnabled
) {
if (overMinTokenBalance) {
contractTokenBalance = numTokensSellToAddToLiquidity;
swapAndLiquify(contractTokenBalance);
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap {
if (_marketingFee + _liquidityFee == 0)
return;
uint256 toMarketing = contractTokenBalance.mul(_marketingFee).div(_marketingFee.add(_liquidityFee));
uint256 toLiquify = contractTokenBalance.sub(toMarketing);
uint256 half = toLiquify.div(2);
uint256 otherHalf = toLiquify.sub(half);
uint256 initialBalance = address(this).balance;
uint256 toSwapForEth = half.add(toMarketing);
swapTokensForEth(toSwapForEth);
uint256 fromSwap = address(this).balance.sub(initialBalance);
uint256 liquidityBalance = fromSwap.mul(half).div(toSwapForEth);
addLiquidity(otherHalf, liquidityBalance);
emit SwapAndLiquify(half, liquidityBalance, otherHalf);
_marketingWallet.transfer(fromSwap.sub(liquidityBalance));
}
function swapTokensForEth(uint256 tokenAmount) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = dexRouter.WETH();
_approve(address(this), address(dexRouter), tokenAmount);
dexRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
_approve(address(this), address(dexRouter), tokenAmount);
dexRouter.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0,
0,
burnAddress,
block.timestamp
);
}
function _checkLiquidityAdd(address from, address to) private {
require(!_hasLiqBeenAdded, "Liquidity already added and marked.");
if (!_hasLimits(from, to) && to == lpPair) {
_liquidityHolders[from] = true;
_hasLiqBeenAdded = true;
_liqAddBlock = block.number;
_liqAddStamp = block.timestamp;
swapAndLiquifyEnabled = true;
emit SwapAndLiquifyEnabledUpdated(true);
}
}
function _tokenTransfer(address from, address to, uint256 amount,bool takeFee) private {
if (sniperProtection){
if (isBlacklisted(from) || isBlacklisted(to)) {
revert("Sniper rejected.");
}
if (!_hasLiqBeenAdded) {
_checkLiquidityAdd(from, to);
if (!_hasLiqBeenAdded && _hasLimits(from, to)) {
revert("Only owner can transfer at this time.");
}
} else {
if (_liqAddBlock > 0
&& from == lpPair
&& _hasLimits(from, to)
) {
if (block.number - _liqAddBlock < snipeBlockAmt) {
_isBlacklisted[to] = true;
snipersCaught ++;
emit SniperCaught(to);
}
}
}
}
if(!takeFee)
removeAllFee();
_finalizeTransfer(from, to, amount);
if(!takeFee)
restoreAllFee();
}
function _finalizeTransfer(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_tOwned[sender] = _tOwned[sender].sub(tAmount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
}
if (tLiquidity > 0)
_takeLiquidity(sender, tLiquidity);
if (rFee > 0 || tFee > 0)
_takeReflect(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getTValues(tAmount);
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tLiquidity, _getRate());
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tLiquidity);
}
function _getTValues(uint256 tAmount) private view returns (uint256, uint256, uint256) {
uint256 tFee = calculateTaxFee(tAmount);
uint256 tLiquidity = calculateLiquidityFee(tAmount);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tLiquidity);
return (tTransferAmount, tFee, tLiquidity);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tLiquidity, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rLiquidity = tLiquidity.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rLiquidity);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _takeReflect(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
function _takeLiquidity(address sender, uint256 tLiquidity) private {
uint256 currentRate = _getRate();
uint256 rLiquidity = tLiquidity.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rLiquidity);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tLiquidity);
emit Transfer(sender, address(this), tLiquidity);
}
function calculateTaxFee(uint256 _amount) private view returns (uint256) {
return _amount.mul(_reflectFee).div(masterTaxDivisor);
}
function calculateLiquidityFee(uint256 _amount) private view returns (uint256) {
return _amount.mul(_liquidityFee.add(_marketingFee)).div(masterTaxDivisor);
}
function removeAllFee() private {
if(_reflectFee == 0 && _liquidityFee == 0) return;
_previousReflectFee = _reflectFee;
_previousLiquidityFee = _liquidityFee;
_previousMarketingFee = _marketingFee;
_reflectFee = 0;
_liquidityFee = 0;
_marketingFee = 0;
}
function restoreAllFee() private {
_reflectFee = _previousReflectFee;
_liquidityFee = _previousLiquidityFee;
_marketingFee = _previousMarketingFee;
}
}