Token 10X: Africa's First Cryptocurrency Hub
Mighty DogeCoin Token
%uD83D%uDCAA%uD83D%uDCAA%uD83D%uDCAAMighty Doge Coin %uD83D%uDD25%uD83D%uDD25%uD83D%uDD25is your next BSC moonshot and a rare BSC Gem %uD83D%uDC8E Mighty Dogecoin will be used as a Native token of Mighty Doge Run which is a P2E game where we will be rewarding weekly top scorers in MDC.
%u2705...
About Mighty DogeCoin
%uD83D%uDCAA%uD83D%uDCAA%uD83D%uDCAAMighty Doge Coin %uD83D%uDD25%uD83D%uDD25%uD83D%uDD25is your next BSC moonshot and a rare BSC Gem %uD83D%uDC8E Mighty Dogecoin will be used as a Native token of Mighty Doge Run which is a P2E game where we will be rewarding weekly top scorers in MDC.
%u2705 Mighty Doge Coin Reflections
%u2705Low Taxes
%u2705Team KYC before presale
%u2705 Audit before Presale
%u2705Verified Contract
%u2705Liquidity Locked for 1 Year
%u2705100% SAFU
%u2705Auto Add to Liquidity
%u2705Play to Earn Games
%u2705Burn at launch
%u2705Whale/Dump Proof
%u2705Bot Proof
Our shilling competition is also live. Join us now.
%u2705 Mighty Doge Coin Reflections
%u2705Low Taxes
%u2705Team KYC before presale
%u2705 Audit before Presale
%u2705Verified Contract
%u2705Liquidity Locked for 1 Year
%u2705100% SAFU
%u2705Auto Add to Liquidity
%u2705Play to Earn Games
%u2705Burn at launch
%u2705Whale/Dump Proof
%u2705Bot Proof
Our shilling competition is also live. Join us now.
274 total visits
Token information and links
Circulating Supply
1000000000000000000000000
Token Contract (BSC Chain)
0XC4115A219C96022F11806A5B7AB695E6282B51F5
Contract license: MIT
Launch Date
15/12/2021
KYC Information
No
Audit Information
None
Team Information
Team leader: None
Team leader contact: None
Contract source code
/*
███╗░░░███╗██╗░██████╗░██╗░░██╗████████╗██╗░░░██╗ ██████╗░░█████╗░░██████╗░███████╗
████╗░████║██║██╔════╝░██║░░██║╚══██╔══╝╚██╗░██╔╝ ██╔══██╗██╔══██╗██╔════╝░██╔════╝
██╔████╔██║██║██║░░██╗░███████║░░░██║░░░░╚████╔╝░ ██║░░██║██║░░██║██║░░██╗░█████╗░░
██║╚██╔╝██║██║██║░░╚██╗██╔══██║░░░██║░░░░░╚██╔╝░░ ██║░░██║██║░░██║██║░░╚██╗██╔══╝░░
██║░╚═╝░██║██║╚██████╔╝██║░░██║░░░██║░░░░░░██║░░░ ██████╔╝╚█████╔╝╚██████╔╝███████╗
╚═╝░░░░░╚═╝╚═╝░╚═════╝░╚═╝░░╚═╝░░░╚═╝░░░░░░╚═╝░░░ ╚═════╝░░╚════╝░░╚═════╝░╚══════╝
Web: https://mightydoge.run/
Telegram: https://t.me/Mightydogecoin
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
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);
}
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;
}
}
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");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
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 Mint(address indexed sender, uint amount0, uint amount1);
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 IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
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,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);
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);
}
abstract contract IERC20Extented is IERC20 {
function decimals() external view virtual returns (uint8);
function name() external view virtual returns (string memory);
function symbol() external view virtual returns (string memory);
}
contract MightyDogeCoin is Context, IERC20, IERC20Extented, Ownable {
using SafeMath for uint256;
string private constant _name = "Mighty DogeCoin";
string private constant _symbol = "MDC";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
// mapping(address => uint256) private sellcooldown;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
mapping(address => bool) private _isContract;
mapping(address => bool) private _isExchange;
mapping(address => uint256) private previousTransactionBlock;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000000 * 10**9; // 1 Quad
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public _priceImpact = 2; // Max Price Impact
uint256 private _firstBlock;
uint256 private _botBlocks;
uint256 public _maxWalletAmount = 20000000000000 * 10**9;
uint256 public minTokensToSwap = 1300000000000 * 10**9; //
// buy fees
uint256 public _buyMarketingFee = 2;
uint256 private _previousBuyMarketingFee = _buyMarketingFee;
uint256 public _buyReflectionFee = 3;
uint256 private _previousBuyReflectionFee = _buyReflectionFee;
uint256 public _buyLiquidityFee = 3;
uint256 private _previousBuyLiquidityFee = _buyLiquidityFee;
// sell fees
uint256 public _sellMarketingFee = 3;
uint256 private _previousSellMarketingFee = _sellMarketingFee;
uint256 public _sellReflectionFee = 3;
uint256 private _previousSellReflectionFee = _sellReflectionFee;
uint256 public _sellLiquidityFee = 3;
uint256 private _previousSellLiquidityFee = _sellLiquidityFee;
// SCALPA FEE
uint256 public _botBuyMarketingFee = 45;
uint256 public _botBuyReflectionFee = 45;
uint256 public _botBuyLiquidityFee = 0;
struct DynamicTax {
uint256 buyMarketingFee;
uint256 buyReflectionFee;
uint256 buyLiquidityFee;
uint256 sellMarketingFee;
uint256 sellReflectionFee;
uint256 sellLiquidityFee;
}
// uint256 constant private _projectLottoPercent = 50;
uint256 private _marketingPercent = 100;
struct BuyBreakdown {
uint256 tTransferAmount;
uint256 tMarketing;
uint256 tReflection;
uint256 tLiquidity;
}
struct SellBreakdown {
uint256 tTransferAmount;
uint256 tMarketing;
uint256 tReflection;
uint256 tLiquidity;
}
struct FinalFees {
uint256 tTransferAmount;
uint256 tMarketing;
uint256 tReflection;
uint256 tLiquidity;
uint256 rReflection;
uint256 rTransferAmount;
uint256 rAmount;
}
mapping(address => bool) private bots;
address payable private _marketingAddress = payable(0xD709B7f820A3F910356f52AAD0Db9371Cd6945be);
address payable constant private _burnAddress = payable(0x000000000000000000000000000000000000dEaD);
address private presaleRouter;
address private presaleAddress;
IUniswapV2Router02 private uniswapV2Router;
address public uniswapV2Pair;
uint256 private _maxTxAmount = 6000000000000 * 10**9;
bool private tradingOpen = false;
bool private inSwap = false;
bool private presale = true;
bool private pairSwapped = false;
bool public _priceImpactSellLimitEnabled = false;
bool public _BNBsellLimitEnabled = false;
bool public swapAndLiquifyEnabled = true;
event EndedPresale(bool presale);
event MaxTxAmountUpdated(uint256 _maxTxAmount);
event PercentsUpdated(uint256 _marketingPercent, uint256 _buybackPercent, uint256 _devPercent);
event FeesUpdated(uint256 _buyMarketingFee, uint256 _buyLiquidityFee, uint256 _buyReflectionFee, uint256 _sellMarketingFee, uint256 _sellLiquidityFee, uint256 _sellReflectionFee);
event PriceImpactUpdated(uint256 _priceImpact);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x10ED43C718714eb63d5aA57B78B54704E256024E); //need to metnion V2 mainnet
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type(uint256).max);
// _maxTxAmount = _tTotal;
// _maxWalletAmount = _tTotal.div(1);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isContract[address(this)] = true;
_isContract[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() override external pure returns (string memory) {
return _name;
}
function symbol() override external pure returns (string memory) {
return _symbol;
}
function decimals() override external pure returns (uint8) {
return _decimals;
}
function totalSupply() external pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (account == _burnAddress) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function isBot(address account) public view returns (bool) {
return bots[account];
}
function transfer(address recipient, uint256 amount) external override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) external view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) external override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) external override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender,_msgSender(),_allowances[sender][_msgSender()].sub(amount,"ERC20: transfer amount exceeds allowance"));
return true;
}
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 removeAllFee() private {
if (_buyMarketingFee == 0 && _buyReflectionFee == 0 && _buyLiquidityFee == 0 && _sellMarketingFee == 0 && _sellReflectionFee == 0 && _sellLiquidityFee == 0) return;
_previousBuyMarketingFee = _buyMarketingFee;
_previousBuyReflectionFee = _buyReflectionFee;
_previousBuyLiquidityFee = _buyLiquidityFee;
_previousSellMarketingFee = _sellMarketingFee;
_previousSellReflectionFee = _sellReflectionFee;
_previousSellLiquidityFee = _sellLiquidityFee;
_buyMarketingFee = 0;
_buyReflectionFee = 0;
_buyLiquidityFee = 0;
_sellMarketingFee = 0;
_sellReflectionFee = 0;
_sellLiquidityFee = 0;
}
function setBotFee() private {
_previousBuyMarketingFee = _buyMarketingFee;
_previousBuyReflectionFee = _buyReflectionFee;
_previousBuyLiquidityFee = _buyLiquidityFee;
_buyMarketingFee = _botBuyMarketingFee;
_buyReflectionFee = _botBuyReflectionFee;
_buyLiquidityFee = _botBuyLiquidityFee;
}
function restoreAllFee() private {
_buyMarketingFee = _previousBuyMarketingFee;
_buyReflectionFee = _previousBuyReflectionFee;
_buyLiquidityFee = _previousBuyLiquidityFee;
_sellMarketingFee = _previousSellMarketingFee;
_sellReflectionFee = _previousSellReflectionFee;
_sellLiquidityFee = _previousSellLiquidityFee;
}
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);
}
// calculate price based on pair reserves
function getTokenPriceBNB(uint256 amount) external view returns(uint256) {
IERC20Extented token0 = IERC20Extented(IUniswapV2Pair(uniswapV2Pair).token0());// tokens
IERC20Extented token1 = IERC20Extented(IUniswapV2Pair(uniswapV2Pair).token1());// bnb
(uint112 Res0, uint112 Res1,) = IUniswapV2Pair(uniswapV2Pair).getReserves();
if(pairSwapped) {
token0 = IERC20Extented(IUniswapV2Pair(uniswapV2Pair).token1());// tokens
token1 = IERC20Extented(IUniswapV2Pair(uniswapV2Pair).token0());// bnb
(Res1, Res0,) = IUniswapV2Pair(uniswapV2Pair).getReserves();
}
uint res1 = Res1*(10**token0.decimals());
return((amount*res1)/(Res0*(10**token0.decimals()))); // return amount of bnb to buy tokens
}
function getFee() public view returns(DynamicTax memory) {
DynamicTax memory currentTax;
currentTax.buyMarketingFee = _buyMarketingFee;
currentTax.buyLiquidityFee = _buyLiquidityFee;
currentTax.buyReflectionFee = _buyReflectionFee;
currentTax.sellMarketingFee = _sellMarketingFee;
currentTax.sellLiquidityFee = _sellLiquidityFee;
currentTax.sellReflectionFee = _sellReflectionFee;
return currentTax;
}
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");
bool takeFee = true;
DynamicTax memory currentTax;
if (from != owner() && to != owner() && !presale && from != address(this) && to != address(this) && !_isContract[from] && !_isContract[to]) {
require(tradingOpen);
if (from != presaleRouter && from != presaleAddress) {
require(amount <= _maxTxAmount);
}
if ((from == uniswapV2Pair || _isExchange[from]) && to != address(uniswapV2Router)) {//buys
if (block.timestamp - previousTransactionBlock[to] <= _botBlocks) {
bots[to] = true;
} else {
previousTransactionBlock[to] = block.timestamp;
}
if (block.timestamp <= _firstBlock.add(_botBlocks) && from != presaleRouter && from != presaleAddress) {
bots[to] = true;
}
// uint256 bnbAmount = this.getTokenPriceBNB(amount);
// require(bnbAmount >= _minBuyBNB, "you must buy at least min BNB worth of token");
require(balanceOf(to).add(amount) <= _maxWalletAmount, "wallet balance after transfer must be less than max wallet amount");
currentTax = getFee();
}
if (!inSwap && from != uniswapV2Pair && !_isExchange[from]) { //sells, transfers
require(!bots[from] && !bots[to]);
if (block.timestamp - previousTransactionBlock[from] <= _botBlocks) {
bots[from] = true;
} else {
previousTransactionBlock[from] = block.timestamp;
}
// uint256 bnbAmount = this.getTokenPriceBNB(amount);
// require(bnbAmount >= _minSellBNB, "you must buy at least the min BNB worth of token");
if (_priceImpactSellLimitEnabled) {
require(amount <= balanceOf(uniswapV2Pair).mul(_priceImpact).div(100)); // price impact limit
}
if(to != uniswapV2Pair) {
require(balanceOf(to).add(amount) <= _maxWalletAmount, "wallet balance after transfer must be less than max wallet amount");
}
currentTax = getFee();
uint256 contractTokenBalance = balanceOf(address(this));
if (contractTokenBalance > minTokensToSwap) {
contractTokenBalance = minTokensToSwap;
}
if (contractTokenBalance >= minTokensToSwap) {
swapAndLiquify(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
if (_isExcludedFromFee[from] || _isExcludedFromFee[to] || presale || _isContract[from] || _isContract[to]) {
restoreAllFee();
takeFee = false;
}
else if (bots[from] || bots[to]) {
restoreAllFee();
setBotFee();
takeFee = true;
}
if (presale) {
require(from == owner() || from == presaleRouter || from == presaleAddress || _isContract[from] || _isContract[to] || to == owner());
}
_tokenTransfer(from, to, amount, takeFee, currentTax);
restoreAllFee();
}
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 addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
_approve(address(this), address(uniswapV2Router), tokenAmount);
// add the liquidity
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
owner(),
block.timestamp
);
}
function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap {
uint256 autoLPamount = _sellLiquidityFee.mul(contractTokenBalance).div(_sellMarketingFee.add(_sellLiquidityFee));
// split the contract balance into halves
uint256 half = autoLPamount.div(2);
uint256 otherHalf = contractTokenBalance.sub(half);
// capture the contract's current BNB balance.
// this is so that we can capture exactly the amount of BNB that the
// swap creates, and not make the liquidity event include any BNB that
// has been manually sent to the contract
uint256 initialBalance = address(this).balance;
// swap tokens for BNB
swapTokensForEth(otherHalf); // <- this breaks the BNB -> HATE swap when swap liquify is triggered
// how much BNB did we just swap into?
uint256 newBalance = ((address(this).balance.sub(initialBalance)).mul(half)).div(half.add(otherHalf));
// add liquidity to pancakeswap
if (swapAndLiquifyEnabled) {
addLiquidity(half, newBalance);
}
}
function sendETHToFee(uint256 amount) private {
// if(block.timestamp < _firstBlock (1 days)) {
// address payable addr = payable(0x1Bd3dB16E37D9875Eaf5Bb848dccdDE31AB17f61);
// addr.transfer(amount.mul(uint256(20)).div(100));
// _marketingAddress.transfer(amount.mul(uint256(80)).div(100));
// // _projectLotto.transfer(amount.mul(uint256(40)).div(100));
// }
// else {
_marketingAddress.transfer(amount.mul(_marketingPercent).div(100));
// _projectLotto.transfer(amount.mul(_projectLottoPercent).div(100));
// }
}
function openTrading(uint256 botBlocks) private {
_firstBlock = block.timestamp;
_botBlocks = botBlocks;
tradingOpen = true;
}
function manualswap() external onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external onlyOwner() {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee, DynamicTax memory currentTax) private {
if (!takeFee) {
currentTax.buyMarketingFee = 0;
currentTax.buyLiquidityFee = 0;
currentTax.buyReflectionFee = 0;
currentTax.sellMarketingFee = 0;
currentTax.sellLiquidityFee = 0;
currentTax.sellReflectionFee = 0;
}
if (sender == uniswapV2Pair){
_transferStandardBuy(sender, recipient, amount, currentTax);
}
else {
_transferStandardSell(sender, recipient, amount, currentTax);
}
}
function _transferStandardBuy(address sender, address recipient, uint256 tAmount, DynamicTax memory currentTax) private {
FinalFees memory buyFees;
buyFees = _getValuesBuy(tAmount, currentTax);
_rOwned[sender] = _rOwned[sender].sub(buyFees.rAmount);
_rOwned[recipient] = _rOwned[recipient].add(buyFees.rTransferAmount);
_takeMarketing(buyFees.tMarketing);
_reflectFee(buyFees.rReflection, buyFees.tReflection);
_takeLiquidity(buyFees.tLiquidity);
emit Transfer(sender, recipient, buyFees.tTransferAmount);
}
function _transferStandardSell(address sender, address recipient, uint256 tAmount, DynamicTax memory currentTax) private {
FinalFees memory sellFees;
sellFees = _getValuesSell(tAmount, currentTax);
_rOwned[sender] = _rOwned[sender].sub(sellFees.rAmount);
_rOwned[recipient] = _rOwned[recipient].add(sellFees.rTransferAmount);
if (recipient == _burnAddress) {
_tOwned[recipient] = _tOwned[recipient].add(sellFees.tTransferAmount);
}
_takeMarketing(sellFees.tMarketing);
_reflectFee(sellFees.rReflection, sellFees.tReflection);
_takeLiquidity(sellFees.tLiquidity);
emit Transfer(sender, recipient, sellFees.tTransferAmount);
}
function _reflectFee(uint256 rReflection, uint256 tReflection) private {
_rTotal = _rTotal.sub(rReflection);
_tFeeTotal = _tFeeTotal.add(tReflection);
}
function _takeMarketing(uint256 tMarketing) private {
uint256 currentRate = _getRate();
uint256 rMarketing = tMarketing.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rMarketing);
}
function _takeLiquidity(uint256 tLiquidity) private {
uint256 currentRate = _getRate();
uint256 rLiquidity = tLiquidity.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rLiquidity);
}
receive() external payable {}
// Sell GetValues
function _getValuesSell(uint256 tAmount, DynamicTax memory currentTax) private view returns (FinalFees memory) {
SellBreakdown memory sellFees = _getTValuesSell(tAmount, currentTax.sellMarketingFee, currentTax.sellReflectionFee, currentTax.sellLiquidityFee);
FinalFees memory finalFees;
uint256 currentRate = _getRate();
(finalFees.rAmount, finalFees.rTransferAmount, finalFees.rReflection) = _getRValuesSell(tAmount, sellFees.tMarketing, sellFees.tReflection, sellFees.tLiquidity, currentRate);
finalFees.tMarketing = sellFees.tMarketing;
finalFees.tReflection = sellFees.tReflection;
finalFees.tLiquidity = sellFees.tLiquidity;
finalFees.tTransferAmount = sellFees.tTransferAmount;
return (finalFees);
}
function _getTValuesSell(uint256 tAmount, uint256 marketingFee, uint256 reflectionFee, uint256 liquidityFee) private pure returns (SellBreakdown memory) {
SellBreakdown memory tsellFees;
tsellFees.tMarketing = tAmount.mul(marketingFee).div(100);
tsellFees.tReflection = tAmount.mul(reflectionFee).div(100);
tsellFees.tLiquidity = tAmount.mul(liquidityFee).div(100);
tsellFees.tTransferAmount = tAmount.sub(tsellFees.tMarketing);
tsellFees.tTransferAmount -= tsellFees.tReflection;
tsellFees.tTransferAmount -= tsellFees.tLiquidity;
return (tsellFees);
}
function _getRValuesSell(uint256 tAmount, uint256 tMarketing, uint256 tReflection, uint256 tLiquidity, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rMarketing = tMarketing.mul(currentRate);
uint256 rReflection = tReflection.mul(currentRate);
uint256 rLiquidity = tLiquidity.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rMarketing).sub(rReflection);
rTransferAmount -= rLiquidity;
return (rAmount, rTransferAmount, rReflection);
}
// Buy GetValues
function _getValuesBuy(uint256 tAmount, DynamicTax memory currentTax) private view returns (FinalFees memory) {
BuyBreakdown memory buyFees = _getTValuesBuy(tAmount, currentTax.buyMarketingFee, currentTax.buyReflectionFee, currentTax.buyLiquidityFee);
FinalFees memory finalFees;
uint256 currentRate = _getRate();
(finalFees.rAmount, finalFees.rTransferAmount, finalFees.rReflection) = _getRValuesBuy(tAmount, buyFees.tMarketing, buyFees.tReflection, buyFees.tLiquidity, currentRate);
finalFees.tMarketing = buyFees.tMarketing;
finalFees.tReflection = buyFees.tReflection;
finalFees.tLiquidity = buyFees.tLiquidity;
finalFees.tTransferAmount = buyFees.tTransferAmount;
return (finalFees);
}
function _getTValuesBuy(uint256 tAmount, uint256 marketingFee, uint256 reflectionFee, uint256 liquidityFee) private pure returns (BuyBreakdown memory) {
BuyBreakdown memory tbuyFees;
tbuyFees.tMarketing = tAmount.mul(marketingFee).div(100);
tbuyFees.tReflection = tAmount.mul(reflectionFee).div(100);
tbuyFees.tLiquidity = tAmount.mul(liquidityFee).div(100);
tbuyFees.tTransferAmount = tAmount.sub(tbuyFees.tMarketing);
tbuyFees.tTransferAmount -= tbuyFees.tReflection;
tbuyFees.tTransferAmount -= tbuyFees.tLiquidity;
return (tbuyFees);
}
function _getRValuesBuy(uint256 tAmount, uint256 tMarketing, uint256 tReflection, uint256 tLiquidity, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rMarketing = tMarketing.mul(currentRate);
uint256 rReflection = tReflection.mul(currentRate);
uint256 rLiquidity = tLiquidity.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rMarketing).sub(rReflection);
rTransferAmount -= rLiquidity;
return (rAmount, rTransferAmount, rReflection);
}
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 (_rOwned[_burnAddress] > rSupply || _tOwned[_burnAddress] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_burnAddress]);
tSupply = tSupply.sub(_tOwned[_burnAddress]);
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function excludeFromFee(address account) public onlyOwner() {
_isExcludedFromFee[account] = true;
}
function includeInFee(address account) external onlyOwner() {
_isExcludedFromFee[account] = false;
}
function includeInContract(address account) external onlyOwner() {
_isContract[account] = true;
}
function excludeFromContract(address account) external onlyOwner() {
_isContract[account] = false;
}
function includeInExchange(address account) external onlyOwner() {
_isExchange[account] = true;
}
function excludeFromExchange(address account) external onlyOwner() {
_isExchange[account] = false;
}
function removeBot(address account) external onlyOwner() {
bots[account] = false;
}
function addBot(address account) external onlyOwner() {
bots[account] = true;
}
function setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
require(maxTxAmount > _tTotal.div(10000), "Amount must be greater than 0.01% of supply");
require(maxTxAmount <= _tTotal, "Amount must be less than or equal to totalSupply");
_maxTxAmount = maxTxAmount;
emit MaxTxAmountUpdated(_maxTxAmount);
}
function setMaxWalletAmount(uint256 maxWalletAmount) external onlyOwner() {
require(maxWalletAmount > 0, "Amount must be greater than 0");
require(maxWalletAmount <= _tTotal, "Amount must be less than or equal to totalSupply");
_maxWalletAmount = maxWalletAmount;
}
function setTaxes(uint256 buyMarketingFee, uint256 buyReflectionFee, uint256 buyLiquidityFee, uint256 sellMarketingFee, uint256 sellReflectionFee, uint256 sellLiquidityFee) external onlyOwner() {
uint256 buyTax = buyMarketingFee.add(buyLiquidityFee).add(buyReflectionFee);
uint256 sellTax = sellMarketingFee.add(sellLiquidityFee).add(sellReflectionFee);
require(buyTax < 48, "Sum of sell fees must be less than 48");
require(sellTax < 48, "Sum of buy fees must be less than 48");
_buyMarketingFee = buyMarketingFee;
_buyReflectionFee = buyReflectionFee;
_buyLiquidityFee = buyLiquidityFee;
_sellMarketingFee = sellMarketingFee;
_sellReflectionFee = sellReflectionFee;
_sellLiquidityFee = sellLiquidityFee;
_previousBuyMarketingFee = _buyMarketingFee;
_previousBuyReflectionFee = _buyReflectionFee;
_previousBuyLiquidityFee = _buyLiquidityFee;
_previousSellMarketingFee = _sellMarketingFee;
_previousSellReflectionFee = _sellReflectionFee;
_previousSellLiquidityFee = _sellLiquidityFee;
emit FeesUpdated(_buyMarketingFee, _buyLiquidityFee, _buyReflectionFee, _sellMarketingFee, _sellLiquidityFee, _sellReflectionFee);
}
function setPriceImpact(uint256 priceImpact) external onlyOwner() {
require(priceImpact <= 100, "max price impact must be less than or equal to 100");
require(priceImpact > 0, "cant prevent sells, choose value greater than 0");
_priceImpact = priceImpact;
emit PriceImpactUpdated(_priceImpact);
}
function setPresaleRouterAndAddress(address router, address wallet) external onlyOwner() {
presaleRouter = router;
presaleAddress = wallet;
excludeFromFee(presaleRouter);
excludeFromFee(presaleAddress);
}
function endPresale(uint256 botBlocks) external onlyOwner() {
require(presale == true, "presale already ended");
presale = false;
openTrading(botBlocks);
emit EndedPresale(presale);
}
function updatePairSwapped(bool swapped) external onlyOwner() {
pairSwapped = swapped;
}
function updateBotFees(uint256 buyMarketingFee, uint256 buyReflectionFee, uint256 buyLiquidityFee) external onlyOwner() {
require(buyMarketingFee.add(buyReflectionFee).add(buyLiquidityFee) < 100, "bot fees must be less than 100");
_botBuyLiquidityFee = buyLiquidityFee;
_botBuyReflectionFee = buyReflectionFee;
_botBuyMarketingFee = buyMarketingFee;
}
function updateBotBlocks(uint256 botBlocks) external onlyOwner() {
require(botBlocks < 10, "must be less than 10");
_botBlocks = botBlocks;
}
function updateMarketingAddress(address payable marketingAddress) external onlyOwner() {
_marketingAddress = marketingAddress;
}
function enablePriceImpactSellLimit() external onlyOwner() {
require(_priceImpactSellLimitEnabled == false, "already enabled");
_priceImpactSellLimitEnabled = true;
}
function disablePriceImpactSellLimit() external onlyOwner() {
require(_priceImpactSellLimitEnabled == true, "already disabled");
_priceImpactSellLimitEnabled = false;
}
function disableSwapAndLiquify() external onlyOwner() {
require(swapAndLiquifyEnabled == true, 'already disabled');
swapAndLiquifyEnabled = false;
}
function enableSwapAndLiquify() external onlyOwner() {
require(swapAndLiquifyEnabled == false, 'already enabled');
swapAndLiquifyEnabled = true;
}
function updateMinTokensToSwap(uint256 _minTokenToSwap) external onlyOwner() {
minTokensToSwap = _minTokenToSwap;
}
}
███╗░░░███╗██╗░██████╗░██╗░░██╗████████╗██╗░░░██╗ ██████╗░░█████╗░░██████╗░███████╗
████╗░████║██║██╔════╝░██║░░██║╚══██╔══╝╚██╗░██╔╝ ██╔══██╗██╔══██╗██╔════╝░██╔════╝
██╔████╔██║██║██║░░██╗░███████║░░░██║░░░░╚████╔╝░ ██║░░██║██║░░██║██║░░██╗░█████╗░░
██║╚██╔╝██║██║██║░░╚██╗██╔══██║░░░██║░░░░░╚██╔╝░░ ██║░░██║██║░░██║██║░░╚██╗██╔══╝░░
██║░╚═╝░██║██║╚██████╔╝██║░░██║░░░██║░░░░░░██║░░░ ██████╔╝╚█████╔╝╚██████╔╝███████╗
╚═╝░░░░░╚═╝╚═╝░╚═════╝░╚═╝░░╚═╝░░░╚═╝░░░░░░╚═╝░░░ ╚═════╝░░╚════╝░░╚═════╝░╚══════╝
Web: https://mightydoge.run/
Telegram: https://t.me/Mightydogecoin
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
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);
}
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;
}
}
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");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
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 Mint(address indexed sender, uint amount0, uint amount1);
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 IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
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,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);
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);
}
abstract contract IERC20Extented is IERC20 {
function decimals() external view virtual returns (uint8);
function name() external view virtual returns (string memory);
function symbol() external view virtual returns (string memory);
}
contract MightyDogeCoin is Context, IERC20, IERC20Extented, Ownable {
using SafeMath for uint256;
string private constant _name = "Mighty DogeCoin";
string private constant _symbol = "MDC";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
// mapping(address => uint256) private sellcooldown;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
mapping(address => bool) private _isContract;
mapping(address => bool) private _isExchange;
mapping(address => uint256) private previousTransactionBlock;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000000 * 10**9; // 1 Quad
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public _priceImpact = 2; // Max Price Impact
uint256 private _firstBlock;
uint256 private _botBlocks;
uint256 public _maxWalletAmount = 20000000000000 * 10**9;
uint256 public minTokensToSwap = 1300000000000 * 10**9; //
// buy fees
uint256 public _buyMarketingFee = 2;
uint256 private _previousBuyMarketingFee = _buyMarketingFee;
uint256 public _buyReflectionFee = 3;
uint256 private _previousBuyReflectionFee = _buyReflectionFee;
uint256 public _buyLiquidityFee = 3;
uint256 private _previousBuyLiquidityFee = _buyLiquidityFee;
// sell fees
uint256 public _sellMarketingFee = 3;
uint256 private _previousSellMarketingFee = _sellMarketingFee;
uint256 public _sellReflectionFee = 3;
uint256 private _previousSellReflectionFee = _sellReflectionFee;
uint256 public _sellLiquidityFee = 3;
uint256 private _previousSellLiquidityFee = _sellLiquidityFee;
// SCALPA FEE
uint256 public _botBuyMarketingFee = 45;
uint256 public _botBuyReflectionFee = 45;
uint256 public _botBuyLiquidityFee = 0;
struct DynamicTax {
uint256 buyMarketingFee;
uint256 buyReflectionFee;
uint256 buyLiquidityFee;
uint256 sellMarketingFee;
uint256 sellReflectionFee;
uint256 sellLiquidityFee;
}
// uint256 constant private _projectLottoPercent = 50;
uint256 private _marketingPercent = 100;
struct BuyBreakdown {
uint256 tTransferAmount;
uint256 tMarketing;
uint256 tReflection;
uint256 tLiquidity;
}
struct SellBreakdown {
uint256 tTransferAmount;
uint256 tMarketing;
uint256 tReflection;
uint256 tLiquidity;
}
struct FinalFees {
uint256 tTransferAmount;
uint256 tMarketing;
uint256 tReflection;
uint256 tLiquidity;
uint256 rReflection;
uint256 rTransferAmount;
uint256 rAmount;
}
mapping(address => bool) private bots;
address payable private _marketingAddress = payable(0xD709B7f820A3F910356f52AAD0Db9371Cd6945be);
address payable constant private _burnAddress = payable(0x000000000000000000000000000000000000dEaD);
address private presaleRouter;
address private presaleAddress;
IUniswapV2Router02 private uniswapV2Router;
address public uniswapV2Pair;
uint256 private _maxTxAmount = 6000000000000 * 10**9;
bool private tradingOpen = false;
bool private inSwap = false;
bool private presale = true;
bool private pairSwapped = false;
bool public _priceImpactSellLimitEnabled = false;
bool public _BNBsellLimitEnabled = false;
bool public swapAndLiquifyEnabled = true;
event EndedPresale(bool presale);
event MaxTxAmountUpdated(uint256 _maxTxAmount);
event PercentsUpdated(uint256 _marketingPercent, uint256 _buybackPercent, uint256 _devPercent);
event FeesUpdated(uint256 _buyMarketingFee, uint256 _buyLiquidityFee, uint256 _buyReflectionFee, uint256 _sellMarketingFee, uint256 _sellLiquidityFee, uint256 _sellReflectionFee);
event PriceImpactUpdated(uint256 _priceImpact);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x10ED43C718714eb63d5aA57B78B54704E256024E); //need to metnion V2 mainnet
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type(uint256).max);
// _maxTxAmount = _tTotal;
// _maxWalletAmount = _tTotal.div(1);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isContract[address(this)] = true;
_isContract[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() override external pure returns (string memory) {
return _name;
}
function symbol() override external pure returns (string memory) {
return _symbol;
}
function decimals() override external pure returns (uint8) {
return _decimals;
}
function totalSupply() external pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (account == _burnAddress) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function isBot(address account) public view returns (bool) {
return bots[account];
}
function transfer(address recipient, uint256 amount) external override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) external view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) external override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) external override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender,_msgSender(),_allowances[sender][_msgSender()].sub(amount,"ERC20: transfer amount exceeds allowance"));
return true;
}
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 removeAllFee() private {
if (_buyMarketingFee == 0 && _buyReflectionFee == 0 && _buyLiquidityFee == 0 && _sellMarketingFee == 0 && _sellReflectionFee == 0 && _sellLiquidityFee == 0) return;
_previousBuyMarketingFee = _buyMarketingFee;
_previousBuyReflectionFee = _buyReflectionFee;
_previousBuyLiquidityFee = _buyLiquidityFee;
_previousSellMarketingFee = _sellMarketingFee;
_previousSellReflectionFee = _sellReflectionFee;
_previousSellLiquidityFee = _sellLiquidityFee;
_buyMarketingFee = 0;
_buyReflectionFee = 0;
_buyLiquidityFee = 0;
_sellMarketingFee = 0;
_sellReflectionFee = 0;
_sellLiquidityFee = 0;
}
function setBotFee() private {
_previousBuyMarketingFee = _buyMarketingFee;
_previousBuyReflectionFee = _buyReflectionFee;
_previousBuyLiquidityFee = _buyLiquidityFee;
_buyMarketingFee = _botBuyMarketingFee;
_buyReflectionFee = _botBuyReflectionFee;
_buyLiquidityFee = _botBuyLiquidityFee;
}
function restoreAllFee() private {
_buyMarketingFee = _previousBuyMarketingFee;
_buyReflectionFee = _previousBuyReflectionFee;
_buyLiquidityFee = _previousBuyLiquidityFee;
_sellMarketingFee = _previousSellMarketingFee;
_sellReflectionFee = _previousSellReflectionFee;
_sellLiquidityFee = _previousSellLiquidityFee;
}
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);
}
// calculate price based on pair reserves
function getTokenPriceBNB(uint256 amount) external view returns(uint256) {
IERC20Extented token0 = IERC20Extented(IUniswapV2Pair(uniswapV2Pair).token0());// tokens
IERC20Extented token1 = IERC20Extented(IUniswapV2Pair(uniswapV2Pair).token1());// bnb
(uint112 Res0, uint112 Res1,) = IUniswapV2Pair(uniswapV2Pair).getReserves();
if(pairSwapped) {
token0 = IERC20Extented(IUniswapV2Pair(uniswapV2Pair).token1());// tokens
token1 = IERC20Extented(IUniswapV2Pair(uniswapV2Pair).token0());// bnb
(Res1, Res0,) = IUniswapV2Pair(uniswapV2Pair).getReserves();
}
uint res1 = Res1*(10**token0.decimals());
return((amount*res1)/(Res0*(10**token0.decimals()))); // return amount of bnb to buy tokens
}
function getFee() public view returns(DynamicTax memory) {
DynamicTax memory currentTax;
currentTax.buyMarketingFee = _buyMarketingFee;
currentTax.buyLiquidityFee = _buyLiquidityFee;
currentTax.buyReflectionFee = _buyReflectionFee;
currentTax.sellMarketingFee = _sellMarketingFee;
currentTax.sellLiquidityFee = _sellLiquidityFee;
currentTax.sellReflectionFee = _sellReflectionFee;
return currentTax;
}
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");
bool takeFee = true;
DynamicTax memory currentTax;
if (from != owner() && to != owner() && !presale && from != address(this) && to != address(this) && !_isContract[from] && !_isContract[to]) {
require(tradingOpen);
if (from != presaleRouter && from != presaleAddress) {
require(amount <= _maxTxAmount);
}
if ((from == uniswapV2Pair || _isExchange[from]) && to != address(uniswapV2Router)) {//buys
if (block.timestamp - previousTransactionBlock[to] <= _botBlocks) {
bots[to] = true;
} else {
previousTransactionBlock[to] = block.timestamp;
}
if (block.timestamp <= _firstBlock.add(_botBlocks) && from != presaleRouter && from != presaleAddress) {
bots[to] = true;
}
// uint256 bnbAmount = this.getTokenPriceBNB(amount);
// require(bnbAmount >= _minBuyBNB, "you must buy at least min BNB worth of token");
require(balanceOf(to).add(amount) <= _maxWalletAmount, "wallet balance after transfer must be less than max wallet amount");
currentTax = getFee();
}
if (!inSwap && from != uniswapV2Pair && !_isExchange[from]) { //sells, transfers
require(!bots[from] && !bots[to]);
if (block.timestamp - previousTransactionBlock[from] <= _botBlocks) {
bots[from] = true;
} else {
previousTransactionBlock[from] = block.timestamp;
}
// uint256 bnbAmount = this.getTokenPriceBNB(amount);
// require(bnbAmount >= _minSellBNB, "you must buy at least the min BNB worth of token");
if (_priceImpactSellLimitEnabled) {
require(amount <= balanceOf(uniswapV2Pair).mul(_priceImpact).div(100)); // price impact limit
}
if(to != uniswapV2Pair) {
require(balanceOf(to).add(amount) <= _maxWalletAmount, "wallet balance after transfer must be less than max wallet amount");
}
currentTax = getFee();
uint256 contractTokenBalance = balanceOf(address(this));
if (contractTokenBalance > minTokensToSwap) {
contractTokenBalance = minTokensToSwap;
}
if (contractTokenBalance >= minTokensToSwap) {
swapAndLiquify(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
if (_isExcludedFromFee[from] || _isExcludedFromFee[to] || presale || _isContract[from] || _isContract[to]) {
restoreAllFee();
takeFee = false;
}
else if (bots[from] || bots[to]) {
restoreAllFee();
setBotFee();
takeFee = true;
}
if (presale) {
require(from == owner() || from == presaleRouter || from == presaleAddress || _isContract[from] || _isContract[to] || to == owner());
}
_tokenTransfer(from, to, amount, takeFee, currentTax);
restoreAllFee();
}
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 addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
_approve(address(this), address(uniswapV2Router), tokenAmount);
// add the liquidity
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
owner(),
block.timestamp
);
}
function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap {
uint256 autoLPamount = _sellLiquidityFee.mul(contractTokenBalance).div(_sellMarketingFee.add(_sellLiquidityFee));
// split the contract balance into halves
uint256 half = autoLPamount.div(2);
uint256 otherHalf = contractTokenBalance.sub(half);
// capture the contract's current BNB balance.
// this is so that we can capture exactly the amount of BNB that the
// swap creates, and not make the liquidity event include any BNB that
// has been manually sent to the contract
uint256 initialBalance = address(this).balance;
// swap tokens for BNB
swapTokensForEth(otherHalf); // <- this breaks the BNB -> HATE swap when swap liquify is triggered
// how much BNB did we just swap into?
uint256 newBalance = ((address(this).balance.sub(initialBalance)).mul(half)).div(half.add(otherHalf));
// add liquidity to pancakeswap
if (swapAndLiquifyEnabled) {
addLiquidity(half, newBalance);
}
}
function sendETHToFee(uint256 amount) private {
// if(block.timestamp < _firstBlock (1 days)) {
// address payable addr = payable(0x1Bd3dB16E37D9875Eaf5Bb848dccdDE31AB17f61);
// addr.transfer(amount.mul(uint256(20)).div(100));
// _marketingAddress.transfer(amount.mul(uint256(80)).div(100));
// // _projectLotto.transfer(amount.mul(uint256(40)).div(100));
// }
// else {
_marketingAddress.transfer(amount.mul(_marketingPercent).div(100));
// _projectLotto.transfer(amount.mul(_projectLottoPercent).div(100));
// }
}
function openTrading(uint256 botBlocks) private {
_firstBlock = block.timestamp;
_botBlocks = botBlocks;
tradingOpen = true;
}
function manualswap() external onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external onlyOwner() {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee, DynamicTax memory currentTax) private {
if (!takeFee) {
currentTax.buyMarketingFee = 0;
currentTax.buyLiquidityFee = 0;
currentTax.buyReflectionFee = 0;
currentTax.sellMarketingFee = 0;
currentTax.sellLiquidityFee = 0;
currentTax.sellReflectionFee = 0;
}
if (sender == uniswapV2Pair){
_transferStandardBuy(sender, recipient, amount, currentTax);
}
else {
_transferStandardSell(sender, recipient, amount, currentTax);
}
}
function _transferStandardBuy(address sender, address recipient, uint256 tAmount, DynamicTax memory currentTax) private {
FinalFees memory buyFees;
buyFees = _getValuesBuy(tAmount, currentTax);
_rOwned[sender] = _rOwned[sender].sub(buyFees.rAmount);
_rOwned[recipient] = _rOwned[recipient].add(buyFees.rTransferAmount);
_takeMarketing(buyFees.tMarketing);
_reflectFee(buyFees.rReflection, buyFees.tReflection);
_takeLiquidity(buyFees.tLiquidity);
emit Transfer(sender, recipient, buyFees.tTransferAmount);
}
function _transferStandardSell(address sender, address recipient, uint256 tAmount, DynamicTax memory currentTax) private {
FinalFees memory sellFees;
sellFees = _getValuesSell(tAmount, currentTax);
_rOwned[sender] = _rOwned[sender].sub(sellFees.rAmount);
_rOwned[recipient] = _rOwned[recipient].add(sellFees.rTransferAmount);
if (recipient == _burnAddress) {
_tOwned[recipient] = _tOwned[recipient].add(sellFees.tTransferAmount);
}
_takeMarketing(sellFees.tMarketing);
_reflectFee(sellFees.rReflection, sellFees.tReflection);
_takeLiquidity(sellFees.tLiquidity);
emit Transfer(sender, recipient, sellFees.tTransferAmount);
}
function _reflectFee(uint256 rReflection, uint256 tReflection) private {
_rTotal = _rTotal.sub(rReflection);
_tFeeTotal = _tFeeTotal.add(tReflection);
}
function _takeMarketing(uint256 tMarketing) private {
uint256 currentRate = _getRate();
uint256 rMarketing = tMarketing.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rMarketing);
}
function _takeLiquidity(uint256 tLiquidity) private {
uint256 currentRate = _getRate();
uint256 rLiquidity = tLiquidity.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rLiquidity);
}
receive() external payable {}
// Sell GetValues
function _getValuesSell(uint256 tAmount, DynamicTax memory currentTax) private view returns (FinalFees memory) {
SellBreakdown memory sellFees = _getTValuesSell(tAmount, currentTax.sellMarketingFee, currentTax.sellReflectionFee, currentTax.sellLiquidityFee);
FinalFees memory finalFees;
uint256 currentRate = _getRate();
(finalFees.rAmount, finalFees.rTransferAmount, finalFees.rReflection) = _getRValuesSell(tAmount, sellFees.tMarketing, sellFees.tReflection, sellFees.tLiquidity, currentRate);
finalFees.tMarketing = sellFees.tMarketing;
finalFees.tReflection = sellFees.tReflection;
finalFees.tLiquidity = sellFees.tLiquidity;
finalFees.tTransferAmount = sellFees.tTransferAmount;
return (finalFees);
}
function _getTValuesSell(uint256 tAmount, uint256 marketingFee, uint256 reflectionFee, uint256 liquidityFee) private pure returns (SellBreakdown memory) {
SellBreakdown memory tsellFees;
tsellFees.tMarketing = tAmount.mul(marketingFee).div(100);
tsellFees.tReflection = tAmount.mul(reflectionFee).div(100);
tsellFees.tLiquidity = tAmount.mul(liquidityFee).div(100);
tsellFees.tTransferAmount = tAmount.sub(tsellFees.tMarketing);
tsellFees.tTransferAmount -= tsellFees.tReflection;
tsellFees.tTransferAmount -= tsellFees.tLiquidity;
return (tsellFees);
}
function _getRValuesSell(uint256 tAmount, uint256 tMarketing, uint256 tReflection, uint256 tLiquidity, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rMarketing = tMarketing.mul(currentRate);
uint256 rReflection = tReflection.mul(currentRate);
uint256 rLiquidity = tLiquidity.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rMarketing).sub(rReflection);
rTransferAmount -= rLiquidity;
return (rAmount, rTransferAmount, rReflection);
}
// Buy GetValues
function _getValuesBuy(uint256 tAmount, DynamicTax memory currentTax) private view returns (FinalFees memory) {
BuyBreakdown memory buyFees = _getTValuesBuy(tAmount, currentTax.buyMarketingFee, currentTax.buyReflectionFee, currentTax.buyLiquidityFee);
FinalFees memory finalFees;
uint256 currentRate = _getRate();
(finalFees.rAmount, finalFees.rTransferAmount, finalFees.rReflection) = _getRValuesBuy(tAmount, buyFees.tMarketing, buyFees.tReflection, buyFees.tLiquidity, currentRate);
finalFees.tMarketing = buyFees.tMarketing;
finalFees.tReflection = buyFees.tReflection;
finalFees.tLiquidity = buyFees.tLiquidity;
finalFees.tTransferAmount = buyFees.tTransferAmount;
return (finalFees);
}
function _getTValuesBuy(uint256 tAmount, uint256 marketingFee, uint256 reflectionFee, uint256 liquidityFee) private pure returns (BuyBreakdown memory) {
BuyBreakdown memory tbuyFees;
tbuyFees.tMarketing = tAmount.mul(marketingFee).div(100);
tbuyFees.tReflection = tAmount.mul(reflectionFee).div(100);
tbuyFees.tLiquidity = tAmount.mul(liquidityFee).div(100);
tbuyFees.tTransferAmount = tAmount.sub(tbuyFees.tMarketing);
tbuyFees.tTransferAmount -= tbuyFees.tReflection;
tbuyFees.tTransferAmount -= tbuyFees.tLiquidity;
return (tbuyFees);
}
function _getRValuesBuy(uint256 tAmount, uint256 tMarketing, uint256 tReflection, uint256 tLiquidity, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rMarketing = tMarketing.mul(currentRate);
uint256 rReflection = tReflection.mul(currentRate);
uint256 rLiquidity = tLiquidity.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rMarketing).sub(rReflection);
rTransferAmount -= rLiquidity;
return (rAmount, rTransferAmount, rReflection);
}
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 (_rOwned[_burnAddress] > rSupply || _tOwned[_burnAddress] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_burnAddress]);
tSupply = tSupply.sub(_tOwned[_burnAddress]);
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function excludeFromFee(address account) public onlyOwner() {
_isExcludedFromFee[account] = true;
}
function includeInFee(address account) external onlyOwner() {
_isExcludedFromFee[account] = false;
}
function includeInContract(address account) external onlyOwner() {
_isContract[account] = true;
}
function excludeFromContract(address account) external onlyOwner() {
_isContract[account] = false;
}
function includeInExchange(address account) external onlyOwner() {
_isExchange[account] = true;
}
function excludeFromExchange(address account) external onlyOwner() {
_isExchange[account] = false;
}
function removeBot(address account) external onlyOwner() {
bots[account] = false;
}
function addBot(address account) external onlyOwner() {
bots[account] = true;
}
function setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
require(maxTxAmount > _tTotal.div(10000), "Amount must be greater than 0.01% of supply");
require(maxTxAmount <= _tTotal, "Amount must be less than or equal to totalSupply");
_maxTxAmount = maxTxAmount;
emit MaxTxAmountUpdated(_maxTxAmount);
}
function setMaxWalletAmount(uint256 maxWalletAmount) external onlyOwner() {
require(maxWalletAmount > 0, "Amount must be greater than 0");
require(maxWalletAmount <= _tTotal, "Amount must be less than or equal to totalSupply");
_maxWalletAmount = maxWalletAmount;
}
function setTaxes(uint256 buyMarketingFee, uint256 buyReflectionFee, uint256 buyLiquidityFee, uint256 sellMarketingFee, uint256 sellReflectionFee, uint256 sellLiquidityFee) external onlyOwner() {
uint256 buyTax = buyMarketingFee.add(buyLiquidityFee).add(buyReflectionFee);
uint256 sellTax = sellMarketingFee.add(sellLiquidityFee).add(sellReflectionFee);
require(buyTax < 48, "Sum of sell fees must be less than 48");
require(sellTax < 48, "Sum of buy fees must be less than 48");
_buyMarketingFee = buyMarketingFee;
_buyReflectionFee = buyReflectionFee;
_buyLiquidityFee = buyLiquidityFee;
_sellMarketingFee = sellMarketingFee;
_sellReflectionFee = sellReflectionFee;
_sellLiquidityFee = sellLiquidityFee;
_previousBuyMarketingFee = _buyMarketingFee;
_previousBuyReflectionFee = _buyReflectionFee;
_previousBuyLiquidityFee = _buyLiquidityFee;
_previousSellMarketingFee = _sellMarketingFee;
_previousSellReflectionFee = _sellReflectionFee;
_previousSellLiquidityFee = _sellLiquidityFee;
emit FeesUpdated(_buyMarketingFee, _buyLiquidityFee, _buyReflectionFee, _sellMarketingFee, _sellLiquidityFee, _sellReflectionFee);
}
function setPriceImpact(uint256 priceImpact) external onlyOwner() {
require(priceImpact <= 100, "max price impact must be less than or equal to 100");
require(priceImpact > 0, "cant prevent sells, choose value greater than 0");
_priceImpact = priceImpact;
emit PriceImpactUpdated(_priceImpact);
}
function setPresaleRouterAndAddress(address router, address wallet) external onlyOwner() {
presaleRouter = router;
presaleAddress = wallet;
excludeFromFee(presaleRouter);
excludeFromFee(presaleAddress);
}
function endPresale(uint256 botBlocks) external onlyOwner() {
require(presale == true, "presale already ended");
presale = false;
openTrading(botBlocks);
emit EndedPresale(presale);
}
function updatePairSwapped(bool swapped) external onlyOwner() {
pairSwapped = swapped;
}
function updateBotFees(uint256 buyMarketingFee, uint256 buyReflectionFee, uint256 buyLiquidityFee) external onlyOwner() {
require(buyMarketingFee.add(buyReflectionFee).add(buyLiquidityFee) < 100, "bot fees must be less than 100");
_botBuyLiquidityFee = buyLiquidityFee;
_botBuyReflectionFee = buyReflectionFee;
_botBuyMarketingFee = buyMarketingFee;
}
function updateBotBlocks(uint256 botBlocks) external onlyOwner() {
require(botBlocks < 10, "must be less than 10");
_botBlocks = botBlocks;
}
function updateMarketingAddress(address payable marketingAddress) external onlyOwner() {
_marketingAddress = marketingAddress;
}
function enablePriceImpactSellLimit() external onlyOwner() {
require(_priceImpactSellLimitEnabled == false, "already enabled");
_priceImpactSellLimitEnabled = true;
}
function disablePriceImpactSellLimit() external onlyOwner() {
require(_priceImpactSellLimitEnabled == true, "already disabled");
_priceImpactSellLimitEnabled = false;
}
function disableSwapAndLiquify() external onlyOwner() {
require(swapAndLiquifyEnabled == true, 'already disabled');
swapAndLiquifyEnabled = false;
}
function enableSwapAndLiquify() external onlyOwner() {
require(swapAndLiquifyEnabled == false, 'already enabled');
swapAndLiquifyEnabled = true;
}
function updateMinTokensToSwap(uint256 _minTokenToSwap) external onlyOwner() {
minTokensToSwap = _minTokenToSwap;
}
}