├── README.md └── SafeWolf.sol /README.md: -------------------------------------------------------------------------------- 1 | SAFEWOLF.IO 2 | 3 | SAFEWOLF © is a community driven project built on Binance Smart Chain #BSC. Two functions occur during each trade: 4 | Reflection & Burn. SAFEWOLF brings the most revolutionary mechanism to BSC ecosystem. 5 | 6 | 7 | 📉 DUMP PREVENTION MECHANISM: 8 | - Daily burn: 4% of total token will be burned daily in the first 7 days 9 | - Dev-token will be locked for 365 days 10 | 11 | ✅ Audit by Experts 12 | 13 | 14 | 💠TOKENOMICS 15 | - Token name: SafeWolf 16 | - Token symbol: $SW 17 | - Token Contract: https://bscscan.com/token/0xc845341377c68b8003485036c3163b8dbcf8acb2 18 | - Total Supply: 100,000,000,000,000,000 $SW tokens 19 | - For every transaction:🔥Burn 4% tokens & 📊Redistribute 4% to all holders. 20 | 21 | 🌕 TOKEN DISTRIBUTION 22 | - Presale: 60,000,000,000,000,000 23 | - Pre-sale bonus: 20,000,000,000,000,000 24 | - Liquidity pool: 10,000,000,000,000,000 25 | - Foundation: 4,000,000,000,000,000 26 | - Burn Daily: 4,000,000,000,000,000 27 | - Bounty and airdrop: 1,000,000,000,000,000 28 | - Telegram shilling contest: 500,000,000,000,000 29 | - Reddit shilling contest: 250,000,000,000,000 30 | - Twitter shilling contest: 250,000,000,000,000 31 | 32 | ⚡ SOCIAL NETWORK 33 | - Website: https://safewolf.io 34 | - Telegram Official Group: https://t.me/Safewolfgroup 35 | - Telegram Announcement: https://t.me/safewolfannouncement 36 | - Twitter: https://twitter.com/Safewolfdefi 37 | - Reddit: https://www.reddit.com/user/SafeWolfOfficial 38 | - Github: https://github.com/safewolfio 39 | - Gitbook Document: https://safewolfofficial.gitbook.io/safewolf -------------------------------------------------------------------------------- /SafeWolf.sol: -------------------------------------------------------------------------------- 1 | /** 2 | 3 | #SafeWolf 4 | 5 | #SafeWolf Tokenomics: 6 | 4% fee auto burn forever. 7 | 4% fee auto distribute to all holders. 8 | 9 | */ 10 | 11 | pragma solidity ^0.6.12; 12 | // SPDX-License-Identifier: Unlicensed 13 | abstract contract Context { 14 | function _msgSender() internal view virtual returns (address payable) { 15 | return msg.sender; 16 | } 17 | 18 | function _msgData() internal view virtual returns (bytes memory) { 19 | this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 20 | return msg.data; 21 | } 22 | } 23 | 24 | /** 25 | * @dev Interface of the ERC20 standard as defined in the EIP. 26 | */ 27 | interface IERC20 { 28 | /** 29 | * @dev Returns the amount of tokens in existence. 30 | */ 31 | function totalSupply() external view returns (uint256); 32 | 33 | /** 34 | * @dev Returns the amount of tokens owned by `account`. 35 | */ 36 | function balanceOf(address account) external view returns (uint256); 37 | 38 | /** 39 | * @dev Moves `amount` tokens from the caller's account to `recipient`. 40 | * 41 | * Returns a boolean value indicating whether the operation succeeded. 42 | * 43 | * Emits a {Transfer} event. 44 | */ 45 | function transfer(address recipient, uint256 amount) external returns (bool); 46 | 47 | /** 48 | * @dev Returns the remaining number of tokens that `spender` will be 49 | * allowed to spend on behalf of `owner` through {transferFrom}. This is 50 | * zero by default. 51 | * 52 | * This value changes when {approve} or {transferFrom} are called. 53 | */ 54 | function allowance(address owner, address spender) external view returns (uint256); 55 | 56 | /** 57 | * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. 58 | * 59 | * Returns a boolean value indicating whether the operation succeeded. 60 | * 61 | * IMPORTANT: Beware that changing an allowance with this method brings the risk 62 | * that someone may use both the old and the new allowance by unfortunate 63 | * transaction ordering. One possible solution to mitigate this race 64 | * condition is to first reduce the spender's allowance to 0 and set the 65 | * desired value afterwards: 66 | * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 67 | * 68 | * Emits an {Approval} event. 69 | */ 70 | function approve(address spender, uint256 amount) external returns (bool); 71 | 72 | /** 73 | * @dev Moves `amount` tokens from `sender` to `recipient` using the 74 | * allowance mechanism. `amount` is then deducted from the caller's 75 | * allowance. 76 | * 77 | * Returns a boolean value indicating whether the operation succeeded. 78 | * 79 | * Emits a {Transfer} event. 80 | */ 81 | function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); 82 | 83 | /** 84 | * @dev Emitted when `value` tokens are moved from one account (`from`) to 85 | * another (`to`). 86 | * 87 | * Note that `value` may be zero. 88 | */ 89 | event Transfer(address indexed from, address indexed to, uint256 value); 90 | 91 | /** 92 | * @dev Emitted when the allowance of a `spender` for an `owner` is set by 93 | * a call to {approve}. `value` is the new allowance. 94 | */ 95 | event Approval(address indexed owner, address indexed spender, uint256 value); 96 | } 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 | library SafeMath { 114 | /** 115 | * @dev Returns the addition of two unsigned integers, reverting on 116 | * overflow. 117 | * 118 | * Counterpart to Solidity's `+` operator. 119 | * 120 | * Requirements: 121 | * 122 | * - Addition cannot overflow. 123 | */ 124 | function add(uint256 a, uint256 b) internal pure returns (uint256) { 125 | uint256 c = a + b; 126 | require(c >= a, "SafeMath: addition overflow"); 127 | 128 | return c; 129 | } 130 | 131 | /** 132 | * @dev Returns the subtraction of two unsigned integers, reverting on 133 | * overflow (when the result is negative). 134 | * 135 | * Counterpart to Solidity's `-` operator. 136 | * 137 | * Requirements: 138 | * 139 | * - Subtraction cannot overflow. 140 | */ 141 | function sub(uint256 a, uint256 b) internal pure returns (uint256) { 142 | return sub(a, b, "SafeMath: subtraction overflow"); 143 | } 144 | 145 | /** 146 | * @dev Returns the subtraction of two unsigned integers, reverting with custom message on 147 | * overflow (when the result is negative). 148 | * 149 | * Counterpart to Solidity's `-` operator. 150 | * 151 | * Requirements: 152 | * 153 | * - Subtraction cannot overflow. 154 | */ 155 | function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { 156 | require(b <= a, errorMessage); 157 | uint256 c = a - b; 158 | 159 | return c; 160 | } 161 | 162 | /** 163 | * @dev Returns the multiplication of two unsigned integers, reverting on 164 | * overflow. 165 | * 166 | * Counterpart to Solidity's `*` operator. 167 | * 168 | * Requirements: 169 | * 170 | * - Multiplication cannot overflow. 171 | */ 172 | function mul(uint256 a, uint256 b) internal pure returns (uint256) { 173 | // Gas optimization: this is cheaper than requiring 'a' not being zero, but the 174 | // benefit is lost if 'b' is also tested. 175 | // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 176 | if (a == 0) { 177 | return 0; 178 | } 179 | 180 | uint256 c = a * b; 181 | require(c / a == b, "SafeMath: multiplication overflow"); 182 | 183 | return c; 184 | } 185 | 186 | /** 187 | * @dev Returns the integer division of two unsigned integers. Reverts on 188 | * division by zero. The result is rounded towards zero. 189 | * 190 | * Counterpart to Solidity's `/` operator. Note: this function uses a 191 | * `revert` opcode (which leaves remaining gas untouched) while Solidity 192 | * uses an invalid opcode to revert (consuming all remaining gas). 193 | * 194 | * Requirements: 195 | * 196 | * - The divisor cannot be zero. 197 | */ 198 | function div(uint256 a, uint256 b) internal pure returns (uint256) { 199 | return div(a, b, "SafeMath: division by zero"); 200 | } 201 | 202 | /** 203 | * @dev Returns the integer division of two unsigned integers. Reverts with custom message on 204 | * division by zero. The result is rounded towards zero. 205 | * 206 | * Counterpart to Solidity's `/` operator. Note: this function uses a 207 | * `revert` opcode (which leaves remaining gas untouched) while Solidity 208 | * uses an invalid opcode to revert (consuming all remaining gas). 209 | * 210 | * Requirements: 211 | * 212 | * - The divisor cannot be zero. 213 | */ 214 | function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { 215 | require(b > 0, errorMessage); 216 | uint256 c = a / b; 217 | // assert(a == b * c + a % b); // There is no case in which this doesn't hold 218 | 219 | return c; 220 | } 221 | 222 | /** 223 | * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), 224 | * Reverts when dividing by zero. 225 | * 226 | * Counterpart to Solidity's `%` operator. This function uses a `revert` 227 | * opcode (which leaves remaining gas untouched) while Solidity uses an 228 | * invalid opcode to revert (consuming all remaining gas). 229 | * 230 | * Requirements: 231 | * 232 | * - The divisor cannot be zero. 233 | */ 234 | function mod(uint256 a, uint256 b) internal pure returns (uint256) { 235 | return mod(a, b, "SafeMath: modulo by zero"); 236 | } 237 | 238 | /** 239 | * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), 240 | * Reverts with custom message when dividing by zero. 241 | * 242 | * Counterpart to Solidity's `%` operator. This function uses a `revert` 243 | * opcode (which leaves remaining gas untouched) while Solidity uses an 244 | * invalid opcode to revert (consuming all remaining gas). 245 | * 246 | * Requirements: 247 | * 248 | * - The divisor cannot be zero. 249 | */ 250 | function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { 251 | require(b != 0, errorMessage); 252 | return a % b; 253 | } 254 | } 255 | 256 | /** 257 | * @dev Collection of functions related to the address type 258 | */ 259 | library Address { 260 | /** 261 | * @dev Returns true if `account` is a contract. 262 | * 263 | * [IMPORTANT] 264 | * ==== 265 | * It is unsafe to assume that an address for which this function returns 266 | * false is an externally-owned account (EOA) and not a contract. 267 | * 268 | * Among others, `isContract` will return false for the following 269 | * types of addresses: 270 | * 271 | * - an externally-owned account 272 | * - a contract in construction 273 | * - an address where a contract will be created 274 | * - an address where a contract lived, but was destroyed 275 | * ==== 276 | */ 277 | function isContract(address account) internal view returns (bool) { 278 | // According to EIP-1052, 0x0 is the value returned for not-yet created accounts 279 | // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned 280 | // for accounts without code, i.e. `keccak256('')` 281 | bytes32 codehash; 282 | bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; 283 | // solhint-disable-next-line no-inline-assembly 284 | assembly { codehash := extcodehash(account) } 285 | return (codehash != accountHash && codehash != 0x0); 286 | } 287 | 288 | /** 289 | * @dev Replacement for Solidity's `transfer`: sends `amount` wei to 290 | * `recipient`, forwarding all available gas and reverting on errors. 291 | * 292 | * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost 293 | * of certain opcodes, possibly making contracts go over the 2300 gas limit 294 | * imposed by `transfer`, making them unable to receive funds via 295 | * `transfer`. {sendValue} removes this limitation. 296 | * 297 | * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. 298 | * 299 | * IMPORTANT: because control is transferred to `recipient`, care must be 300 | * taken to not create reentrancy vulnerabilities. Consider using 301 | * {ReentrancyGuard} or the 302 | * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. 303 | */ 304 | function sendValue(address payable recipient, uint256 amount) internal { 305 | require(address(this).balance >= amount, "Address: insufficient balance"); 306 | 307 | // solhint-disable-next-line avoid-low-level-calls, avoid-call-value 308 | (bool success, ) = recipient.call{ value: amount }(""); 309 | require(success, "Address: unable to send value, recipient may have reverted"); 310 | } 311 | 312 | /** 313 | * @dev Performs a Solidity function call using a low level `call`. A 314 | * plain`call` is an unsafe replacement for a function call: use this 315 | * function instead. 316 | * 317 | * If `target` reverts with a revert reason, it is bubbled up by this 318 | * function (like regular Solidity function calls). 319 | * 320 | * Returns the raw returned data. To convert to the expected return value, 321 | * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. 322 | * 323 | * Requirements: 324 | * 325 | * - `target` must be a contract. 326 | * - calling `target` with `data` must not revert. 327 | * 328 | * _Available since v3.1._ 329 | */ 330 | function functionCall(address target, bytes memory data) internal returns (bytes memory) { 331 | return functionCall(target, data, "Address: low-level call failed"); 332 | } 333 | 334 | /** 335 | * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with 336 | * `errorMessage` as a fallback revert reason when `target` reverts. 337 | * 338 | * _Available since v3.1._ 339 | */ 340 | function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { 341 | return _functionCallWithValue(target, data, 0, errorMessage); 342 | } 343 | 344 | /** 345 | * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], 346 | * but also transferring `value` wei to `target`. 347 | * 348 | * Requirements: 349 | * 350 | * - the calling contract must have an ETH balance of at least `value`. 351 | * - the called Solidity function must be `payable`. 352 | * 353 | * _Available since v3.1._ 354 | */ 355 | function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { 356 | return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); 357 | } 358 | 359 | /** 360 | * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but 361 | * with `errorMessage` as a fallback revert reason when `target` reverts. 362 | * 363 | * _Available since v3.1._ 364 | */ 365 | function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { 366 | require(address(this).balance >= value, "Address: insufficient balance for call"); 367 | return _functionCallWithValue(target, data, value, errorMessage); 368 | } 369 | 370 | function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) { 371 | require(isContract(target), "Address: call to non-contract"); 372 | 373 | // solhint-disable-next-line avoid-low-level-calls 374 | (bool success, bytes memory returndata) = target.call{ value: weiValue }(data); 375 | if (success) { 376 | return returndata; 377 | } else { 378 | // Look for revert reason and bubble it up if present 379 | if (returndata.length > 0) { 380 | // The easiest way to bubble the revert reason is using memory via assembly 381 | 382 | // solhint-disable-next-line no-inline-assembly 383 | assembly { 384 | let returndata_size := mload(returndata) 385 | revert(add(32, returndata), returndata_size) 386 | } 387 | } else { 388 | revert(errorMessage); 389 | } 390 | } 391 | } 392 | } 393 | 394 | /** 395 | * @dev Contract module which provides a basic access control mechanism, where 396 | * there is an account (an owner) that can be granted exclusive access to 397 | * specific functions. 398 | * 399 | * By default, the owner account will be the one that deploys the contract. This 400 | * can later be changed with {transferOwnership}. 401 | * 402 | * This module is used through inheritance. It will make available the modifier 403 | * `onlyOwner`, which can be applied to your functions to restrict their use to 404 | * the owner. 405 | */ 406 | contract Ownable is Context { 407 | address private _owner; 408 | address private _previousOwner; 409 | uint256 private _lockTime; 410 | 411 | event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); 412 | 413 | /** 414 | * @dev Initializes the contract setting the deployer as the initial owner. 415 | */ 416 | constructor () internal { 417 | address msgSender = _msgSender(); 418 | _owner = msgSender; 419 | emit OwnershipTransferred(address(0), msgSender); 420 | } 421 | 422 | /** 423 | * @dev Returns the address of the current owner. 424 | */ 425 | function owner() public view returns (address) { 426 | return _owner; 427 | } 428 | 429 | /** 430 | * @dev Throws if called by any account other than the owner. 431 | */ 432 | modifier onlyOwner() { 433 | require(_owner == _msgSender(), "Ownable: caller is not the owner"); 434 | _; 435 | } 436 | 437 | /** 438 | * @dev Leaves the contract without owner. It will not be possible to call 439 | * `onlyOwner` functions anymore. Can only be called by the current owner. 440 | * 441 | * NOTE: Renouncing ownership will leave the contract without an owner, 442 | * thereby removing any functionality that is only available to the owner. 443 | */ 444 | function renounceOwnership() public virtual onlyOwner { 445 | emit OwnershipTransferred(_owner, address(0)); 446 | _owner = address(0); 447 | } 448 | 449 | /** 450 | * @dev Transfers ownership of the contract to a new account (`newOwner`). 451 | * Can only be called by the current owner. 452 | */ 453 | function transferOwnership(address newOwner) public virtual onlyOwner { 454 | require(newOwner != address(0), "Ownable: new owner is the zero address"); 455 | emit OwnershipTransferred(_owner, newOwner); 456 | _owner = newOwner; 457 | } 458 | 459 | function geUnlockTime() public view returns (uint256) { 460 | return _lockTime; 461 | } 462 | 463 | //Locks the contract for owner for the amount of time provided 464 | function lock(uint256 time) public virtual onlyOwner { 465 | _previousOwner = _owner; 466 | _owner = address(0); 467 | _lockTime = now + time; 468 | emit OwnershipTransferred(_owner, address(0)); 469 | } 470 | 471 | //Unlocks the contract for owner when _lockTime is exceeds 472 | function unlock() public virtual { 473 | require(_previousOwner == msg.sender, "You don't have permission to unlock"); 474 | require(now > _lockTime , "Contract is locked until 7 days"); 475 | emit OwnershipTransferred(_owner, _previousOwner); 476 | _owner = _previousOwner; 477 | } 478 | } 479 | 480 | contract SafeWolf is Context, IERC20, Ownable { 481 | using SafeMath for uint256; 482 | using Address for address; 483 | 484 | mapping (address => uint256) private _rOwned; 485 | mapping (address => uint256) private _tOwned; 486 | mapping (address => mapping (address => uint256)) private _allowances; 487 | 488 | mapping (address => bool) private _isExcluded; 489 | address[] private _excluded; 490 | 491 | uint256 private constant MAX = ~uint256(0); 492 | uint256 private _tTotal = 100 * 10**15 * 10**9; 493 | uint256 private _rTotal = (MAX - (MAX % _tTotal)); 494 | uint256 private _tFeeTotal; 495 | 496 | string private _name = 'SafeWolf'; 497 | string private _symbol = 'SW'; 498 | uint8 private _decimals = 9; 499 | 500 | uint256 public _taxFee = 4; 501 | uint256 private _previousTaxFee = _taxFee; 502 | uint256 public _burnFee = 4; 503 | uint256 private _previousBurnFee = _burnFee; 504 | 505 | address public burnAdd = 0x000000000000000000000000000000000000dEaD; 506 | 507 | uint private _max_tx_size = 60 * 10**15 * 10**9; 508 | 509 | constructor () public { 510 | _rOwned[_msgSender()] = _rTotal; 511 | emit Transfer(address(0), _msgSender(), _tTotal); 512 | } 513 | 514 | function name() public view returns (string memory) { 515 | return _name; 516 | } 517 | 518 | function symbol() public view returns (string memory) { 519 | return _symbol; 520 | } 521 | 522 | function decimals() public view returns (uint8) { 523 | return _decimals; 524 | } 525 | 526 | function totalSupply() public view override returns (uint256) { 527 | return _tTotal; 528 | } 529 | 530 | function balanceOf(address account) public view override returns (uint256) { 531 | if (_isExcluded[account]) return _tOwned[account]; 532 | return tokenFromReflection(_rOwned[account]); 533 | } 534 | 535 | function transfer(address recipient, uint256 amount) public override returns (bool) { 536 | _transfer(_msgSender(), recipient, amount); 537 | return true; 538 | } 539 | 540 | function allowance(address owner, address spender) public view override returns (uint256) { 541 | return _allowances[owner][spender]; 542 | } 543 | 544 | function approve(address spender, uint256 amount) public override returns (bool) { 545 | _approve(_msgSender(), spender, amount); 546 | return true; 547 | } 548 | 549 | function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) { 550 | _transfer(sender, recipient, amount); 551 | _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance")); 552 | return true; 553 | } 554 | 555 | function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { 556 | _approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue)); 557 | return true; 558 | } 559 | 560 | function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { 561 | _approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero")); 562 | return true; 563 | } 564 | 565 | function isExcluded(address account) public view returns (bool) { 566 | return _isExcluded[account]; 567 | } 568 | 569 | function totalFees() public view returns (uint256) { 570 | return _tFeeTotal; 571 | } 572 | 573 | function deliver(uint256 tAmount) public { 574 | address sender = _msgSender(); 575 | require(!_isExcluded[sender], "Excluded addresses cannot call this function"); 576 | (uint256 rAmount,,,,,) = _getValues(tAmount); 577 | _rOwned[sender] = _rOwned[sender].sub(rAmount); 578 | _rTotal = _rTotal.sub(rAmount); 579 | _tFeeTotal = _tFeeTotal.add(tAmount); 580 | } 581 | 582 | function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) { 583 | require(tAmount <= _tTotal, "Amount must be less than supply"); 584 | if (!deductTransferFee) { 585 | (uint256 rAmount,,,,,) = _getValues(tAmount); 586 | return rAmount; 587 | } else { 588 | (,uint256 rTransferAmount,,,,) = _getValues(tAmount); 589 | return rTransferAmount; 590 | } 591 | } 592 | 593 | function tokenFromReflection(uint256 rAmount) public view returns(uint256) { 594 | require(rAmount <= _rTotal, "Amount must be less than total reflections"); 595 | uint256 currentRate = _getRate(); 596 | return rAmount.div(currentRate); 597 | } 598 | 599 | function excludeAccount(address account) external onlyOwner() { 600 | //require(account != 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, 'We can not exclude Uniswap router.'); 601 | require(!_isExcluded[account], "Account is already excluded"); 602 | if(_rOwned[account] > 0) { 603 | _tOwned[account] = tokenFromReflection(_rOwned[account]); 604 | } 605 | _isExcluded[account] = true; 606 | _excluded.push(account); 607 | } 608 | 609 | function includeAccount(address account) external onlyOwner() { 610 | require(_isExcluded[account], "Account is already excluded"); 611 | for (uint256 i = 0; i < _excluded.length; i++) { 612 | if (_excluded[i] == account) { 613 | _excluded[i] = _excluded[_excluded.length - 1]; 614 | _tOwned[account] = 0; 615 | _isExcluded[account] = false; 616 | _excluded.pop(); 617 | break; 618 | } 619 | } 620 | } 621 | 622 | function _approve(address owner, address spender, uint256 amount) private { 623 | require(owner != address(0), "ERC20: approve from the zero address"); 624 | require(spender != address(0), "ERC20: approve to the zero address"); 625 | 626 | _allowances[owner][spender] = amount; 627 | emit Approval(owner, spender, amount); 628 | } 629 | 630 | function _transfer(address sender, address recipient, uint256 amount) private { 631 | require(sender != address(0), "ERC20: transfer from the zero address"); 632 | require(recipient != address(0), "ERC20: transfer to the zero address"); 633 | require(amount > 0, "Transfer amount must be greater than zero"); 634 | 635 | if(sender != owner() && recipient != owner()) 636 | require(amount <= _max_tx_size, "Transfer amount exceeds the maxTxAmount."); 637 | 638 | if (_isExcluded[sender] && !_isExcluded[recipient]) { 639 | _transferFromExcluded(sender, recipient, amount); 640 | } else if (!_isExcluded[sender] && _isExcluded[recipient]) { 641 | _transferToExcluded(sender, recipient, amount); 642 | } else if (!_isExcluded[sender] && !_isExcluded[recipient]) { 643 | _transferStandard(sender, recipient, amount); 644 | } else if (_isExcluded[sender] && _isExcluded[recipient]) { 645 | _transferBothExcluded(sender, recipient, amount); 646 | } else { 647 | _transferStandard(sender, recipient, amount); 648 | } 649 | } 650 | 651 | function _transferStandard(address sender, address recipient, uint256 tAmount) private { 652 | (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tBurn) = _getValues(tAmount); 653 | _rOwned[sender] = _rOwned[sender].sub(rAmount); 654 | _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); 655 | _burn(tBurn); 656 | _reflectFee(rFee, tFee); 657 | emit Transfer(sender, burnAdd, tBurn); 658 | emit Transfer(sender, recipient, tTransferAmount); 659 | } 660 | 661 | function _transferToExcluded(address sender, address recipient, uint256 tAmount) private { 662 | (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tBurn) = _getValues(tAmount); 663 | _rOwned[sender] = _rOwned[sender].sub(rAmount); 664 | _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); 665 | _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); 666 | _burn(tBurn); 667 | _reflectFee(rFee, tFee); 668 | emit Transfer(sender, burnAdd, tBurn); 669 | emit Transfer(sender, recipient, tTransferAmount); 670 | } 671 | 672 | function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private { 673 | (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tBurn) = _getValues(tAmount); 674 | _tOwned[sender] = _tOwned[sender].sub(tAmount); 675 | _rOwned[sender] = _rOwned[sender].sub(rAmount); 676 | _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); 677 | _burn(tBurn); 678 | _reflectFee(rFee, tFee); 679 | emit Transfer(sender, burnAdd, tBurn); 680 | emit Transfer(sender, recipient, tTransferAmount); 681 | } 682 | 683 | function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private { 684 | (uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tBurn) = _getValues(tAmount); 685 | _tOwned[sender] = _tOwned[sender].sub(tAmount); 686 | _rOwned[sender] = _rOwned[sender].sub(rAmount); 687 | _tOwned[recipient] = _tOwned[recipient].add(tTransferAmount); 688 | _rOwned[recipient] = _rOwned[recipient].add(rTransferAmount); 689 | _burn(tBurn); 690 | _reflectFee(rFee, tFee); 691 | emit Transfer(sender, burnAdd, tBurn); 692 | emit Transfer(sender, recipient, tTransferAmount); 693 | } 694 | 695 | function _reflectFee(uint256 rFee, uint256 tFee) private { 696 | _rTotal = _rTotal.sub(rFee); 697 | _tFeeTotal = _tFeeTotal.add(tFee); 698 | } 699 | 700 | function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) { 701 | (uint256 tTransferAmount, uint256 tFee, uint256 tBurn) = _getTValues(tAmount); 702 | uint256 currentRate = _getRate(); 703 | (uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tBurn, currentRate); 704 | return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tBurn); 705 | } 706 | 707 | function _getTValues(uint256 tAmount) private view returns (uint256, uint256, uint256) { 708 | uint256 tFee = calculateTaxFee(tAmount); 709 | uint256 tBurn = calculateBurnFee(tAmount); 710 | uint256 tTransferAmount = tAmount.sub(tFee).sub(tBurn); 711 | return (tTransferAmount, tFee, tBurn); 712 | } 713 | 714 | function _getRValues(uint256 tAmount, uint256 tFee, uint256 tBurn, uint256 currentRate) private pure returns (uint256, uint256, uint256) { 715 | uint256 rAmount = tAmount.mul(currentRate); 716 | uint256 rFee = tFee.mul(currentRate); 717 | uint256 rBurn = tBurn.mul(currentRate); 718 | uint256 rTransferAmount = rAmount.sub(rFee).sub(rBurn); 719 | return (rAmount, rTransferAmount, rFee); 720 | } 721 | 722 | function _getRate() private view returns(uint256) { 723 | (uint256 rSupply, uint256 tSupply) = _getCurrentSupply(); 724 | return rSupply.div(tSupply); 725 | } 726 | 727 | function _getCurrentSupply() private view returns(uint256, uint256) { 728 | uint256 rSupply = _rTotal; 729 | uint256 tSupply = _tTotal; 730 | for (uint256 i = 0; i < _excluded.length; i++) { 731 | if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal); 732 | rSupply = rSupply.sub(_rOwned[_excluded[i]]); 733 | tSupply = tSupply.sub(_tOwned[_excluded[i]]); 734 | } 735 | if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal); 736 | return (rSupply, tSupply); 737 | } 738 | 739 | function _burn(uint256 burn) private { 740 | uint256 currentRate = _getRate(); 741 | uint256 rBurn = burn.mul(currentRate); 742 | _rOwned[burnAdd] = _rOwned[burnAdd].add(rBurn); 743 | } 744 | function calculateTaxFee(uint256 _amount) private view returns (uint256) { 745 | return _amount.mul(_taxFee).div( 746 | 10**2 747 | ); 748 | } 749 | 750 | function calculateBurnFee(uint256 _amount) private view returns (uint256) { 751 | return _amount.mul(_burnFee).div( 752 | 10**2 753 | ); 754 | } 755 | 756 | function removeAllFee() private { 757 | if (_taxFee == 0 && _burnFee == 0) return; 758 | 759 | _previousTaxFee = _taxFee; 760 | _previousBurnFee = _burnFee; 761 | 762 | _taxFee = 0; 763 | _burnFee = 0; 764 | } 765 | 766 | function restoreAllFee() private { 767 | _taxFee = _previousTaxFee; 768 | _burnFee = _previousBurnFee; 769 | } 770 | 771 | function _getTaxFee() public view returns(uint256) { 772 | return _taxFee; 773 | } 774 | 775 | function _getBurnFee() public view returns(uint256) { 776 | return _burnFee; 777 | } 778 | 779 | function _getMaxTxAmount() public view returns(uint256){ 780 | return _max_tx_size; 781 | } 782 | 783 | function _setTaxFee(uint256 taxFee) external onlyOwner() { 784 | _taxFee = taxFee; 785 | } 786 | 787 | function _setBurnFee(uint256 burnFee) external onlyOwner() { 788 | _burnFee = burnFee; 789 | } 790 | 791 | } --------------------------------------------------------------------------------