Share
Buy $MOVE
Hungarian Vizsla Inu (HVI)

0xde61...3b26

Buy tax: 13%

Sell tax: 12.7%

Overall Score

89/100

Decentralization

88/100

Security

91/100

Code Quality

89/100

1// Beginning of CoinToken.sol
2pragma solidity ^0.6.12;
3// SPDX-License-Identifier: Unlicensed
4interface IERC20 {
5
6 function totalSupply() external view returns (uint256);
7
8 /**
9 * @dev Returns the amount of tokens owned by `account`.
10 */
11 function balanceOf(address account) external view returns (uint256);
12
13 /**
14 * @dev Moves `amount` tokens from the caller's account to `recipient`.
15 *
16 * Returns a boolean value indicating whether the operation succeeded.
17 *
18 * Emits a {Transfer} event.
19 */
20 function transfer(address recipient, uint256 amount) external returns (bool);
21
22 /**
23 * @dev Returns the remaining number of tokens that `spender` will be
24 * allowed to spend on behalf of `owner` through {transferFrom}. This is
25 * zero by default.
26 *
27 * This value changes when {approve} or {transferFrom} are called.
28 */
29 function allowance(address owner, address spender) external view returns (uint256);
30
31 /**
32 * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
33 *
34 * Returns a boolean value indicating whether the operation succeeded.
35 *
36 * IMPORTANT: Beware that changing an allowance with this method brings the risk
37 * that someone may use both the old and the new allowance by unfortunate
38 * transaction ordering. One possible solution to mitigate this race
39 * condition is to first reduce the spender's allowance to 0 and set the
40 * desired value afterwards:
41 * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
42 *
43 * Emits an {Approval} event.
44 */
45 function approve(address spender, uint256 amount) external returns (bool);
46
47 /**
48 * @dev Moves `amount` tokens from `sender` to `recipient` using the
49 * allowance mechanism. `amount` is then deducted from the caller's
50 * allowance.
51 *
52 * Returns a boolean value indicating whether the operation succeeded.
53 *
54 * Emits a {Transfer} event.
55 */
56 function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
57
58 /**
59 * @dev Emitted when `value` tokens are moved from one account (`from`) to
60 * another (`to`).
61 *
62 * Note that `value` may be zero.
63 */
64 event Transfer(address indexed from, address indexed to, uint256 value);
65
66 /**
67 * @dev Emitted when the allowance of a `spender` for an `owner` is set by
68 * a call to {approve}. `value` is the new allowance.
69 */
70 event Approval(address indexed owner, address indexed spender, uint256 value);
71}
72
73
74
75/**
76 * @dev Wrappers over Solidity's arithmetic operations with added overflow
77 * checks.
78 *
79 * Arithmetic operations in Solidity wrap on overflow. This can easily result
80 * in bugs, because programmers usually assume that an overflow raises an
81 * error, which is the standard behavior in high level programming languages.
82 * `SafeMath` restores this intuition by reverting the transaction when an
83 * operation overflows.
84 *
85 * Using this library instead of the unchecked operations eliminates an entire
86 * class of bugs, so it's recommended to use it always.
87 */
88
89library SafeMath {
90 /**
91 * @dev Returns the addition of two unsigned integers, reverting on
92 * overflow.
93 *
94 * Counterpart to Solidity's `+` operator.
95 *
96 * Requirements:
97 *
98 * - Addition cannot overflow.
99 */
100 function add(uint256 a, uint256 b) internal pure returns (uint256) {
101 uint256 c = a + b;
102 require(c >= a, "SafeMath: addition overflow");
103
104 return c;
105 }
106
107 /**
108 * @dev Returns the subtraction of two unsigned integers, reverting on
109 * overflow (when the result is negative).
110 *
111 * Counterpart to Solidity's `-` operator.
112 *
113 * Requirements:
114 *
115 * - Subtraction cannot overflow.
116 */
117 function sub(uint256 a, uint256 b) internal pure returns (uint256) {
118 return sub(a, b, "SafeMath: subtraction overflow");
119 }
120
121 /**
122 * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
123 * overflow (when the result is negative).
124 *
125 * Counterpart to Solidity's `-` operator.
126 *
127 * Requirements:
128 *
129 * - Subtraction cannot overflow.
130 */
131 function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
132 require(b <= a, errorMessage);
133 uint256 c = a - b;
134
135 return c;
136 }
137
138 /**
139 * @dev Returns the multiplication of two unsigned integers, reverting on
140 * overflow.
141 *
142 * Counterpart to Solidity's `*` operator.
143 *
144 * Requirements:
145 *
146 * - Multiplication cannot overflow.
147 */
148 function mul(uint256 a, uint256 b) internal pure returns (uint256) {
149 // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
150 // benefit is lost if 'b' is also tested.
151 // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
152 if (a == 0) {
153 return 0;
154 }
155
156 uint256 c = a * b;
157 require(c / a == b, "SafeMath: multiplication overflow");
158
159 return c;
160 }
161
162 /**
163 * @dev Returns the integer division of two unsigned integers. Reverts on
164 * division by zero. The result is rounded towards zero.
165 *
166 * Counterpart to Solidity's `/` operator. Note: this function uses a
167 * `revert` opcode (which leaves remaining gas untouched) while Solidity
168 * uses an invalid opcode to revert (consuming all remaining gas).
169 *
170 * Requirements:
171 *
172 * - The divisor cannot be zero.
173 */
174 function div(uint256 a, uint256 b) internal pure returns (uint256) {
175 return div(a, b, "SafeMath: division by zero");
176 }
177
178 /**
179 * @dev Returns the integer division of two unsigned integers. Reverts with custom message on
180 * division by zero. The result is rounded towards zero.
181 *
182 * Counterpart to Solidity's `/` operator. Note: this function uses a
183 * `revert` opcode (which leaves remaining gas untouched) while Solidity
184 * uses an invalid opcode to revert (consuming all remaining gas).
185 *
186 * Requirements:
187 *
188 * - The divisor cannot be zero.
189 */
190 function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
191 require(b > 0, errorMessage);
192 uint256 c = a / b;
193 // assert(a == b * c + a % b); // There is no case in which this doesn't hold
194
195 return c;
196 }
197
198 /**
199 * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
200 * Reverts when dividing by zero.
201 *
202 * Counterpart to Solidity's `%` operator. This function uses a `revert`
203 * opcode (which leaves remaining gas untouched) while Solidity uses an
204 * invalid opcode to revert (consuming all remaining gas).
205 *
206 * Requirements:
207 *
208 * - The divisor cannot be zero.
209 */
210 function mod(uint256 a, uint256 b) internal pure returns (uint256) {
211 return mod(a, b, "SafeMath: modulo by zero");
212 }
213
214 /**
215 * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
216 * Reverts with custom message when dividing by zero.
217 *
218 * Counterpart to Solidity's `%` operator. This function uses a `revert`
219 * opcode (which leaves remaining gas untouched) while Solidity uses an
220 * invalid opcode to revert (consuming all remaining gas).
221 *
222 * Requirements:
223 *
224 * - The divisor cannot be zero.
225 */
226 function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
227 require(b != 0, errorMessage);
228 return a % b;
229 }
230}
231
232abstract contract Context {
233 function _msgSender() internal view virtual returns (address payable) {
234 return msg.sender;
235 }
236
237 function _msgData() internal view virtual returns (bytes memory) {
238 this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
239 return msg.data;
240 }
241}
242
243
244/**
245 * @dev Collection of functions related to the address type
246 */
247library Address {
248 /**
249 * @dev Returns true if `account` is a contract.
250 *
251 * [IMPORTANT]
252 * ====
253 * It is unsafe to assume that an address for which this function returns
254 * false is an externally-owned account (EOA) and not a contract.
255 *
256 * Among others, `isContract` will return false for the following
257 * types of addresses:
258 *
259 * - an externally-owned account
260 * - a contract in construction
261 * - an address where a contract will be created
262 * - an address where a contract lived, but was destroyed
263 * ====
264 */
265 function isContract(address account) internal view returns (bool) {
266 // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
267 // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
268 // for accounts without code, i.e. `keccak256('')`
269 bytes32 codehash;
270 bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
271 // solhint-disable-next-line no-inline-assembly
272 assembly { codehash := extcodehash(account) }
273 return (codehash != accountHash && codehash != 0x0);
274 }
275
276 /**
277 * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
278 * `recipient`, forwarding all available gas and reverting on errors.
279 *
280 * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
281 * of certain opcodes, possibly making contracts go over the 2300 gas limit
282 * imposed by `transfer`, making them unable to receive funds via
283 * `transfer`. {sendValue} removes this limitation.
284 *
285 * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
286 *
287 * IMPORTANT: because control is transferred to `recipient`, care must be
288 * taken to not create reentrancy vulnerabilities. Consider using
289 * {ReentrancyGuard} or the
290 * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
291 */
292 function sendValue(address payable recipient, uint256 amount) internal {
293 require(address(this).balance >= amount, "Address: insufficient balance");
294
295 // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
296 (bool success, ) = recipient.call{ value: amount }("");
297 require(success, "Address: unable to send value, recipient may have reverted");
298 }
299
300 /**
301 * @dev Performs a Solidity function call using a low level `call`. A
302 * plain`call` is an unsafe replacement for a function call: use this
303 * function instead.
304 *
305 * If `target` reverts with a revert reason, it is bubbled up by this
306 * function (like regular Solidity function calls).
307 *
308 * Returns the raw returned data. To convert to the expected return value,
309 * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
310 *
311 * Requirements:
312 *
313 * - `target` must be a contract.
314 * - calling `target` with `data` must not revert.
315 *
316 * _Available since v3.1._
317 */
318 function functionCall(address target, bytes memory data) internal returns (bytes memory) {
319 return functionCall(target, data, "Address: low-level call failed");
320 }
321
322 /**
323 * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
324 * `errorMessage` as a fallback revert reason when `target` reverts.
325 *
326 * _Available since v3.1._
327 */
328 function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
329 return _functionCallWithValue(target, data, 0, errorMessage);
330 }
331
332 /**
333 * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
334 * but also transferring `value` wei to `target`.
335 *
336 * Requirements:
337 *
338 * - the calling contract must have an ETH balance of at least `value`.
339 * - the called Solidity function must be `payable`.
340 *
341 * _Available since v3.1._
342 */
343 function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
344 return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
345 }
346
347 /**
348 * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
349 * with `errorMessage` as a fallback revert reason when `target` reverts.
350 *
351 * _Available since v3.1._
352 */
353 function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
354 require(address(this).balance >= value, "Address: insufficient balance for call");
355 return _functionCallWithValue(target, data, value, errorMessage);
356 }
357
358 function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
359 require(isContract(target), "Address: call to non-contract");
360
361 // solhint-disable-next-line avoid-low-level-calls
362 (bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
363 if (success) {
364 return returndata;
365 } else {
366 // Look for revert reason and bubble it up if present
367 if (returndata.length > 0) {
368 // The easiest way to bubble the revert reason is using memory via assembly
369
370 // solhint-disable-next-line no-inline-assembly
371 assembly {
372 let returndata_size := mload(returndata)
373 revert(add(32, returndata), returndata_size)
374 }
375 } else {
376 revert(errorMessage);
377 }
378 }
379 }
380}
381
382/**
383 * @dev Contract module which provides a basic access control mechanism, where
384 * there is an account (an owner) that can be granted exclusive access to
385 * specific functions.
386 *
387 * By default, the owner account will be the one that deploys the contract. This
388 * can later be changed with {transferOwnership}.
389 *
390 * This module is used through inheritance. It will make available the modifier
391 * `onlyOwner`, which can be applied to your functions to restrict their use to
392 * the owner.
393 */
394contract Ownable is Context {
395 address public _owner;
396 address private _previousOwner;
397 uint256 private _lockTime;
398
399 event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
400
401
402 /**
403 * @dev Returns the address of the current owner.
404 */
405 function owner() public view returns (address) {
406 return _owner;
407 }
408
409 /**
410 * @dev Throws if called by any account other than the owner.
411 */
412 modifier onlyOwner() {
413 require(_owner == _msgSender(), "Ownable: caller is not the owner");
414 _;
415 }
416
417 /**
418 * @dev Leaves the contract without owner. It will not be possible to call
419 * `onlyOwner` functions anymore. Can only be called by the current owner.
420 *
421 * NOTE: Renouncing ownership will leave the contract without an owner,
422 * thereby removing any functionality that is only available to the owner.
423 */
424 function renounceOwnership() public virtual onlyOwner {
425 emit OwnershipTransferred(_owner, address(0));
426 _owner = address(0);
427 }
428
429 /**
430 * @dev Transfers ownership of the contract to a new account (`newOwner`).
431 * Can only be called by the current owner.
432 */
433 function transferOwnership(address newOwner) public virtual onlyOwner {
434 require(newOwner != address(0), "Ownable: new owner is the zero address");
435 emit OwnershipTransferred(_owner, newOwner);
436 _owner = newOwner;
437 }
438
439 function geUnlockTime() public view returns (uint256) {
440 return _lockTime;
441 }
442
443 //Locks the contract for owner for the amount of time provided
444 function lock(uint256 time) public virtual onlyOwner {
445 _previousOwner = _owner;
446 _owner = address(0);
447 _lockTime = now + time;
448 emit OwnershipTransferred(_owner, address(0));
449 }
450
451 //Unlocks the contract for owner when _lockTime is exceeds
452 function unlock() public virtual {
453 require(_previousOwner == msg.sender, "You don't have permission to unlock");
454 require(now > _lockTime , "Contract is locked until 7 days");
455 emit OwnershipTransferred(_owner, _previousOwner);
456 _owner = _previousOwner;
457 }
458}
459
460// pragma solidity >=0.5.0;
461
462interface IUniswapV2Factory {
463 event PairCreated(address indexed token0, address indexed token1, address pair, uint);
464
465 function feeTo() external view returns (address);
466 function feeToSetter() external view returns (address);
467
468 function getPair(address tokenA, address tokenB) external view returns (address pair);
469 function allPairs(uint) external view returns (address pair);
470 function allPairsLength() external view returns (uint);
471
472 function createPair(address tokenA, address tokenB) external returns (address pair);
473
474 function setFeeTo(address) external;
475 function setFeeToSetter(address) external;
476}
477
478
479// pragma solidity >=0.5.0;
480
481interface IUniswapV2Pair {
482 event Approval(address indexed owner, address indexed spender, uint value);
483 event Transfer(address indexed from, address indexed to, uint value);
484
485 function name() external pure returns (string memory);
486 function symbol() external pure returns (string memory);
487 function decimals() external pure returns (uint8);
488 function totalSupply() external view returns (uint);
489 function balanceOf(address owner) external view returns (uint);
490 function allowance(address owner, address spender) external view returns (uint);
491
492 function approve(address spender, uint value) external returns (bool);
493 function transfer(address to, uint value) external returns (bool);
494 function transferFrom(address from, address to, uint value) external returns (bool);
495
496 function DOMAIN_SEPARATOR() external view returns (bytes32);
497 function PERMIT_TYPEHASH() external pure returns (bytes32);
498 function nonces(address owner) external view returns (uint);
499
500 function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
501
502 event Mint(address indexed sender, uint amount0, uint amount1);
503 event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
504 event Swap(
505 address indexed sender,
506 uint amount0In,
507 uint amount1In,
508 uint amount0Out,
509 uint amount1Out,
510 address indexed to
511 );
512 event Sync(uint112 reserve0, uint112 reserve1);
513
514 function MINIMUM_LIQUIDITY() external pure returns (uint);
515 function factory() external view returns (address);
516 function token0() external view returns (address);
517 function token1() external view returns (address);
518 function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
519 function price0CumulativeLast() external view returns (uint);
520 function price1CumulativeLast() external view returns (uint);
521 function kLast() external view returns (uint);
522
523 function mint(address to) external returns (uint liquidity);
524 function burn(address to) external returns (uint amount0, uint amount1);
525 function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
526 function skim(address to) external;
527 function sync() external;
528
529 function initialize(address, address) external;
530}
531
532// pragma solidity >=0.6.2;
533
534interface IUniswapV2Router01 {
535 function factory() external pure returns (address);
536 function WETH() external pure returns (address);
537
538 function addLiquidity(
539 address tokenA,
540 address tokenB,
541 uint amountADesired,
542 uint amountBDesired,
543 uint amountAMin,
544 uint amountBMin,
545 address to,
546 uint deadline
547 ) external returns (uint amountA, uint amountB, uint liquidity);
548 function addLiquidityETH(
549 address token,
550 uint amountTokenDesired,
551 uint amountTokenMin,
552 uint amountETHMin,
553 address to,
554 uint deadline
555 ) external payable returns (uint amountToken, uint amountETH, uint liquidity);
556 function removeLiquidity(
557 address tokenA,
558 address tokenB,
559 uint liquidity,
560 uint amountAMin,
561 uint amountBMin,
562 address to,
563 uint deadline
564 ) external returns (uint amountA, uint amountB);
565 function removeLiquidityETH(
566 address token,
567 uint liquidity,
568 uint amountTokenMin,
569 uint amountETHMin,
570 address to,
571 uint deadline
572 ) external returns (uint amountToken, uint amountETH);
573 function removeLiquidityWithPermit(
574 address tokenA,
575 address tokenB,
576 uint liquidity,
577 uint amountAMin,
578 uint amountBMin,
579 address to,
580 uint deadline,
581 bool approveMax, uint8 v, bytes32 r, bytes32 s
582 ) external returns (uint amountA, uint amountB);
583 function removeLiquidityETHWithPermit(
584 address token,
585 uint liquidity,
586 uint amountTokenMin,
587 uint amountETHMin,
588 address to,
589 uint deadline,
590 bool approveMax, uint8 v, bytes32 r, bytes32 s
591 ) external returns (uint amountToken, uint amountETH);
592 function swapExactTokensForTokens(
593 uint amountIn,
594 uint amountOutMin,
595 address[] calldata path,
596 address to,
597 uint deadline
598 ) external returns (uint[] memory amounts);
599 function swapTokensForExactTokens(
600 uint amountOut,
601 uint amountInMax,
602 address[] calldata path,
603 address to,
604 uint deadline
605 ) external returns (uint[] memory amounts);
606 function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
607 external
608 payable
609 returns (uint[] memory amounts);
610 function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
611 external
612 returns (uint[] memory amounts);
613 function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
614 external
615 returns (uint[] memory amounts);
616 function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
617 external
618 payable
619 returns (uint[] memory amounts);
620
621 function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
622 function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
623 function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
624 function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
625 function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
626}
627
628
629
630// pragma solidity >=0.6.2;
631
632interface IUniswapV2Router02 is IUniswapV2Router01 {
633 function removeLiquidityETHSupportingFeeOnTransferTokens(
634 address token,
635 uint liquidity,
636 uint amountTokenMin,
637 uint amountETHMin,
638 address to,
639 uint deadline
640 ) external returns (uint amountETH);
641 function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
642 address token,
643 uint liquidity,
644 uint amountTokenMin,
645 uint amountETHMin,
646 address to,
647 uint deadline,
648 bool approveMax, uint8 v, bytes32 r, bytes32 s
649 ) external returns (uint amountETH);
650
651 function swapExactTokensForTokensSupportingFeeOnTransferTokens(
652 uint amountIn,
653 uint amountOutMin,
654 address[] calldata path,
655 address to,
656 uint deadline
657 ) external;
658 function swapExactETHForTokensSupportingFeeOnTransferTokens(
659 uint amountOutMin,
660 address[] calldata path,
661 address to,
662 uint deadline
663 ) external payable;
664 function swapExactTokensForETHSupportingFeeOnTransferTokens(
665 uint amountIn,
666 uint amountOutMin,
667 address[] calldata path,
668 address to,
669 uint deadline
670 ) external;
671}
672
673
674contract CoinToken is Context, IERC20, Ownable {
675 using SafeMath for uint256;
676 using Address for address;
677
678 mapping (address => uint256) private _rOwned;
679 mapping (address => uint256) private _tOwned;
680 mapping (address => mapping (address => uint256)) private _allowances;
681
682 mapping (address => bool) private _isExcludedFromFee;
683
684 mapping (address => bool) private _isExcluded;
685 address[] private _excluded;
686
687 uint256 private constant MAX = ~uint256(0);
688 uint256 private _tTotal;
689 uint256 private _rTotal;
690 uint256 private _tFeeTotal;
691
692 string private _name;
693 string private _symbol;
694 uint256 private _decimals;
695
696 uint256 public _taxFee;
697 uint256 private _previousTaxFee;
698
699 uint256 public _liquidityFee;
700 uint256 private _previousLiquidityFee;
701
702 IUniswapV2Router02 public immutable uniswapV2Router;
703 address public immutable uniswapV2Pair;
704
705 bool inSwapAndLiquify;
706 bool public swapAndLiquifyEnabled = true;
707
708 uint256 public _maxTxAmount;
709 uint256 public numTokensSellToAddToLiquidity;
710
711 event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap);
712 event SwapAndLiquifyEnabledUpdated(bool enabled);
713 event SwapAndLiquify(
714 uint256 tokensSwapped,
715 uint256 ethReceived,
716 uint256 tokensIntoLiqudity
717 );
718
719 modifier lockTheSwap {
720 inSwapAndLiquify = true;
721 _;
722 inSwapAndLiquify = false;
723 }
724
725 constructor (string memory _NAME, string memory _SYMBOL, uint256 _DECIMALS, uint256 _supply, uint256 _txFee,uint256 _lpFee,uint256 _MAXAMOUNT,uint256 SELLMAXAMOUNT,address routerAddress,address tokenOwner) public {
726 _name = _NAME;
727 _symbol = _SYMBOL;
728 _decimals = _DECIMALS;
729 _tTotal = _supply * 10 ** _decimals;
730 _rTotal = (MAX - (MAX % _tTotal));
731 _taxFee = _txFee;
732 _liquidityFee = _lpFee;
733 _previousTaxFee = _txFee;
734 _previousLiquidityFee = _lpFee;
735 _maxTxAmount = _MAXAMOUNT * 10 ** _decimals;
736 numTokensSellToAddToLiquidity = SELLMAXAMOUNT * 10 ** _decimals;
737
738
739 _rOwned[tokenOwner] = _rTotal;
740
741 IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(routerAddress);
742 // Create a uniswap pair for this new token
743 uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
744 .createPair(address(this), _uniswapV2Router.WETH());
745
746 // set the rest of the contract variables
747 uniswapV2Router = _uniswapV2Router;
748
749 //exclude owner and this contract from fee
750 _isExcludedFromFee[tokenOwner] = true;
751 _isExcludedFromFee[address(this)] = true;
752
753 _owner = tokenOwner;
754 emit Transfer(address(0), tokenOwner, _tTotal);
755 }
756
757
758 function name() public view returns (string memory) {
759 return _name;
760 }
761
762 function symbol() public view returns (string memory) {
763 return _symbol;
764 }
765
766 function decimals() public view returns (uint256) {
767 return _decimals;
768 }
769
770 function totalSupply() public view override returns (uint256) {
771 return _tTotal;
772 }
773
774 function balanceOf(address account) public view override returns (uint256) {
775 if (_isExcluded[account]) return _tOwned[account];
776 return tokenFromReflection(_rOwned[account]);
777 }
778
779 function transfer(address recipient, uint256 amount) public override returns (bool) {
780 _transfer(_msgSender(), recipient, amount);
781 return true;
782 }
783
784 function allowance(address owner, address spender) public view override returns (uint256) {
785 return _allowances[owner][spender];
786 }
787
788 function approve(address spender, uint256 amount) public override returns (bool) {
789 _approve(_msgSender(), spender, amount);
790 return true;
791 }
792
793 function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
794 _transfer(sender, recipient, amount);
795 _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
796 return true;
797 }
798
799 function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
800 _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
801 return true;
802 }
803
804 function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
805 _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
806 return true;
807 }
808
809 function isExcludedFromReward(address account) public view returns (bool) {
810 return _isExcluded[account];
811 }
812
813 function totalFees() public view returns (uint256) {
814 return _tFeeTotal;
815 }
816
817 function deliver(uint256 tAmount) public {
818 address sender = _msgSender();
819 require(!_isExcluded[sender], "Excluded addresses cannot call this function");
820 (uint256 rAmount,,,,,) = _getValues(tAmount);
821 _rOwned[sender] = _rOwned[sender].sub(rAmount);
822 _rTotal = _rTotal.sub(rAmount);
823 _tFeeTotal = _tFeeTotal.add(tAmount);
824 }
825
826 function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) {
827 require(tAmount <= _tTotal, "Amount must be less than supply");
828 if (!deductTransferFee) {
829 (uint256 rAmount,,,,,) = _getValues(tAmount);
830 return rAmount;
831 } else {
832 (,uint256 rTransferAmount,,,,) = _getValues(tAmount);
833 return rTransferAmount;
834 }
835 }
836
837 function tokenFromReflection(uint256 rAmount) public view returns(uint256) {
838 require(rAmount <= _rTotal, "Amount must be less than total reflections");
839 uint256 currentRate = _getRate();
840 return rAmount.div(currentRate);
841 }
842
843 function excludeFromReward(address account) public onlyOwner() {
844 // require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not exclude Uniswap router.');
845 require(!_isExcluded[account], "Account is already excluded");
846 if(_rOwned[account] > 0) {
847 _tOwned[account] = tokenFromReflection(_rOwned[account]);
848 }
849 _isExcluded[account] = true;
850 _excluded.push(account);
851 }
852
853 function includeInReward(address account) external onlyOwner() {
854 require(_isExcluded[account], "Account is already excluded");
855 for (uint256 i = 0; i < _excluded.length; i++) {
856 if (_excluded[i] == account) {
857 _excluded[i] = _excluded[_excluded.length - 1];
858 _tOwned[account] = 0;
859 _isExcluded[account] = false;
860 _excluded.pop();
861 break;
862 }
863 }
864 }
865 function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
866 (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount);
867 _tOwned[sender] = _tOwned[sender].sub(tAmount);
868 _rOwned[sender] = _rOwned[sender].sub(rAmount);
869 _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
870 _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
871 _takeLiquidity(tLiquidity);
872 _reflectFee(rFee, tFee);
873 emit Transfer(sender, recipient, tTransferAmount);
874 }
875
876 function excludeFromFee(address account) public onlyOwner {
877 _isExcludedFromFee[account] = true;
878 }
879
880 function includeInFee(address account) public onlyOwner {
881 _isExcludedFromFee[account] = false;
882 }
883
884 function setTaxFeePercent(uint256 taxFee) external onlyOwner() {
885 _taxFee = taxFee;
886 }
887
888 function setLiquidityFeePercent(uint256 liquidityFee) external onlyOwner() {
889 _liquidityFee = liquidityFee;
890 }
891
892 function setNumTokensSellToAddToLiquidity(uint256 swapNumber) public onlyOwner {
893 numTokensSellToAddToLiquidity = swapNumber * 10 ** _decimals;
894 }
895
896 function setMaxTxPercent(uint256 maxTxPercent) public onlyOwner {
897 _maxTxAmount = maxTxPercent * 10 ** _decimals;
898 }
899
900 function setSwapAndLiquifyEnabled(bool _enabled) public onlyOwner {
901 swapAndLiquifyEnabled = _enabled;
902 emit SwapAndLiquifyEnabledUpdated(_enabled);
903 }
904
905 //to recieve ETH from uniswapV2Router when swaping
906 receive() external payable {}
907
908 function _reflectFee(uint256 rFee, uint256 tFee) private {
909 _rTotal = _rTotal.sub(rFee);
910 _tFeeTotal = _tFeeTotal.add(tFee);
911 }
912
913 function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
914 (uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getTValues(tAmount);
915 (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tLiquidity, _getRate());
916 return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tLiquidity);
917 }
918
919 function _getTValues(uint256 tAmount) private view returns (uint256, uint256, uint256) {
920 uint256 tFee = calculateTaxFee(tAmount);
921 uint256 tLiquidity = calculateLiquidityFee(tAmount);
922 uint256 tTransferAmount = tAmount.sub(tFee).sub(tLiquidity);
923 return (tTransferAmount, tFee, tLiquidity);
924 }
925
926 function _getRValues(uint256 tAmount, uint256 tFee, uint256 tLiquidity, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
927 uint256 rAmount = tAmount.mul(currentRate);
928 uint256 rFee = tFee.mul(currentRate);
929 uint256 rLiquidity = tLiquidity.mul(currentRate);
930 uint256 rTransferAmount = rAmount.sub(rFee).sub(rLiquidity);
931 return (rAmount, rTransferAmount, rFee);
932 }
933
934 function _getRate() private view returns(uint256) {
935 (uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
936 return rSupply.div(tSupply);
937 }
938
939 function _getCurrentSupply() private view returns(uint256, uint256) {
940 uint256 rSupply = _rTotal;
941 uint256 tSupply = _tTotal;
942 for (uint256 i = 0; i < _excluded.length; i++) {
943 if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
944 rSupply = rSupply.sub(_rOwned[_excluded[i]]);
945 tSupply = tSupply.sub(_tOwned[_excluded[i]]);
946 }
947 if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
948 return (rSupply, tSupply);
949 }
950
951 function _takeLiquidity(uint256 tLiquidity) private {
952 uint256 currentRate = _getRate();
953 uint256 rLiquidity = tLiquidity.mul(currentRate);
954 _rOwned[address(this)] = _rOwned[address(this)].add(rLiquidity);
955 if(_isExcluded[address(this)])
956 _tOwned[address(this)] = _tOwned[address(this)].add(tLiquidity);
957 }
958
959
960 function claimTokens() public onlyOwner {
961 payable(_owner).transfer(address(this).balance);
962 }
963
964 function calculateTaxFee(uint256 _amount) private view returns (uint256) {
965 return _amount.mul(_taxFee).div(
966 10**2
967 );
968 }
969
970 function calculateLiquidityFee(uint256 _amount) private view returns (uint256) {
971 return _amount.mul(_liquidityFee).div(
972 10**2
973 );
974 }
975
976 function removeAllFee() private {
977 if(_taxFee == 0 && _liquidityFee == 0) return;
978
979 _previousTaxFee = _taxFee;
980 _previousLiquidityFee = _liquidityFee;
981
982 _taxFee = 0;
983 _liquidityFee = 0;
984 }
985
986 function restoreAllFee() private {
987 _taxFee = _previousTaxFee;
988 _liquidityFee = _previousLiquidityFee;
989 }
990
991 function isExcludedFromFee(address account) public view returns(bool) {
992 return _isExcludedFromFee[account];
993 }
994
995 function _approve(address owner, address spender, uint256 amount) private {
996 require(owner != address(0), "ERC20: approve from the zero address");
997 require(spender != address(0), "ERC20: approve to the zero address");
998
999 _allowances[owner][spender] = amount;
1000 emit Approval(owner, spender, amount);
1001 }
1002
1003 function _transfer(
1004 address from,
1005 address to,
1006 uint256 amount
1007 ) private {
1008 require(from != address(0), "ERC20: transfer from the zero address");
1009 require(to != address(0), "ERC20: transfer to the zero address");
1010 require(amount > 0, "Transfer amount must be greater than zero");
1011 if(from != owner() && to != owner())
1012 require(amount <= _maxTxAmount, "Transfer amount exceeds the maxTxAmount.");
1013
1014 // is the token balance of this contract address over the min number of
1015 // tokens that we need to initiate a swap + liquidity lock?
1016 // also, don't get caught in a circular liquidity event.
1017 // also, don't swap & liquify if sender is uniswap pair.
1018 uint256 contractTokenBalance = balanceOf(address(this));
1019
1020 if(contractTokenBalance >= _maxTxAmount)
1021 {
1022 contractTokenBalance = _maxTxAmount;
1023 }
1024
1025 bool overMinTokenBalance = contractTokenBalance >= numTokensSellToAddToLiquidity;
1026 if (
1027 overMinTokenBalance &&
1028 !inSwapAndLiquify &&
1029 from != uniswapV2Pair &&
1030 swapAndLiquifyEnabled
1031 ) {
1032 contractTokenBalance = numTokensSellToAddToLiquidity;
1033 //add liquidity
1034 swapAndLiquify(contractTokenBalance);
1035 }
1036
1037 //indicates if fee should be deducted from transfer
1038 bool takeFee = true;
1039
1040 //if any account belongs to _isExcludedFromFee account then remove the fee
1041 if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
1042 takeFee = false;
1043 }
1044
1045 //transfer amount, it will take tax, burn, liquidity fee
1046 _tokenTransfer(from,to,amount,takeFee);
1047 }
1048
1049 function swapAndLiquify(uint256 contractTokenBalance) private lockTheSwap {
1050 // split the contract balance into halves
1051 uint256 half = contractTokenBalance.div(2);
1052 uint256 otherHalf = contractTokenBalance.sub(half);
1053
1054 // capture the contract's current ETH balance.
1055 // this is so that we can capture exactly the amount of ETH that the
1056 // swap creates, and not make the liquidity event include any ETH that
1057 // has been manually sent to the contract
1058 uint256 initialBalance = address(this).balance;
1059
1060 // swap tokens for ETH
1061 swapTokensForEth(half); // <- this breaks the ETH -> HATE swap when swap+liquify is triggered
1062
1063 // how much ETH did we just swap into?
1064 uint256 newBalance = address(this).balance.sub(initialBalance);
1065
1066 // add liquidity to uniswap
1067 addLiquidity(otherHalf, newBalance);
1068
1069 emit SwapAndLiquify(half, newBalance, otherHalf);
1070 }
1071
1072 function swapTokensForEth(uint256 tokenAmount) private {
1073 // generate the uniswap pair path of token -> weth
1074 address[] memory path = new address[](2);
1075 path[0] = address(this);
1076 path[1] = uniswapV2Router.WETH();
1077
1078 _approve(address(this), address(uniswapV2Router), tokenAmount);
1079
1080 // make the swap
1081 uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
1082 tokenAmount,
1083 0, // accept any amount of ETH
1084 path,
1085 address(this),
1086 block.timestamp
1087 );
1088 }
1089
1090 function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
1091 // approve token transfer to cover all possible scenarios
1092 _approve(address(this), address(uniswapV2Router), tokenAmount);
1093
1094 // add the liquidity
1095 uniswapV2Router.addLiquidityETH{value: ethAmount}(
1096 address(this),
1097 tokenAmount,
1098 0, // slippage is unavoidable
1099 0, // slippage is unavoidable
1100 owner(),
1101 block.timestamp
1102 );
1103 }
1104
1105 //this method is responsible for taking all fee, if takeFee is true
1106 function _tokenTransfer(address sender, address recipient, uint256 amount,bool takeFee) private {
1107 if(!takeFee)
1108 removeAllFee();
1109
1110 if (_isExcluded[sender] && !_isExcluded[recipient]) {
1111 _transferFromExcluded(sender, recipient, amount);
1112 } else if (!_isExcluded[sender] && _isExcluded[recipient]) {
1113 _transferToExcluded(sender, recipient, amount);
1114 } else if (!_isExcluded[sender] && !_isExcluded[recipient]) {
1115 _transferStandard(sender, recipient, amount);
1116 } else if (_isExcluded[sender] && _isExcluded[recipient]) {
1117 _transferBothExcluded(sender, recipient, amount);
1118 } else {
1119 _transferStandard(sender, recipient, amount);
1120 }
1121
1122 if(!takeFee)
1123 restoreAllFee();
1124 }
1125
1126 function _transferStandard(address sender, address recipient, uint256 tAmount) private {
1127 (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount);
1128 _rOwned[sender] = _rOwned[sender].sub(rAmount);
1129 _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
1130 _takeLiquidity(tLiquidity);
1131 _reflectFee(rFee, tFee);
1132 emit Transfer(sender, recipient, tTransferAmount);
1133 }
1134
1135 function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
1136 (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount);
1137 _rOwned[sender] = _rOwned[sender].sub(rAmount);
1138 _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
1139 _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
1140 _takeLiquidity(tLiquidity);
1141 _reflectFee(rFee, tFee);
1142 emit Transfer(sender, recipient, tTransferAmount);
1143 }
1144
1145 function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
1146 (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tLiquidity) = _getValues(tAmount);
1147 _tOwned[sender] = _tOwned[sender].sub(tAmount);
1148 _rOwned[sender] = _rOwned[sender].sub(rAmount);
1149 _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
1150 _takeLiquidity(tLiquidity);
1151 _reflectFee(rFee, tFee);
1152 emit Transfer(sender, recipient, tTransferAmount);
1153 }
1154
1155
1156
1157
1158}
1159// End of CoinToken.sol
1160