|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface IERC165 {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function supportsInterface(bytes4 interfaceId) external view returns (bool);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
|
|
|
|
|
|
|
|
interface IERC721 is IERC165 {
|
|
|
|
|
|
|
|
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
|
|
|
|
|
|
|
|
|
|
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
|
|
|
|
|
|
|
|
|
|
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
|
|
|
|
|
|
|
|
|
|
function balanceOf(address owner) external view returns (uint256 balance);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function ownerOf(uint256 tokenId) external view returns (address owner);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function safeTransferFrom(
|
|
address from,
|
|
address to,
|
|
uint256 tokenId,
|
|
bytes calldata data
|
|
) external;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function safeTransferFrom(
|
|
address from,
|
|
address to,
|
|
uint256 tokenId
|
|
) external;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function transferFrom(
|
|
address from,
|
|
address to,
|
|
uint256 tokenId
|
|
) external;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function approve(address to, uint256 tokenId) external;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function setApprovalForAll(address operator, bool _approved) external;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getApproved(uint256 tokenId) external view returns (address operator);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function isApprovedForAll(address owner, address operator) external view returns (bool);
|
|
}
|
|
|
|
|
|
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
interface IUniswapV2Factory {
|
|
function createPair(address tokenA, address tokenB) external returns (address pair);
|
|
}
|
|
|
|
interface IUniswapV2Router02 {
|
|
function swapExactTokensForETHSupportingFeeOnTransferTokens(
|
|
uint amountIn,
|
|
uint amountOutMin,
|
|
address[] calldata path,
|
|
address to,
|
|
uint deadline
|
|
) external;
|
|
function factory() external pure returns (address);
|
|
function WETH() external pure returns (address);
|
|
function addLiquidityETH(
|
|
address token,
|
|
uint amountTokenDesired,
|
|
uint amountTokenMin,
|
|
uint amountETHMin,
|
|
address to,
|
|
uint deadline
|
|
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
abstract contract Context {
|
|
function _msgSender() internal view virtual returns (address) {
|
|
return msg.sender;
|
|
}
|
|
|
|
function _msgData() internal view virtual returns (bytes calldata) {
|
|
return msg.data;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
abstract contract Ownable is Context {
|
|
address private _owner;
|
|
|
|
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
|
|
|
|
|
|
|
|
|
|
constructor() {
|
|
_transferOwnership(_msgSender());
|
|
}
|
|
|
|
|
|
|
|
|
|
modifier onlyOwner() {
|
|
_checkOwner();
|
|
_;
|
|
}
|
|
|
|
|
|
|
|
|
|
function owner() public view virtual returns (address) {
|
|
return _owner;
|
|
}
|
|
|
|
|
|
|
|
|
|
function _checkOwner() internal view virtual {
|
|
require(owner() == _msgSender(), "Ownable: caller is not the owner");
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function renounceOwnership() public virtual onlyOwner {
|
|
_transferOwnership(address(0));
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function transferOwnership(address newOwner) public virtual onlyOwner {
|
|
require(newOwner != address(0), "Ownable: new owner is the zero address");
|
|
_transferOwnership(newOwner);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function _transferOwnership(address newOwner) internal virtual {
|
|
address oldOwner = _owner;
|
|
_owner = newOwner;
|
|
emit OwnershipTransferred(oldOwner, newOwner);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
|
|
|
|
|
|
interface IERC20 {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
event Transfer(address indexed from, address indexed to, uint256 value);
|
|
|
|
|
|
|
|
|
|
|
|
event Approval(address indexed owner, address indexed spender, uint256 value);
|
|
|
|
|
|
|
|
|
|
function totalSupply() external view returns (uint256);
|
|
|
|
|
|
|
|
|
|
function balanceOf(address account) external view returns (uint256);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function transfer(address to, 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 from,
|
|
address to,
|
|
uint256 amount
|
|
) external returns (bool);
|
|
}
|
|
|
|
|
|
|
|
|
|
pragma solidity ^0.8.0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
contract CryptosWarrior is Context, IERC20, Ownable {
|
|
using SafeMath for uint256;
|
|
mapping (address => uint256) private _rOwned;
|
|
mapping (address => uint256) private _tOwned;
|
|
mapping (address => mapping (address => uint256)) private _allowances;
|
|
mapping (address => bool) private _isExcludedFromFee;
|
|
mapping (address => bool) private bots;
|
|
mapping (address => uint) private cooldown;
|
|
uint256 private constant MAX = ~uint256(0);
|
|
uint256 private constant _tTotal = 10_000_000_000 * 10**9;
|
|
uint256 private _rTotal = (MAX - (MAX % _tTotal));
|
|
uint256 private _tFeeTotal;
|
|
|
|
struct FeeValues {
|
|
uint256 rAmount;
|
|
uint256 rTransferAmount;
|
|
uint256 rFee;
|
|
uint256 tTransferAmount;
|
|
uint256 tFee;
|
|
uint256 tMkt;
|
|
uint256 tBurn;
|
|
}
|
|
|
|
|
|
mapping (address => uint256) private _lockedBalance;
|
|
uint256 private _releasePeriodStartTime;
|
|
|
|
|
|
uint256 private _burnFee = 2;
|
|
uint256 private _taxFee = 3;
|
|
uint256 private _mktFee = 7;
|
|
address payable private _mktFeeWalletAddress;
|
|
|
|
struct AccountTax {
|
|
uint256 taxFee;
|
|
uint256 mktFee;
|
|
uint256 burnFee;
|
|
bool isValue;
|
|
}
|
|
|
|
mapping (address => AccountTax) private taxesFromAccount;
|
|
mapping (address => AccountTax) private taxesToAccount;
|
|
|
|
string private constant _name = "ReVeR";
|
|
string private constant _symbol = "RVR";
|
|
uint8 private constant _decimals = 9;
|
|
|
|
IUniswapV2Router02 private uniswapV2Router;
|
|
address private uniswapV2Pair;
|
|
bool private tradingOpen;
|
|
bool private inSwap = false;
|
|
bool private swapEnabled = false;
|
|
bool swapAndLiquifyEnabled = false;
|
|
bool private cooldownEnabled = false;
|
|
uint256 private _maxTxAmount = _tTotal;
|
|
|
|
modifier lockTheSwap {
|
|
inSwap = true;
|
|
_;
|
|
inSwap = false;
|
|
}
|
|
constructor () {
|
|
_mktFeeWalletAddress = payable(0x3a8CbcAEa1d26A0523613B4F31134C7f6b3f0Fb5);
|
|
_rOwned[address(this)] = _rTotal;
|
|
_isExcludedFromFee[owner()] = true;
|
|
_isExcludedFromFee[address(this)] = true;
|
|
_isExcludedFromFee[_mktFeeWalletAddress] = true;
|
|
_maxTxAmount = _tTotal;
|
|
emit Transfer(address(0), _msgSender(), _tTotal);
|
|
}
|
|
|
|
function name() public pure returns (string memory) {
|
|
return _name;
|
|
}
|
|
|
|
function symbol() public pure returns (string memory) {
|
|
return _symbol;
|
|
}
|
|
|
|
function decimals() public pure returns (uint8) {
|
|
return _decimals;
|
|
}
|
|
|
|
function totalSupply() public pure override returns (uint256) {
|
|
return _tTotal;
|
|
}
|
|
|
|
function balanceOf(address account) public view override returns (uint256) {
|
|
return tokenFromReflection(_rOwned[account]).sub(lockedBalanceOf(account));
|
|
}
|
|
|
|
function lockedBalanceOf(address account) public view returns (uint256) {
|
|
|
|
if (block.timestamp < _releasePeriodStartTime || _releasePeriodStartTime == 0) {
|
|
return _lockedBalance[account];
|
|
}
|
|
|
|
uint256 ellapsed = block.timestamp.sub(_releasePeriodStartTime);
|
|
uint256 duration = (70 * 24 * 3600);
|
|
|
|
if (ellapsed > duration) {
|
|
return 0;
|
|
}
|
|
|
|
return _lockedBalance[account].mul(1000 - ellapsed.mul(1000).div(duration)).div(1000);
|
|
}
|
|
|
|
|
|
function loadMigratedAccounts(address[] memory migratedAccounts, uint256[] memory balance, uint256[] memory lockedBalance) external onlyOwner {
|
|
require(_releasePeriodStartTime == 0, "The migration is closed");
|
|
require(migratedAccounts.length == balance.length, "The length of the arrays must be equal");
|
|
require(migratedAccounts.length == lockedBalance.length, "The length of the arrays must be equal");
|
|
|
|
for (uint i = 0; i < migratedAccounts.length; i++) {
|
|
(uint256 _rBalance,,) = _getRValues(balance[i].add(lockedBalance[i]), 0, 0, 0);
|
|
|
|
_rOwned[address(this)] =_rOwned[address(this)].sub(_rBalance);
|
|
_rOwned[migratedAccounts[i]] = _rBalance;
|
|
_lockedBalance[migratedAccounts[i]] = lockedBalance[i];
|
|
emit Transfer(address(this), migratedAccounts[i], balance[i].add(lockedBalance[i]));
|
|
}
|
|
}
|
|
|
|
function transfer(address recipient, uint256 amount) public override returns (bool) {
|
|
_transfer(_msgSender(), recipient, amount);
|
|
return true;
|
|
}
|
|
|
|
function allowance(address owner, address spender) public view override returns (uint256) {
|
|
return _allowances[owner][spender];
|
|
}
|
|
|
|
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 setCooldownEnabled(bool onoff) external onlyOwner {
|
|
cooldownEnabled = onoff;
|
|
}
|
|
|
|
function setMaxTxAmount(uint256 amount) external onlyOwner {
|
|
_maxTxAmount = amount;
|
|
}
|
|
|
|
function setMarketingWallet(address payable account) external onlyOwner {
|
|
_mktFeeWalletAddress = account;
|
|
_isExcludedFromFee[account] = true;
|
|
}
|
|
|
|
function excludeAccountFromFee(address account) external onlyOwner {
|
|
require(!_isExcludedFromFee[account], "Account is already excluded from fees");
|
|
_isExcludedFromFee[account] = true;
|
|
}
|
|
|
|
function includeAccountInFee(address account) external onlyOwner {
|
|
require(_isExcludedFromFee[account], "Account is already included for fees");
|
|
_isExcludedFromFee[account] = false;
|
|
}
|
|
|
|
function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner() {
|
|
swapAndLiquifyEnabled = _enabled;
|
|
}
|
|
|
|
function setFromAccountFees(address account, uint256 taxFee, uint256 mktFee, uint256 burnFee) external onlyOwner {
|
|
require(_taxFee <= 3, "Tax fee cannot be more than 3");
|
|
require(mktFee <= 7, "Tax fee cannot be more than 7");
|
|
require(burnFee <= 2, "Burn fee cannot be more than 2");
|
|
taxesFromAccount[account] = AccountTax(taxFee, mktFee, burnFee, true);
|
|
}
|
|
|
|
function setToAccountFees(address account, uint256 taxFee, uint256 mktFee, uint256 burnFee) external onlyOwner {
|
|
require(_taxFee <= 3, "Tax fee cannot be more than 3");
|
|
require(mktFee <= 7, "Tax fee cannot be more than 7");
|
|
require(burnFee <= 2, "Burn fee cannot be more than 2");
|
|
taxesToAccount[account] = AccountTax(taxFee, mktFee, burnFee, true);
|
|
}
|
|
|
|
function setMktFee(uint256 mktFee) external onlyOwner {
|
|
require(mktFee <= 7, "Tax fee cannot be more than 7");
|
|
_mktFee = mktFee;
|
|
}
|
|
|
|
function setTaxFee(uint256 taxFee) external onlyOwner {
|
|
require(_taxFee <= 3, "Tax fee cannot be more than 3");
|
|
_taxFee = taxFee;
|
|
}
|
|
|
|
function setBurnFee(uint256 burnFee) external onlyOwner {
|
|
require(burnFee <= 2, "Burn fee cannot be more than 2");
|
|
_burnFee = burnFee;
|
|
}
|
|
|
|
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
|
|
require(rAmount <= _rTotal, "Amount must be less than total reflections");
|
|
uint256 currentRate = _getRate();
|
|
return rAmount.div(currentRate);
|
|
}
|
|
|
|
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 (from != owner() && to != owner()) {
|
|
require(tradingOpen, "Trading is not open");
|
|
require(!bots[from] && !bots[to]);
|
|
require(amount <= _maxTxAmount, "Transfer amount exceeds the maximum allowed");
|
|
|
|
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
|
|
|
|
require(cooldown[to] < block.timestamp);
|
|
cooldown[to] = block.timestamp + (30 seconds);
|
|
}
|
|
|
|
uint256 contractTokenBalance = balanceOf(address(this));
|
|
if (swapAndLiquifyEnabled) {
|
|
if (contractTokenBalance > 100_000) {
|
|
swapAndLiquify(contractTokenBalance);
|
|
}
|
|
} else if (contractTokenBalance > 0 && !inSwap && from != uniswapV2Pair && swapEnabled) {
|
|
swapTokensForEth(contractTokenBalance);
|
|
uint256 contractETHBalance = address(this).balance;
|
|
if(contractETHBalance > 0) {
|
|
sendETHToFee(address(this).balance);
|
|
}
|
|
}
|
|
}
|
|
|
|
_tokenTransfer(from,to,amount);
|
|
}
|
|
|
|
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
|
|
address[] memory path = new address[](2);
|
|
path[0] = address(this);
|
|
path[1] = uniswapV2Router.WETH();
|
|
_approve(address(this), address(uniswapV2Router), tokenAmount);
|
|
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
|
|
tokenAmount,
|
|
0,
|
|
path,
|
|
address(this),
|
|
block.timestamp
|
|
);
|
|
}
|
|
|
|
function sendETHToFee(uint256 amount) private {
|
|
_mktFeeWalletAddress.transfer(amount);
|
|
}
|
|
|
|
function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap {
|
|
|
|
uint256 half = contractTokenBalance.div(2);
|
|
uint256 otherHalf = contractTokenBalance.sub(half);
|
|
|
|
|
|
uint256 initialBalance = address(this).balance;
|
|
|
|
|
|
swapTokensForEth(half);
|
|
|
|
|
|
uint256 newBalance = address(this).balance.sub(initialBalance);
|
|
|
|
|
|
addLiquidity(otherHalf, newBalance);
|
|
}
|
|
|
|
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
|
|
|
|
_approve(address(this), address(uniswapV2Router), tokenAmount);
|
|
|
|
|
|
uniswapV2Router.addLiquidityETH{value: ethAmount}(
|
|
address(this),
|
|
tokenAmount,
|
|
0,
|
|
0,
|
|
owner(),
|
|
block.timestamp
|
|
);
|
|
}
|
|
|
|
function openTrading() external onlyOwner {
|
|
require(!tradingOpen, "trading is already open");
|
|
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
|
|
uniswapV2Router = _uniswapV2Router;
|
|
tradingOpen = true;
|
|
_approve(address(this), address(uniswapV2Router), _tTotal);
|
|
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
|
|
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
|
|
_releasePeriodStartTime = block.timestamp;
|
|
swapEnabled = true;
|
|
cooldownEnabled = true;
|
|
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
|
|
}
|
|
|
|
function stopTrading() external onlyOwner {
|
|
tradingOpen = false;
|
|
}
|
|
|
|
function restartTrading() external onlyOwner {
|
|
tradingOpen = true;
|
|
}
|
|
|
|
function setBots(address[] memory bots_) public onlyOwner {
|
|
for (uint i = 0; i < bots_.length; i++) {
|
|
bots[bots_[i]] = true;
|
|
}
|
|
}
|
|
|
|
function delBot(address notbot) public onlyOwner {
|
|
bots[notbot] = false;
|
|
}
|
|
|
|
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
|
|
_transferStandard(sender, recipient, amount);
|
|
}
|
|
|
|
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
|
|
FeeValues memory _values;
|
|
if (taxesFromAccount[sender].isValue) {
|
|
_values = _getValues(tAmount, taxesFromAccount[sender].taxFee, taxesFromAccount[sender].mktFee, taxesFromAccount[sender].burnFee, !(_isExcludedFromFee[sender] || _isExcludedFromFee[recipient]));
|
|
} else if (taxesToAccount[recipient].isValue) {
|
|
_values = _getValues(tAmount, taxesToAccount[recipient].taxFee, taxesToAccount[recipient].mktFee, taxesToAccount[recipient].burnFee, !(_isExcludedFromFee[sender] || _isExcludedFromFee[recipient]));
|
|
} else {
|
|
_values = _getValues(tAmount, _taxFee, _mktFee, _burnFee, !(_isExcludedFromFee[sender] || _isExcludedFromFee[recipient]));
|
|
}
|
|
|
|
_rOwned[sender] = _rOwned[sender].sub(_values.rAmount);
|
|
_rOwned[recipient] = _rOwned[recipient].add(_values.rTransferAmount);
|
|
_takeMarketing(_values.tMkt);
|
|
_burn(_values.tBurn);
|
|
_reflectFee(_values.rFee, _values.tFee);
|
|
emit Transfer(sender, recipient, _values.tTransferAmount);
|
|
}
|
|
|
|
function _burn(uint256 tBurn) private {
|
|
uint256 currentRate = _getRate();
|
|
uint256 rBurn = tBurn.mul(currentRate);
|
|
_rOwned[address(0)] = _rOwned[address(0)].add(rBurn);
|
|
}
|
|
|
|
function _takeMarketing(uint256 tMkt) private {
|
|
uint256 currentRate = _getRate();
|
|
uint256 rMkt = tMkt.mul(currentRate);
|
|
_rOwned[address(this)] = _rOwned[address(this)].add(rMkt);
|
|
}
|
|
|
|
function _reflectFee(uint256 rFee, uint256 tFee) private {
|
|
_rTotal = _rTotal.sub(rFee);
|
|
_tFeeTotal = _tFeeTotal.add(tFee);
|
|
}
|
|
|
|
receive() external payable {}
|
|
|
|
function manualswap() external {
|
|
require(_msgSender() == _mktFeeWalletAddress);
|
|
uint256 contractBalance = balanceOf(address(this));
|
|
swapTokensForEth(contractBalance);
|
|
}
|
|
|
|
function manualsend() external {
|
|
require(_msgSender() == _mktFeeWalletAddress);
|
|
uint256 contractETHBalance = address(this).balance;
|
|
sendETHToFee(contractETHBalance);
|
|
}
|
|
|
|
function _getValues(uint256 tAmount, uint256 currentTaxFee, uint256 currentMktFee, uint256 currentBurnFee, bool takeFees) private view returns (FeeValues memory) {
|
|
(uint256 tTransferAmount, uint256 tFee, uint256 tMkt, uint256 tBurn) = _getTValues(tAmount, currentTaxFee.mul(takeFees ? 1 : 0), currentMktFee.mul(takeFees ? 1 : 0), currentBurnFee.mul(takeFees ? 1 : 0));
|
|
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tMkt, tBurn);
|
|
return FeeValues(rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tMkt, tBurn);
|
|
}
|
|
|
|
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 MarketingFee, uint256 BurnFee) private pure returns (uint256, uint256, uint256, uint256) {
|
|
uint256 tFee = tAmount.mul(taxFee).div(100);
|
|
uint256 tMkt = tAmount.mul(MarketingFee).div(100);
|
|
uint256 tBurn = tAmount.mul(BurnFee).div(100);
|
|
uint256 tDeg = tFee.add(tMkt).add(tBurn);
|
|
uint256 tTransferAmount = tAmount.sub(tDeg);
|
|
return (tTransferAmount, tFee, tMkt, tBurn);
|
|
}
|
|
|
|
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tMkt, uint256 tBurn) private view returns (uint256, uint256, uint256) {
|
|
uint256 currentRate = _getRate();
|
|
uint256 rAmount = tAmount.mul(currentRate);
|
|
uint256 rFee = tFee.mul(currentRate);
|
|
uint256 rMkt = tMkt.mul(currentRate);
|
|
uint256 rBurn = tBurn.mul(currentRate);
|
|
uint256 rTransferAmount = rAmount.sub(rFee).sub(rMkt).sub(rBurn);
|
|
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;
|
|
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
|
|
return (rSupply, tSupply);
|
|
}
|
|
} |