Advertisement
jaenudinmaulana69

yoi

Jun 20th, 2021
1,086
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // SPDX-License-Identifier: UNLICENSED
  2. pragma solidity ^0.8.3;
  3.  
  4. interface IBEP20 {
  5.   /**
  6.    * @dev Returns the amount of tokens in existence.
  7.    */
  8.   function totalSupply() external view returns (uint256);
  9.  
  10.   /**
  11.    * @dev Returns the token decimals.
  12.    */
  13.   function decimals() external view returns (uint8);
  14.  
  15.   /**
  16.    * @dev Returns the token symbol.
  17.    */
  18.   function symbol() external view returns (string memory);
  19.  
  20.   /**
  21.    * @dev Returns the token name.
  22.    */
  23.   function name() external view returns (string memory);
  24.  
  25.   /**
  26.    * @dev Returns the bep token owner.
  27.    */
  28.   function getOwner() external view returns (address);
  29.  
  30.   /**
  31.    * @dev Returns the amount of tokens owned by `account`.
  32.    */
  33.   function balanceOf(address account) external view returns (uint256);
  34.  
  35.   /**
  36.    * @dev Moves `amount` tokens from the caller's account to `recipient`.
  37.    *
  38.    * Returns a boolean value indicating whether the operation succeeded.
  39.    *
  40.    * Emits a {Transfer} event.
  41.    */
  42.   function transfer(address recipient, uint256 amount) external returns (bool);
  43.  
  44.   /**
  45.    * @dev Returns the remaining number of tokens that `spender` will be
  46.    * allowed to spend on behalf of `owner` through {transferFrom}. This is
  47.    * zero by default.
  48.    *
  49.    * This value changes when {approve} or {transferFrom} are called.
  50.    */
  51.   function allowance(address _owner, address spender)
  52.     external
  53.     view
  54.     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(
  82.     address sender,
  83.     address recipient,
  84.     uint256 amount
  85.   ) external returns (bool);
  86.  
  87.   /**
  88.    * @dev Emitted when `value` tokens are moved from one account (`from`) to
  89.    * another (`to`).
  90.    *
  91.    * Note that `value` may be zero.
  92.    */
  93.   event Transfer(address indexed from, address indexed to, uint256 value);
  94.  
  95.   /**
  96.    * @dev Emitted when the allowance of a `spender` for an `owner` is set by
  97.    * a call to {approve}. `value` is the new allowance.
  98.    */
  99.  // SPDX-License-Identifier: UNLICENSED
  100.   event Approval(address indexed owner, address indexed spender, uint256 value);
  101. }
  102. /**
  103.  * @dev Wrappers over Solidity's arithmetic operations with added overflow
  104.  * checks.
  105.  *
  106.  * Arithmetic operations in Solidity wrap on overflow. This can easily result
  107.  * in bugs, because programmers usually assume that an overflow raises an
  108.  * error, which is the standard behavior in high level programming languages.
  109.  * `SafeMath` restores this intuition by reverting the transaction when an
  110.  * operation overflows.
  111.  *
  112.  * Using this library instead of the unchecked operations eliminates an entire
  113.  * class of bugs, so it's recommended to use it always.
  114.  */
  115. library SafeMath {
  116.   /**
  117.    * @dev Returns the addition of two unsigned integers, reverting on
  118.    * overflow.
  119.    *
  120.    * Counterpart to Solidity's `+` operator.
  121.    *
  122.    * Requirements:
  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.    * - 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.    * - Subtraction cannot overflow.
  153.    */
  154.   function sub(
  155.     uint256 a,
  156.     uint256 b,
  157.     string memory errorMessage
  158.   ) internal pure returns (uint256) {
  159.     require(b <= a, errorMessage);
  160.     uint256 c = a - b;
  161.  
  162.     return c;
  163.   }
  164.  
  165.   /**
  166.    * @dev Returns the multiplication of two unsigned integers, reverting on
  167.    * overflow.
  168.    *
  169.    * Counterpart to Solidity's `*` operator.
  170.    *
  171.    * Requirements:
  172.    * - Multiplication cannot overflow.
  173.    */
  174.   function mul(uint256 a, uint256 b) internal pure returns (uint256) {
  175.     // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
  176.     // benefit is lost if 'b' is also tested.
  177.     // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
  178.     if (a == 0) {
  179.       return 0;
  180.     }
  181.  
  182.     uint256 c = a * b;
  183.     require(c / a == b, 'SafeMath: multiplication overflow');
  184.  
  185.     return c;
  186.   }
  187.  
  188.   /**
  189.    * @dev Returns the integer division of two unsigned integers. Reverts on
  190.    * division by zero. The result is rounded towards zero.
  191.    *
  192.    * Counterpart to Solidity's `/` operator. Note: this function uses a
  193.    * `revert` opcode (which leaves remaining gas untouched) while Solidity
  194.    * uses an invalid opcode to revert (consuming all remaining gas).
  195.    *
  196.    * Requirements:
  197.    * - The divisor cannot be zero.
  198.    */
  199.   function div(uint256 a, uint256 b) internal pure returns (uint256) {
  200.     return div(a, b, 'SafeMath: division by zero');
  201.   }
  202.  
  203.   /**
  204.    * @dev Returns the integer division of two unsigned integers. Reverts with custom message on
  205.    * division by zero. The result is rounded towards zero.
  206.    *
  207.    * Counterpart to Solidity's `/` operator. Note: this function uses a
  208.    * `revert` opcode (which leaves remaining gas untouched) while Solidity
  209.    * uses an invalid opcode to revert (consuming all remaining gas).
  210.    *
  211.    * Requirements:
  212.    * - The divisor cannot be zero.
  213.    */
  214.   function div(
  215.     uint256 a,
  216.     uint256 b,
  217.     string memory errorMessage
  218.   ) internal pure returns (uint256) {
  219.     // Solidity only automatically asserts when dividing by 0
  220.     require(b > 0, errorMessage);
  221.     uint256 c = a / b;
  222.     // assert(a == b * c + a % b); // There is no case in which this doesn't hold
  223.  
  224.     return c;
  225.   }
  226.  
  227.   /**
  228.    * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
  229.    * Reverts when dividing by zero.
  230.    *
  231.    * Counterpart to Solidity's `%` operator. This function uses a `revert`
  232.    * opcode (which leaves remaining gas untouched) while Solidity uses an
  233.    * invalid opcode to revert (consuming all remaining gas).
  234.    *
  235.    * Requirements:
  236.    * - The divisor cannot be zero.
  237.    */
  238.   function mod(uint256 a, uint256 b) internal pure returns (uint256) {
  239.     return mod(a, b, 'SafeMath: modulo by zero');
  240.   }
  241.  
  242.   /**
  243.    * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
  244.    * Reverts with custom message when dividing by zero.
  245.    *
  246.    * Counterpart to Solidity's `%` operator. This function uses a `revert`
  247.    * opcode (which leaves remaining gas untouched) while Solidity uses an
  248.    * invalid opcode to revert (consuming all remaining gas).
  249.    *
  250.    * Requirements:
  251.    * - The divisor cannot be zero.
  252.    */
  253.   function mod(
  254.     uint256 a,
  255.     uint256 b,
  256.     string memory errorMessage
  257.   ) internal pure returns (uint256) {
  258.     require(b != 0, errorMessage);
  259.     return a % b;
  260.  // SPDX-License-Identifier: UNLICENSED
  261.   }
  262. }
  263. /*
  264.  * @dev Provides information about the current execution context, including the
  265.  * sender of the transaction and its data. While these are generally available
  266.  * via msg.sender and msg.data, they should not be accessed in such a direct
  267.  * manner, since when dealing with GSN meta-transactions the account sending and
  268.  * paying for execution may not be the actual sender (as far as an application
  269.  * is concerned).
  270.  *
  271.  * This contract is only required for intermediate, library-like contracts.
  272.  */
  273. abstract contract Context {
  274.   function _msgSender() internal view virtual returns (address) {
  275.     return msg.sender;
  276.   }
  277.  
  278.   function _msgData() internal view virtual returns (bytes calldata) {
  279.     this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
  280.     return msg.data;
  281.  // SPDX-License-Identifier: UNLICENSED
  282.   }
  283. }
  284. /**
  285.  * @dev Contract module which provides a basic access control mechanism, where
  286.  * there is an account (an owner) that can be granted exclusive access to
  287.  * specific functions.
  288.  *
  289.  * By default, the owner account will be the one that deploys the contract. This
  290.  * can later be changed with {transferOwnership}.
  291.  *
  292.  * This module is used through inheritance. It will make available the modifier
  293.  * `onlyOwner`, which can be applied to your functions to restrict their use to
  294.  * the owner.
  295.  */
  296. abstract contract Ownable is Context {
  297.   address private _owner;
  298.  
  299.   event OwnershipTransferred(
  300.     address indexed previousOwner,
  301.     address indexed newOwner
  302.   );
  303.  
  304.   /**
  305.    * @dev Initializes the contract setting the deployer as the initial owner.
  306.    */
  307.   constructor() {
  308.     address msgSender = _msgSender();
  309.     _owner = msgSender;
  310.     emit OwnershipTransferred(address(0), msgSender);
  311.   }
  312.  
  313.   /**
  314.    * @dev Returns the address of the current owner.
  315.    */
  316.   function owner() public view returns (address) {
  317.     return _owner;
  318.   }
  319.  
  320.   /**
  321.    * @dev Throws if called by any account other than the owner.
  322.    */
  323.   modifier onlyOwner() {
  324.     require(_owner == _msgSender(), 'Ownable: caller is not the owner');
  325.     _;
  326.   }
  327.  
  328.   /**
  329.    * @dev Leaves the contract without owner. It will not be possible to call
  330.    * `onlyOwner` functions anymore. Can only be called by the current owner.
  331.    *
  332.    * NOTE: Renouncing ownership will leave the contract without an owner,
  333.    * thereby removing any functionality that is only available to the owner.
  334.    */
  335.   function renounceOwnership() public onlyOwner {
  336.     emit OwnershipTransferred(_owner, address(0));
  337.     _owner = address(0);
  338.   }
  339.  
  340.   /**
  341.    * @dev Transfers ownership of the contract to a new account (`newOwner`).
  342.    * Can only be called by the current owner.
  343.    */
  344.   function transferOwnership(address newOwner) public onlyOwner {
  345.     _transferOwnership(newOwner);
  346.   }
  347.  
  348.   /**
  349.    * @dev Transfers ownership of the contract to a new account (`newOwner`).
  350.    */
  351.   function _transferOwnership(address newOwner) internal {
  352.     require(newOwner != address(0), 'Ownable: new owner is the zero address');
  353.     emit OwnershipTransferred(_owner, newOwner);
  354.     _owner = newOwner;
  355.  // SPDX-License-Identifier: UNLICENSED
  356.   }
  357. }
  358. contract dont is Context, IBEP20, Ownable {
  359.   using SafeMath for uint256;
  360.  
  361.   mapping(address => uint256) private _balances;
  362.  
  363.   mapping(address => mapping(address => uint256)) private _allowances;
  364.  
  365.   uint256 private _totalSupply;
  366.   uint8 public _decimals;
  367.   string public _symbol;
  368.   string public _name;
  369.  
  370.   constructor() {
  371.     _name = 'dont buy4';
  372.     _symbol = 'dont 4';
  373.     _decimals = 18;
  374.     _totalSupply = 1 * 10**8 * 10**18; // 500m
  375.     _balances[msg.sender] = _totalSupply;
  376.  
  377.     emit Transfer(address(0), msg.sender, _totalSupply);
  378.   }
  379.  
  380.   /**
  381.    * @dev Returns the bep token owner.
  382.    */
  383.   function getOwner() external view virtual override returns (address) {
  384.     return owner();
  385.   }
  386.  
  387.   /**
  388.    * @dev Returns the token decimals.
  389.    */
  390.   function decimals() external view virtual override returns (uint8) {
  391.     return _decimals;
  392.   }
  393.  
  394.   /**
  395.    * @dev Returns the token symbol.
  396.    */
  397.   function symbol() external view virtual override returns (string memory) {
  398.     return _symbol;
  399.   }
  400.  
  401.   /**
  402.    * @dev Returns the token name.
  403.    */
  404.   function name() external view virtual override returns (string memory) {
  405.     return _name;
  406.   }
  407.  
  408.   /**
  409.    * @dev See {BEP20-totalSupply}.
  410.    */
  411.   function totalSupply() external view virtual override returns (uint256) {
  412.     return _totalSupply;
  413.   }
  414.  
  415.   /**
  416.    * @dev See {BEP20-balanceOf}.
  417.    */
  418.   function balanceOf(address account)
  419.     external
  420.     view
  421.     virtual
  422.     override
  423.     returns (uint256)
  424.   {
  425.     return _balances[account];
  426.   }
  427.  
  428.   /**
  429.    * @dev See {BEP20-transfer}.
  430.    *
  431.    * Requirements:
  432.    *
  433.    * - `recipient` cannot be the zero address.
  434.    * - the caller must have a balance of at least `amount`.
  435.    */
  436.   function transfer(address recipient, uint256 amount)
  437.     external
  438.     override
  439.     returns (bool)
  440.   {
  441.     _transfer(_msgSender(), recipient, amount);
  442.     return true;
  443.   }
  444.  
  445.   /**
  446.    * @dev See {BEP20-allowance}.
  447.    */
  448.   function allowance(address owner, address spender)
  449.     external
  450.     view
  451.     override
  452.     returns (uint256)
  453.   {
  454.     return _allowances[owner][spender];
  455.   }
  456.  
  457.   /**
  458.    * @dev See {BEP20-approve}.
  459.    *
  460.    * Requirements:
  461.    *
  462.    * - `spender` cannot be the zero address.
  463.    */
  464.   function approve(address spender, uint256 amount)
  465.     external
  466.     override
  467.     returns (bool)
  468.   {
  469.     _approve(_msgSender(), spender, amount);
  470.     return true;
  471.   }
  472.  
  473.   /**
  474.    * @dev See {BEP20-transferFrom}.
  475.    *
  476.    * Emits an {Approval} event indicating the updated allowance. This is not
  477.    * required by the EIP. See the note at the beginning of {BEP20};
  478.    *
  479.    * Requirements:
  480.    * - `sender` and `recipient` cannot be the zero address.
  481.    * - `sender` must have a balance of at least `amount`.
  482.    * - the caller must have allowance for `sender`'s tokens of at least
  483.    * `amount`.
  484.    */
  485.   function transferFrom(
  486.     address sender,
  487.     address recipient,
  488.     uint256 amount
  489.   ) external override returns (bool) {
  490.     _transfer(sender, recipient, amount);
  491.     _approve(
  492.       sender,
  493.       _msgSender(),
  494.       _allowances[sender][_msgSender()].sub(
  495.         amount,
  496.         'BEP20: transfer amount exceeds allowance'
  497.       )
  498.     );
  499.     return true;
  500.   }
  501.  
  502.   /**
  503.    * @dev Atomically increases the allowance granted to `spender` by the caller.
  504.    *
  505.    * This is an alternative to {approve} that can be used as a mitigation for
  506.    * problems described in {BEP20-approve}.
  507.    *
  508.    * Emits an {Approval} event indicating the updated allowance.
  509.    *
  510.    * Requirements:
  511.    *
  512.    * - `spender` cannot be the zero address.
  513.    */
  514.   function increaseAllowance(address spender, uint256 addedValue)
  515.     public
  516.     returns (bool)
  517.   {
  518.     _approve(
  519.       _msgSender(),
  520.       spender,
  521.       _allowances[_msgSender()][spender].add(addedValue)
  522.     );
  523.     return true;
  524.   }
  525.  
  526.   /**
  527.    * @dev Atomically decreases the allowance granted to `spender` by the caller.
  528.    *
  529.    * This is an alternative to {approve} that can be used as a mitigation for
  530.    * problems described in {BEP20-approve}.
  531.    *
  532.    * Emits an {Approval} event indicating the updated allowance.
  533.    *
  534.    * Requirements:
  535.    *
  536.    * - `spender` cannot be the zero address.
  537.    * - `spender` must have allowance for the caller of at least
  538.    * `subtractedValue`.
  539.    */
  540.   function decreaseAllowance(address spender, uint256 subtractedValue)
  541.     public
  542.     returns (bool)
  543.   {
  544.     _approve(
  545.       _msgSender(),
  546.       spender,
  547.       _allowances[_msgSender()][spender].sub(
  548.         subtractedValue,
  549.         'BEP20: decreased allowance below zero'
  550.       )
  551.     );
  552.     return true;
  553.   }
  554.  
  555.   /**
  556.    * @dev Destroys `amount` tokens from the caller.
  557.    *
  558.    * See {BEP20-_burn}.
  559.    */
  560.   function burn(uint256 amount) public virtual {
  561.     _burn(_msgSender(), amount);
  562.   }
  563.  
  564.   /**
  565.    * @dev Destroys `amount` tokens from `account`, deducting from the caller's
  566.    * allowance.
  567.    *
  568.    * See {BEP20-_burn} and {BEP20-allowance}.
  569.    *
  570.    * Requirements:
  571.    *
  572.    * - the caller must have allowance for ``accounts``'s tokens of at least
  573.    * `amount`.
  574.    */
  575.   function burnFrom(address account, uint256 amount) public virtual {
  576.     uint256 decreasedAllowance =
  577.       _allowances[account][_msgSender()].sub(
  578.         amount,
  579.         'BEP20: burn amount exceeds allowance'
  580.       );
  581.  
  582.     _approve(account, _msgSender(), decreasedAllowance);
  583.     _burn(account, amount);
  584.   }
  585.  
  586.   /**
  587.    * @dev Moves tokens `amount` from `sender` to `recipient`.
  588.    *
  589.    * This is internal function is equivalent to {transfer}, and can be used to
  590.    * e.g. implement automatic token fees, slashing mechanisms, etc.
  591.    *
  592.    * Emits a {Transfer} event.
  593.    *
  594.    * Requirements:
  595.    *
  596.    * - `sender` cannot be the zero address.
  597.    * - `recipient` cannot be the zero address.
  598.    * - `sender` must have a balance of at least `amount`.
  599.    */
  600.   function _transfer(
  601.     address sender,
  602.     address recipient,
  603.     uint256 amount
  604.   ) internal {
  605.     require(sender != address(0), 'BEP20: transfer from the zero address');
  606.     require(recipient != address(0), 'BEP20: transfer to the zero address');
  607.  
  608.     _balances[sender] = _balances[sender].sub(
  609.       amount,
  610.       'BEP20: transfer amount exceeds balance'
  611.     );
  612.     _balances[recipient] = _balances[recipient].add(amount);
  613.     emit Transfer(sender, recipient, amount);
  614.   }
  615.  
  616.   /**
  617.    * @dev Destroys `amount` tokens from `account`, reducing the
  618.    * total supply.
  619.    *
  620.    * Emits a {Transfer} event with `to` set to the zero address.
  621.    *
  622.    * Requirements
  623.    *
  624.    * - `account` cannot be the zero address.
  625.    * - `account` must have at least `amount` tokens.
  626.    */
  627.   function _burn(address account, uint256 amount) internal {
  628.     require(account != address(0), 'BEP20: burn from the zero address');
  629.  
  630.     _balances[account] = _balances[account].sub(
  631.       amount,
  632.       'BEP20: burn amount exceeds balance'
  633.     );
  634.     _totalSupply = _totalSupply.sub(amount);
  635.     emit Transfer(account, address(0), amount);
  636.   }
  637.  
  638.   /**
  639.    * @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
  640.    *
  641.    * This is internal function is equivalent to `approve`, and can be used to
  642.    * e.g. set automatic allowances for certain subsystems, etc.
  643.    *
  644.    * Emits an {Approval} event.
  645.    *
  646.    * Requirements:
  647.    *
  648.    * - `owner` cannot be the zero address.
  649.    * - `spender` cannot be the zero address.
  650.    */
  651.   function _approve(
  652.     address owner,
  653.     address spender,
  654.     uint256 amount
  655.   ) internal {
  656.     require(owner != address(0), 'BEP20: approve from the zero address');
  657.     require(spender != address(0), 'BEP20: approve to the zero address');
  658.  
  659.     _allowances[owner][spender] = amount;
  660.     emit Approval(owner, spender, amount);
  661.   }
  662. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement