NIL FAQ
Search…
Contract v2
This is the new Contract created on 12/28/2021 to replace the first contract due to a vital flaw in the contracts function to limit buys/sells.
PLEASE SEE THE CONTRACT BELOW. IT HAS THE ABILITY TO SET LIMITS ON TRANSACTIONS AND ALSO CAN TIME LOCK WALLETS BASED ON CERTAIN CONDITIONS. BEFORE YOU BUY NIL YOU SHOULD BE FULLY AWARE OF THE FUNCTIONS IN THIS CONTRACT.

The new contract address is 0x0Eb638648207D00b9025684d13B1cB53806deBe4

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